akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;

struct edge { int to,cost; };

int main() {
  string S;cin>>S;
  // 境界線の数がどちらかに一つ奥ごとに一つ減る
  // ...00..00.0
  // つまり境界線の数
  int ans = 0;
  char pre = S[0];
  REP(i,S.size()) {
    if (pre!=S[i]) {
      ans++;
      pre = S[i];
    }
  }
  OUT(ans);

  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int N;
 int a;
 vector<int>A;
 vector<int>B;
 cin>>N;
 for(int i=0; i<N; i++){
  cin>>a;
  A.push_back(a);
  B.push_back(a);
 }
 sort(A.begin(),A.end());
 for(int i=0; i<N; i++){
  if(B[i]<A[N/2])std::cout<<A[N/2]<<std::endl;
  else std::cout<<A[N/2-1]<<std::endl;
 }
}
     

Measured memory_bytes: 3948
import sys
INF = int(1e10)
n, m = [int(i) for i in sys.stdin.readline().split()]
# n : box, m : key
key_info = dict()
for i in range(m):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    c_ls = [int(i)-1 for i in sys.stdin.readline().split()]
    c_ls = "".join(["1" if c in c_ls else "0" for c in range(n-1,-1,-1)])
    key_info[i] = [a, int(c_ls, 2)]

memo_ls = [[INF for i in range(2**n)] for j in range(m)]
# memo_ls[i][j] : i番目までの鍵で状態を j にする為に必要な最小費用
for i in range(m):
    memo_ls[i][0] = 0
    for j in range(2**n):
        memo_ls[i][j] = min(memo_ls[i][j], memo_ls[max(0, i-1)][j])
        memo_ls[i][j | key_info[i][1]] = min(memo_ls[i][j | key_info[i][1]], memo_ls[max(i-1, 0)][j | key_info[i][1]], memo_ls[max(0, i-1)][j] + key_info[i][0])
if memo_ls[-1][-1] == INF:
    print(-1)
else:
    print(memo_ls[-1][-1])

