akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
void hSwap(int x[], int i, int j)
{
	int temp;

	temp = x[i];
	x[i] = x[j];
	x[j] = temp;
}
void ShowData(int x[], int left, int right)
{
	int i;
	for (i = left; i <= right; i++)printf("%d  ", x[i]);
	printf("\n");
}
void QSort(int x[], int left, int right, int n) {
	int i, j;	//左端,右端
	int pivot;	//軸

	i = left;
	j = right;
	pivot = x[(left + right) / 2];

	while (1) {
		if (n > 0) {				//n>0なら昇順、n<=0なら降順
			while ((x[i] < pivot) && (i <= right))i++;	//軸値より大きい要素
			while ((pivot < x[j]) && (i <= right))j--;	//軸値より小さい要素
		}
		else {
			while ((x[i] > pivot) && (i <= right))i++;	//軸値より小さい要素
			while ((pivot > x[j]) && (i <= right))j--;	//軸値より大きい要素
		}
		if (i >= j)	break;
		hSwap(x, i, j);
		i++; j--;
	}
	//ShowData(x, left, right);

	if (left < i - 1)QSort(x, left, i - 1, n);
	if (j + 1 <  right)QSort(x, j + 1, right, n);
}

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

	int a[100000];
	REP(i, n) {
		scanf("%d", &a[i]);
	}
	QSort(a, 0, n - 1, 0);

	int idx = 0;
	int maxG = a[0];
	REPS(i, n - 1) {
		int gcdN = gcd(maxG, a[i]);
		if (maxG > gcdN) {
			maxG = gcdN;
			idx = i;
		}
	}
	int tmp = a[idx];
	a[idx] = a[0];
	int ans1 = a[0];
	REPS(i, n - 1) {
		ans1 = gcd(ans1, a[i]);
	}
	a[idx] = tmp;
	a[0] = a[1];
	int ans2=a[0];
	REPS(i, n - 1) {
		ans2 = gcd(ans2, a[i]);
	}

	PRINTD(Max(ans1,ans2));
}

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

