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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  ll ans = 0;
  for (int i = 1; i < (n + 1) / 2; i++) {
    int j = n - i;
    if (i != j) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void debug() { std::cerr << '\n'; }
template <class H, class... T> void debug(H &&head, T &&... args) {
    std::cerr << head;
    sizeof...(args) == 0 ? std::cerr << "" : std::cerr << ' ';
    debug(std::forward<T>(args)...);
}
template <class T> void debug(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cerr << v[i];
        i == v.size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
    }
}
template <class T> void debug(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cerr << v[i][j];
            j == v[i].size() - 1 ? std::cerr << '\n' : std::cerr << ' ';
        }
    }
}

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

    string s;
    cin >> s;
    if (s == "Sunny")
        print("Cloudy");
    else if (s == "Cloudy")
        print("Rainy");
    else
        print("Sunny");

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    string t; cin >> t;
    string ans;
    REP(i, t.size()){
        if (t[i] == '?'){
            ans.push_back('D');
        } else {
            ans.push_back(t[i]);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n;
  string s;
  cin >> n >> s;
  bool x[26] = {}, y[26] = {};
  int ans = 0;
  FOR(i, 1, n)
  {
    REP(j, 26)
    {
      x[j] = false;
      y[j] = false;
    }

    REP(j, i)
    {
      x[s[j] - 'a'] = true;
    }

    FOR(j, i, n)
    {
      y[s[j] - 'a'] = true;
    }

    int tmp = 0;
    REP(j, 26)
    {
      if (x[j] && y[j])
      {
        tmp++;
      }
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#define pi 2*acos(0)
int main()
{
    int a,b,c;
    int x=0;
    std::cin>>a>>b>>c;

    x = c/a;
    if(a*x>= b){
        std::cout<<"OK"<<std::endl;
    }
    else{
        
        std::cout<<"NG"<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 3568
function Main(input) {
  var tmp = input.split('');
  for(var i = 0; i < tmp.length; i++) {
    if (tmp[i] === tmp[i - 1]) {
      console.log('Bad');
      return;
    }
  }
  console.log('Good');
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int h[n]; ll dp[n];
    for (int i = 0; i < n; ++i)
        cin >> h[i];
    dp[0] = 0;
    for (int i = 1; i < n; ++i) {
        dp[i] = LLONG_MAX;
        for(int j = i-1; i-j <= k && j >= 0; j--) {
            dp[i] = min(dp[i], dp[j] + abs(h[i]-h[j]));
        }
    }
    cout << dp[n-1];
    return 0;
}


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

int n, a, b, c;
vector<int> l(8);

int dfs(int total, int x, int y, int z) {
  if(total == n){
    if(min({x, y, z}) > 0){
      return abs(a - x) + abs(b - y) + abs(c - z) - 30;
    }
    else{
      return 1e9;
    }
  }
  
  int ret0, ret1, ret2, ret3;
  ret0 = dfs(total + 1, x, y, z);
  ret1 = dfs(total + 1, x + l.at(total), y, z) + 10;
  ret2 = dfs(total + 1, x, y + l.at(total), z) + 10;
  ret3 = dfs(total + 1, x, y, z + l.at(total)) + 10;
  
  return min({ret0, ret1, ret2, ret3});
}

int main() {
  cin >> n >> a >> b >> c;
  
  for(int i = 0; i < n; i++) cin >> l.at(i);
  
  cout << dfs(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
H.append(H[N - 1])
ans = True
ma = H[0]
if N != 1:
    for i in range(N - 1):
        ma = max(ma, H[i + 1])
        if ma - 1 > H[i + 1]:
            ans = False
            break
        elif H[i] <= H[i + 1]:
            continue
        elif H[i] - 1 <= H[i + 1]:
            H[i] = H[i] - 1
        else:
            ans = False
            break
if ans:
    print("Yes")
else:
    print("No")

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

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

  vector<int> c(n), s(n), f(n);
  for (int i = 0; i < n - 1; ++i) {
    cin >> c[i] >> s[i] >> f[i];
  }

  for (int i = 0; i < n; ++i) {
    int ans = s[i] + c[i];
    for (int j = i + 1; j < n - 1; ++j) {
      ans = (max(ans, s[j]) + f[j] - 1) / f[j] * f[j] + c[j];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;

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

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;}

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

int main(){
    int n; cin >> n;
    int ans = 0;
    REP(i, 0, n){
        ll k; cin >> k;
        while(k % 2 == 0){
            k /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long A = l[0], B = l[1], C = l[2];
            var x = A;

            while (x < A*B*C)
            {
                if (x % B == C)
                {
                    Console.WriteLine("YES");
                    return;
                }

                x += A;
            }

            Console.WriteLine("NO");
        }
    }
}


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

int main(){
    int H,W; cin>>H>>W;
    vector<string> V(H);
    for(auto&v:V)cin>>v;

    int n_x, n_y;
    for(int i=0;i<H;i++, puts("")){
        for(int j=0;j<W;j++){
            if(V[i][j]=='#'){cout<<"#"; continue;}
            V[i][j] = '0';
            for(int dy=-1;dy<=1;dy++)for(int dx=-1;dx<=1;dx++){
                n_y = i + dy; n_x = j + dx;
                if(n_x>=0 && n_x<W && n_y>=0 && n_y<H && V[n_y][n_x]=='#')V[i][j]++;
            }
        cout<<V[i][j];
        }
    }
}

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

int main() {
    string S;
    cin >> S;
    int l = S.length();
    bool nor = 0, so = 0, we = 0, ea = 0;
    for (int i =0; i<l;i++)
    {
        if (S[i] == 'N') nor = true;
        else if (S[i] == 'S') so = true;
        else if (S[i] == 'W') we = true;
        else if (S[i] = 'E') ea = true;
    }

    if ((nor && so && !ea && !we) || (!nor && !so && ea && we) || (nor && so && ea && we) )
        cout << "Yes";
    else
        cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int d;
	cin >> d;
	long long int g;
	cin >> g;
	long long int pt = (1LL << (long long int)d);

	long long int ans = 0;

	vector<long long int> p(d);
	vector<long long int> c(d);
	for (int i = 0; i < d; i++) {
		cin >> p[i] >> c[i];
		ans += p[i];
	}

	for (long long int i = 0; i < pt; i++) {
		long long int kp = 0;
		long long int sum = 0;
		for (long long int j = 0; j < d; j++) {
			if ((i&(1 << j)) != 0) {
				sum += p[j] * 100 * (j + 1);
				sum += c[j];
				kp += p[j];
			}
		}
		if (sum >= g) {
			ans = min(ans, kp);
		}
		else {
			for (long long int j = d - 1; j >= 0; j--) {
				if ((i&(1 << j)) == 0) {
					for (int k = 0; k < p[j]; k++) {
						sum += (j + 1) * 100;
						kp++;
						if (sum >= g) {
							ans = min(ans, kp);
							break;
						}
					}
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if V!=W:
    t = (B-A)/(V-W)
    if A>B:
        t=-t
    if 0<=t<=T:
        print('YES')
    else:
        print('NO')
else:
    if A!=B:
        print('NO')
    else:
        print('YES')

Measured memory_bytes: 9148
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>


int main(void) {
	int a, b;

	scanf("%d%d", &a, &b);

	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)printf("Possible"); else printf("Impossible");





	return(0);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[1010][1010];
char crr[1010][1010];


int main (){
	memset(arr,0,sizeof arr);
	ll h,w;
	cin >> h >> w;
	for(ll i = 1; i <= h; i++){
		for(ll j = 1; j <= w; j++){
			cin >> crr[i][j];
			if((i == 1 && j == 1) && crr[i][j] == '.') arr[i][j] = 1;
			else if(crr[i][j] == '.'){
				arr[i][j] = arr[i - 1][j] + arr[i][j - 1];
				arr[i][j] = (arr[i][j] % 1000000007);
			} 
		}
	}
	
	cout << arr[h][w] << endl; 
}

Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Stack;

public class Main {
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
    	int a = s.nextInt(), v = s.nextInt();
    	int b = s.nextInt(), w = s.nextInt();
    	int t = s.nextInt();
    	int speed = v - w;
    	if(a == b) {
    		System.out.println("YES");
//    		continue;
    	} else if(speed <= 0) {
    		System.out.println("NO");
    	} else {
    		double dist = Math.abs(b - a);
    		System.out.println(dist / speed <= t ? "YES" : "NO");
    	}
    }
}


Measured memory_bytes: 35732
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
#include<set>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int>p(n);
	for (int i = 0; i < n; i++)cin >> p[i];
	sort(p.begin(), p.end());
	int sum = 0;
	for (int i = 0; i < n - 1; i++) {
		sum += p[i];
	}
	sum += p[n - 1] / 2;
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
//cod2017final_b.cpp
//Sun Aug  4 18:55:20 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	string s;
	cin >> s;

	int a[3];
	fill(a,a+3,0);
	for (int i=0;i<s.size();i++){
		if (s[i]=='a'){
			a[0]++;
		}else if (s[i]=='b'){
			a[1]++;
		}else {
			a[2]++;
		}
	}

	if (abs(a[0]-a[1])<=1 && 
		abs(a[0]-a[2])<=1 &&
		abs(a[1]-a[2])<=1){
		cout << "YES" << endl;
	}else {
		cout <<"NO" <<endl;
	}
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

#define MAX 1000000000

int main() {
    int N;
    int ans = 0;

    cin >> N;
    
    cout << setprecision(10);
    for (int i=1; i<MAX; i++) {
        if (N < pow(i, 2)){
            cout << pow((i-1), 2) << endl;
            break;
        }else if(N == pow(i, 2)){
            cout << pow(i,2) << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()
import fractions
#gcd=fractions.gcd
def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a
class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo
show_flg=False
show_flg=True
def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

ans=0

n=I()
a=LI()

av=sum(a)/n
m=min([abs(i-av) for i in a])
for i in range(n):
    if m==abs(a[i]-av):
        print(i)
        exit()

#print(ans)



Measured memory_bytes: 65132
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double

using namespace std;

int main()
{
    fastio;

    ll a, b, c;

    cin >> a >> b >> c;

    if((a==5 && b==5 && c==7) || (a==5 && b==7 && c==5) || (a==7 && b==5 && c==5)){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char s[100001];
int main()
{
	cin>>s;
	int len=strlen(s);
	for(int i=0;i<len;i++)
		if(s[i]=='A'&&s[i+1]=='C')
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	cout<<"No"<<endl;
}

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

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

int main()
{
    double x1,x2,x3,y1,y2,y3,r=0,a,b,c;
    scanf("%lf,%lf",&x1,&y1);
    scanf("%lf,%lf",&x2,&y2);
    while(scanf("%lf,%lf",&x3,&y3) != EOF)
    {
	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	b=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
	r+=sqrt((a+b+c)/2*(b+c-a)/2*(a-b+c)/2*(a+b-c)/2);
	x2=x3;
	y2=y3;
    }
    printf("%.6f\n",r);
    return 0;
}

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

int main()
{
    int m,f,r;
    while(1)
    {
        cin>>m>>f>>r;
        if(m==-1&&f==-1&&r==-1)break;
        if(m+f>=80)
            cout<<"A"<<endl;
        if(m+f<80&&m+f>=65)
            cout<<"B"<<endl;
        if(m+f<65&&m+f>=50)
            cout<<"C"<<endl;
        if(m+f<50&&m+f>=30&&f!=-1&&m!=-1)
        {
            if(r>=50)
                cout<<"C"<<endl;
            else
            cout<<"D"<<endl;
        }
        if(m+f<30||m==-1||f==-1)
            cout<<"F"<<endl;
        
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair < ll, ll > PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main() {
    ll x;
    cin >> x;
    ll i = 1;
    ll tmp_num  = 0;
    ll ans = 0;
    while(1) {
        if ( tmp_num >= x ) break;
        tmp_num += i;
        ++i;
    }
    cout << i - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);  
    double a,b;
    double h,m;
    cin >> a >> b >> h >> m;
    double zikann = h*60 + m;
    double A = 0.5*zikann;
    double B = 6*zikann - 360*h;
    double sa = abs(A-B);
    //cout << sa << endl;
    double kaku = ((sa/360)*2)*PI;
    //cout << kaku << endl;
    //cout << fixed << setprecision(15) << sqrt(a*a+b*b-2*cos(kaku))<<endl;
    double kari = a*a + b*b - 2*a*b*cos(kaku);
    cout << fixed << setprecision(15) << sqrt(kari) << endl;  

	return 0;
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n,m,x[100005],y[100005],t[405];
int T[405][405];
int main(){
	cin >> n >> m;
	for(int i=1;i<=m;i++){
		scanf("%d%d",&x[i],&y[i]);
	}
	for(int i=1;i<=n;i++){
		T[i][i] = INF;
		for(int j=m;j>=1;j--){
			if(T[i][x[j]]){
				if(T[i][y[j]]){
					T[i][y[j]] = -1;
				}
				else{
					T[i][y[j]] = j;
				}
			}
			else if(T[i][y[j]]){
				if(T[i][x[j]]){
					T[i][x[j]] = -1;
				}
				else{
					T[i][x[j]] = j;
				}
			}
		}
	}
	int ret = 0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(T[i][i] != INF || T[i][j] || T[j][i] || T[j][j] != INF) continue;
			//cout << i << " " << j << endl;
			for(int k=1;k<=n;k++){
				if(T[i][k] == -1 || T[j][k] == -1 || (T[i][k]&&T[j][k]&&T[i][k] != T[j][k])) goto bad;
			}
			ret++; bad:;
		}
	}
	cout << ret << endl;
}

Measured memory_bytes: 1664
#include<stdio.h>
int main(void){
	int n,i;
	double ans=0;
	double x[10];
	char u[3];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%lf %s",&x[i],u);
		if(u[0]=='J'){
			ans = ans + x[i];
		}
		else{
			ans = ans + (x[i]*380000);
		}
	}

	printf("%f\n",ans);

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0; i<n; ++i)
#define rep1(i,n) for(ll i=1; i<=n; ++i)
#define revrep(i,n) for(ll i=n-1; n>=0; --i)
inline constexpr ll Inf = (1ULL << 62) -1;
#define fastio cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define endl '\n'

template <class T>
void updatemax(T& a, T b) { if (b > a) a = b; }

int gcd2_(int a, int b) {
    int r = a % b;
    if (r == 0)
        return b;
    return gcd2_(b, r);
}
int gcd2(int a, int b) {
    if (b > a) swap(a, b);
    return gcd2_(a, b);
}

int main() {
    fastio;
    ll ans=0, N;
    cin >> N;
    rep1(i,N) rep1(j,N) rep1(k,N) ans += gcd2(gcd2(i, j), k);
    cout << ans << endl;
}


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

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

    int n;
    cin >> n;

    vector<long long> A(10000010, 1);
    for(int i = 2; i <= n; i++){
        for(int j = i; j <= n; j += i){
            A[j]++;
        }
    }

    long long ans = 0;
    for(int i = 1; i <= n; i++){
        ans += i * A[i];
    }

    cout << ans << endl;

    return 0;
}

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


long long Getf(long long n, long long x) {
	
	long long ans;

	if (n >= 0) {
		ans = n / x + 1;
	}
	else {
		ans = 0;
	}

	return ans;
}

int main()
{
	long long a, b, x, answer;

	cin >> a >> b >> x;
		
	answer = Getf(b,x) - Getf(a-1,x);
	
	cout << answer  << endl;

	return 0;
}

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

ll solve(ll n, ll m){
    ll x = n/3;
    ll v[] = {x, x, x};
    n -= 3*x;
    for(int i = 0; n > 0; i=(i+1)%3, n--)
        v[i]++;
    sort(v, v+3);
    return v[2]*m-v[0]*m;
}

/*
.....
.....

.....
.....
.....
*/

ll go(ll n, ll m){
    ll res = 1e18;
    for(ll i = 1; i < n; i++){
        ll x1 = i, y1 = m;
        ll x2 = (n-i), y2 = m/2;
        ll x3 = (n-i), y3 = m/2;
        if(m%2 != 0) y3++;
        // cout << x1 << " " << y1 << endl;
        // cout << x2 << " " << y2 << endl;
        // cout << x3 << " " << y3 << endl;
        vector<ll> area;
        area.push_back(x1*y1);
        area.push_back(x2*y2);
        area.push_back(x3*y3);
        sort(area.begin(), area.end());
        // cout << area[2]-area[0] << endl;
        res = min(res, area[2]-area[0]);
        // cout << endl;
    }
    return res;
}

int main(){
    ll n, m; cin >> n >> m;
    ll res = 1e18;
    res = min(res, solve(n, m));
    res = min(res, solve(m, n));
    
    res = min(res, go(n, m));
    res = min(res, go(m, n));

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int maxn=55;
int n,m;
vector<pair<int,int> > neigh[maxn];
bool tk[maxn];
void Traverse(int v,int forb)
{
	if(tk[v])
		return ;
	tk[v]=true;
	for(int i=0;i<neigh[v].size();i++)
	{
		pair<int,int> u=neigh[v][i];
		if(u.second==forb)
			continue;
		Traverse(u.first,forb);
	}
}
bool Con(int forb)
{
	memset(tk,false,sizeof(tk));
	Traverse(0,forb);
	for(int i=0;i<n;i++)
		if(!tk[i])
			return false;
	return true;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		--a,--b;
		neigh[a].push_back(make_pair(b,i));
		neigh[b].push_back(make_pair(a,i));
	}
	int ans=0;
	for(int i=0;i<m;i++)
		ans+=1^Con(i);
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((int)1e9+7)
#define INF ((int)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;

LL modinv(LL a){
	LL b = MOD, u = 1, v = 0;
	while(b){
		LL t = a / b;
		a -= t * b;swap(a, b);
		u -= t * v;swap(u, v);
	}
	u%=MOD;
	if(u < 0) u += MOD;
	return u;

}
LL exp(LL a, LL b){
	LL res = 1;
	LL sum = a;
	while(b){
		if(b&1)res = (res * sum) % MOD;
		sum = (sum * sum) % MOD;
		b>>=1;
	}
	return res;
}

int main(){
	string str;
	cin >> str;
	string back = "";
	int ans = 0;
	string now = "";
	foreach(i, str){
		now += i;
		if(back!=now){
			back=now;
			now = "";
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)
#define size size()

int main(){
    int n,m;
    cin >> n >> m;
    if(n+m>=10){
        cout << "error" << endl;
    }else{
        cout << m+n << endl;
    }
}







Measured memory_bytes: 764
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int H,W;
    cin >> H >> W;
    vector<string> V(H);
    rep(i,0,H)cin >> V[i];
    int dist[H][W];
    rep(i,0,H)rep(j,0,W)dist[i][j] = INF;
    dist[0][0] = 1;
    queue<P> que;
    que.push(P(0,0));
    while(!que.empty()){
        auto p = que.front();
        que.pop();
        int dx[] = {1,-1,0,0};
        int dy[] = {0,0,1,-1};
        rep(i,0,4){
            int nx = p.second + dx[i];
            int ny = p.first + dy[i];
            if(dist[ny][nx] != INF || V[ny][nx] == '#')continue;
            if(nx < 0 || nx >= W || ny < 0 || ny >= H)continue;
            dist[ny][nx] = dist[p.first][p.second] + 1;
            que.push(P(ny,nx));
        }
    }
    if(dist[H-1][W-1] == INF){
        cout << -1 << endl;
        return 0;
    }
    int cnt = 0;
    //cout << dist[H-1][W-1] << endl;
    rep(i,0,H)rep(j,0,W)if(V[i][j] == '#')cnt++;
    cout << H * W - cnt - dist[H-1][W-1]<< endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pii(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)
#define iso ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
int main(){
//	freopen("in.txt","r",stdin);
 //   freopen("out.txt","w",stdout);
    int a,b,t;cin>>a>>b>>t;
     cout<<(t/a)*b; 
   
}

Measured memory_bytes: 256
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};

/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        av: [[u64]; n],
    }

    let mut iter = av
        .iter()
        .map(|row| row.iter().cloned().collect::<HashSet<_>>());
    let answer = if let Some(map) = iter
        .next()
        .map(|base| {
            iter.fold(base, |set1, set2| {
                set1.intersection(&set2).cloned().collect()
            })
        })
        .map(|map| map.len())
    {
        map
    } else {
        0
    };

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


Measured memory_bytes: 4352
N = int(input())
X = []
if N == 1:
  print("Yes")
  exit()
for i in range(1,N):
  if N % i == 0:
    a = i
    b = int(N / i)
    if a <= 9 and b <= 9:
      print("Yes")
      exit()
print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(void)
{
    int N, K;
    cin >> N >> K;
    vector<ll> h(N);  
    rep(i,N) cin >> h[i];
    sort(h.begin(), h.end());
    ll h_diff_min = INF;
    rep(i,N){
        int k = K - 1;
        if ( (i+k) >= N) break;
        ll h_diff = h[i+k] - h[i]; 
        h_diff_min = min(h_diff_min, h_diff);
    }
    cout << h_diff_min << endl;
    return 0;
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  S = S.substr(0, S.size() - 1);

  for(int i = S.size() / 2; i > 0; i--) {
    bool even = true;

    for (int j = 0; j < i; j++) {
      if (S[j] != S[i + j]) {
        even = false;
        break;
      }
    }

    if (even) {
      cout << i * 2 << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <map>
#include <cmath>
#include <algorithm>

int main(int argc, char *argv[]){
    int n;
    std::cin >> n;
    int P[n];
    for(auto &p : P){
        std::cin >> p;
    }

    int sum = 0;
    for(int i=1; i<n-1; ++i){
        if((P[i-1]-P[i])*(P[i]-P[i+1])>0){ ++sum; }
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = False
if n%2 == 1:
	for i in range(n):
		if a[i] != (i+1)//2*2:
			print("0")
			flag = True
			break
else:
	for i in range(n):
		if a[i] != i//2*2+1:
			print("0")
			flag = True
			break
if flag==False:
	print(2**(n//2)%1000000007)

Measured memory_bytes: 13880
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>

using namespace std;

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

#define rep(i,x) for(Int i = 0; i < (Int)(x); i++)
#define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--)
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back


template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}

Int dx[4] = {1,0,-1,0};
Int dy[4] = {0,1,0,-1};
const Int INF = 1001002003004005006ll;
const Int mod = 1e9 + 7;
const double PI = 3.14159265358979323846;


// ****************************************CODE***************************************//










Int a[100010];
Int b[100010];


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

        Int sum = 0;
        for(Int i = n-1; i >= 0; i--){
                a[i] += sum;
                a[i] %= b[i];
                if(a[i]){
                        sum += b[i] - a[i];
                }
        }

        cout << sum << endl;
        return 0;
}















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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int f[64][64];

int del(int i,int j)
{
  if(i<0||j<0) return 0;
  if(f[i][j]){
    f[i][j]=0;
    REP(di,3) REP(dj,3)
      del(i+di-1,j+dj-1);
    return 1;
  }
  else return 0;
}
int main(void)
{
  for(;;){
    int n,m;
    cin >> n >> m;
    if(!n&&!m) return 0;
    REP(j,m){
      REP(i,n)
	cin >> f[i][j];
    }
    int answer=0;
    REP(j,m){
      REP(i,n)
	answer+=del(i,j);
    }
    cout << answer << endl;
  }
}

Measured memory_bytes: 1280
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
using namespace std;




int main()
{
	string a,b;
	cin>>a;
	b="2019/04/30";
	if(a<=b)cout<<"Heisei";
	else cout<<"TBD";
	cout<<endl;
	return 0;
}
	

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

int main() {
	int A,B;
	cin >> A >> B;
	for(int i=1;i<=2000;i++){
		int p8 = i*0.08;
		int p10 = i*0.1;
		if(p8==A&&p10==B){
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> pii;

bool solve(){
  int n,m,p,q,r;
  vector<pii> v;
  cin >> n;
  if(n==0) return false;
  cin >> m >> p >> q >> r;
  v.push_back(pii(1,n));
  for(int i=0;i<m;i++){
    int x[3],cnt = 0, now = 0;
    vector<pii> t[3];
    cin >> x[0] >> x[1];
    x[2] = n;
    for(int j=0;j<v.size();j++){
      int l = v[j].second - v[j].first + 1;
      if(cnt + l <= x[now]){
        t[now].push_back(v[j]);
        if(cnt + l == x[now]) now++;
      }else{
        l = x[now] - cnt;
        t[now].push_back(pii(v[j].first,v[j].first + l - 1));
        v[j].first = v[j].first + l;
        j--;
        now++;
      }
      cnt += l;
    }
    vector<pii> tmp;
    for(int i=2;i>=0;i--) copy(t[i].begin(),t[i].end(),back_inserter(tmp));
    if(v.size() > tmp.size()) cout << "oaksii" << endl;
    for(int i=0;i<tmp.size();i++){
      if(i < v.size()) v[i] = tmp[i];
      else v.push_back(tmp[i]);
    }
  }
  int cnt = 0, now = 0, x[3] = {p-1,q,n};
  vector<pii> t[3];
  for(int j=0;j<v.size();j++){
    int l = v[j].second - v[j].first + 1;
    if(cnt + l <= x[now]){
      t[now].push_back(v[j]);
      if(cnt + l == x[now]) now++;
    }else{
      l = x[now] - cnt;
      t[now].push_back(pii(v[j].first,v[j].first + l - 1));
      v[j].first = v[j].first + l;
      j--;
      now++;
    }
    cnt += l;
  }
  int ans = 0;
  for(int i=0;i<t[1].size();i++){
    if(r>=t[1][i].first) ans += min(r,t[1][i].second) - t[1][i].first + 1;
  }
  cout << ans << endl;
  return true;
}

int main(){
  while(true) if(!solve()) return 0;
}

Measured memory_bytes: 3244
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a;
  //九九の値かどうかなので直接値を設定する
  set<int> c = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24,
      25, 27, 28, 30, 32, 35, 36, 40, 42, 45, 48, 49, 54, 56, 63, 64, 72, 81 };
  cin >> a;
  if (c.end() != c.find(a)) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

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

int keta_sum (int n){
    int sum=0;
    while(n>0){
        sum += n%10;
        n /= 10;
    }
    return sum;
}
int main(){
   int N;
   cin >> N ;

   int fx=keta_sum(N);

   if(N%fx==0){
       cout << "Yes" <<endl;
   }
   else cout << "No" <<endl;
}

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

using namespace std;

int main()
{

    string s;
    cin >> s;
    int l = s.length();
    int hl = l / 2;
    for (int i = 0; i < hl; i++)
    {
        if (s.at(i) != s.at(l - i - 1))
        {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = 0; i < hl / 2; i++)
    {
        if (s.at(i) != s.at(hl - i - 1))
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cstdio>
#include <stdio.h> 
#include <map>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	s[k-1] = s[k-1] + 32;
	cout << s;
	return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
a = list(li())
bunbo = 0
for ai in a:
    bunbo += 1/ai

print(1/bunbo)

Measured memory_bytes: 3064
#include<cstdio>
int p[1<<17],n,s,i;
main() {
  p[1]=1;
  for(i=2;i*i<1<<17;i++)
    if(!p[i])
      for(s=2;i*s<1<<17;s++)
	p[i*s]++;

  for(;scanf("%d",&n),n;printf("%d\n",s))
    for(i=2,s=0;(!p[i])?s+=i,n--:n,n;i++);
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void){
    int count=0,a[4],b[4],ans[100][2],hit,blow,i,j;
    while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=-1) {
        scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
        hit=0,blow=0;
        for(i=0;i<4;i++) {
            if(a[i]==b[i]) hit++;
        }
        ans[count][0]=hit;
        for(i=0;i<4;i++){
            for(j=0;j<4;j++){
                if (b[i]==a[j]) blow++;
            }
        }
        ans[count][1]=blow-hit;
        count++;
    }
    for(i=0;i<count;i++) printf("%d %d\n",ans[i][0],ans[i][1]);
    return 0;
}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  vector<int> a(n), b(m);
  set<int> sa, sb;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    sa.insert(a.at(i));
  }
  for (int i = 0; i < m; i++) {
    cin >> b.at(i);
    sb.insert(b.at(i));
  }
  
  if (sa.size() < n || sb.size() < m) {
    cout << "0\n";
    return 0;
  }
  
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  a.emplace_back(0);
  b.emplace_back(0);
  
  ll ans = 1, h = 0, w = 0, occupy = 0;
  int ita = 0, itb = 0;
  for (int i = n * m; i > 0; i--) {
    if (a.at(ita) == i && b.at(itb) == i) {
      h++;
      w++;
      ita++;
      itb++;
    }
    else if (a.at(ita) == i) {
      ans *= w;
      h++;
      ita++;
    }
    else if (b.at(itb) == i) {
      ans *= h;
      w++;
      itb++;
    }
    else {
      ans *= max<ll>(h * w - occupy, 0);
    }
    occupy++;
    ans %= MOD;
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 202;

int n;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n;
	n *= 2;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	int res = 0;
	for (int i = (n & 1); i < n; i += 2)
		res += a[i];
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k>0){
        if(k%2==1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k/=2;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
int main()
{
	int h, w, K;
	cin>>h>>w>>K;
	ll dp[8][101]={};
	K--;
	ll ct[9]={};
	ct[0]=ct[1]=1;
	ll f[9];
	f[0]=1;
	for(ll i=1; i<=w; i++) f[i]=f[i-1]*i%MOD;
	ll invf[9];
	invf[w]=inv(f[w]);
	for(ll i=w-1; i>=0; i--){
		invf[i]=invf[i+1]*(i+1)%MOD;
	}
	for(int i=1; i<w; i++){
		for(int j=0; i+1-j>=j; j++){
			ct[i+1]+=(f[i-j+1]*invf[j]%MOD*invf[i-2*j+1]%MOD);
			ct[i+1]%=MOD;
		}
	}
	dp[0][0]=1;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			ll c=ct[w];
			if(j>0){
				ll c1=ct[j-1], c2=ct[w-j-1];
				c-=(c1*c2);
				dp[j-1][i+1]+=(dp[j][i]*c1*c2);
				dp[j-1][i+1]%=MOD;
			}
			if(j<w-1){
				ll c1=ct[j], c2=ct[w-j-2];
				c-=(c1*c2);
				dp[j+1][i+1]+=(dp[j][i]*c1*c2);
				dp[j+1][i+1]%=MOD;
			}
			dp[j][i+1]+=(dp[j][i]*c);
			dp[j][i+1]%=MOD;
		}
	}
	cout<<dp[K][h]<<endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
S=list(map(int,input().split()))
D={}
mod=((10**9)+7)
ans=1
for i in range(N):
    try:
        if S[i]==0:
            if 0 not in D:
                D[0]=1
                ans*=3
            elif D[0]==1:
                D[0]+=1
                ans*=2
            elif D[0]==2:
                D[0]=3
            else:
                ans=0
        elif S[i] not in D:
            ans*=D[S[i]-1]
            ans%mod
            D[S[i]]=1
        else:
            if D[S[i]]==1:
                ans*=(D[S[i]-1]-1)
                D[S[i]]+=1
                ans%=mod
            elif D[S[i]]==2:
                ans*=(D[S[i]-1]-2)
                D[S[i]]+=1
                ans%=mod
            else:
                ans=0
    except:
        ans=0
    #print(ans)
print(ans%mod)
            

Measured memory_bytes: 17396