Measured memory_bytes: 80348
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int A=0,B=0;
    rep(i, 3){
        if(s[i]=='A') A++;
        else B++;
    }
    if(A>0&&B>0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*--------------------------------------------------------------------*/


signed main(){
  string s,t;
  cin>>s>>t;
  int ans=0;
  rep(i,s.size()){
    if(s[i]!=t[i]) ans++;
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3916
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

//階乗,factで初期化
vector<ll> tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

ll n;
mat edge(2e5+10);
vec dp1(2e5+10);
vec dp2(2e5+10);
vec size1(2e5+10);
vec size2(2e5+10);
vec ans(2e5+10);

void dfs1(ll x, ll last=-1) {
  size1[x]=1;
  dp1[x]=1;
  for(auto to:edge[x]) {
    if(to==last) continue;
    dfs1(to,x);
    size1[x]+=size1[to];
    dp1[x]*=dp1[to];
    dp1[x]%=mod;
    dp1[x]*=mpow(tfact[size1[to]],mod-2);
    dp1[x]%=mod;
  }
  size2[x]=n-size1[x];
  dp1[x]*=tfact[size1[x]-1];
  dp1[x]%=mod;
}

void dfs2(ll x, ll last=-1) {
  if(last==-1) dp2[x]=1;
  ll all_product=dp2[x]*mpow(tfact[size2[x]],mod-2)%mod;
  for(auto to:edge[x]) {
    if(to==last) continue;
    all_product*=dp1[to];
    all_product%=mod;
    all_product*=mpow(tfact[size1[to]],mod-2);
    all_product%=mod;
  }
  for(auto to:edge[x]) {
    if(to==last) continue;
    ll tmp=all_product;
    tmp*=mpow(dp1[to],mod-2);
    tmp%=mod;
    tmp*=tfact[size1[to]];
    tmp%=mod;
    tmp*=tfact[size2[to]-1];
    tmp%=mod;
    dp2[to]=tmp;
    dfs2(to,x);
  }
}

void dfs3(ll x, ll last=-1) {
  if(last==-1) dp2[x]=1;
  ll all_product=dp2[x]*mpow(tfact[size2[x]],mod-2)%mod;
  for(auto to:edge[x]) {
    if(to==last) continue;
    dfs3(to,x);
    all_product*=dp1[to];
    all_product%=mod;
    all_product*=mpow(tfact[size1[to]],mod-2);
    all_product%=mod;
  }
  all_product*=tfact[n-1];
  all_product%=mod;
  ans[x]=all_product;
}

int main() {
  cin >> n;
  fact(n);
  for(ll i=0;i<n-1;i++) {
    ll a,b;
    cin >> a >> b;
    a--;b--;
    edge[b].push_back(a);
    edge[a].push_back(b);
  }
  dfs1(1);
  dfs2(1);
  dfs3(1);
  for(ll i=0;i<n;i++) {
    cout << ans[i] << endl;
  }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

vector<ll> pw2(51,1);
vector<ll> pw10(19,1);

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	ll N; cin>>N;
	if(N<=9) cout<<N;
	else if(N<=99) cout<<9;
	else if(N<=999) cout<<N-90;
	else if(N<=9999) cout<<909;
	else if(N<=99999) cout<<N-9999+909;
	else cout<<90909;	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int count[4] = {0};
    for(int i=0;i<N;i++){
        string str;
        cin >> str;
        if(str == "AC")count[0]++;
        else if(str == "WA")count[1]++;
        else if(str == "TLE")count[2]++;
        else if(str == "RE")count[3]++;
    }
    cout << "AC x " << count[0] << endl;
    cout << "WA x " << count[1] << endl;
    cout << "TLE x " << count[2] << endl;
    cout << "RE x " << count[3] << endl;
}

Measured memory_bytes: 3192
from heapq import heapify, heappush, heappop

# input
n = int(input())

nodes = [[] * n for i in range(n)]
for _ in range(n):
    line = list(map(int, input().split()))
    u = line.pop(0)
    k = line.pop(0)
    for i in range(k):
        v = line.pop(0)
        c = line.pop(0)
        nodes[u].append((v, c))


# 変数定義
inf = 100 * 100000 + 1

d = [inf] * n
V = set([i for i in range(n)]) #nodeの一覧
S = set() #探索済みnodeの一覧

# 探索
start = 0
target = start
d[start] = 0

H = []

#for i in range(n):
#    heappush(H, (i, d[i]))
heappush(H, (start, d[start]))

while V != S:
    u, c = heappop(H)
    S.add(u)
    for v, c in nodes[u]:
        if d[u] + c < d[v]:
            d[v] = d[u] + c
            heappush(H, (v, d[v]))
    
# 出力
for i in range(n):
    print(f"{i} {d[i]}")



Measured memory_bytes: 68968
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String z = s.next();
		int r = 0;
		for(int i=0;i * 2 < z.length();i++) {
			if (z.charAt(i) != z.charAt(z.length() - 1 - i)) ++r;
		}
		System.out.println(r);
	}

}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N-1);
  vector<int> B(N);
  
  for (int x : A){
    cin >> x;
    B.at(x-1)++;
  }
  for (int i=0; i<N; i++){
    cout << B.at(i) << endl;
  }
}


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

using namespace std;

#define reg register

inline long long read() {
	reg long long s = 0, t = 1; reg char ch = getchar();
	while(ch > '9' || ch < '0') { if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
	return s * t;
}

inline void print(reg int x) {
	if(x < 0) putchar('-'), x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + '0');
}

const int N = 10000000;

int n;
long long x;
long long a[N + 1];

int main() {
	n = read(); x = read();
	for(reg int i = 1; i <= n; i++) a[i] = read();
	sort(a + 1, a + 1 + n);
	for(reg int i = 1; i <= n + 1 && x >= 0; x -= a[i++])
		if(x < a[i] || i == n + 1)
			print(i - 1 - (i == n + 1 && x > 0));
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int x,y,z,k;
  cin>>x>>y>>z>>k;
  long long a[x],b[y],c[z];
  REP(i,x){
    cin>>a[i];
  }
  REP(i,y){
    cin>>b[i];
  }
  REP(i,z){
    cin>>c[i];
  }
  
  vector<long long> ab;
  REP(i,x){
    REP(j,y){
      ab.push_back(a[i]+b[j]);
    }
  }
  sort(ab.begin(),ab.end(),greater<long long>());
  
  int s = ab.size();
  vector<long long> abm;
  REP(i,s){
    if(i<3000){
      abm.push_back(ab[i]);
    }else{
      break;
    }
  }
  
  int sm=abm.size();
  vector<long long> abc;
  REP(i,sm){
    REP(j,z){
      abc.push_back(abm[i]+c[j]);
    }
  }
  sort(abc.begin(),abc.end(),greater<long long>());
  
  REP(i,k){
    cout<<abc[i]<<endl;
  }
  return 0;
}


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

