akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n;
  cin >> n;
  int ans = 0;
  rep(i, 0, n) {
    ans += i + 1;
  }
  cout << ans << endl;
}


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

int main(){
int n;
  
  cin >> n;
  string ans;
  for(int i=1; i<=9; i++){
   for(int j=1; j<=9; j++){
    if(i*j == n){
     cout << "Yes";
      return 0;
   }
   }
  }
   cout << "No";
}

Measured memory_bytes: 256
using System;

namespace ABC136A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c,d;
            string[] ss = Console.ReadLine().Split(' ');
            a = int.Parse(ss[0]);
            b = int.Parse(ss[1]);
            c = int.Parse(ss[2]);
            d = c - (a - b);
            if (d < 0)
                Console.WriteLine(0);
            else
                Console.WriteLine(d);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	long long red[a],blue[b],i;
	for(i=0 ; i<a ; i++) cin>>red[i];
	for(i=0 ; i<b ; i++) cin>>blue[i];
	vector <long long> res;
	for(i=0 ; i<c ; i++){
		long long x;
		cin>>x;
		res.push_back(x);
	}
	sort(red,red+a,greater<long long>());
	sort(blue,blue+b,greater<long long>());
	for(i=0 ; i<x ; i++) res.push_back(red[i]);
	for(i=0 ; i<y ; i++) res.push_back(blue[i]);
	sort(res.begin(),res.end(),greater <long long> ());
	long long ans=0;
	for(i=0 ; i<x+y ; i++) ans+=res[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8048
A = list(input())
A = [int(i) for i in A]

if sum(A) == 7:
    print("{}+{}+{}+{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]+A[1]+A[2]-A[3] == 7:
    print("{}+{}+{}-{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]+A[1]-A[2]+A[3] == 7:
    print("{}+{}-{}+{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]-A[1]+A[2]+A[3] == 7:
    print("{}-{}+{}+{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]+A[1]-A[2]-A[3] == 7:
    print("{}+{}-{}-{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]-A[1]+A[2]-A[3] == 7:
    print("{}-{}+{}-{}=7".format(A[0],A[1],A[2],A[3]))
elif A[0]-A[1]-A[2]+A[3] == 7:
    print("{}-{}-{}+{}=7".format(A[0],A[1],A[2],A[3]))
else:
    print("{}-{}-{}-{}=7".format(A[0],A[1],A[2],A[3]))


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

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
template<class T> inline void chmax(T& a, T b) { if(a < b) a = b; }
template<class T> inline void chmin(T& a, T b) { if(a > b) a = b; }
const ll mod = 1000000007;

int main(){
	int N, K;
	std::cin >> N >> K;
	std::vector<int> A(N);
	rep(i, N) std::cin >> A[i];

	for(int i=K; i<N; i++){
		if(A[i-K] < A[i]){
			std::cout << "Yes" << std::endl;
		}else{
			std::cout << "No" << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long x = in.nextLong();
			long ans1 = 0;
			long ans2 = 0;

			ans1 = (long) Math.ceil((x / 11.0) * 2);

			ans2 = (long) Math.ceil((x + 5) / 11.0) * 2 - 1;

			out.println(Math.min(ans1, ans2));
		}
	}

	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 23380
package main

import "fmt"

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

	ds := make([]int, n+1)
	for i := 1; i <= n; i++ {
		for j := i; j <= n; j += i {
			ds[j]++
		}
	}

	ans := 0
	for i := 1; i <= n; i++ {
		ans += i * ds[i]
	}

	fmt.Println(ans)
}


Measured memory_bytes: 82556
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  string C;
  cin >> A >> B;
  cin >> C;
  if(C[B-1]=='A'){
    (C[B-1]='a');
  }
  else if(C[B-1]=='B'){
   (C[B-1]='b');
  }
  else if(C[B-1]=='C'){
    (C[B-1]='c');
  }
	cout <<  C << endl;
}

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

using namespace std;

#define ll long long

int main()
{
	ll N, K;
	cin >> N >> K;

	ll nk = N / K;
	if (K % 2 == 1) {
		cout << nk * nk * nk << endl;
		return 0;
	}

	if (N % K >= K / 2) {
		ll nk1 = nk + 1;
		cout << nk * nk * nk + nk1 * nk1 * nk1 << endl;
	} else {
		cout << nk * nk * nk * 2 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
    ll l, r;
    cin >> l >> r;
    ll ans = 2019;
    for (ll i = l; i < r; i++)
    {
        for (ll j = i + 1; j <= r; j++)
        {
            ans = min(ans, (i * j) % 2019);
            if (ans == 0)
                break;
        }
        if (ans == 0)
            break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(lambda x:int(x), input().split()))

fail=False
count_list = [0]*(int((N-1)/2)+1)
for i in range(N):
	if A[i]%2==N%2:
		print(0)
		fail=True
		break
	count_list[int(A[i]/2)] = count_list[int(A[i]/2)]+1
if not fail:
	if N%2==0:
		for c in count_list:
			if c!=2:
				print(0)
				break
		else:
			result = 2
			for i in range(int(N/2)-1):
				result = result*2%(10**9+7)
			print(result)
	if N%2==1:
		if count_list[0]!=1:
			print(0)
		else:
			count_list.pop(0)
			for c in count_list:
				if c!=2:
					print(0)
					break
			else:
				if N==1:
					print(1)
				else:
					result = 2
					for i in range(int((N-1)/2)-1):
						result = result*2%(10**9+7)
					print(result)

Measured memory_bytes: 14452
#include<bits/stdc++.h>
#pragma warning(disable:4996)
using namespace std;
using ll = long long;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int main() {	
	int H, W;
	cin >> H >> W;
	vector<vector<char>>v(H,vector<char>(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			
			cin >> v[i][j];
		}
	}
	for (int i = 0; i < v.size(); i++) {
		bool c = true;
		for (int j = 0; j < v[i].size(); j++) {
			//cout << i << j;
			//vector<char>v2 = v[3];
			if (v[i][j] == '#') {
				c = false;
			}
		}
		if (c == true) {
			v.erase(v.begin()+i);
			i--;
		}
	}
	vector<int>memo;
	for (int i = 0; i < W; i++) {
		bool c = true;
		for (int j = 0; j < v.size(); j++) {
			if (v[j][i] == '#') {
				c = false;
			}
		}
		if (c == true) {
			memo.push_back(i);
		}
	}
	for (int i = 0; i < v.size(); i++) {
		for (int j = 0; j < v[i].size(); j++) {
			if (memo.size() == 0) {
				cout << v[i][j];
			}
			else {
				bool j_c = true;
				for (int k = 0; k < memo.size(); k++) {
					if (j == memo[k]) {
						//cout << v[i][j];
						j_c = false;
					}
				}
				if (j_c == true) {
					cout << v[i][j];
				}
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e;++i)
#define forsn(i,s,e) for(int i = s; i < e;++i)
#define rforn(i,s) for(int i = s; i >= 0;--i)
#define rforsn(i,s,e) for(int i = s; i >= e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime ((double)clock()/CLOCKS_PER_SEC)
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
int t,n,m,k,x,y,w;
signed main(){
	fastio;
	cin>>n;
	int p[n];
	string s;
	map<string,v32> M;
	forn(i,n){
		cin>>s>>p[i];
		M[s].pb(i);
	}
	forstl(it,M){
		v32 cur=it.se;
		sort(all(cur),[&p](int a,int b){
			return p[a]>p[b];
		});
		forstl(it,cur){
			cout<<it+1<<ln;
		}
	}
	return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
ns = {}
for i in range(H):
  As = input()
  for a in As:
    if a not in ns: ns[a] = 0
    ns[a] += 1
ns4 = [0, 0, 0, 0]
for a in ns:
  n = ns[a]
  ns4[n%4] += 1
#print(ns4)
if H%2 == 0 and W%2 == 0:
  if ns4[1] > 0 or ns4[2] > 0 or ns4[3] > 0:
    print("No")
  else:
    print("Yes")
if H%2 == 1 and W%2 == 0:
  if ns4[1]+ns4[3] > 0:
    print("No")
  elif ns4[2] > W//2:
    print("No")
  else:
    print("Yes")
if H%2 == 0 and W%2 == 1:
  if ns4[1]+ns4[3] > 0:
    print("No")
  elif ns4[2] > H//2:
    print("No")
  else:
    print("Yes")
if H%2 == 1 and W%2 == 1:
  if ns4[1]+ns4[3] > 1:
    print("No")
  elif ns4[2]+ns4[3] > H//2+W//2:
    print("No")
  else:
    print("Yes")


Measured memory_bytes: 3064
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<cstring>
//using namespace std;
//const int M = 100010;
//int x,cnt,ans,p,k,t,l,n;
//int a[M],b[M];
//bool f[M];
//char s[M];
//int main()
//{
//	memset(f,0,sizeof(f));
//	memset(a,0,sizeof(a));
//	memset(b,0,sizeof(b));
//	ans = 0;
//	scanf("%d",&n);
//	for (int i = 0; i < n; i++)
//	{
//		scanf("%d",&a[i]);
//		//b[i]= 1;
//	}
//	for (int i = 0; i < n; i++)
//	{
//		memset(b,0,sizeof(b));
//		for (int j = 0; j < n; j++)
//		{
//			if(a[j] + 1 == a[i] || a[j] - 1 == a[i] || a[i] == a[j])
//			{
//				b[a[i]] ++;
//			}
//		}
//		if(b[a[i]] > ans)
//			ans = b[a[i]];
//	}
//	printf("%d\n",ans);
//	return 0;
//}

//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<cstring>
//using namespace std;
//const int M = 100010;
//int x,cnt,ans,p,k,t,l,n;
//int a[M],b[M];
//bool f[M];
//char s[M];
//int main()
//{
//	memset(f,0,sizeof(f));
//	memset(a,0,sizeof(a));
//	memset(b,0,sizeof(b));
//	ans = 0;
//	scanf("%d",&n);
//	for (int i = 0; i < n; i++)
//	{
//		scanf("%d",&a[i]);
//		b[a[i]]++;
//		b[a[i]+1]++;
//		b[a[i]-1]++;
//	}
//	for (int i = 0; i < n; i++)
//		ans = max(ans,b[a[i]]);
//	printf("%d\n",ans);
//	return 0;
//}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int M = 100010;
int x,cnt,ans,p,k,t,l,n;
int a[M],b[M];
bool f[M];
char s[M];
int main()
{
	memset(f,0,sizeof(f));
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	ans = 0;
	scanf("%d",&n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i = 1; i <= n; i++)
	{
		if(a[i] == i)
		{
			if(a[i+1] != i && i+1 != n+1 && a[i] != i+1)
			{
				swap(a[i],a[i+1]);
				ans++;
			}
			else
			if(a[i-1] != i && i-1 != 0 && a[i] != i-1)
			{
				swap(a[i],a[i-1]);
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

typedef struct{
	double x;
	double y;
}POINT;

double dot(POINT a,POINT b){//??????
	return a.x*b.x + a.y*b.y;
}
double cross(POINT a,POINT b){//??????
	return a.x*b.y - a.y*b.x;
}
POINT make_vec(POINT a,POINT b){//a->b
	b.x -= a.x;
	b.y -= a.y;
	return b;
}

int inclusion(POINT a[],int n,POINT p){
	int ans = 0;
	int i;
	POINT g[n+1];
	double w,rad = 0.0;

	for(i = 0;i < n;i++){
		g[i] = a[i];
	}
	g[n] = g[0];

	for(i = 0;i < n;i++){
		if(g[i].x == p.x && g[i].y == p.y){
			return ans = 1;
		}
	}
	for(i = 0;i < n;i++){
		w = atan2(cross(make_vec(p,g[i]),make_vec(p,g[i+1])),
				dot(make_vec(p,g[i]),make_vec(p,g[i+1])));
		rad += w;
		if(fabs(w - 3.1415926535) <= 0.000001 ||
			 fabs(w + 3.1415926535) <= 0.000001)
		
return ans = 1;
	}
	if(fabs(rad - 3.1415926535*2)<=0.000001){//2??
		return ans = 2;//in!
	}
	return ans;
}

int main(){
	int i,m,n;
	POINT g[100];//n
	POINT q;//m
	int ans = 0;

	scanf("%d",&n);
	for(i = 0;i < n;i++){
		scanf("%lf%lf",&g[i].x,&g[i].y);
	}
	scanf("%d",&m);
	for(i = 0;i < m;i++){
		scanf("%lf%lf",&q.x,&q.y);
		ans = inclusion(g,n,q);
		printf("%d\n",ans);
	}
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    cout << n << ":";
    for (int i = 2; i*i <= n; ++i) {
        while (n % i == 0) {
            cout << " " << i;
            n /= i;
        }
    }
    if (n != 1) {
        cout << " " << n;
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 3092
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        List<Integer> a = new ArrayList<>(n);
        for (int i = 0; i < n; i++) a.add(scan.nextInt());
        int k = 1;

        for (int item : a
        ) {
            if (item == k) {
                k++;
            }
        }

        if (k == 1) {
            System.out.println(-1);
        } else {
            System.out.println(n - (k - 1));
        }
    }
}


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

int main() {
  	cin.tie(0);
  	ios::sync_with_stdio(false);
  
    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W));
    vector<int> h(H), w(W);

    rep(i, H) rep(j, W) {
        cin >> grid[i][j];
        if (grid[i][j] == '#') h[i] = w[j] = 1;
    }

    rep(i, H) if (h[i]) {
        rep(j, W) if (w[j]) {
            cout << grid[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

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

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define pb push_back
#define pii pair<int,int>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;
    int n , k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1; i<=n; i++)cin>>arr[i];

    vector<int>path;
    set<int>travelled;
    int next = 1;

    int cycle = -1;
    while(travelled.find(next) == travelled.end()) {
        travelled.insert(next);
        path.pb(next);
        next = arr[next];
        cycle = next;
    }

    int cycle_len = 0 ;
    for(int i=0; i<path.size(); i++) {
        if(path[i] == cycle) cycle_len = path.size()-i;
    }

    if(k < path.size()) {
        cout<<path[k]<<"\n";
    }
    else
    {
        k -= path.size()-cycle_len;
        k %= cycle_len;
        if(cycle_len == 1) {
            cout<<cycle<<"\n";
            return 0;
        }
        cout<<path[path.size()-cycle_len+k]<<"\n";
    }




}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn abs(x:f64) -> f64{
	if(x<0.0){
    	-x
    }else{
    	x
    }
}

fn main(){
let N:usize = read();
let r = read_vec();
let T:f64 = r[0];
let A:f64 = r[1];
let H:Vec<f64> = read_vec();
let mut min = 100000.0;
let mut num = 0;
for i in 0..N{
if abs(A - (T - H[i] * 0.006)) < min {
min = abs(A - (T - H[i] * 0.006));
num = i+1;
}
}
println!("{}", num);
}


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

int main() {
  int a, b, c;
  string S;
  cin >> S;
  b = (S.size() + 1) / 2;
  a = (S.size() - 1) / 2 - 1;
  c = b / 2;
  for (int i = 0; i < c; i++) {
    if (S.at(i) != S.at(a - i)) {
      cout << "No" << endl;
      break;
    }
    else if (S.at(S.size() - i - 1) != S.at(b + i)) {
      cout << "No" << endl;
      break;
    }
    else if (S.at(i * 2) != S.at(S.size() - (i * 2) - 1)) {
      cout << "No" << endl;
      break;
    }
    else if (S.at(i * 2 + 1) != S.at(S.size() - (i * 2) - 2)) {
      cout << "No" << endl;
      break;
    }
    else if (i < c - 1) {
      continue;
    }
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
/*
    Created by Ezio112
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define inf ll(10e16)
#define mod ll(10e5+7)
#define ff first
#define ss second
ll power(ll a,ll b)
{
    if(!b)
        return 1;
    ll temp=power(a,b/2);
    if(b&1)
        return (temp*temp)*a;
    return (temp*temp);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll t=1;
    //cin>>t;
    while(t--)
    {
        double pi=3.14159265358979323846;
        double a,b,h,m;
        cin>>a>>b>>h>>m;

        double th1=(2*pi/60.0)*m;
        double th2=(2*pi/720.0)*m+(2*pi/12)*h;

        cout<<setprecision(10);
        cout<<fixed;
        cout<<sqrt(a*a+b*b-2*a*b*cos(abs(th1-th2)));

    }
    return 0;
}


Measured memory_bytes: 4176
#include <stdio.h>
int diff(int a,int b)
{
	int difference;
	if(a>=b){
		difference=a-b;
	}else if(a<b){
		difference=b-a;
	}
	return difference;
}
int main(void)
{
	int n,a[100001],i,b=0,c;
	scanf("%d",&n);
	a[0]=0;
	a[n+1]=0;
	for(i=1; i<=n; i++){
		scanf("%d",&a[i]);
	}
	for(i=0; i<=n; i++){
		b=b+diff(a[i],a[i+1]);
	}
	for(i=1; i<=n; i++){
		c=b+diff(a[i-1],a[i+1])-diff(a[i-1],a[i])-diff(a[i],a[i+1]);
		printf("%d\n",c);
	}
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define getmid(l,r) ((l) + ((r) - (l)) / 2)
#define MEM(a,b) memset(a,b,sizeof(a))
#define MP(a,b) make_pair(a,b)
#define PB push_back

typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;

int main(){
	int N;
	scanf("%d",&N);
	int K = sqrt(2.0 * N);
	if(K * (K + 1) / 2 < N) K++;
	while(N){
		printf("%d\n",K);
		N -= K;
		K--;
		K = min(K,N);
	}
	return 0;
}

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

typedef long long int ll;
ll a[3001];
ll dp[3001][3001];

ll func(ll i,ll j)
{
	if(dp[i][j]!=-1)
		return dp[i][j];
	if(i==j)
	{
		dp[i][j]=a[i];
		return dp[i][j];
	}
	if(j==i+1)
	{
		dp[i][j]=max(a[i],a[j]);
		return dp[i][j];
	}
	if(dp[i][j]!=-1)
		return dp[i][j];
	dp[i][j] = max(a[i]+min(func(i+2,j),func(i+1,j-1)),a[j]+min(func(i+1,j-1),func(i,j-2)));
	return dp[i][j];
}


int main()
{
	ios::sync_with_stdio(0);
	ll n,i,j;
	cin >> n;
	ll sum=0;
	for(i=0;i<n;i++)
	{
		cin >> a[i];
		sum+=a[i];
	}
	for(i=0;i<=3000;i++)
	{
		for(j=0;j<=3000;j++)
			dp[i][j]=-1;
	}
	ll ans = func(0,n-1);
	ll y = sum-ans;
	cout << ans-y << "\n";
	return 0;
}

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

using namespace std;

int main() {
	int h1, m1, s1, h2, m2, s2;
	
	while (cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2) {
		int t1 = h1 * 60 * 60 + m1 * 60 + s1;
		int t2 = h2 * 60 * 60 + m2 * 60 + s2;
		int diff = t2 - t1;
		cout << diff / 3600 << " " << diff / 60 % 60 << " " << diff % 60 << endl;
	}

	return 0;
}

Measured memory_bytes: 2884
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void) {

	string s;

	cin >> s;

	if (s[1] == s[2] && (s[0] == s[1] || s[2] == s[3]))cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAXN 107
using namespace std;
int h,w;
int a[MAXN][MAXN],dp[MAXN][MAXN];
int main()
{
	cin>>h>>w;
	for(int i=0;i<h;i++)
	{
		string s;
		cin>>s;
		for(int j=0;j<w;j++) a[i][j]=(s[j]=='#')?1:0;
	}
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) dp[i][j]=10000;
	dp[0][0]=a[0][0];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(i!=0) dp[i][j]=min(dp[i][j],dp[i-1][j]+max(0,a[i][j]-a[i-1][j]));
			if(j!=0) dp[i][j]=min(dp[i][j],dp[i][j-1]+max(0,a[i][j]-a[i][j-1]));
		}
	}
	cout<<dp[h-1][w-1];
}

Measured memory_bytes: 384
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val a = Array(5) { sc.nextInt() }
    println(15 - a.sum())
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 38344
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n, q = map(int, input().split())
    s = list(input())
    lr = [list(map(int, input().split())) for _ in range(q)]
    ac = [0] * len(s)
    for i in range(1, len(s)):
        if s[i-1]=='A' and s[i]=='C':
            ac[i] = ac[i-1] + 1
        else:
            ac[i] = ac[i-1]
    for i in lr:
        print(ac[i[1]-1]-ac[i[0]-1])
            
if __name__ == '__main__':
    main()

Measured memory_bytes: 30352
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<iomanip>
#include<algorithm>
#define lint long long int
#define FOR(x, to) for(int x=0; x<(to); x++) // for簡略表記
#define DUMP(ar) for(int i=0; i<ar.size(); i++) cout << "[" << i << "]:" << ar[i] << endl // 配列一覧表示
#define COUT(x) cout << x << endl // 単要素出力
#define ALL(ar) ar.begin(), ar.end() // コンテナの全要素
using namespace std;
// cout << fixed << setprecision(4) で小数点以下4桁の桁そろえ
// goto ANSWER; で最後へ飛ぶ

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, q;
    cin >> n;
    vector<int> s(n);
    FOR(i, n) cin >> s[i];
    cin >> q;
    vector<int> t(q);
    FOR(i, q) cin >> t[i];

    int cnt = 0;
    int left, right, center;
    for(int i=0; i<q; i++){
        left = 0;
        right = n-1;
        // cout << "----------t[" << i << "]:" << t[i] << "のループ----------" << endl;
        while(true){
            center = (left + right)/2;
            // cout << "[ループ]" << endl;
            // cout << "left:" << left << ", right:" << right << endl;
            // cout << "center:" << center << ", t[center]:" << s[center] << endl;
            if(s[center] > t[i]){
                if(right == center){
                    if(left != right && s[left] == t[i]) cnt++;
                    break; 
                }
                right = center;
            }else if(s[center] < t[i]){
                if(left == center){
                    if(right != left && s[right] == t[i]) cnt++;
                    break; 
                }
                left = center;
            }else{
                cnt++;
                break;
            }
        }

    }

    
ANSWER:
    COUT(cnt);
    return 0;
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
 
using namespace std;
 
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define mp make_pair
#define f first
#define s second
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
 
void fio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); 
  cout.tie(0);
}
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 

 
const long double pi = 3.14159265358979323846;
const ll mod = (ll)(1e9 + 7);
 
void solve() {
  string s, t; cin >> s >> t;
  if (s == t.substr(0, s.length())) cout << "Yes\n";
  else cout << "No\n";
}
 
int main() {
  fio();
  
  int T;
  T = 1;
  // cin >> T;
  while (T--) solve();
} 

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int
int main(){
ll h , w ;
  cin >> h >> w ;
  if(h == 1 || w == 1)
  	cout << "1" ;
  else{
  if((h * w) % 2 == 0)
    cout << (h * w) / 2 ;
  else
    cout << (((h * w) - 1) / 2 ) + 1 ;  	
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    string s1, s2;
    cin >> s1;
    cin >> s2;
    string ans = (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0]) ? "YES" : "NO";
    cout << ans << endl;

    return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(auto&& e:v) cin>>e;
    int ans=numeric_limits<int>::max();
    for (int i=0,j=i+k-1; j<n; i++,j++) {
        ans=min(ans, v[j]-v[i]+min(int(abs(v[i])), int(abs(v[j]))));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 888
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	string S;
	cin >> S;
	int cnt = 0;
	for (int i = 0; i < S.length() / 2; i++)
	{
		if (S[i] != S[S.length() - i - 1])
		{
			cnt++;
		}
	}

	cout << cnt;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
N = int(input())
list = []
for i in range(N):
    list.append(str(input()))
flag = 0
for i in range(N):
    c = 0
    for j in range(N):
        if list[i] == list[j]:
            c += 1
    if c >= 2:
        print("No")
        break

if c < 2:
    for i in range(N-1):
        if list[i][len(list[i])-1] == list[i+1][0]:
            flag += 1
    if flag == N - 1:
        print("Yes")
    else:
        print("No")

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;cin>>N;
    if(N==0){
        cout<<"0"<<endl;
        return 0;
    }
    int b=1;
    string ans;
    while(N!=0){
        int bb=b*(-2);
        if(N%(abs(bb))==0)ans="0"+ans;
        else{
                ans="1"+ans;
            N-=b;
        }
        b=bb;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

// aoj DPL_1_D
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		// LIS O(n log n)
		int[] dp = new int[n];
		Arrays.fill(dp, Integer.MAX_VALUE);

		for (int j = 0; j < n; j++) {
			int i = lower_bound(dp, 0, n, a[j]);
			dp[i] = a[j];
		}

		System.out.println(lower_bound(dp, 0, n, Integer.MAX_VALUE));
		
		sc.close();
	}

	// [l,r)????????????data[i]>=value??¨??????????°????i???????????????
	private static int lower_bound(int[] data, int l, int r, int value) {
		while (r > l) {
			int mid = (r + l) / 2;
			if (data[mid] >= value) {
				r = mid;
			} else {
				l = mid + 1;
			}
		}
		
		return r;
	}
}

Measured memory_bytes: 64108
from sys import stdin
input = stdin.readline

n = int(input())
a = list(map(int, input().split()))

a_max=max(a)
a_max_half=a_max/2
tmp=a[0]
if n==2:
    print(max(a),min(a))
    exit()
for i in range(1,n):
    if abs(a[i]-a_max_half)<abs(tmp-a_max_half):
        tmp=a[i]
print(a_max,tmp)


Measured memory_bytes: 14436
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
typedef long long ll;

int main(){
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K % 2 == 0) {
		cout << A - B << endl;
	} else {
		cout << B - A << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#pragma comment (linker, "/STACK:526000000")
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(100);
}
#define int ll
int go[300000];
int imos[300000];
void solve(){
    int n, d, a;
    cin >> n >> d >> a;
    vector<pair<int, int>> inputs;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        inputs.push_back(mp(a, b));
    }
    sort(ALL(inputs));
    inputs.push_back(mp(1e12, 0));
    int ans = 0;
    int next_go = 0;
    REP(i, n) {
        while (inputs[next_go + 1].first - inputs[i].first <= 2 * d) {
            next_go++;
        }
        go[i] = next_go;
    }
    int now_bomb = 0;
    for (int i = 0; i < n; ++i) {
        now_bomb += imos[i];
        if (now_bomb * a < inputs[i].second) {
            int hoge = inputs[i].second - now_bomb * a;
            int cnt = (hoge + a - 1LL) / a;
            now_bomb += cnt;
            ans += cnt;
            imos[go[i] + 1] -= cnt;
        }
    }
    cout << ans << endl;
}
#undef int
int main() {
    init();
    solve();
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const ll mod = 1777777777ll;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s, t;
  cin >> s >> t;
  set<char> st;
  for(auto c : s) st.insert(c);
  for(auto c : t) if(st.find(c) == st.end()) {
    cout << -1 << endl;
    return 0;
  }
  vector<set<int>> idx(26);
  rep(i, s.size()) idx[s[i]-'a'].insert(i+1);
  int now = 0;
  ll loop = 0;
  for(auto c : t) {
    auto it = idx[c-'a'].upper_bound(now);
    if(it == idx[c-'a'].end()) {
      ++loop;
      now = *idx[c-'a'].begin();
    }
    else now = *it;
  }
  ll ans = (ll)s.size() * loop + now;
  cout << ans << endl;
}

Measured memory_bytes: 8544
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 998244353;
const int MAX = 10000;
Int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
Int COM(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void chadd(Int &x, Int y) { x = (x + y) % MOD; }
Int dp0[512][512];
int main() {
    COMinit();
    int N, X; cin >> N >> X;
    dp0[0][0] = 1;
    for (int t = 1; t <= X; t++) {
        for (int k = N - 1; k >= 0; k--) {
            for (int x = 0; x < 512; x++) {
                chadd(dp0[k + 1][x ^ t], dp0[k][x]);
            }
        }
    }
    Int ans = 0;
    for (int k = 0; k <= N; k++) {
        int t = (N - k) / 2;
        chadd(ans, COM(t + (X + 1) - 1, t) * dp0[k][X]);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 5380
#include<stdio.h>
  
void spin_w(int x[]){
  int sai1[6],i;
  
  for(i=0;i<6;i++){
    sai1[i]=x[i];
  }
  
  sai1[0]=x[2];
  sai1[2]=x[5];
  sai1[3]=x[0];
  sai1[5]=x[3];
  
  for(i=0;i<6;i++){
    x[i]=sai1[i];
  }
  
}
  
void spin_side(int x[]){
int sai1[6],i;
  
for(i=0;i<6;i++){
  sai1[i]=x[i];
 }
  
sai1[1]=x[2];
sai1[2]=x[4];
sai1[3]=x[1];
sai1[4]=x[3];
  
for(i=0;i<6;i++){
  x[i]=sai1[i];
 }
}
  
  
void spin_s(int x[]){
    int sai1[6],i;
      
  for(i=0;i<6;i++){
    sai1[i]=x[i];
  }
  sai1[0]=x[4];
  sai1[1]=x[0];
  sai1[4]=x[5];
    sai1[5]=x[1];
      
  for(i=0;i<6;i++){
    x[i]=sai1[i];
  }
}
  
int conf(int x[],int y[]){
      
    int i,count=0,count2=0,a=0,sai1[6],sai2[6];
      
    for(i=0;i<6;i++){
        sai1[i]=x[i];
        sai2[i]=y[i];
    }
      
    for(i=0;i<6;i++){
    if(sai1[i]==sai2[i]){
      count++;
    }
    }
      
  if(count!=6){
        for(i=0;i<=3;i++){
            spin_w(sai1);
            count2++;
        if(sai1[0]==sai2[0])break;
        }
        if(count2==4){
            for(i=0;i<=3;i++){
            spin_s(sai1);
        if(sai1[0]==sai2[0])break;
            }
        }
              
    for(i=0;i<=3;i++){
      spin_side(sai1);
      if(sai1[1]==sai2[1] && sai1[2]==sai2[2] && sai1[3]==sai2[3] && sai1[4]==sai2[4])break;
        }
  }
  
  count=0;
  
  
  for(i=0;i<6;i++){
    if(sai1[i]==sai2[i]){
      count++;
        }
    }
    if(count==6){
        return 1;
    }else{
        return 0;
    }
}
  
int main(){
  int i,j,k,l,sai1[6],sai2[6],sai_c[105][6],n,a=0;
      
    scanf("%d",&n);
    for(i=0;i<n;i++){
        for(j=0;j<6;j++){
            scanf("%d",&sai_c[i][j]);
        }
    }
    for(i=0;i<n;i++){
        for(j=0;j<6;j++){
            sai1[j]=sai_c[i][j];
        }
        for(k=i+1;k<n;k++){
            for(l=0;l<6;l++){
                sai2[l]=sai_c[k][l];
            }
                if(conf(sai1,sai2)==1){
            a++;
            }
        }
    }
  if(a==0){
      printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;

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

    using P = pair<int, int>;
    vector<P> v(m);
    rep(i, m) cin >> v[i].second >> v[i].first;
    sort(all(v));

    int ans = 0;

    int b = -1;
    rep(i, m){
        if(v[i].second <= b && b < v[i].first) continue;
        else {
            ans++;
            b = v[i].first - 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>                                               //scanf,printf
#include <algorithm>                                            //max,min
#include <string>                                               //string
#include <cstring>                                              //strlen,strcat
#include <cctype>                                               //isalpha,tolower
#include <cmath>                                                //sqrt,sin
#include <stack>                                                //top,push
#include <queue>                                                //front,push
#include <vector>                                               //push_back,sort
#include <set>                                                  //insert,begin
#include <map>                                                  //insert,find
#include <list>                                                 //push_front,begin
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>                                               //pow,powf
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define rep(i,n) for(int i=0; i<n; i++)

ll e;
bool C(ll d){
  return e>d*d;
}

int main(){
  ll n,a,b,ans;
  cin>>n;
  rep(i, n){
    ll lb,ub;
    cin>>a>>b;
    if(b>a){ ub=b; lb=a;}
    else {ub=a; lb=b;}
    
    e=a*b;
    rep(i, 100){
      ll mid=(ub+lb)/2;
      if(C(mid)) lb=mid;
      else ub=mid;
    }
    
    if((lb+1)*lb<e) ans=lb*2-1;
    else ans=lb*2-2;
    
    cout<<ans<<en
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>
#include<functional>
#include<deque>
#include<queue>
#include<string>
#include<iostream>
#define fir first
#define sec second
#define mp make_pair
#define mt make_tuple
#define pb push_back
using namespace std;
typedef long long int llint;
const llint one = 1;
const llint big = (one<<33);
const llint ban = (big<<20);
llint dp[55][55]={0};

llint ncr(int n,int r){
	if(dp[n][r]!=0){return dp[n][r];}
	if(n==r){return 1;}
	if(r==0){return 1;}
	dp[n][r]=ncr(n-1,r)+ncr(n-1,r-1);
	return dp[n][r];
}
int main(void){
	double ue;
	llint wa=0;
	llint N,A,B,i,j,ans,chose,q,w,e,r,t;
	vector<llint> V;
	
	scanf("%lld %lld %lld",&N,&A,&B);
	for(i=0;i<N;i++){
		scanf("%lld",&j);
		V.pb(j);
	}
	sort(V.begin(),V.end());//10 10 10 20
	q=V[N-A];//A個選んだ時の一番小さいもの
	for(i=0;i<A;i++){
		wa+=V[N-i-1];
	}
	ue=(double)(wa)/(double)(A);
	printf("%f\n",ue);
	if(q==V[N-1]){//たくさん選んで可
		w=0;e=0;//wこの中からe個
		for(i=0;i<N;i++){
			if(V[i]==q){ w++; }
		}
		for(i=N-A;i<N;i++){
			if(V[i]==q){ e++; }
		}
		r=A-e;ans=0;
		while(-1){
			ans+=ncr(w,e);
			if(w<=e){break;}
			if(r+e>=B){
				break;
			}
			e++;
		}
		printf("%lld\n",ans);
	} else{//A個しか選ばない
		w=0;e=0;//wこの中からe個
		for(i=0;i<N;i++){
			if(V[i]==q){ w++; }
		}
		for(i=N-A;i<N;i++){
			if(V[i]==q){ e++; }
		}
		printf("%lld\n",ncr(w,e));
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <random>
#include <ctime>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2")
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define pll pair<ll,ll>
#define ld double
#define pld pair<ld,ld>
#define pii pair<int,int>
#define sqr(a) ((a)*(a))
#define all(v) v.begin(),v.end()

using namespace std;
//using namespace __gnu_pbds;

const ll MOD = 998244353;
const ll INF = 1e18;
const ld E = 1e-12;
const ld PI=acos(-1);
mt19937_64 rnd(time(0));
ll p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD, md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;

//using ord_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

ll n, m, a[1000001];

ll binpow(ll h, ll r, ll md = MOD)
{
    ll l = 1;
    while (r)
    {
        if (r & 1) l *= h, l %= md;
        h *= h;
        h %= md;
        r /= 2;
    }
    return l;
}

ll gcd(ll x, ll y)
{
    if (x < y) swap(x, y);
    while (x && y)
    {
        x %= y;
        swap(x, y);
    }
    return x + y;
}

#define dies_from_cringe exit(0)

void solve()
{
    string s, d;
    cin >> s >> d;
    ll ans=0;
    for (int i = 0; i < s.size(); i++) 
        ans+=(s[i]!=d[i]);
    cout << ans << "\n";
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //freopen("capitals.in","r",stdin);
    //freopen("capitals.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

/*
1
3 3
10 1 2
5 1 1
*/



Measured memory_bytes: 3808