akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int digit(int x) {
	int cnt = 0;
	while (x > 0) {
		cnt += x % 10;
		x /= 10;
	}
	return cnt;
}
int read() {
	int tmp;
	cin >> tmp;
	return tmp;
}
int xor128() {
	static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	int t = (x xor (x << 11));
	x = y; y = z; z = w;
	return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}

signed main() {
	int n;
	int a[100005];
	cin >> n;
	rep(i, n) {
		char c;
		cin >> c;
		if (c == 'o') a[i] = 1;
		else a[i] = 0;
	}

	P p[4] = { {0,0},{0,1},{1,0},{1,1} };
	rep(i, 4) {
		int ans[100005];
		ans[0] = p[i].first, ans[1] = p[i].second;
		if ((a[0] && !ans[0]) || (!a[0] && ans[0])) ans[n - 1] = ans[1];
		else ans[n - 1] = 1 - ans[1];
		bool finish = false;
		for (int i = 1; i <= n - 2; i++) {
			int next;
			if ((a[i] && !ans[i]) || (!a[i] && ans[i])) next = ans[i - 1];
			else next = 1 - ans[i - 1];
			if (i == n - 2 && next == ans[n - 1]) {
				if (a[n - 1] && !ans[n - 1]) finish = (ans[0] == ans[n - 2]);
				else if (a[n - 1] && ans[n - 1]) finish = (ans[0] != ans[n - 2]);
				else if (!a[n - 1] && !ans[n - 1]) finish = (ans[0] != ans[n - 2]);
				else finish = (ans[0] == ans[n - 2]);
			}
			ans[i + 1] = next;
		}
		if (finish) {
			rep(i, n) {
				if (ans[i] == 0) cout << "S";
				else cout << "W";
			}
			cout << endl;
			return 0;
		}
	}
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 1920
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split()))  for _ in range(n)]
answer = 0

for ai in a:
    if sum(am * bm for am, bm in zip(ai, b)) > -c:
        answer += 1
print(answer)

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

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

int main(void)
{
	int n,ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{

		if (to_string(i).length() % 2 == 1)
		{
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int n,m;
vi A,B;
int dp[52][52][110][2];
int mem[52][52][110][2][3];
int f(int a,int b,int co,int tu,int pas){
	if(pas==3)return 0;
	if(mem[a][b][co][tu][pas]+inf)return mem[a][b][co][tu][pas];
	 
	int A,B,TU=(tu+co)%2;
	if(!tu)A=a+(1+co)/2,B=b+co/2;
	else A=a+co/2,B=b+(1+co)/2;
	int out;
	if(TU==0){
		out=-inf;
		if(A<n)out=max(out,f(a,b,co+1,tu,0));
		out=max(out,dp[a][b][co][tu]+f(A,B,0,TU^1,pas+1));
	}else{
		out=inf;
		if(B<m)out=min(out,f(a,b,co+1,tu,0));
		out=min(out,dp[a][b][co][tu]+f(A,B,0,TU^1,pas+1));
	}
	return mem[a][b][co][tu][pas]=out;
}
int main(){
	cin>>n>>m;
	A=vi(n);rep(i,n)cin>>A[i];
	B=vi(m);rep(i,m)cin>>B[i];
	
	rep(l,2)rep(i,n+1)rep(j,m+1){
		int suma=0,sumb=0;
		int L=l,I=i,J=j;
		int co=0;
		while(1){
			dp[i][j][co][l]=suma-sumb;
			if(L&&J>=m||!L&&I>=n)break;
			if(L){
				if(B[J]+1)sumb+=B[J];
				else suma=0;
				J++;
			}else{
				if(A[I]+1)suma+=A[I];
				else sumb=0;
				I++;
			}
			L^=1;
			co++;
		}
	}   
	rep(i,52)rep(j,52)rep(k,110)rep(l,2)rep(q,3)
		mem[i][j][k][l][q]=-inf;
	cout<<f(0,0,0,0,1)<<endl;
}








Measured memory_bytes: 12344
#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>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int main(){
	int a;scanf("%d",&a);
	long long cur=0;
	priority_queue<int>L;
	priority_queue<int>R;
	L.push(-mod);
	R.push(-mod);
	long long Lsum=0;
	long long Rsum=0;
	for(int i=0;i<a;i++){
		int t;scanf("%d",&t);
		if(t==1){
			int p,q;scanf("%d%d",&p,&q);
			cur+=q;
			if(L.top()<p){
				R.push(-p);
				Rsum+=p;
			}else{
				L.push(p);
				Lsum+=p;
			}
			if(L.size()>R.size()+1){
				int val=L.top();L.pop();
				R.push(-val);
				Lsum-=val;
				Rsum+=val;
			}
			if(R.size()>L.size()){
				int val=-R.top();R.pop();
				L.push(val);
				Rsum-=val;
				Lsum+=val;
			}
		//	printf("%lld %lld\n",Lsum,Rsum);
		}else{
			printf("%d ",L.top());
			long long ret=cur;
			int x=L.top();
			ret+=(long long)x*L.size()-Lsum;
			ret+=Rsum-(long long)x*R.size();
			printf("%lld\n",ret);
		}
	}
}


Measured memory_bytes: 3452
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    
    int n = s.size();
    
    string ans = "";
    
    for(int i = 0; i < n; i++) ans += 'x';
    
    cout << ans << endl;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int, input().split()))