int  main()
{
	int n,x ; cin >> n >> x;
	vector<int> l(n);
	rep(i, n)
	{
		cin >> l[i];
	}
	int ans = 0;
	vector<int> q;
	q.push_back(0);
	rep1(i, n)
	{
		ans = l[i-1] + q.back();
		q.push_back(ans);
		// cout << ans << endl;
	}
	int cnt = 0;
	rep(i, q.size())
	{
		if (q[i] <= x)
			cnt++;
	}
	cout << cnt << endl;
	return (0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
int main()
{
    ll n,m,i;
    cin>>n>>m;
    string s;
    cin>>s;
    vector<int> color(n);
    for(i=0;i<n;i++)
    {
        color[i]=(s[i]=='A');
    }
    vector<vector<ll>> g(n);
    vector<vector<ll>> deg(n,vector<ll>(2,0));
    while(m--)
    {
        ll x,y;
        cin>>x>>y;
        x--;y--;
        g[x].pb(y);
        g[y].pb(x);
        deg[x][color[y]]++;
        deg[y][color[x]]++;
    }
    vector<ll> q;
    vector<ll> was(n,0);
    for(i=0;i<n;i++)
    {
        if(deg[i][0]==0||deg[i][1]==0) 
        {
            q.pb(i);
            was[i]=1;
        }
    }
    
    for(i=0;i<q.size();i++)
    {
        for(ll j:g[q[i]])
        {
            deg[j][color[q[i]]]--;
            if(deg[j][0]==0||deg[j][1]==0)
            {
                if(!was[j])
                {
                    was[j]=1;
                    q.pb(j);
                }
            }
        }
    }
    cout<<((q.size()==n)?"No":"Yes");
    return 0;
}

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

#define MAX 200000
#define SENTINEL 2000000000

typedef long long llong;

int L[MAX / 2 + 2], R[MAX/2 + 2];

llong merge(int A[], int n, int left, int mid, int right)
{
    int i, j, k;
    llong cnt = 0;
    int n1 = mid - left;
    int n2 = right - mid;
    for(i = 0; i < n1; i++)
    {
        L[i] = A[left + i];
    }
    for(i = 0; i < n2; i++)
    {
        R[i] = A[mid + i];
    }
    L[n1] = R[n2] = SENTINEL;

    i = j = 0;

    for(k = left; k < right; k++)
    {
        if(L[i] <=R[j])
        {
            A[k] = L[i++];
        }
        else
        {
            A[k] = R[j++];
            cnt += n1 - i;
        }
        
    }
    return cnt;
}

llong mergeSort(int A[], int n, int left, int right)
{
    int mid;
    llong v1, v2, v3;
    if(left + 1 < right)
    {
        mid = (left + right) / 2;
        v1 = mergeSort(A, n, left, mid);
        v2 = mergeSort(A, n, mid, right);
        v3 = merge(A, n, left, mid, right);
        return v1 + v2 + v3;
    }
    else
    {
        return 0;
    }
}

int main()
{
    int A[MAX], n, i;

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

    llong ans = mergeSort(A, n, 0, n);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4640
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
int main()
{
    int N;
    cin >> N;
    long sum = 0;
    for (int i = 1; i <= N; i++)
    {
        if(i%3 != 0 && i%5 != 0){
            sum += i;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3636
/// Bismillahir Rahmanir Rahim
/* Mohammad Morsalin
   Dept of ICE, NSTU
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int n,m,k;
    cin>>n>>m>>k;
    vector<int>a(n+1),b(m+1);
    f0(n){
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    f0(m){
        cin>>b[i+1];
        b[i+1]+=b[i];
    }
    int ans=0;
    for(int i=0,j=m;i<=n;i++){
        if(a[i]>k)break;
        while(a[i]+b[j]>k)j--;
        ans=max(ans,i+j);
    }
    cout << ans << endl;
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 6396
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll deg[4];
	REP(i, 3) {
		ll a = in(), b = in();
		++deg[a - 1];
		++deg[b - 1];
	}
	ll cnto = 0;
	REP(i, 4) {
		if (deg[i] % 2 == 1)++cnto;
	}
	cout << (cnto == 2 || cnto == 0 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;



int main(){
 string s; cin>>s;
 int n=s.size();
 int count=0;
 //gpgpの順が一版効率がいい
REP(i,n){
  if((i+1)%2==1){//奇数番目はつねにgより
    if(s[i]=='p')count--;
  }else{
    if(s[i]=='g')count++;
  }
   
}
cout<<count<<endl;
}



Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    string s;
    ll k;
    cin >> s >> k;

    vector<ll> vec(s.size());

    for(int i = 0;i < s.size();i++){
        if(k >= ('z' + 1 - s[i]) && s[i] != 'a'){
            k -= ('z' + 1 - s[i]);
            s[i] = 'a';
        }
    }

    if(k > 0){
        k %= 26;
        s[s.size() - 1] += k;
    }

    for (int i = 0; i < s.size(); i++)
    {
        cout << s[i];
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
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 (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * mod_pow(10, s.size() - i - 1, INF);
	}
	return cnt;
}
/*--------Library Zone!--------*/


signed main() {
	string s;
	cin >> s;
	if (s == "keyence")cout << "YES" << endl;
	else if (s.substr(0, 1) == "k"&&s.substr(s.size() - 6, 6) == "eyence")cout << "YES" << endl;
	else if (s.substr(0, 2) == "ke"&&s.substr(s.size() - 5, 5) == "yence")cout << "YES" << endl;
	else if (s.substr(0, 3) == "key"&&s.substr(s.size() - 4, 4) == "ence")cout << "YES" << endl;
	else if (s.substr(0, 4) == "keye"&&s.substr(s.size() - 3, 3) == "nce")cout << "YES" << endl;
	else if (s.substr(0, 5) == "keyen"&&s.substr(s.size() - 2, 2) == "ce")cout << "YES" << endl;
	else if (s.substr(0, 6) == "keyenc"&&s.substr(s.size() - 1, 1) == "e")cout << "YES" << endl;
	else if (s.substr(s.size() - 7, 7) == "keyence")cout << "YES" << endl;
	else if (s.substr(0, 7) == "keyence")cout << "YES" << endl;
	else cout << "NO" << endl;
	endre;
}


Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut sum = 0;
    let mut min = std::i64::MAX;
    for _ in 0..n {
        let a: i64 = sc.read();
        let b: i64 = sc.read();
        sum += a;
        if a > b {
            min = cmp::min(min, b);
        }
    }
    if min == std::i64::MAX {
        println!("0");
    } else {
        println!("{}", sum - min);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

n = int(input())
b = [int(input()) for _ in range(n)]

for i in b:
    for j in range(3):
        if a1[j] == i:
            a1[j] = 0
        if a2[j] == i:
            a2[j] = 0
        if a3[j] == i:
            a3[j] = 0

for i in range(3):
    if a1[i] == a2[i] == a3[i] == 0:
        print('Yes')
        exit()

if a1[0] == a1[1] == a1[2] == 0:
    print('Yes')
    exit()
if a2[0] == a2[1] == a2[2] == 0:
    print('Yes')
    exit()
if a3[0] == a3[1] == a3[2] == 0:
    print('Yes')
    exit()

if a1[0] == a2[1] == a3[2] == 0:
    print('Yes')
    exit()
if a3[0] == a2[1] == a1[2] == 0:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 38384
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>
#include <functional>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define PI 3.141592

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> vNum(N, 0);
	rep(i, N-1)
	{
		cin >> vNum[i];
	}
	vNum[N - 1] = vNum[N - 2];

	int result = 0;
	for (int i = vNum.size() - 1; i > 0; --i)
	{
		vNum[i] = min(vNum[i], vNum[i - 1]);
	}
	rep(i, vNum.size())
	{
		result += vNum[i];
	}

	printf("%d", result);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int modpow(int x,int y,int md){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
ll a,b;
inline ll get(ll x){
	if(x%4==1)return 1;
	if(x%4==3)return 0;
	if(x%4==2)return x+1;
	if(x%4==0)return x;
}
int main(){
	cin>>a>>b;
	cout<<(get(a-1)^get(b))<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
     
    public void solve(){
        Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
	    int	b = sc.nextInt();
		
		System.out.println( a*b + " " + (a+b)*2 ); 
	
    }
   
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
} 

Measured memory_bytes: 17160
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long 
#define mod 1000000007;
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    if(n<10)
    cout<<n;
    else if(n<100)
    cout<<9;
    else if(n<1000)
    cout<<10+(n-100);
    else if(n<10000)
    cout<<909;
    else if(n<100000)
    cout<<910+n-10000;
    else
    cout<<90909;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(void){
int a;
int b;
long long c;
int n;
int x;
scanf("%d",&n);
scanf("%d",&x);
a=x;
b=x;
c=x;
for(int i=1;i<n;i++){
scanf("%d",&x);
if(a>x)a=x;
if(b<x)b=x;
c=c+x;
}
printf("%d %d %lld\n",a,b,c);
return 0;
}

Measured memory_bytes: 2720
#include <stdio.h>

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
///////////////////////////////////////////////

int main(){
	int N,H,W;
	cin >> N >> H >> W;

	PRINTD((N-H+1) * (N-W+1));
}


Measured memory_bytes: 256
import itertools
import numpy as np

N = int(input())

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

ame = list() # ame[i] := #ame you get when you go down at i-th position

for n in range(N):
    up = sum(A1[0:n+1])
    down = sum(A2[n:N])
    ame.append(up+down)

print(max(ame))


Measured memory_bytes: 12388
import math
A, B, H, M = map(int, input().split())
h_hand = H*30+M*0.5
m_hand = 6 * M
diff_hand = abs(h_hand - m_hand)
print((A**2+B**2-2*A*B*math.cos(math.radians(diff_hand)))**0.5)


Measured memory_bytes: 9440
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%d", $k);
fscanf(STDIN, "%d", $x);
fscanf(STDIN, "%d", $y);
$result = 0;
for($i = 0; $i < $n; $i++) {
    if($i < $k) {
        $result += $x;
    } else {
        $result += $y;
    }
}
echo $result, PHP_EOL;

Measured memory_bytes: 4856
/*
けんちょん2
0 と 1 のみから成る 3 桁の番号 s が与えられます。1 が何個含まれるかを求めてください。

【数値例】
　s = "101"
　答え: 2
'1' が 2 個含まれています。
*/
#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    cin >> s;
    int counter = 0;
    if (s[0] == '1') ++counter;
    if (s[1] == '1') ++counter;
    if (s[2] == '1') ++counter;
    cout << counter << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <set>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};

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

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

bool intersectLP(const L& l, const P& p){
    return abs(cross(l[1]-p, l[0]-p)) < EPS;
}

P projection(const L& l, const P& p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
P reflection(const L& l, const P& p) {
    return p + 2.0*(projection(l, p) -p);
}

int main(){
    int n;
    cin >> n;
    set<P> poly;
    for(int i=0; i<n; i++){
        int x,y;
        cin >> x >> y;
        poly.insert(P(x, y));
    }

    P g(0, 0);
    for(auto p: poly){
        g += p;
    }
    g /= (double)n;

    vector<L> cand;
    for(auto p: poly){
        if(g != p){
            cand.emplace_back(g, p);
        }
        for(auto q: poly){
            if(p == q) continue;
            P mid = (p+q) /2.0;
            if(g == mid) continue;
            if(reflection(L(g, mid), p) == q){
                cand.emplace_back(g, mid);
            }
        }
    }
    bool ok = false;
    for(auto l: cand){
        int on_line = 0;
        bool symmetry = true;
        for(auto p: poly){
            if(intersectLP(l, p)){
                on_line++;
            }
            if(poly.find(reflection(l, p)) == poly.end()){
                symmetry = false;
                break;
            }
        }
        if(symmetry and on_line <= 2){
            ok = true;
            break;
        }
    }
    if(ok){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

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

int main() {
    long long n, m;
    cin >> n >> m;

    long long s = 0;
    s = min(n, m/2);
    if(m > 2*n){
        s = s+(m-2*n)/4;
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

using namespace std;

struct point {
    long long x, y;
    point(long long x_ = 0, long long y_ = 0) : x(x_), y(y_) {}
};

point operator-(point a, point b) {
    a.x -= b.x;
    a.y -= b.y;
    return a;
}

// a*d - b*c < 0
bool cmp(long long a, long long b, long long c, long long d) {
    if (b == 0) return (a > 0 && d < 0) || (a < 0 && d > 0);
    if (d == 0) return (b > 0 && c > 0) || (b < 0 && c < 0);
    if (b < 0) return cmp(c, d, -a, -b);
    if (d < 0) return cmp(-c, -d, a, b);
    long long q1 = a >= 0 ? a / b : (a - b + 1) / b;
    long long q2 = c >= 0 ? c / d : (c - d + 1) / d;
    if (q1 != q2) return q1 < q2;
    long long r1 = a - b * q1;
    long long r2 = c - d * q2;
    if (r2 == 0) return false;
    if (r1 == 0) return true;
    return cmp(d, r2, b, r1);
}

bool cmp(point a, point b) {
    return cmp(b.x, b.y, a.x, a.y);
}


int N;
long long C;
long long H[200000];
long long dp[200000];
int L, R;
point Q[200000];

void insert(point a) {
    while (R - L >= 2 && !cmp(Q[R - 1] - Q[R - 2], a - Q[R - 1])) R--;
    Q[R++] = a;
}

long long f(int k, long long x) {
    return Q[k].x * x + Q[k].y;
}

long long query(long long x) {
    while (R - L >= 2 && f(L, x) > f(L + 1, x)) L++;
    return f(L, x);
}

int main() {
    scanf("%d %lld", &N, &C);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &H[i]);
    }
    insert(point(2 * H[0], H[0] * H[0]));
    for (int i = 1; i < N; i++) {
        dp[i] = C + H[i] * H[i] + query(-H[i]);
        insert(point(2 * H[i], H[i] * H[i] + dp[i]));
    }
    printf("%lld\n", dp[N - 1]);
    return 0;
}


Measured memory_bytes: 6528
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

struct sta{
    ll c;
    ll s;
    ll f;
};
signed main(){
    ll n;
    struct sta p[509];
    cin>>n;
    rep(i,n-1) cin>>p[i].c>>p[i].s>>p[i].f;
    ll sum=0;
    rep(i,n){
        sum = 0;
        for(ll j=i+1;j<n;j++){
            if(j==1){
                sum += p[j-1].s;
            }else{
                if(sum<p[j-1].s) sum = p[j-1].s;
                else{
                    if(sum%p[j-1].f!=0){
                        sum += p[j-1].f - (sum%p[j-1].f);
                    } 
                }
            }
            sum += p[j-1].c;
        }
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
	int N;
	int min = 0, max = 0;
        long sum = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		sum += tmp;
		if (i == 0) {
			min = max = tmp;
			continue;
		}
		if (tmp < min) min = tmp;
		if (tmp > max) max = tmp;
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
}




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




int main() {
	string s;
	cin >> s;
	if(s == "Sunny") {
		cout << "Cloudy" << endl; return 0;
	}
	else if(s == "Cloudy") {
		cout << "Rainy" << endl; return 0;
	}
	else if(s == "Rainy") {
		cout << "Sunny" << endl; return 0;
	}

}


Measured memory_bytes: 256
H,W,K=map(int,input().split())

dpW=[[1,0]for i in range(9)]
for i in range(1,9):
    dpW[i][0]=dpW[i-1][0]+dpW[i-1][1]
    dpW[i][1]=dpW[i-1][0]
#print(dpW)

dpH=[[0 for i in range(W+2)]for j in range(H+1)]
dpH[0][1]=1

for i in range(1,H+1):
    for j in range(1,W+1):
        
        dpH[i][j]+=dpH[i-1][j]*dpW[W-j][0]*dpW[j-1][0]
        if W-j-1>=0:
            dpH[i][j]+=dpH[i-1][j+1]*dpW[W-j-1][0]*dpW[j-1][0]
        if j-2>=0:
            dpH[i][j]+=dpH[i-1][j-1]*dpW[W-j][0]*dpW[j-2][0]
        dpH[i][j]%=(10**9+7)
print(dpH[H][K])

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//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 SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL l(n);
	LL sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
		sum += l[i];
	}
	SORT(l);
	sum -= l[n-1];
	cout << (l[n-1] < sum ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;

template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
void yesno(bool c) { OUT(c ? "yes" : "no"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	int K, S;
	cin >> K >> S;
	int x, y, z;
	int ans = 0;
	REP(x, K + 1) {
		REP(y, K + 1) {
			z = S - x - y;
			if (0 <= z && z <= K) {
				ans++;
			}
		}
	}
	OUT(ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;
public class Main {


    public static void main(String[] args) {


        Scanner scan=new Scanner(System.in);
        int N=scan.nextInt();

        int A[]=new int[N];
        int B[]=new int[N];
        int C[]=new int[N];

        long K=scan.nextLong();

        int i=0;
        while (i<N){A[i]=scan.nextInt()-1;
        i=i+1;

        }
        int p=0;
        int R=0;
        if(K>N*2) {
            while (C[p] <= 2) {
                C[p] = C[p] + 1;
                if (C[p] == 2) {
                    R = R + 1;
                }
                ;
                p = A[p];
                K = K - 1;

            }
            K = K % R;
        }
        int i2=0;

       while(K>0){
               p=A[p];
       K=K-1;



       }
        System.out.println(p+1);
    }

       }



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

#define mod 1000000007
#define LOCAL 0
#define pb push_back
#define ll long long

ll po(ll a,ll b){
	ll x = 1,y=a;
	while(b>0){
		if(b%2){
			x = x*y;
			x %= mod;
		}
		y=y*y;
		y%=mod;
		b/=2;
	}
	return x;
}

int main(){
	if(LOCAL){
    	freopen("C:/Users/gold/Desktop/sublime IO/input.txt","r",stdin);
    	freopen("C:/Users/gold/Desktop/sublime IO/output.txt","w",stdout);
	}
	int T = 1;
	//scanf("%d",&T);
	while(T--){
		int n;
		scanf("%d",&n);
		static int cnt[5];
		for(int i=0;i<n;i++){
			int x;
			scanf("%d",&x);
			cnt[x%4]++;
		}

		if(cnt[0] >= (cnt[1] + cnt[3]-1)){
			if(cnt[0] == (cnt[1]+cnt[3]-1) && cnt[2]){
				puts("No");
			} else
			puts("Yes");
		} else {
			puts("No");
		}
	}
	return 0;	
}

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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");
 
private:
	using ll = long long;
 
	int v;
 
	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}
 
public:
 
	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }
 
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
 
	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
 
	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}
 
	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}
 
	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9) + 7>;

const int MAXN = 105;
num dp[MAXN][5][5][5];

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

	dp[0][4][4][4] = 1;
	// AGCT
	for (int i = 0; i < N; i++) {
		for (int a = 0; a < 5; a++) {
			for (int b = 0; b < 5; b++) {
				for (int c = 0; c < 5; c++) {
					for (int d = 0; d < 4; d++) {
						if ((a == 0 && c == 1 && d == 2) || 
							(a == 0 && b == 1 && d == 2) ||
							(b == 0 && c == 1 && d == 2) ||
							(b == 1 && c == 0 && d == 2) ||
							(b == 0 && c == 2 && d == 1)) {
							continue;
						}
						dp[i+1][b][c][d] += dp[i][a][b][c];
					}
				}
			}
		}
	}

	num ans = 0;
	for (int a = 0; a < 4; a++) {
		for (int b = 0; b < 4; b++) {
			for (int c = 0; c < 4; c++) {
				ans += dp[N][a][b][c];
			}
		}
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())

N = I()
for h in range(1,3501):
    for n in range(h,3501):
        if 4*h*n-N*n-N*h > 0 and (N*h*n) % (4*h*n-N*n-N*h) == 0:
            print(h,n,(N*h*n)//(4*h*n-N*n-N*h))
            exit()


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int L = a +b;
  int R = c + d;
  
  if (L > R) {
    cout << "Left" << endl;
  }
  else if (L == R) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
n,a,b,c,d = map(int,input().split())
s = input().rstrip()
renzoku_iwa = [0 for i in range(n)]
renzoku_blank = [0 for i in range(n)]
old1 = ""
old2 = ""
for i,tmp in enumerate(s):
	if old1 == tmp:
		if old1 == "." and old2 == ".":
			renzoku_blank[i] = 1
		elif old1 == "#":
			renzoku_iwa[i] = 1
	old2 = old1
	old1 = tmp

if sum(renzoku_iwa[a-1:c]) == 0 and sum(renzoku_iwa[b-1:d]) == 0:
	if c < d:
		print("Yes")
	else:
		if sum(renzoku_blank[b:min(d+1,len(renzoku_blank))])>=1:
			print("Yes")
		else:
			print("No")
else:
	print("No")

Measured memory_bytes: 56104
#include<bits/stdc++.h>
#define     ll          long long
#define     MOD         10e9+7
#define     pb          push_back
#define     vll         vector<long long>
#define     vi          vector<int>
#define     vl          vector<long>
#define     pii         pair<int, int>
#define     all(a)      (a).begin(),(a).end()
#define     rep(i,a,b)  for(int i=a;i<b;i++)
#define     MAX         100002 
#define     ios	      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int main() {
    
      int n,k,d;
      cin >> n >> k;
      vi ans(n,0);
      while(k--){
            
            cin >> d;
            vi a(d);
            for(int i=0;i<d;i++){
                  cin >> a[i];
                  ans[a[i]-1]+=i+1;
                  
            } 
            
      }
      int zero=count(ans.begin(),ans.end(),0);
      cout << zero <<"\n";      
      
  
}

/*

3 2
2
1 3
1
3  */


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

int main() {
    int a, b, count = 0;
    cin >> a >> b;
    for(int i = 1; a >= i; i++)
        for (int j = 1; 12 >= j; j++){
        if(i == j) {
            count++;
        }
    }
    if(a > b) count--;
    cout << count;
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    LL n;cin >> n;
    vector<LL> a(n), b(n);
    inc(i, 0, n) cin >> a[i];
    inc(i, 0, n) cin >> b[i];

    LL sum = 0;

    inc(i, 0, n){
        if(a[i] > b[i]){
            sum += a[i] - b[i];
        }
    }

    inc(i, 0, n){
        if(b[i] > a[i]){
            sum -= (b[i]-a[i])/2;
        }
    }

    if(sum > 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 4;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	string s;
	cin >> s;
	if (s[1] == s[2] && (s[0] == s[1] || s[2] == s[3])) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
import sys
l,r = map(int, input().split())
if r-l >= 2019:
    print(0)
    sys.exit()
else:
    ans = 2019
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min([ans,(i*j)%2019])
    print(ans)

Measured memory_bytes: 3060
import math

a, b, x = map(int, input().split())

"""
a<=100
b<=100
x<=a**2*b

角度y傾けた時の空白の体積を求めれば良い
"""

rest = a**2 * b - x
if rest <= x:
    c = (rest * 2) / a**2
    print(math.degrees(math.atan2(c, a)))
else:
    c = (x * 2) / (a*b)
    print(90 - math.degrees(math.atan2(c, b)))

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

int main()
{
    ios_base::sync_with_stdio(false);
    int n, q, t, count = 0;
    int a[100001];
    cin >> n;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    cin >> q;
    for(int i = 0; i < q; ++i){
        cin >> t;
        if(binary_search(a, a + n, t)) {
            ++count;
        }
    }
    
    cout << count << endl;
    
}

Measured memory_bytes: 1584
N,K = list(map(int,input().split()))
S = input()
input_str = ''

if S[K-1]=='A':
  input_str = S[:(K-1)] + 'a' + S[K:]
elif S[K-1]=='B':
  input_str = S[:(K-1)] + 'b' + S[K:]
else:
  input_str = S[:(K-1)] + 'c' + S[K:]
  
print(input_str)

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")   //Comment optimisations for an interative problem/use endl
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;  
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss;  
typedef vector<pll> vpll; 
typedef vector<ll> vll; 
typedef vector<vll> vvll; 
typedef unordered_map<ll,ll> um;

#define fastio ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define sqr(x) ((ll)(x) * (x)) 
#define reset(a, b) memset(a, b, sizeof(a)) 
#define f first 
#define s second 
#define mp make_pair 
#define pb push_back 
#define all(v) v.begin(), v.end() 
#define alla(arr, sz) arr, arr + sz 
#define showv(v) for(auto it: (v))cout<<it<<" ";newl;
#define newl cout<<"\n"

const ll MAXN=1e+2+7;
const ll MOD=1e+9+7, INF=0x7f7f7f7f7f7f7f7f;const int INFi=0x7f7f7f7f;
double EPS = 1e-9;  
double PI = acos(-1); 

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
ll t,n;
ll i,j;
 
//<<-----Implement Functions Here---->>//
 
 
//<<-----Start of Main--------------->>//

int main()
{
	
	fastio;
	char c;cin>>c;cout<<char(c+1);

}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;

#[fastout]
fn main() {
    input!{
        N: usize,
        M: usize,
        a: [usize; N],
    }

    let sum = a.iter().sum::<usize>();
    let criteria = sum as f64 / (4.0 * M as f64);

    let ans = a.iter().filter(|x| **x as f64 >= criteria).collect::<Vec<&usize>>().len();

    if ans >= M {
        println!("Yes");
    } else {
        println!("No");
    }
    
}


Measured memory_bytes: 2176
S = input()
T = input()

ans = []
for i in range(len(S)-len(T)+1):
    ss = list(S)
    for j in range(len(T)):
        if S[i+j]=="?":
            ss[i+j] = T[j]
            continue
        elif S[i+j]!=T[j]:
            break
    else:
        ans.append("".join(ss))

# print(ans)
if ans:
    for i in range(len(ans)):
        ans[i] = ans[i].replace("?", "a")
    print(min(ans))
else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
N=int(input())
A=list(map(int,input().split()))
data=[0]*N
r=-1
S=0
T=0
for k in range(N):
    while S==T and r<N:
        r+=1
        if r==N:
            break
        S+=A[r]
        T^=A[r]
    data[k]=r-1
    S-=A[k]
    T^=A[k]
print(sum([data[i]-i+1 for i in range(N)]))

Measured memory_bytes: 24584
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;


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

  string s; cin >> s;
  s[3] = '8';
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){

    int n, m; cin >> n >> m;
    int kind[50] = {};

    rep(i,n){
        int k; cin >> k;
        rep(i, k){
            int tmp; cin >> tmp;
            kind[tmp]++;
        }
    }

    int ans = 0;
    rep(i,m+1){
        if(kind[i] == n) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3604
// #pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma vector temporal
// #pragma simd
// #pragma GCC diagnostic ignored "-W"

#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<utility>
#include<functional>
#include<complex>
#include<climits>

// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

#define ll long long
#define ld long double
#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vint vector<int>
#define SS stringstream
#define PQ priority_queue
#define MS(x,v) memset((x),(v),sizeof(x))
#define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin())
#define FLH fflush(stdout)
#define CPPinput ios_base::sync_with_stdio(0); cin.tie(0)
#define FIN(fname) freopen(fname,"r",stdin)
#define FOUT(fname) freopen(fname,"w",stdout)

#define tm Ovuvuevuevue
#define y1 Enyetuenwuevue
#define left Ugbemugbem
#define ws Osas
#define dec tetteterette
#define exp expexpexpexp
#define expl explexplexpl

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl

#ifdef WEAK
#include"/home/edison/Coding/cpp/template/debug.cpp"
#define DEB(...) printf(__VA_ARGS__),fflush(stdout)
#define WHR() printf("%s: Line %d",__PRETTY_FUNCTION__,__LINE__),fflush(stdout)
#define LOG(...) printf("%s: Line %d ",__PRETTY_FUNCTION__,__LINE__),printf(__VA_ARGS__),fflush(stdout)
#define DEBUG 1
#define exit(x) cout<<"exit code "<<x<<endl, exit(0)
#else
#define PDE(...) ;
#define DEB(...) ;
#define WHR() ;
#define LOG(...) ;
#define DEBUG 0
#endif

#define lowbit(x) ((x)&(-(x)))

#if __cplusplus >= 201103L
#include<unordered_map>
#include<unordered_set>
#include<tuple>
#endif

void JIZZ(string output=""){cout<<output; exit(0);}

const ld PI=3.14159265358979323846264338327950288;
const ld eps=1e-13;
const ll mod=1e9+7;

int a[3333];
int main(){
    CPPinput;
    int n; cin>>n;
    for(int i=0;i<n;++i)cin>>a[i];
    int ans=0;
    for(int i=0;i<n;++i)ans+=a[i]-1;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define all(s) s.begin(),s.end()
#define sz(s) (int)s.size()
#define clr(v, d) memset(v, d, sizeof(v))
#define fi first
#define se second
#define pp push_back
#define pb pop_back
#define pi 3.141592654
#define MOD 1000000007 
#define cons1 1e12
#define cons2 1e6
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, ll> pa;
typedef unsigned long long int ull;
typedef double long dl;
const int N = 1e5+9,oo=-1e9;
ll dp[109][N], n, v[109][109];
ll sol(int i, int k){
	if (n-i&&!dp[i][k]) {
		if (k >= v[i][0])   
			dp[i][k] = v[i][1] + sol(i + 1, k - v[i][0]);
		dp[i][k] = max(dp[i][k], sol(i + 1, k));
	}

	return dp[i][k];
}
void solve() {
	int w;
	cin >> n >> w;
	rep(i, 0, n)
		cin >> v[i][0] >> v[i][1];
	cout << sol(0, w) << endl;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	int t = 1;
	//cin >> t;
	while (t--)
		solve();

#ifndef ONLINE_JUDGE
	- system("pause");
#endif

}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}


int main(){
    int n;
    int m;
    map<string,int> mp;
    cin >> n;
    for(int i=0;i<n;i++){
        string s;cin >> s;
        if(mp[s] == 0)mp[s] = 1;
        else mp[s]++;
    }
    cin >> m;
    for(int i=0;i<m;i++){
        string t;cin >> t;
        if(mp[t] == 0)mp[t] = -1;
        else mp[t]--;
    }

    int ans = 0;
    for(auto i : mp){
        if(i.second>0)chmax(ans,i.second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256