int main() {
  int N;
  int X[120];
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> X[i];
  int ans = 1e+8;
  for (int i = 1; i <= 100; i++)
  {
    int sum = 0;
    for (int j = 0; j < N; j++)
         sum += (X[j] - i) * (X[j] - i);
    ans = min(ans, sum);
  }
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	cnt := cube(n / k)
	if k%2 == 0 {
		cnt += cube(n/(k/2) - n/k)
	}
	fmt.Println(cnt)
}

func cube(n int) int {
	return n * n * n
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int t=0,x=0,y=0;
    for(int i=0;i<n;i++){
        int t1,x1,y1;
        cin>>t1>>x1>>y1;
        int def=abs(x-x1)+abs(y-y1);
        def-=t1-t;
        if(def%2!=0||def>0){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

pair<int, int> a[100001];

int main()
{
	int n, m, j, k, x = 0, ans = 0;;
	cin >> n >> m;
	
	for (int i = 0; i < m; i++)
	{
		cin >> j >> k;
		a[i] = make_pair(j, k);
	}
	
	sort(a, a + m, [](auto &left, auto &right){
		if(left.second != right.second)
			return left.second < right.second;
		else
			return left.first < right.first;
	});
	
	for (int i = 0; i < m; i++)
	{
		if (a[i].first >= x)
		{
			x = a[i].second;
			ans++;
		}
	}
	
	cout << ans;
	return 0;	
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	int a[n+1]={0};
	for(int i = 0; i<k; i++)
	{
		int j;
		cin>>j;
		for(int h = 0; h<j; h++)
		{
			int g;
			cin>>g;
			a[g]++;
		}
	}
	int ans = 0;
	for(int i = 1; i<=n; i++)
		if(!a[i]) ans++;
	cout<<ans<<endl;
	return 0;
}

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

N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

class RollingHash() :
    # mod ex. (1<<61)-1, (1<<31)-1
    # 文字列のときはxをordに通すのを忘れない！！
    def __init__(self, x, base=26, mod=(1<<61)-1) :
        self.hash = [0]
        self.pow = [1]
        self.mod = mod
        
        for xi in x :
            self.hash.append((self.hash[-1] * base + xi) % mod)
            self.pow.append(self.pow[-1] * base % mod)
            
    # [l, r)
    def get(self, l, r) :
        return (self.hash[r] - self.hash[l] * self.pow[r-l]) % self.mod

da = [a[i] ^ a[(i + 1) % N] for i in range(N)] * 2
db = [b[i] ^ b[(i + 1) % N] for i in range(N)] * 2

RHa1 = RollingHash(da, base=1<<30)
RHa2 = RollingHash(da, base=1<<30, mod=(1<<31)-1)
RHb1 = RollingHash(db, base=1<<30)
RHb2 = RollingHash(db, base=1<<30, mod=(1<<31)-1)

hashb1 = RHb1.get(0, N)
hashb2 = RHb2.get(0, N)

for i in range(N) :
  if RHa1.get(i, N + i) == hashb1 and RHa2.get(i, N + i) == hashb2 :
    print(i, a[i] ^ b[0])

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

int n, y;

int main()
{
	scanf("%d %d", &n, &y);
	for (int i = 0; i <= n && i * 10000 <= y; i++)
		for (int j = 0; i + j <= n && i * 10000 + j * 5000 <= y; j++)
			if (1000 * (n - i - j) == y - i * 10000 - j * 5000) {
				printf("%d %d %d\n", i, j, n - i - j); return 0;
			}
	printf("-1 -1 -1\n");
	return 0;
}

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

using namespace std;

void test_case()
{
  int t;
  cin >> t;
  if (t >= 30)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

int main(void)
{
  ios::sync_with_stdio(false);
  int t;
  t = 1;
  // cin >> t;
  while (t--)
  {
    test_case();
  }
  return 0;
}


Measured memory_bytes: 3592
#include<stack>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cmath>
using namespace std;

int main()
{
    int h1,k1,h2,k2,k;
    cin>>h1>>k1>>h2>>k2>>k;
    long long x1=h1*60+k1;
    long long x2=h2*60+k2-k;
    cout<<x2-x1<<endl;
    return 0;

}


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

using namespace std;

typedef long long LL;

const int mod=1e9+7;

map<LL,LL>mp;

LL n,k;

LL qsm(LL a,LL b) 
{
	LL res=1;
	while(b) {
		if(b&1) res=res*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return res;
}

int main()
{
	
	cin>>n>>k;
	
	for(int i=k;i>=1;i--) {
		LL res=0;
		res=qsm(k/i,n);
		int bei=2;
		while(bei*i<=k) res-=mp[bei*i],bei++;
		mp[i]=res%mod;
	}
	//cout<<"----"<<mp[1]<<'\n';
	LL sum=0;
	for(LL i=1;i<=k;i++) {
		sum=(sum+(LL)i*mp[i]%mod)%mod;
	}
	cout<<sum%mod<<'\n';
	
	return 0;
}

//12927461

Measured memory_bytes: 9792
using System;
using System.Collections.Generic;
using System.Linq;

public static partial class Program
{
    public static void Main()
    {
        var s = CRL();
        //01010101... => 0
        //10101010... => 1
        var count = new long[2];
        for (int i = 0; i < s.Length; i++)
        {
            if (i.IsEven())
            {
                if (s[i] == '0')
                {
                    count[1]++;
                }
                else
                {
                    count[0]++;
                }
            }
            else
            {
                if (s[i] == '1')
                {
                    count[1]++;
                }
                else
                {
                    count[0]++;
                }
            }
        }

        CWL(count.Min());
    }
}

public static partial class Program
{
    //テンプレここから
    private static long ToInt(this string str) => long.Parse(str);
    private static long[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] { 0, -1, 0, 1 };
    public static long[] dy = new long[] { -1, 0, 1, 0 };
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array)
    {
        var list = array.ToList();
        list.Sort();
        return list.ToArray();
    }
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);
    public static long LCM(long a, long b) => a * b / GCD(a, b);
    //テンプレここまで
}


Measured memory_bytes: 13268
#include <math.h>
#define PI 3.141592653589793

int main(){
	double a,b,C;
	scanf("%lf %lf %lf",&a,&b,&C);
	printf("%lf\n%lf\n%lf\n",a*b*sin(C*PI/180)/2,a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(C*PI/180)),b*sin(C*PI/180));
	return 0;
}

Measured memory_bytes: 692
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
ll dp[100010][4];

int main(int argc, char **argv)
{
	string s; cin >> s;
	ll N = (int)s.size();
	memset(dp, 0, sizeof dp);
	dp[0][0] = 1;
	for (ll i = 0; i < N; ++i)
	{
		for (ll j = 0; j < 4; ++j)
		{
			if (s[i] == '?') (dp[i+1][j] += dp[i][j] * 3) %= MOD;
			else (dp[i+1][j] += dp[i][j]) %= MOD;
		}

		char &c = s[i];
		if (c == 'A' || c == '?') (dp[i+1][1] += dp[i][0]) %= MOD;
		if (c == 'B' || c == '?') (dp[i+1][2] += dp[i][1]) %= MOD;
		if (c == 'C' || c == '?') (dp[i+1][3] += dp[i][2]) %= MOD;
	}

	std::cout << dp[s.size()][3] << std::endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

int mat[105][105];
int n;
map<set<pair<int,int>>, int> memo;

int solve(set<pair<int,int>> s){
  if(memo.count(s)==1) return memo[s];

  int ret = 0;
  for(auto &p : s) ret += p.se;
  rep(i,n){
    auto itr = s.lower_bound(mp(i,0));
    if(itr!=s.end() && itr->fi == i) continue;

    set<pair<int,int>> ns;
    bool ok = true;
    int v = INF;
    for(auto &p : s){
      if(mat[i][p.fi] == 0){ok=false; break;}
      ns.insert(mp(p.fi, min(p.se, mat[i][p.fi])));
      v = min(v, mat[i][p.fi]);
    }
    if(!ok) continue;
    ns.insert(mp(i,v));
    ret = max(ret, solve(ns));
  }
  return memo[s] = ret;
}

int main(){
  int m;
  cin>>n>>m;
  fill(mat[0], mat[100], 0);
  rep(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    mat[a][b] = mat[b][a] = c;
  }

  int res = 0;
  rep(i,n) rep(j,i) if(mat[i][j]>0){
    set<pair<int,int>> s = {{i,mat[i][j]}, {j,mat[i][j]}};
    res = max(res, solve(s));
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 10060
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,n) loop(i,0,n)
typedef vector<int> vi;
typedef vector<vi> vvi;

typedef string String;

String lcs(const String& a, const String& b) {
    const int n = a.size(), m = b.size();
    vvi X(n+1, vi(m+1));
    vvi Y(n+1, vi(m+1));
    rep(i,n)rep(j,m){
        if (a[i] == b[j]) {
            X[i+1][j+1] = X[i][j] + 1;
            Y[i+1][j+1] = 0;
        } else if (X[i+1][j] < X[i][j+1]) {
            X[i+1][j+1] = X[i][j+1];
            Y[i+1][j+1] = +1;
        } else {
            X[i+1][j+1] = X[i+1][j];
            Y[i+1][j+1] = -1;
        }
    }
    String c;
    for (int i = n, j = m; i > 0 && j > 0; ) {
        if      (Y[i][j] > 0) --i;
        else if (Y[i][j] < 0) --j;
        else { c.push_back(a[i-1]); --i; --j; }
    }
    reverse(c.begin(), c.end());
    return c;
}

int solve(string const& s){
    string a=s.substr(0,s.find("iwi"));
    string b=s.substr(s.find("iwi")+3);
    rep(i,b.size()){
        if(b[i]=='(')b[i]=')';
        else if(b[i]==')')b[i]='(';
        else if(b[i]=='{')b[i]='}';
        else if(b[i]=='}')b[i]='{';
        else if(b[i]=='[')b[i]=']';
        else if(b[i]==']')b[i]='[';
    }
    reverse(b.begin(),b.end());
    return 2*lcs(a,b).size()+3;
}

int main(){
    string s;
    while(cin>>s){
        cout << solve(s) << endl;
    }
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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



int main(){
	while(1){
		int x,y,s;
		cin >> x >> y >> s;
		if(x + y + s == 0) break;
		int ans = 0;
		for(int i = 1;i <= s;i++){
			for(int j = 1;j <= s;j++){
				if( i*(100+x)/100 + j*(100+x)/100 == s){
					ans = max(ans,i*(100+y)/100 + j*(100+y)/100);
				}
			}
		}
		cout << ans << endl;
	}


}


Measured memory_bytes: 3084
#AOJ DSL_2_B
class BIT:
    #n:要素数
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(n+1)
    
    #i番目(0-indexed)の値にxを足す
    def add(self, i, x):
        i += 1
        
        while i<=self.n:
            self.bit[i] += x
            i += i&(-i)
    
    #0からi番目までの値の和を求める
    def acc(self, i):
        i += 1
        s = 0
        
        while i>0:
            s += self.bit[i]
            i -= i&(-i)
        
        return s

n, q = map(int, input().split())
bit = BIT(n)

for _ in range(q):
    c, x, y = map(int, input().split())
    
    if c==0:
        bit.add(x-1, y)
    else:
        print(bit.acc(y-1)-bit.acc(x-2))


Measured memory_bytes: 7924
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;



void main() {
    int n, k;
    scan(n, k);
    int ans = n - k + 1;
    writeln(ans);
}























int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {
    writeln(b ? "Yes" : "No");
}

void YES(bool b) {
    writeln(b ? "YES" : "NO");
}

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

T[] readArrByLines(T)(int n) {
    return iota(n).map!(i => readln.chomp.to!T).array;
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

#define ll long long
#define EPSION numeric_limits<double>::epsilon()
#define REP(i,n) for(int i=0; i<n; ++i)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

//ifstream f("input.in");
//ofstream g("output.out");

signed main(int argc, char **argv)
{
    IOS;

    char t;
    
    cin>>t;
    
    if(t == 'A')
        cout<<'T';
    else if(t == 'T')
        cout<<'A';
    else if(t == 'G')
        cout<<'C';
    else
        cout<<'G';

    return 0;
}



Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [H, W] = input[0].map(Number);

  const empty = ".";
  const bomb = "#";

  const field = input.slice(1, -1).map((line) => line[0].split(""));

  for (let i = 0; i < H; i++) {
    for (let j = 0; j < W; j++) {
      if (field[i][j] !== empty) {
        continue;
      }

      let bombs = 0;

      for (let ii = i - 1; ii <= i + 1; ii++) {
        for (let jj = j - 1; jj <= j + 1; jj++) {
          if (
            (ii === i && jj === j) ||
            ii < 0 ||
            jj < 0 ||
            ii >= H ||
            jj >= W
          ) {
            continue;
          }

          if (field[ii][jj] === bomb) {
            bombs += 1;
          }
        }
      }

      field[i][j] = bombs.toString();
    }
  }

  return field.map((row) => row.join("")).join("\n");
};

console.log(main(read()));


Measured memory_bytes: 32456
import math

def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)

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


S = int(input())
ans = 0

if S < 3:
    print(0)
elif S == 3:
    print(1)
else:
    for i in range(S // 3):
        ans += combinations_with_replacement_count(S // 3 - i , S % 3 + 3 *i ) % (10**9 + 7)
    print(ans % (10**9 + 7))

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

using namespace std;
const int N = 2e5 + 111;
const int mod = 998244353;
#define ll long long
int n;
ll dp[N], b[N];
struct node{
    int x, d;
}a[N];

bool cmp(node &a, node &b){
    return a.x < b.x;
}
ll tree[N<<2], nex[N];

void update(int id, int l, int r, int i, ll v){
    if (l == r){
        tree[id] = v;
        return ;
    }
    int m = (l+r)>>1;
    if (m >= i) update(id<<1, l, m, i, v);
    else update(id<<1|1, m+1, r, i, v);
    tree[id] = max(tree[id<<1], tree[id<<1|1]);
}

ll query(int id, int l, int r, int ql, int qr){
    if (ql <= l && r <= qr) return tree[id];
    int m = (l+r)>>1;
    ll res = 0;
    if (m >= ql) res = max(res, query(id<<1, l, m, ql, qr));
    if (m < qr) res = max(res, query(id<<1|1, m+1, r, ql, qr));
    return res;
}

int main(){
    scanf("%d", &n);
    for (int i = 1; i <= n; i++){
        scanf("%d%d", &a[i].x, &a[i].d);
    }
    sort(a+1, a+1+n, cmp);
    for (int i = 1; i <= n; i++) b[i] = a[i].x;
    memset(tree, 0, sizeof(tree));
    for (int i = n; i >= 1; i--){
        int p = upper_bound(b+1, b+1+n, a[i].x+a[i].d-1) - b;
        if (p == i+1) nex[i] = i;
        else nex[i] = query(1, 1, n, i+1, p-1);
        update(1, 1, n, i, nex[i]);
    }
    dp[n+1] = 1;
    for (int i = n; i >= 1; i--){
        dp[i] = (dp[i+1] + dp[nex[i]+1])%mod;
    }
    cout << dp[1];
}


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

int gcd(int x,int y){
  if(y==0) return x;
  return gcd(y,x%y);
}

int main(){
  int x,y,tmp;
  cin>>x>>y;
  tmp=min(x,y);
  x=max(x,y);
  y=tmp;
  cout<<gcd(x,y)<<endl;
}

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

typedef long long ll;

int main(void){
    ll N,K;
    cin>>N>>K;
    
    vector<ll> A(N),C(200001,0);
    for(int i=0;i<N;i++){
        cin>>A[i];
        C[A[i]]++;
    }
    
    sort(A.begin(),A.end());
    A.erase(unique(A.begin(),A.end()),A.end());
    sort(C.begin(),C.end());
    
    int i=1;
    while(C[i]==0)i++;
    C.erase(C.begin(),C.begin()+i);
    
    ll sum=0;
    if(A.size()>K){
        for(int i=0;i<A.size()-K;i++){
            sum+=C[i];
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#define inf 1000000000000000
#define llint long long int

using namespace std;

typedef pair<int, int> edge;


vector<edge> G[100005];
int N, Q, K;

llint dist[100005];
bool used[100005];

void dijkstra()
{
	priority_queue<int, vector<int>, greater<int> > Q;
	
	for(int i = 1; i <= N; i++){
		dist[i] = inf;
	}
	dist[K] = 0;
	Q.push(K);
	
	int v;
	while( (int)Q.size() ){
		v = Q.top();
		Q.pop();
		used[v] = true;
		
		for(int i = 0; i < (int)G[v].size(); i++){
			if(used[G[v][i].first]) continue;
			dist[G[v][i].first] = min(dist[G[v][i].first], dist[v] + G[v][i].second);
			Q.push(G[v][i].first);
		}
	}
}

int main(void)
{
	int a, b, c;
	
	cin >> N;
	for(int i = 0; i < N-1; i++){
		cin >> a >> b >> c;
		G[a].push_back( make_pair(b, c) );
		G[b].push_back( make_pair(a, c) );
	}
	cin >> Q >> K;
	
	dijkstra();
	
	int x, y;
	for(int i = 0; i < Q; i++){
		cin >> x >> y;
		cout << dist[x] + dist[y] << endl;
	}
	
	
	
	return 0;
}

Measured memory_bytes: 8556
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

struct Pos
{
    int pos;
    ll happiness;
};

bool cmp( const Pos &a, const Pos &b ){
    return a.happiness > b.happiness;
}


const int MAX = 2001;
ll dp[MAX][MAX];


int main(){

    int n;
    cin >> n;
    vector<Pos> v(n);
    for(int i = 0; i < n; i++){
        v[i].pos = i;
        cin >> v[i].happiness;
    }
    sort( all(v), cmp );

    for(int i = 0; i < MAX; i++){
        for(int j = 0; j < MAX; j++){
            dp[i][j] = 0;
        }
    }

    for(int i = 0; i < n; i++){
        // h:左からが何個埋まっているか
        for(int h = 0; h <= i; h++){
            ll t = i - h;
            ll happy;
            happy = v[i].happiness * abs( v[i].pos - h );
            dp[h + 1][t] = max(dp[h + 1][t],  dp[h][t] + happy );

            happy = v[i].happiness * abs( v[i].pos - (n - 1 - t) );
            dp[h][t + 1] = max(dp[h][t + 1],  dp[h][t] + happy );

        }
    }


    ll ans = 0;
    for(int i = 0; i <= n; i++){
        ans = max(ans, dp[i][n - i]);
    }

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

Measured memory_bytes: 34940
n, w = list(map(int, input().split(' ')))
items = [list(map(int, input().split(' '))) for i in range(n)]

table = [[0 for j in range(w+1)] for i in range(n+1)]

for i in range(1, n+1):
    v_i, w_i = items[i-1]
    for j in range(1, w+1):
        if j - w_i < 0:
            table[i][j] = max(table[i][j-1], table[i-1][j])
        else:
            new_val = table[i-1][j-w_i] + v_i
            if new_val > table[i][j-1]:
                table[i][j] = max(new_val, table[i][j-1], table[i-1][j])
            else:
                table[i][j] = max(table[i][j-1], table[i-1][j])

print(table[-1][-1])


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

typedef long double ld;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int a,b;

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

  cin>>a>>b;

  for (int i=0;i<=1e6;i++) {
    if (i*8/100==a && i*10/100==b) out(i);
  }

  out(-1);  

  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 256
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
  cnt = 0
  for s in S:
    if s.isupper():
      cnt += 1
  if cnt == 2:
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}


int main(){
  priority_queue<int> v[1000];
  int n,q;
  cin>>n>>q;
  lp(i,q){
    int a,b,c;
    cin>>a>>b;
    if(a==0){
      cin>>c;
      v[b].push(c);
    }
    if(a==1){
      if(v[b].empty()) 1; else
      cout<<v[b].top()<<endl;
    }
    if(a==2){
      if(v[b].empty()) 1; else 
      v[b].pop();
    }
  }
  return 0;
}



Measured memory_bytes: 4100
#define ffor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string O,E;
	cin >> O;
	cin >> E;

	int str_len_o = O.length();
	int str_len_e = E.length();


	if(str_len_o == str_len_e){
		for(int i=0; i<str_len_e; i++)
		{
			cout <<O[i]<<E[i];
		}
		cout << endl;
	}
	else
	{
		for(int i=0; i<str_len_e; i++){
			cout << O[i]<<E[i];		
		}
		cout<<O[str_len_o-1] << endl;

	}
	return 0;
}


Measured memory_bytes: 256
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;typedef vector<ll> vll;
#define fill(a,b) memset(a, b, sizeof (a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;
    int n,k;
    int ans=0;
	cin>>n>>k;
	int chek[n+1];
	for(int i=1;i<=n;i++)
		chek[i]=0;
	while(k--){
		int d;
		cin>>d;
		for(int i=0,x;i<d;i++){
			cin>>x;
			chek[x]++;
		}
	}
	for(int i=1;i<=n;i++){
        if(!chek[i]){
            ans++;
            }
    }

	cout<<ans<<endl;


return 0;
}



Measured memory_bytes: 3612
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio
    int n , d ;
    cin >> n >> d ;
    d *= d ;
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        int a , b ; 
        cin >> a >> b ;
        if ( a * a + b * b <= d ) ans++ ;
    }
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3652
index = int(input())
values = list(map(int, input().split()))

for i in range(index):
  if(i == 0 and values[i] > 0):
    values[i] = values[i] -1
    continue
  if(values[i] > values[i-1]):
    values[i] = values[i] - 1
#print(values)
flag = "Yes"
for i in range(index):
  if(i == 0):
    continue
  if(values[i] < values[i-1]):
    flag = "No"

print(flag)

Measured memory_bytes: 14252
import math
import sys
readline = sys.stdin.readline


def main():
    # input
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    B = [0] * n

    for a in A:
        B[a - 1] += 1

    total = 0
    for b in B:
        if b > 1:
            total += b * (b - 1) // 2

    C = [0] * n
    for i, b in enumerate(B):
        C[i] = total - b + 1

    for a in A:
        print(C[a-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 26140
N, x = map(int, input().split())

if x == 1 or x == 2 * N - 1:
  print("No")
else:
  a = [0] * (2 * N - 1)
  a[N - 1] = x
  a[N - 2] = 1
  a[N] = 2 * N - 1
  pos = 0
  for i in range(2 * N - 1):
    while pos < 2 * N - 1 and a[pos]:
      pos += 1
    if i + 1 == 1 or i + 1 == 2 * N - 1 or i + 1 == x:
      continue
    a[pos] = i + 1
  
  print("Yes")
  for d in a:
    print(d)

Measured memory_bytes: 16840
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
#define mod 1000000007
using namespace std;
using graph =vector<vector<ll>>;
const ll MAX = 510000;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算nCk
ll com(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 二項係数計算nPk
ll per(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n-k] % MOD) % MOD;
}

// mod. m での a の逆元 a^{-1} を計算する
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	return b ? gcd(b,a%b) : a;
}



/*最小公倍数*/

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


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/


//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    string s;
    cin>>s;
    ll cnt=0,cnt1=0;
    rep(i,0,s.size()){
        if(s[i]=='0'){
            cnt++;
        }
        else{
            cnt1++;
        }
    }
    cout<<2*min(cnt,cnt1)<<endl;
    
    
    
}


Measured memory_bytes: 512
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	cin>>n;
	vector<P> d(n);
	set<ll> st;
	rep(i, n){
		ll a;
		cin>>a;
		d[i] = P(a, i);
	}
	sort(all(d));
	st.insert(-1);
	st.insert(n);
	ll res = 0;
	rep(i, n){
		ll a = d[i].snd;
		auto l = st.lower_bound(a), r = st.upper_bound(a);
		--l;
		res += (i+1)*(a-*l)*(*r-a);
		st.insert(a);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 12800
import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


immutable string YES = "Yes";
immutable string NO = "No";


auto solve(string S) {
    foreach (i, c; S) {
        if (i % 2 == 1 && !"LUD".canFind(c)) return NO;
        if (i % 2 == 0 && !"RUD".canFind(c)) return NO;
    }
    return YES;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    string S;
    S = input.front.to!string;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(S);
    else
        solve(S).writeln;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
s = input()
count_odd = 0
count_even = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "0":
            count_even += 1
        else:
            count_odd += 1
    else:
        if s[i] == "1":
            count_even += 1
        else:
            count_odd += 1
print(min(count_even, count_odd))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  int a,b,c,d,e,f;
  int ans[3]={};

  for(int i=0;i<3;i++){
    cin >> a >> b >> c;
    cin >> d >> e >> f;
    ans[i] = ((d*3600)+(e*60)+f) - ((a*3600)+(b*60)+c);
  }

  for(int i=0;i<3;i++){
    cout << ans[i]/3600 << " ";
    ans[i] %= 3600;
    cout << ans[i]/60 << " ";
    ans[i] %= 60;
    cout << ans[i] << endl;;
  }

  return 0;
}

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

using namespace std;


int main() {
	int a ,b ;
	scanf("%d %d",&a ,&b ) ;
	if ( (a + b) & 1 ) {
		printf("IMPOSSIBLE\n") ;
	} else {
		printf("%d\n",(a + b)/2) ;
	}
	return 0;
}

Measured memory_bytes: 256
void main() {
	auto ip = readAs!(ulong[]), N = ip[0], M = ip[1];
	auto S = rs;
	auto T = rs;
	auto L = (N*M) / gcd(N, M);
	//auto arr = iota(0, min(N, M)+1).filter!(i => i % (L/N) == 0).filter!(i => i % (L/M)).map!(i => i - 1).array;
	//auto arr = iota(0, L+1, max(N, M));
	auto arrN = iota(0, L, L / N);
	auto arrM = iota(0, L, L / M);
	auto arr = setIntersection(arrN, arrM);
	foreach(i; arr) {
		//auto j = i == 0 ? 0 : i / (L / N) - 1;
		//auto k = i == 0 ? 0 : i / (L / M) - 1;
		auto j = i / (L / N);
		auto k = i / (L / M);
		//writefln("%d %s %d %s", j, S[j], k, T[k]);
		if(S[j] != T[k]) {
			writeln(-1);
			return;
		}
	}
	writeln(L);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 2428
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int D;		//??\?????????????´???°
		int x=0;	//X??§?¨?
		int val=0;	//??¢???
		
		while(str!=null){
			D=Integer.parseInt(str);
			while(600-D>=x){
				val+=D*x*x;
				x+=D;
			}
			System.out.println(val);
			x=0;
			val=0;
			str=br.readLine();
		}
	}

}

Measured memory_bytes: 24244