print(" ".join(map(str,a)))
for i in range(1,n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j=j-1
    a[j+1]=v
    print(" ".join(map(str,a)))


Measured memory_bytes: 5600
import collections


class Splice():
    def __init__(self, num_lists):
        self.lists = [collections.deque() for i in range(0, num_lists, 1)]

    def insert(self, t, x):
        self.lists[t].append(x)
        return self

    def dump(self, t):
        print(' '.join(map(str, self.lists[t])))

    def splice(self, s, t):
        if self.lists[t]:
            if len(self.lists[s]) == 1:
                self.lists[t].append(self.lists[s][0])
            elif len(self.lists[t]) == 1:
                self.lists[s].appendleft(self.lists[t][0])
                self.lists[t] = self.lists[s]
            else:
                self.lists[t].extend(self.lists[s])
        else:
            self.lists[t] = self.lists[s]
        self.lists[s] = collections.deque()
        return self


num_lists, num_op = map(int, input().split(' '))
lists = Splice(num_lists)

for op in range(0, num_op):
    op = tuple(map(int, input().split(' ')))
    if op[0] == 0:
        lists.insert(op[1], op[2])
    elif op[0] == 1:
        lists.dump(op[1])
    elif op[0] == 2:
        lists.splice(op[1], op[2])


Measured memory_bytes: 61916
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
#define wzh(x) cerr<<#x<<'='<<x<<endl;
int a,b,c,k;
int main() {
  ios::sync_with_stdio(false);
  cin>>a>>b>>c>>k;int x=0;
  while(b<=a)b*=2,x++;
  while(c<=b)c*=2,x++;
  if(x<=k)cout<<"Yes\n";
  else cout<<"No\n";
  return 0;
}

Measured memory_bytes: 3612
n,m = map(int, input().split())
mo = list(map(int,input().split()))
dp = [float("inf") for i in range(n+2)]
dp[0] = 0
for i in range(n+1):
    for j in mo:
        if i+j <= n:
            dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])


Measured memory_bytes: 7388
# abc089_c.py
import collections
N = int(input())
M = []
for i in range(N):
    c = input()[0]
    if c == 'M' or c == 'A' or c == 'R' or c == 'C' or c == 'H':
        M.append(c)
C = collections.Counter(M)
ans = 0
march = list('MARCH')
for i in range(5):
    for j in range(i+1, 5):
        for k in range(j+1, 5):
            ans += C[march[i]]*C[march[j]]*C[march[k]]
print(ans)


Measured memory_bytes: 10120
#include<iostream>
using namespace std;
int main()
{
    int A,B,C,D,i=0;
    cin>>A>>B>>C>>D;
    while(A>0 && C>0)
    {
        if(i%2==0)
        {
            C-=B;
            i++;
        }
        else
        {
            A-=D;
            i++;
        }
    }
    if(A<=0)
        cout<<"No";
    else
        cout<<"Yes";
    return 0;
}


Measured memory_bytes: 3568
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n,A[10000];
	int flag;
	int i, j, k, tmp, count = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}

	flag = 1;

	while (flag) {
		flag = 0;
		for (j = n - 1;j > 0;j--) {
			if (A[j] < A[j - 1]) {
				tmp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = tmp;
				flag = 1;
				count++;
			}
		}
	}

	for (k = 0; k < n; k++) {
		printf("%d", A[k]);
		if (k != n - 1) {
			printf(" ");
		}
		else
		{
			printf("\n%d\n",count);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2068
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long mod = (long)Math.pow(10,9)+7;
        long n = sc.nextLong()+1;
        long k = sc.nextLong();
        long ans = 0;
        long max = 0;
        long min = 0;
        for(long i = 1; i <= n; i++){
            max += n-i;
            min += i-1;
            if(k <= i){
                ans += (max-min+1)%mod;
                ans %= mod;
            }
            
        }
        System.out.println(ans);
    }
}


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

int main() {
  int N, T;
  cin >> N >> T;
  int AT = 0;
  int tp = 0;
  for (int i = 0; i < N; i++) {
    int t;
    cin >> t;
    if (i == 0) continue;
    AT += min(t-tp, T);
    tp = t;
  }
  
  cout << AT + T << endl;
}

Measured memory_bytes: 256
import math


a, b, h, m = map(int, input().split())

hd = h * 30
md = m * 6

hd += m / 60 * 30

d = max(hd, md) - min(hd, md)

if d > 180:
    d = 360 - d

d = math.radians(d)
ans = a**2 + b**2 - 2*a*b*math.cos(d)
ans = math.sqrt(ans)
print(ans)


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

#define V vector
typedef long long ll;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define f(i,a) for(int i = 0 ; i < a ; i++)
#define ff first
#define ss second
#define all(x) (x).begin() ,(x).end()

#define pb push_back
#define mp make_pair
#define numberofdigits(x) floor(log10(x)) + 1



int main() {


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

	int t = 1;
	//cin >> t;

	while (t--)
	{
		int x;
		cin >> x;

		if (x >= 30)
			cout << "Yes\n";
		else
			cout << "No\n";
	}

	return 0;
}





Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int a[n+1];
//	int b[n+1]={};
	for(int i=1;i<=n;i++)cin>>a[i];
	n=1;
//	b[n]=1;
	int count=0;
	int c=1;
	while(n!=2){c=n;n=a[n];if(!a[n]){cout<<-1<<"\n";return 0;}a[c]=-1;count++;}
	cout<<count<<"\n";
	return 0;
}

Measured memory_bytes: 640
f=0
s=list(input())
if len(s)%2==1:
    f=1
else:
    for i in range(len(s)):
        if i%2==1:
            if s[i]!='i':
                f=1
                break
        else:
            if s[i]!='h':
                f=1
                break
if f==0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
r,g,b,n = map(int,input().split())
a = [0]*(n+1)
a[0] = 1
for j in range(0,n+1-r,r):
    a[j+r]=1
for j in range(n+1-b):
    a[j+b]+=a[j]
for j in range(n+1-g):
    a[j+g]+=a[j]
    #print(a)
print(a[n])


Measured memory_bytes: 3060
N = int(input())
A = [int(i) for i in input().split()]
ans = 1

for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            ans = 0

if ans:
    print('APPROVED')
else:
    print('DENIED')
            

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

#define ll long long
#define ld long double
#define tc(t) int t;cin >> t; while(t--)
#define pb push_back
#define fi first
#define se second
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    int n, m;
    cin >> n >> m;
    int ans = (n * (n-1))/2 + (m * (m-1))/2;
    cout << ans << ' ';
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


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

int main(){

    int k,a,b,n;

    cin>>k>>a>>b;
    n=1;
    while(k*n<=b){
        if(k*n>=a){
            cout<<"OK";
            return 0;
        }
        n++;
    }
    
    cout<<"NG";
    return 0;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;
 
int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}
 
ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

bool is_prime(long long N){
    if (N == 1) return false;
    for (long long i = 2;i * i <= N;i++){
        if (N % i == 0) return false;
    }
    return true;
}
 
ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}
 
double DegreeToRadian(double degree){
    return degree * M_PI / 180.0;
}
 
 
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
 
 
///////////////////////////////////////////////////////////////////////////////////
long long dp[100010][13];
int main(){
    string s;
    cin >> s;
    
    dp[0][0] = 1;
    for (int i = 0;i < s.size();i++){
        for (int j = 0;j < 13;j++){
            if (s[i] == '?'){
                for (int k = 0;k < 10;k++){
                    dp[i+1][(j*10 + k)%13] += dp[i][j]%mod;
                }
            }
            else {
                int k = s[i] - '0';
                dp[i+1][(j*10+k)%13] += dp[i][j]%mod;
            }
        }
    }
    if (dp[s.size()][5] >= 1e9 + 7){
        dp[s.size()][5] -= mod;
        dp[s.size()][5] %= mod;
    }
    cout << dp[s.size()][5] << endl;
}

Measured memory_bytes: 13868
N = int(input())
B = list(map(int, input().split()))
A = [0] * N

A[0] = B[0]
A[N - 1] = B[N - 2]
for i in range(N - 2):
    A[i + 1] = min(B[i], B[i + 1])

print(sum(A))

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif



ll a,b;
int main() {
	cin>>a>>b;
	if (a*b<=0) return puts("Zero"),0;
	if (a>0) return puts("Positive"),0;
	puts(a-b&1?"Positive":"Negative");
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{

   int n,k;
   scanf("%d %d",&n,&k);
   char s[100];
   scanf("%s",&s);
   s[k-1]= 'a'+s[k-1]-'A';
   printf("%s",s);
}


Measured memory_bytes: 3696
N = int(input())
C = []
for c in list(input()):
  a = 0
  if c == "R":
    a = 1
  C.append(a)
L = -1
R = N
cnt = 0
while L < R:
#  print(str(L) + " " + str(R))
  L += 1
  if L >= R:
    break
  if C[L] != 0:
    continue
  while L < R:
    R -= 1
    if L >= R:
      break
    if C[R] != 1:
      continue
    cnt += 1
    break     
print(cnt)
  

Measured memory_bytes: 12348
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace  std;
#define ND -100
#define pb push_back
#define ins inset
#define g2(i,j,arr) arr[i][j]
#define g3(i,j,k,arr) arr[i][j][k]
#define g4(i,j,k,l,arr) arr[i][j][k][l]
#define g5(i,j,k,l,m,arr) arr[i][j][k][l][m]
#define g6(i,j,k,l,m,n,arr) arr[i][j][k][l][m][n]
#define var auto
//typedef int i;
typedef long l;
typedef long long ll;
typedef string s;
typedef char c;
typedef pair<int, int> pii;

typedef vector<int> vi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef set<pii> spii;

const int Max = 1e6;

int main()
{
	s str;
	cin >> str;
	if(str == "SUN")
	{
		cout << "7";
	}
	if (str == "MON")
	{
		cout << "6";
	}
	if (str == "TUE")
	{
		cout << "5";
	}
	if (str == "WED")
	{
		cout << "4";
	}
	if (str == "THU")
	{
		cout << "3";
	}
	if (str == "FRI")
	{
		cout << "2";
	}
	if (str == "SAT")
	{
		cout << "1";
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <string>

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

using namespace std;

typedef pair<int,int> P;

int main(){
    int h, w, n;
    cin >> h >> w >> n;

    int area[1001][1001] = {0};
    vector<string> field(h);

    rep(i,h) cin >> field[i];
   
    int ans = 0;
    int x, y;

    rep(i,h) rep(j,w) if(field[i][j] == 'S'){
        x = i;
        y = j;
        break;
    }

    rep(i,n){
        char ob = i + '0' + 1;
        rep(a,h) rep(b,w) area[a][b] = 0;
        queue<P> bfs;
        bfs.push(P(x,y));
        while(1){
            int u = bfs.front().first;
            int v = bfs.front().second;
            bfs.pop();
            if(field[u][v] == ob){
                ans += area[u][v];
                x = u;
                y = v;
                break;
            }
            if(u>0 && !area[u-1][v] && field[u-1][v] != 'X'){
                bfs.push(P(u-1,v));
                area[u-1][v] = area[u][v]+1;
            }
            if(v>0 && !area[u][v-1] && field[u][v-1] != 'X'){
                bfs.push(P(u,v-1));
                area[u][v-1] = area[u][v]+1;
            }
            if(u<h-1 && !area[u+1][v] && field[u+1][v] != 'X'){
                bfs.push(P(u+1,v));
                area[u+1][v] = area[u][v]+1;
            }
            if(v<w-1 && !area[u][v+1] && field[u][v+1] != 'X'){
                bfs.push(P(u,v+1));
                area[u][v+1] = area[u][v]+1;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 5952
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <limits.h>
 
#define YesNo(b) ((b) ? "Yes" : "No")
#define YESNO(b) ((b) ? "YES" : "NO")

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;



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


    vi ruiR(N+1), ruiG(N+1), ruiB(N+1);
    ruiR[0] = 0;
    ruiG[0] = 0;
    ruiB[0] = 0;
    for (int i = 1; i <= N; i++)
    {
        int isR = (S[i] == 'R') ? 1 : 0;
        int isG = (S[i] == 'G') ? 1 : 0;
        int isB = (S[i] == 'B') ? 1 : 0;

        ruiR[i] = ruiR[i-1] + isR;
        ruiG[i] = ruiG[i-1] + isG;
        ruiB[i] = ruiB[i-1] + isB;
    }
    
    ll ans = 0ll;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            if (S[i] == S[j]) continue;

            int d;
            if (S[i] != 'R' && S[j] != 'R')
            {
                d = ruiR[N] - ruiR[j];
                if (2*j-i < N && S[2*j-i] == 'R')
                    --d;
            }            
            else if (S[i] != 'G' && S[j] != 'G')
            {
                d = ruiG[N] - ruiG[j];
                if (2*j-i < N && S[2*j-i] == 'G')
                    --d;
            }            
            else if (S[i] != 'B' && S[j] != 'B')
            {
                d = ruiB[N] - ruiB[j];
                if (2*j-i < N && S[2*j-i] == 'B')
                    --d;
            }
            ans += d;     
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3692
from sys import stdin
rs = lambda : stdin.readline().strip()
ri = lambda : int(rs())
ril = lambda : list(map(int, rs().split()))

def main():
    s = rs()
    if len(s) == 2:
        print(s)
    else:
        print(s[::-1])

if __name__ == '__main__':
    main()


Measured memory_bytes: 9036
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

int main() {
  std::string S;

  std::cin >> S;

  std::string que;

  int ans = 999;

  for (auto c : S) {
    que.push_back(c);
    if (que.size() > 3) {
      que.erase(0, 1);
    }
    ans = std::min(ans, std::abs(753 - std::stoi(que)));
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int vis[13];
int main(void) {
    vis[1] = vis[3] = vis[5] = vis[7] = vis[8] = vis[10] = vis[12] = 1;
    vis[4] = vis[6] = vis[9] = vis[11] = 2;
    vis[2] = 3;
    int x, y;
    scanf("%d%d", &x, &y);
    puts(vis[x] == vis[y] ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans,a[100001];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+1+n);reverse(a+1,a+1+n);
	for(int i=1;i<=n;i++)
		if(i+1>a[i+1]) {
			for(int j=i+1;a[j]==i;j++) ans^=1;
			ans|=(a[i]-i)&1;
			puts(ans?"First":"Second");
			return 0;
		}
	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a > b) {
            System.out.println(a-1);
		}
        else {
            System.out.println(a);
        }
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define LIMIT 1000000007 //10^9+7
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define all(v) (v).begin(), (v).end()

namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

int main(){
	int n;cin>>n;
  for(int i=0; i<20; i++){
    if(n<=i*1000){
      cout<<(i*1000)-n<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FOR(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--)
#define LL long long;
#define ULL unsigned long long;
using namespace std;

int main() {
	int w, h, n, x, y, a, t = 0;
	cin >> w >> h >> n;

	int map[w][h] = {0};
	REP(i,w) {
		REP(j,h) {
			map[i][j] = 0;
		}
	}

	REP(i,n) {
		cin >> x >> y >> a;
		switch (a) {
			case 1:
			REP(i,x) {
				REP(j,h) {
					map[i][j] = 1;
				}
			}
			break;
		case 2:
			RFOR(i,x,w) {
				REP(j,h) {
					map[i][j] = 1;
				}
			}
			break;
		case 3:
			REP(i,w) {
				REP(j,y) {
					map[i][j] = 1;
				}
			}
			break;
		case 4:
			REP(i,w) {
				RFOR(j,y,h) {
					map[i][j] = 1;
				}
			}
			break;
		}
	}

	REP(i,w) {
		REP(j,h) {
			t += map[i][j];
		}
	}

	cout << w * h - t << endl;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i];}cerr<<endl //[l, r))

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

template<typename T> inline void in(T &e){cin>>e;}
template<typename H,typename... T>void in(H &a, T&... b){in(a);in(b...);}
template<typename T> inline void out(T e){cout<<e<<endl;}
template<typename H,typename... T> void out(H a, T... b){out(a);out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int n;
vi vec;
int ans=0;

signed main(){
    io();

    in(n);
    vec.resize(n*2);
    rep(i,n*2){
        in(vec[i]);
    }
    sort(all(vec));

    for(int i=0;i<n*2;i+=2){
        ans+=vec[i];
    }

    out(ans);

    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,l;
    string s[110];
    cin>>n>>l;
    for(int i=0;i<n;++i)
    {
        cin>>s[i];
    }
    stable_sort(s,s+n);
    for(int i=0;i<n;++i)
    {
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}


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

int main(int argc, char **argv){
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]==s[i+1]){
            cout<<"Bad"<<endl;
            return 0;
        }
    }
    cout<<"Good"<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
a='abcdefghijklmnopqrstuvwxyz'
for b in sys.stdin:
 for i in range(26):
  c=''.join(a[ord(e)-97-i]if e in a else e for e in b)
  if any(('the'in c,'this'in c,'that'in c)):print(c.strip())


Measured memory_bytes: 5576
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;

int main()
{
  int x, n;
  while (scanf("%d %d", &x, &n) != EOF)
  {
    set<int> p;
    for (int i = 0; i < n; i++)
    {
      int pp; scanf("%d", &pp);
      p.insert(pp);
    }

    int ans = 10000, diff = 10000;
    for (int i = -10; i <= 110; i++)
      if (!p.count(i))
        if (abs(i - x) < diff)
          ans = i, diff = abs(i - x);
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 3784
#include<stdio.h>

int main(void){
	char order[128];
	int count = 0;
	int top;
	int cost;
	
	scanf("%s", order);
	
	for(int i = 0; i<3; i++){
		if(order[i] == 'o')	count++;
	}
	
	top = 100 * count;
	cost = 700 + top;
	
	printf("%d\n",cost);
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <cmath>
#include <stack>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007
const long long INF = 1LL<<60;


int main(){	
	string O,E;
	cin >> O >> E;
	string ans;
	int o = O.size();
	int e = E.size();
	int oe = o+e;
	for(int i = 1; i <= oe; i++){
		if(i % 2 != 0){
			ans += O[i/2];
		}
		else{
			ans += E[i/2-1];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
operation = [list(map(int,input().split())) for _ in range(M)]

red = [0 for _ in range(N)]
red[0] = 1
num = [1 for _ in range(N)]

for o in operation:
    num[o[0]-1] -= 1
    num[o[1]-1] += 1
    if red[o[0]-1]:
        if num[o[0]-1] == 0:
            red[o[0]-1] = 0
        red[o[1]-1] = 1
    
print(sum(red))

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

int main() {
  string S;
  cin >> S;
  int N = S.size() - 1;
  uint64_t sum;
  
  for (int i = 0; i < (1 << N); i++) { // ビット全探索 iが表すのは符号を入れる箇所
    string ss = ""; // バッファ
    for (int j = 0; j < S.size(); j++) {
      ss += S[j]; // 符号が来るまでバッファに文字を足していく
      if ((i >> j) & 1) { // j番目のビットが1の(j番目に符号を入れる)とき
        sum += stoll(ss); // バッファ内の数値を加算
        ss = ""; // バッファクリア
      }
    }
          
    sum += stoll(ss);
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
import datetime
a, b = map(int, input().split(' '))
start = datetime.date(2018, 1, 1).toordinal()
end = datetime.date(2018, a, b).toordinal()

def checker(num):
    check_day = datetime.date(2018, num, num).toordinal()
    if start <= check_day <= end:
        return True
    else:
        return False

print(list(map(checker, [i for i in range (1, 13)])).count(True))

Measured memory_bytes: 3440
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    int n, m;
    cin >> n >> m;
    
    rep(i,m){
        int a;
        cin >> a;
        n -= a;
        if(n < 0){
            cout << -1 << "\n";
            return 0;
        }
    }
    
    cout << n << "\n";
    
    return 0;
}



Measured memory_bytes: 3196
number = input()
num_list = input().split(" ")
odd_list = []
for i in num_list:
	if int(i) % 2 == 0:
		odd_list.append(i)
	else:
		pass
ans = 0
for j in odd_list:
    if int(j) % 5 == 0:
        ans += 1
    elif int(j) % 3 == 0:
        ans = ans + 1
    else:
        pass
if ans >= len(odd_list):
    print("APPROVED")
else:
    print("DENIED")

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int N, K, ans=0;
	int A[100005];

	cin >> N >> K;
	rep(i,N) cin >> A[i];

	int mn = INF;
	rep(i,N) chmin(mn, A[i]);

	bool use = false;
	int l=-1;
	rep(i,N){
		if( A[i] == mn ) use = true;
		else if( l == -1 ){
			l = i;
			use = false;
			ans++;
		}
		if( i - l + 1 >= K ){
			if( !use ){
				l = i;
				ans++;
			}else{
				l = -1;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//s配列に格納した単語を、辞書順にソートする
//getline(cin, s);
//  sort(s.begin(), s.end());
//  string t = "keyence";//で文字列入力ができる
//s.empty() //emptyなら1を出力 入っていれば0を出力
/*//ABC018-B 部分的にreverseをかける解法
int main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  rep(i,n) cin>>a.at(i)>>b.at(i);
  rep(i,n)a.at(i)--;
  rep(i,n)b.at(i)--;
  string t;
  rep(i,n){
    t = s;
    for(int k=0;k<=b.at(i)-a.at(i);k++){
      t.at(a.at(i)+k) = s.at(b.at(i)-k);
    }
    s = t;
  }
  cout << s << endl;
}
*///ABC018-B
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}
int kan_hyaku(int n){
  int kurai = 0;
  for(int i=0;i<3;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ju(int n){
  int kurai = 0;
  for(int i=0;i<2;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int kan_ichi(int n){
  int kurai = 0;
  for(int i=0;i<1;i++){
    kurai = n%10;
    n /=10;
  }
  return kurai;
}
int main() {
  int n;
  cin >> n;
  vector<ll>a(n);
  vector<ll>b(n);
  rep(i,n) cin>> a.at(i) >> b.at(i);
  ll sum = 0;
  for(int i=n-1;i>=0;i--){
//    if( (a.at(i) + sum) < b.at(i) ){
//      sum += b.at(i) - (sum + a.at(i) );
//    }
//    else{
      ll num = (a.at(i)+sum) % b.at(i);
      if(num != 0){
        sum += b.at(i) - num;
//      }
    }
  }
  cout << sum << endl;
}
/*
  for(int i=n-1;i>=0;i--){
    if( a.at(i) + sum <= b.at(i) ){
      sum += b.at(i) - (sum + a.at(i) );
    }
    else{
      ll num = (a.at(i)+sum) % b.at(i);
      if(num != 0){
        sum += b.at(i) - num;
      }
    }
  }
  cout << sum << endl;
}
*/

/*
  for(int i=n-1;i>=0;i--){
    ll num = b.at(i) - (a.at(i) + sum ) % b.at(i);
    if(num != b.at(i)){
      sum += num;
    }
  }
  cout << sum << endl;
}
*/



Measured memory_bytes: 4848
#include <iostream>
#include <iomanip>

double calc(double n, double k) {
    double ans = 0.0;
    for (int i=1; i<=n; ++i) {
        double prob = 1.0 / n;
        int tmp =  i;
        while (tmp < k) {
            tmp *= 2;
            prob /= 2.0;
        }
        ans += prob;
    }
    return ans;
}

int main() {
    double n, k;
    double probability;
    std::cin >> n >> k;
    probability = calc(n, k);
    std::cout << std::setprecision(12) << probability << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793
 
   
int main(){
    int x;
    cin >> x; 
    ll a=x/__gcd(x,360)*360;
    int ans=a/x;
    cout << ans << endl;
} 

Measured memory_bytes: 3612
# n個の点全てを含む円のうち半径が最小である円の
# 中心座標と半径を求める
class SolvCircle

  LOOP_MAX = 100

  # 移動距離がこの値以下になったら処理を終了させる
  CONVRGV = 1.0e-9

  #
  #=== 円の中心座標と半径を求める
  #
  #_pt_x_ :: n個の点のx座標の配列
  #_pt_y_ :: n個の点のy座標の配列
  #
  #返り値::配列を返す。[中心点のx座標, 中心点のy座標, 円の半径]
  #
  def solv_circle(pt_x, pt_y)
    mv_rate  = 0.5 # 移動係数
    max_dist = 0.0 # 中心点から最遠点までの距離
    xsv      = 0.0 # 中心点のx座標
    ysv      = 0.0 # 中心点のy座標
    cx       = 0.0 # 仮中心点のx座標
    cy       = 0.0 # 仮中心点のy座標
    k        = 0
    cvgflg   = false

    while (cvgflg == false)

      LOOP_MAX.times { |t|
        # 最遠点を求める
        max_dist = 0.0
        pt_x.length.times { |i|
          dist = distance(cx, cy, pt_x[i], pt_y[i])
          if (dist > max_dist)
            max_dist = dist
            k        = i
          end
        }

        # 仮の中心点を計算
        cx += (pt_x[k] - xsv) * mv_rate
        cy += (pt_y[k] - ysv) * mv_rate

        # 移動距離が境界値を下回っていればループを抜ける
        if (distance(cx, cy, xsv, ysv) <= CONVRGV)
          cx     = xsv
          cy     = ysv
          cvgflg = true
          break
        end

        xsv = cx
        ysv = cy
      }

      mv_rate /= 2.0

    end

    return [cx, cy, max_dist]
  end

  #
  #=== 二点の距離を求める
  #
  def distance(x1, y1, x2, y2)
    dx = x2 - x1
    dy = y2 - y1
    Math.sqrt(dx * dx + dy * dy)
  end
end

n = gets.chomp.to_i
x,y = n.times.map{gets.split.map(&:to_f)}.transpose

sc = SolvCircle.new()
cx,cy,r = sc.solv_circle(x,y)
puts r


Measured memory_bytes: 1916
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
string N;

int main(int argc, char const *argv[])
{
    cin>>N;
    if(N[0]==N[2]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

int n;
int input[100000+1][4];
bool visited[100000+1][4];
int dp[100000+1][4];

int solve(int i,int j)
{

	if(i>n) return 0;

	int next[2+1];
	for(int k=1,l=1; k<=3; k++)
		if(k!=j)
			next[l++] = k;

	int v[2+1];
	for(int k=1; k <= 2; k++)
	{
		if(visited[i+1][next[k]]) v[k] = dp[i+1][next[k]];
		else v[k] = solve(i+1,next[k]);
	}
	
	int res = input[i][j] + max(v[1],v[2]);
	dp[i][j] = res;
	visited[i][j] = true;

	return res;
}

int main()
{
	cin >> n;
	for(int i=1 ; i <= n ; i++)
	{
		for(int j=1; j <= 3 ; j++)
		{
			cin >> input[i][j];
		}
	}

	int res = solve(1,1);
	for(int i=2; i<=3; i++)
	{
		res = max(res,solve(1,i));
	}

	cout << res << endl;
	return 0;
}

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


void solve(long long K, long long X){
  int min = X-K+1 >= -1000000 ? X-K+1 : -1000000;
  int max = X+K-1 <= 1000000 ? X+K-1 : 1000000;

  for (int i=min; i<=max; ++i) {
    std::cout << i;
    if (i != max)
      std::cout << " ";
    else
      std::cout << std::endl;
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  string str;cin>>str;ll c1=1,c2=0;char c=str[0];ll k;cin>>k;int check=0;ll ans;int c3=0,c4=0;
  int i1,i2;
  if(str[0]!=str[str.length()-1]){
  for(int i=1;i<str.length();++i)
  {
  	if(str[i]==c){c1++;}
  	else
  	{
  	    c=str[i];c2+=(c1/2);c1=1;
  	}
  }
  c2+=(c1/2);c1=1;
      ans=c2*k;
  }
  else
  {
      for(int i=0;i<str.length();++i)
      {
          if(str[i]==c){c3++;}
          else{i1=i;break;}
      }
      //cout<<i1<<"\n";
      if(c3==str.length()){check=1;goto next;}
      
      for(int i=str.length()-1;i>=0;--i)
      {
          if(str[i]==c){c4++;}
          else{i2=i;break;}
      }
      //cout<<i2<<"\n";
      c=str[i1];c1=1;c2=0;
      for(int i=i1+1;i<=i2;++i)
      {
          if(str[i]==c){c1++;}
          else
          {
              c=str[i];c2+=(c1/2);
              //cout<<c2<<"\n";
              c1=1;
          }
      }
      c2+=(c1/2);c1=1;
      //cout<<k<<" "<<c2<<" "<<c2*k<<" "<<c3<<" "<<c4<<" ";
      ans=(c2*k)+(k-1)*((c3+c4)/2)+c3/2+c4/2;
  }next:
  if(check==1)
  {
      cout<<(k*str.length()/2);
      return 0;
  }
  cout<<ans;
}
  
  

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

int main()
{
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i].first>>v[i].second;
    }
    sort(v.begin(),v.end());
     for(int i=0;i<n;i++)
    {
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }
    return 0;
}



Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
#define all(v) v.begin(), v.end()
const int INF = 1<<30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    cin.tie(nullptr) ;
    ios::sync_with_stdio(false) ;

    int k, t;
    cin >> k >> t;
    vector<int> a(t, 0);
    rep(i, t) cin >> a[i];

    int res = 0;
    int at = *max_element(all(a));
    res = max(at - 1 - (k - at), 0);
    cout << res << "\n";
    return 0;
}

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

int n,a,b;
string s;

int main() {
  cin >> n >> a >> b;
  int cnt=0,bcnt=1;
  rep(i,n){
    cin >> s;
    if(s[i]=='a'){
      if(cnt<a+b){
      cout << "Yes" << endl; cnt++;
      } else 
      cout << "No" << endl;
    } 
    if(s[i]=='b'){
      if(cnt<a+b&&bcnt<=b){
      cout << "Yes" << endl; bcnt++; cnt++;
      } else
      cout << "No" << endl;
    }
    if(s[i]=='c')
    cout << "No" << endl;
  }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 4;
	string s;cin>>s;
	bool ok = true;
	for(int i = 0; i < 3; ++i){
		if(s[i]==s[i+1]) ok = false;
	}
	cout<<(ok?"Good":"Bad")<<endl;
	return 0;
}



Measured memory_bytes: 256
n, k, q = gets.split.map(&:to_i)
a = q.times.map { gets.to_i }
points = Array.new(n, k - q)

q.times do |i|
  points[a[i] - 1] += 1
end

points.each { |p| puts p > 0 ? 'Yes' : 'No' }


Measured memory_bytes: 4276
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){
    int k, s,ans = 0;
    cin >> k >> s;
    FOR(x,k+1){
        FOR(y,k+1){
            if(s-x-y <= k && s-x-y >=0){
                ans++;
        }}
    }
    cout << ans fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;
  cin>>N;
  
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  
  int ans=0;
  
  for(int i=1;i<N-1;i++){
    if(vec[i-1]<vec[i]&&vec[i]<vec[i+1]){
      ans++;
    }
    else if(vec[i-1]>vec[i]&&vec[i]>vec[i+1]){
      ans++;
    }
  }
  
  
  cout<<ans<<endl;
}

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

using namespace std;

typedef long long ll;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a, b;
    cin >> a >> b;
    if (b == 100) a = 1000 * a + b;
    else if (b >= 10) a = 100 * a + b;
    else a = 10 * a + b;
    ll r = sqrt(a);
    while (r * r < a) r++;
    while (r * r > a) r--;
    if (r * r == a) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 512