akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            var nk = Input3();
            var n = nk[0];
            var k = nk[1];
            var snack = new int[n];
            var ans = 0;

            for(int i = 0; i < k; i++)
            {
                var d = Input();
                var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                foreach(var aa in a)
                {
                    snack[aa - 1]++;
                }
            }
            for(int i = 0; i < n; i++)
            {
                if (snack[i] == 0) ans++;
            }
            
            Console.WriteLine(ans);



        }






    





        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
    }
}


Measured memory_bytes: 28668
#include <iostream>
using namespace std;
 
int main(){
    int k,r[32]={1,1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin >> k;
    cout << r[k-1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sgn(b) (((op>>(b))%2?1:-1)*n[3-b])
#define sgns(k) ((op>>(k))%2?"+":"-")
int main(){
  int n[4];
  string s;
  cin>>s;
  for(int i=0;i<4;++i)n[i]=s[i]-'0';
  for(int op=0;op<8;++op){
    if(sgn(2)+sgn(1)+sgn(0)==7-n[0]){
      for(int j=0;j<3;++j)cout<<n[j]<<sgns(2-j);
      cout<<n[3]<<"=7";
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
typedef unsigned long long ull;
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define testcases ll t;cin>>t;while(t--)
#define dec(x) greater<x>()

/*** Define Values ***/
#define mx 200005
#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 100005
const char nl = '\n';

#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))

/*** STLs ***/
typedef vector <ll> vll;
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll , ll> > vpll;

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtGreat(v) sort(all(v), greater<ll>())
inline bool cmp(pll a, pll b) { if (a.ff == b.ff)return a.ss < b.ss; return a.ff > b.ff; }

#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": "

/*** Functions
ll BigMod(ll base, ll pow, ll modvalue){ if (pow == 0) return 1;  ll ans = BigMod(base, pow / 2, modvalue);ll total = ((ans % modvalue) * (ans % modvalue)) % modvalue;  if(pow % 2 == 0) return total; else{ return (total * (base % modvalue) ) % modvalue; } }
ll InverseMod(ll base, ll pow) { if(pow == 0) return 1; ll ans = InverseMod(base, pow / 2); ans = (ans * ans) % mod; if(pow & 1){ return (ans * base) % mod; } else{ return ans; } }
bool checkprime(ll num) { if(num < 2) return false; for(ll i = 2; i * i <= num; i++){ if(num % i == 0) return false; } return true; }
ll EularPHI(ll num) { double ans = num; for(ll i = 2; i * i <= num; i++){ if(num % i == 0){ while (num % i == 0) { num /= i; } ans *= (1.0 - (1.0 / (double)i)); } } if(num > 1) ans *= (1.0 - (1.0 / (double)num)); return (ll)ans; }
ll sumofdigit(long ll n){ll sum=0;while(n){sum=sum+n%10;n=n/10;}return sum;}
ll countDigit(ll n) { if (n == 0) return 0; return 1 + countDigit(n / 10); }
ll countDigit(ll n) { return floor(log10(n) + 1); } //only positive
 ***/

template <class T> inline T gcd(T a, T b) {if (b == 0)return a; return gcd(b, a % b);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd<T>(a, b);}
template <class T> inline T power(T b, T p) {ll ans = 1; while (p--) ans *= b; return ans;}

void solve()
{	
	ll n, a, b ;
	cin >> n ;
	vll v, vc ;
	loop(i, 0, n) 
	{
		cin >> a >> b;
		v.pb(a + b) ;
		vc.pb(a - b) ;
	}
	sort(all(v)) ;
	sort(all(vc)) ;
	cout << max({v.back() - v[0], abs(vc.back() - vc[0]) } ) ;
}


int main()
{

#ifndef ONLINE_JUDGE
	freopen("C:/Users/91731/Documents/input.txt", "r", stdin);
	freopen("C:/Users/91731/Documents/output.txt", "w", stdout);
	freopen("C:/Users/91731/Documents/error.txt", "w", stderr);
#endif

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	solve();
}


Measured memory_bytes: 6676
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
#include<stack>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
int main(void)
{
    ll a,b,c,k;

    cin>>a>>b>>c>>k;
    ll ans =0;
   
   if(a>=k) ans = k;

   else if(a+b>=k) ans = a;

   else ans = a -(k-a-b);
   


   cout<<ans<<endl;

}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int par[100005],siz[100005];
int outdegree[100005];
vector<pair<int,int> > final;
void mergeset(int x,int y){
	if(siz[x]<siz[y])
		swap(x,y);
	siz[x]+=siz[y];
	siz[y]=0;
	par[y]=x;
}
int findpar(int x){
	if(par[x]==-1)
		return x;
    return par[x]=findpar(par[x]);
}
void dfs(vector<vector<int> >&v,int i,int parent){
	int j;
	for(j=0;j<v[i].size();j++){
		if(v[i][j]!=parent){
			dfs(v,v[i][j],i);
			if(outdegree[v[i][j]]%2==0){
				final.pb({i,v[i][j]});
				outdegree[i]++;
			}
			else{
				outdegree[v[i][j]]++;
				final.pb({v[i][j],i});
			}
		}
	}
}
int main(){
	int n,m,i,x,y;
	cin>>n>>m;
	vector<vector<int> > v(n+1);
	vector<pair<int,int> > edge;
	vector<pair<int,int> > chose;
	for(i=1;i<=n;i++){
        par[i]=-1;
        siz[i]=1;
	}
	for(i=0;i<m;i++){
		cin>>x>>y;
		edge.pb({x,y});
	}
	int used[m];
	memset(used,0,sizeof(used));
	for(i=0;i<m;i++){
		x=edge[i].first;
		y=edge[i].second;
		int xi=findpar(x);
		int yi=findpar(y);
		if(xi!=yi){
			chose.pb(edge[i]);
			used[i]++;
			mergeset(xi,yi);
		}
	}
	for(i=0;i<chose.size();i++){
		x=chose[i].first;
		y=chose[i].second;
		v[x].pb(y);
		v[y].pb(x);
	}
	memset(outdegree,0,sizeof(outdegree));
	for(i=0;i<m;i++){
		if(!used[i]){
			x=edge[i].first;
			y=edge[i].second;
			outdegree[x]++;
		}
	}
	dfs(v,1,-1);
	for(i=1;i<=n;i++){
		if(outdegree[i]%2)
			break;
	}
	if(i<=n){
		cout<<-1<<endl;
		return 0;
	}
	for(i=0;i<m;i++){
		if(!used[i]){
			cout<<edge[i].first<<" "<<edge[i].second<<endl;
		}
	}
	for(i=0;i<final.size();i++){
		cout<<final[i].first<<" "<<final[i].second<<endl;
	}
}


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    int ans = 0;
    for(int i = 0; i < n; ++i) cin >> p[i], ans += p[i];
    ans -= (*max_element(begin(p), end(p))) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <vector>
#include <climits>
using namespace std;

int main()
{
	int N;

	cin >> N;
	vector<int> h(N);
	for (auto& hi : h)
	{
		cin >> hi;
	}

	vector<int> dp(N);
	dp[1] = abs(h[1] - h[0]);
	for (auto i = 2; i < N; ++i)
	{
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]),
			dp[i - 2] + abs(h[i] - h[i - 2]));
	}

	cout << dp[N - 1] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

#define INF 1e+9
#define MAX_V 10

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d + V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while(!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;

        for(int i = 0; i < G[v].size(); ++i) {
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    string s;
    cin >> s;
    string ans;
    for(int i = 0; i < s.size(); i++)
        if(i % 2 == 0) ans += s[i];
    cout << ans;
    return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)

ll N, A[212345];

int main() {

	scanf("%lld", &N);
	rep(i, N) scanf("%lld", &A[i]);

	vector<ll> d;

	rep(i, N) d.push_back(A[i] - (i + 1));
	sort(d.begin(), d.end());

	ll a = 0, b = 0, c = 0;
	rep(i, N) {
		a += abs(A[i] - (d[max(0ll, N / 2 - 1)] + i + 1));
		b += abs(A[i] - (d[N / 2] + i + 1));
		c += abs(A[i] - (d[min(N - 1, N / 2 + 1)] + i + 1));
	}

	printf("%lld\n", min(min(a, b), c));

	return 0;
}


Measured memory_bytes: 3956
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

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

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
  string a,b;
  cin >> a >> b;
  a+=b;
  float temp = sqrt(atoi(a.c_str()));
  
  if(fmod(temp,1.0) != 0)
    cout << "No" <<endl; else cout << "Yes" <<endl;
}



int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(void) {
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = (S % 3600) / 60;
	s = (S % 3600) % 60;
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

Measured memory_bytes: 1164
import std.stdio;
import std.string;
import std.conv;

void main() {
    string ans = "UNRESTORABLE";
    string s = readln.chomp;
    string t = readln.chomp;

    if (t.length <= s.length) {
        char[] t_ans;
        foreach_reverse (i; 0..s.length - t.length + 1) {
            bool flag = true;
            t_ans = s.dup;
            foreach_reverse (j; 0..t.length) {
                if (s[i + j] != t[j] && s[i + j] != '?'){
                    flag =  false;
                    break;
                } else {
                    t_ans[i + j] = t[j];
                }
            }
            if (flag) {
                ans = t_ans.to!string.tr("?", "a");
                break;
            }
        }
    }
    writeln(ans);
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100005

struct Node
{

  int p;
  int l,r;
  
};

struct Node T[MAX];

void print();
int rec();

int n,A[MAX];


int main()
{
  int i,j;
  int a,b,c,l,r;

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

    T[i].p = -1;
    T[i].l = -1; 
    T[i].r = -1;
    
  }
  
  for(i=0;i<n;i++){

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

    for( j = 0 ; j < b ; j++){

      scanf("%d",&c);

      if(j == 0)T[a].l=c;      
      else T[l].r=c;
      
      l = c;
      T[c].p = a;
      
    }
  }
  
  for(i = 0;i < n; i++){
    if(T[i].p == -1) r = i;
  }
  
  rec(r,0);

  for(i=0;i<n;i++)
    print(i);
  
  return 0;
}

int rec(int x,int y){
  
  A[x] = y;
  if(T[x].r!=-1)rec(T[x].r,y);
  if(T[x].l!=-1)rec(T[x].l,y+1);
  
}
 
void print(int a){

  int i,u;

  printf("node %d:",a);
  printf(" parent = %d,",T[a].p);
  printf(" depth = %d,",A[a]);
  
  if(T[a].p == -1){
    printf(" root, ");
  }
  else if(T[a].l == -1){
    printf(" leaf, ");
  }
  else printf(" internal node, ");
  printf("[");
  
  for(i = 0,u =T[a].l; u != -1; i++,u = T[u].r){
    
    if(i)printf(", ");
    printf("%d",u);
    
  }

  printf("]");

  printf("\n");
}

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

int main(void){
    int N;
    long long Abuf;
    long long res = 1LL;
    bool overe18 = false;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> Abuf;
        if(Abuf > 0){
            if(!overe18){
                if(1000000000000000000LL/Abuf < res){
                    overe18 = true;
                }else{
                    res *= Abuf;
                }
            }
        }else{
            overe18 = false;
            res = 0;
        }
    }
    if(overe18){
        cout << -1 << endl;
    }else{
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
for i in range(1, 6):
    if s == 'hi'*i:
        print('Yes')
        exit()
print('No')












Measured memory_bytes: 27004
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var NM=arr.shift().split(" ").map(Number);
var N=NM[0];
var M=NM[1];
var player=[];
for(var i=0;i<N;i++)player[i]=[];
while(true){
   var ste=arr.shift().split(" ").map(Number);
   if(ste.join(" ")=="0 0 0")break;
   var s=ste.shift()-1;
   player[s].push(ste);
}
var L=arr.shift()-0;
for(var i=0;i<L;i++){
   var ans=[];
   var ary=arr.shift().split(" ").map(Number);
   player.forEach(function(v){
      var sum=0;
      v.forEach(function(value){
         sum+=ary[value[0]-1]*value[1];
      });
      ans.push(sum);
   });
   console.log(ans.join(" "));
}

Measured memory_bytes: 63912
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
	int a, b;
	while(1){
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		int date[13][32];
		for(int i = 0;i < 13;i++){
			for(int j = 0;j < 32;j++){
				date[i][j] = 9;
			}
		}
		int count = 0;
		for(int i = 1;i < 13;i++){
			if(i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12){
				for(int j = 1;j < 32;j++){
					date[i][j] = count;
					count++;
					if(count == 7) count = 0;
					//cout << date[i][j];
				}
				//cout << endl;
			}
			else if(i == 4 || i == 6 || i == 9 || i == 11){
				for(int j = 1;j < 31;j++){
					date[i][j] = count;
					count++;
					if(count == 7) count = 0;
				}
			}
			else if(i == 2){
				for(int j = 1;j < 30;j++){
					date[i][j] = count;
					count++;
					if(count == 7) count = 0;
				}
			}

		}

		if(date[a][b] == 0) cout << "Thursday" << endl;
		if(date[a][b] == 1) cout << "Friday" << endl;
		if(date[a][b] == 2) cout << "Saturday" << endl;
		if(date[a][b] == 3) cout << "Sunday" << endl;
		if(date[a][b] == 4) cout << "Monday" << endl;
		if(date[a][b] == 5) cout << "Tuesday" << endl;
		if(date[a][b] == 6) cout << "Wednesday" << endl;

	}
	return 0;
}

Measured memory_bytes: 1156
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break

    sharp = True
    for i in range(h):
        #奇数行の場合先頭を"#"にする
        if i % 2 != 0:
            sharp = False
        else:
            sharp = True

        #行の出力
        for _ in range(w):
            if (sharp):
                print("#", end="")
                sharp = False
            else:
                print(".", end="")
                sharp = True
        print()
    print()



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

int main()
{
	int array[4] = { 0, 0, 0, 0 };

	int N;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		string tmp;
		cin >> tmp;
		if (tmp == "AC")
		{
			array[0]++;
		}
		else if (tmp == "WA")
		{
			array[1]++;
		}
		else if (tmp == "TLE")
		{
			array[2]++;
		}
		else
		{
			array[3]++;
		}
	}

	cout << "AC x " << array[0] << endl;
	cout << "WA x " << array[1] << endl;
	cout << "TLE x " << array[2] << endl;
	cout << "RE x " << array[3] << endl;

	return 0;
}

Measured memory_bytes: 3612
from collections import Counter
N = int(input())
A = sorted(list(map(int,input().split())))
Ac = Counter(A)
if N%2 == 1:
    if A == [0]+sorted([2*i for i in range(1,N//2+1)]*2):
        flag = True
    else:
        flag = False
else:
    if A == sorted([1+2*i for i in range(N//2)]*2):
        flag = True
    else:
        flag = False
if flag:
    print((2**(N//2)%(10**9+7)))
else:
    print(0)

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

int main()
{
    int n, m;

    cin >> n;                                       //数列a

    int a[n];

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

    cin >> m;                                       //数列b

    int b[m];

    for( int i = 0; i < m; i++ )
        cin >> b[i];

    int i = 0, j = 0;                               //値が小さいほうのindexを増やしていく
    int judge = 2;                                  //aの方が小さいなら1、bの方が小さいなら0
    while( i != n && j != m )                       //while文を抜けたときに、i==n or j==mとなるので、大小が判明する。
    {
        if( a[i] < b[j] )
        {
            judge = 1;
            break;
        }
        else if( a[i] > b[j] )
        {
            judge = 0;
            break;
        }
        else
        {
            i++;
            j++;
        }
    }

    if( judge == 0 )
        cout << 0 << endl;
    else if ( judge == 1 )
        cout << 1 << endl;
    else                                            //比べた数がすべて同じ
    {
        if( i == n && j == m )                      //i,j同時に出てきたら、bの方が大きいとは言えないので0
            cout << 0 << endl;
        else if( i == n )                           //iが先に出てきたら、bの方が大きいので1
            cout << 1 << endl;
        else                                        //jが先に出てきたら、aの方が大きいので0
            cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 3076
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    a,b = map(int, input().split())
    x1 = ceil(a*12.5)
    x2 = ceil((a+1)*12.5) - 1
    y1 = b*10
    y2 = (b+1)*10 - 1
    if x2<y1 or y2<x1:
        print(-1)
    elif x1>=y1:
        print(x1)
    else:
        print(y1)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main() {
  string S; cin >> S;
  int flag = 0;
  if (S[0] == 'A') flag++;
  int Cnum = 0;
  for (int i = 2; i < S.size() - 1; i++) if (S[i] == 'C') Cnum++;
  if (Cnum == 1) flag++;
  int low = 0;
  for (int i = 0; i < S.size(); i++) if (islower(S[i])) low++;
  if (low == S.size() - 2) flag++;
  if (flag == 3) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long;

const int INF = 1e9;
const long long  LLINF = 1e15;

using namespace std;

typedef string::const_iterator State;

int number(State &);
int factor(State &);
int term(State &);
int expression(State &);

// ??°??????????????????????????????????????°????????????
int number(State &begin) {
  int ret = 0;
  while (isdigit(*begin)) {
    ret *= 10;
    ret += *begin - '0';
    begin++;
  }
  return ret;
}

// ??¬??§?????°???????????????????????????????????????????????????
int factor(State &begin) {
    if (*begin == '(') {
        begin++; // '('????£???°??????
        int ret = expression(begin);
        begin++; // ')'????£???°??????
        return ret;
    } else {
        return number(begin);
    }
    //??¨????????????
    return -INF;
}

// ?????????????????????????????????????????????????????????????????????
int term(State &begin) {
  int ret = factor(begin);
  for (;;) {
    if (*begin == '*') {
        begin++;
        ret *= factor(begin);
    } else if (*begin == '/') {
        begin++;
        ret /= factor(begin);
    } else {
        break;
    }
  }
  return ret;
}

// ?????????????????????????????????????????????????????????????????????
int expression(State &begin) {
  int ret = term(begin);
  for (;;) {
    if (*begin == '+') {
        begin++;
        ret += term(begin);
    } else if (*begin == '-') {
        begin++;
        ret -= term(begin);
    } else {
        break;
    }
  }
  return ret;
}


int main() {
  int N;
  cin>>N;
  REP(i,0,N){
    string S;
    cin>>S;
    State state = S.begin();
    cout<<expression(state)<<endl;
  }
  return 0;
}

Measured memory_bytes: 3052
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
const int mod = 1e9 + 7;
int main()
{
	int n, m;
	int i, j;
	int x, y;
	int a[110];
	memset(a, 0, sizeof(a));
	scanf("%d %d", &n, &m);
	for(i = 1; i <= m; i++)
	{
		scanf("%d %d", &x, &y);
		a[x]++;
		a[y]++;
	}
	for(i = 1; i <= n; i++)
		printf("%d\n", a[i]);

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(ll i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

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

  ll n, m; cin >> n >> m;
  ll x[100100], y[100100], a[100100], b[100100];
  rep(i, n) cin >> x[i];
  rep(i, m) cin >> y[i];
  rep(i, n - 1) a[i] = x[i + 1] - x[i];
  rep(i, m - 1) b[i] = y[i + 1] - y[i];

  ll d[100100], h[100100];
  rep(i, n - 1) {
      d[i] = (i + 1) * (n - 1 - i);
      d[i] %= mod;
  }
  rep(i, m - 1) {
      h[i] = (i + 1) * (m - 1 - i) ;
      h[i] %= mod;
  }

  ll A = 0, B = 0;
  rep(i, n - 1) {
    // cout << a[i] << " " << d[i] << endl;;
      A += a[i] * d[i];
      A %= mod;
  }
  rep(i, m - 1) {
    // cout << b[i] << " " << h[i] << endl;
      B += b[i] * h[i];
      B %= mod;
  }
  cout << (A * B) % mod << endl;

  return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull B=5575777;
int K;
 
int n,m;
char a[5000];
char b[5000];
ull po[5000];

int main(){
  po[0]=1;
  for(int i=1;i<5000;i++)po[i]=po[i-1]*B;
   
  scanf("%s %s",a,b);
  n=strlen(a);
  m=strlen(b);
 
  int ans=0;
  for(int K=1;K<=min(n,m);K++){

    set< ull > st;
    ull key,d;
     
    key=0,d=1;
    for(int i=0;i<n;i++){
      key+= po[ (int)a[i] ];
      if(i-K>=0){
        key-= po[ (int)a[i-K] ];
      }else d*=B;
      if(i>=K-1)st.insert(key);
    }
     
    key=0,d=1;
    for(int i=0;i<m;i++){
      key+= po[ (int)b[i] ];
      if(i-K>=0){
        key-= po[ (int)b[i-K] ];
      }else d*=B;
      
      if(i>=K-1)
        if( st.count(key)>0 )
          ans=K;
    }
     
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	string S;
	cin >> S;
	
	int kotae = 0;

	char mae = S[0];
	rep1(i, S.size() - 1) {
		if (mae != S[i]) kotae++;
		mae = S[i];
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 512
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, A = MAP()
print(0 if X <A else 10)

Measured memory_bytes: 5328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

struct UnionFind{
    vector<int> branch;
    UnionFind(int N = 0) : branch(N,-1){}

    int find(int x){
        if(branch[x] < 0) return x;
        else return branch[x] = find(branch[x]);//メモ化、要素を入れて根が返ってくる
    }

    bool unite(int x, int y){
        int rx,ry;
        rx = find(x);
        ry = find(y);
        if(rx == ry) return false;//連結できたかどうか
        if(-branch[rx] < -branch[ry]) swap(rx,ry);
        branch[rx] += branch[ry];//木のサイズを負の値で管理
        branch[ry] = rx;
        return true;
    }

    bool same(int x, int y){
        if(find(x) == find(y)) return true;
        else return false;
    }

    int size(int x){
        return -branch[find(x)];
    }
};

int main(){

    int n,m;
    cin >> n >> m;

    UnionFind tree(n);

    for(int i = 0; i < m; i++){
        int a,b;
        cin >> a >> b;
        tree.unite(a,b);
    }

    int ans = 0;

    for(int i = 0; i < n; i++){
        ans = max(ans,tree.size(i));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4040
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647;
const long long int llINF = 9223372036854775807;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
  multi(ll first, ll second, ll third)
      : first(first), second(second), third(third) {}
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll A, B;
  cin >> A >> B;
  if (A >= 13)
    cout << B << endl;
  else if (A >= 6)
    cout << B / 2 << endl;
  else
    cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define me(a,b) memset(a,b,sizeof(a))
using namespace std;
/*int n,m;
int vis[250][250];
char mp[250][250];
int fx[4][2]={0,1,0,-1,1,0,-1,0};
int yx,yy,mx,my,sum;
struct pointb
{
    int x,y,leny,lenm,step;
}ed[250*250];
queue<point>q;
void(int pi,int pj,int f)
{
    while(q.size())   q.pop();
    point now,kai,next;

}
int main()
{
    while(scanf("%d %d",&n,&m)!=EOF)
    {
        sum=0;
        me(ed,0);
        for(int i=0;i<n;i++)
        {
            scanf("%s",mp[i]);
            for(int j=0;j<m;j++)
            {
                if(mp[i][j]=='@')
                {
                    ed[sum].x=i;
                    ed[sum++].y=j;
                }
                else if(mp[i][j]=='Y')
                {
                    yx=i;
                    yy=j;
                }
                else if(mp[i][j]=='M')
                {
                    mx=i;
                    my=j;
                }
            }
        }
        bfs(yx,yy,0);
        bfs(mx,my,1);
        int mi=0x3f3f3f3f;
        for(int i=0;i<sum;i++)
        {
            ed[i].leny=0x3f3f3f3f;
            ed[i].lenm=0x3f3f3f3f;
        }
        for(int i=0;i<sum;i++)
        {
            mi=min(ed[i].leny+ed[i].lenm,mi);
        }
        printf("%d\n",mi);
    }
    return 0;
}

int main()
{
    int a,b,t;
    while(scanf("%d %d %d",&a,&b,&t)!=EOF)
    {
        int sum=0;
        for(int i=1;i*a<=t;i++)
        {
            sum+=b;
        }
        printf("%d\n",sum);
    }
}
#include <stdio.h>
 long long zxgbs(long long x,long long y)
 {
     int i;
    for(i=1;x*i%y;i++);
        return x*i;
  }
 int main()
 {
     int i,j,n,flag=0,max;
     long long a[1000],sum,temp;
     while(scanf("%d",&n)!=EOF)
     {
         for(i=0;i<n;i++)
         scanf("%lld",&a[i]);
         for(i=0;i<n;i++)
         {
             max=i;
             for(j=i+1;j<n;j++)
                 if(a[max]<a[j])
                     max=j;
                    temp=a[i];
                 a[i]=a[max];
                 a[max]=temp;
         }
         sum=a[0];
         for(i=1;i<n;i++)
         {
             sum=zxgbs(sum,a[i]);
             for(j=i+1;j<n;j++)
             {
                 if(sum%a[j])
                 {
                      flag=0;
                      break;
                 }
                 else
                    flag=1;
             }
             if(flag==1)
             {
                 flag=0;
                 break;
              }
         }
         printf("%lld\n",sum);
     }
     return 0;
 }*/
 int main()
 {
     int n;
     int a[3005];
     scanf("%d",&n);
     long long sum=0;
     for(int i=0;i<n;i++)
     {
        scanf("%d",&a[i]);
        sum+=a[i]-1;
     }
     printf("%lld\n",sum);
     return 0;
 }








Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  int r;
  cin >> r;
  cout << 3 * r*r << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector <int> vi;
typedef long double LD;
typedef pair <int,int> pii;
typedef pair <int,LL> piL;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=105*2;
int n;
vector <int> e[N];
piL ans;
void check(piL &a,piL b){
	if (a.fi>b.fi)
		a=b;
	else if (a.fi==b.fi&&a.se>b.se)
		a=b;
}
namespace A{
	int n;
	int dis[N];
	int findfar(int x,int pre=0,int d=0){
		dis[x]=d;
		int ans=x;
		for (auto y : e[x])
			if (y!=pre){
				int now=findfar(y,x,d+1);
				if (dis[now]>dis[ans])
					ans=now;
			}
		return ans;
	}
	int depth[N],fa[N];
	void dfs(int x,int pre=0,int d=0){
		depth[x]=d,fa[x]=pre;
		for (auto y : e[x])
			if (y!=pre)
				dfs(y,x,d+1);
	}
	int mx[N];
	void sv(int x,int pre,int d){
		int cnt=0;
		for (auto y : e[x])
			if (y!=pre){
				sv(y,x,d+1);
				cnt++;
			}
		mx[d]=max(mx[d],cnt);
	}
	piL solve(){
		int a=findfar(1);
		int b=findfar(a);
		dfs(a);
		int m=b;
		For(i,1,depth[b]/2)
			m=fa[m];
		clr(mx);
		LL ans=1;
		if (depth[b]&1){
			int x=m,y=fa[m];
			sv(x,y,0),sv(y,x,0);
			ans*=2;
		}
		else {
			int x=m;
			sv(x,0,0);
		}
		For(i,0,n)
			if (mx[i])
				ans*=mx[i];
		return mp(depth[b]/2+1,ans);
	}
}
int main(){
	n=read();
	For(i,1,n-1){
		int x=read(),y=read();
		e[x].pb(y),e[y].pb(x);
	}
	A::n=n;
	ans=A::solve();
	For(i,1,n){
		For(j,1,n){
			A::n=n+j;
			int p=j==1?i:n+j-1;
			e[p].pb(n+j),e[n+j].pb(p);
			check(ans,A::solve());
		}
		Fod(j,n,1){
			int p=j==1?i:n+j-1;
			e[p].pop_back();
			e[n+j].pop_back();
		}
	}
	cout<<ans.fi<<" "<<ans.se<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1e9;
#define put(n) cout<<(n)<<endl
#define rep(i,N) for(int(i)=0;(i)<(N);++(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define pb(n) push_back(n)


int main(){
    string S;
    cin >> S;
    long long ans = 0;
    long long cnt = 0;
    for(int i=0;i<S.size();++i){
        if(S[i] == 'B') ++cnt;
        if(S[i] == 'W') ans += cnt;
    }

    cout << ans << endl;
}


Measured memory_bytes: 640
# https://atcoder.jp/contests/abc140/tasks/abc140_d

n, k = map(int, input().split())
str_n = input()
first = str_n[0]
last = ""
if first == "R":
    last = "L"
else:
    last = "R"

for count in range(k): 
    new_line = str_n
    next_last = new_line.find(last)
    next_first = new_line.find(first, next_last)
    next_line = new_line[0:next_last]
    if next_first != -1:
        next_line += new_line[next_last:next_first].replace(last, first) + new_line[next_first:]
    else:
        next_line += new_line[next_last:].replace(last, first)
    str_n = next_line

count = 0
result_line = str_n
for i in range(len(str_n) - 1):
    if result_line[i] == result_line[i + 1]:
        count += 1

print(count)

Measured memory_bytes: 3512
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
typedef long long  L;

#define max_(x, y) (((x) > (y)) ? (x) : (y))
#define min_(x, y) (((x) < (y)) ? (x) : (y))
#define ___ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Mx 2000001
#define inf 1e15
const L MOD = 1e9+7;
const double pi = 2 * acos (0.0);

/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/


//typedef tree<L,null_type,less<L>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

L a,b,a1,a2,a3,b1,b2,b3,c,c1,c2,c3,d,d1,d2,d3,d4,d5,e1,e2,e3,f,h,k,l,n,m1,m2,n1,n2,o,p,p1,p2,p3,p4,
q,q1,q2,q3,q4,r,s,t,u,v,x,y,z,sum,mx=-inf,mn=inf,flg,flg1,flg2,id1,id2,id3,cnt,lim;
double cal_cos(double n) 
{
    double accuracy = 0.000000000000001, x1, denominator, cosx, cosval; 
    n = n * (pi / 180.0);
    x1 = 1.0;
    cosx = x1;
    cosval = cos(n); 
    L i = 1; 
    do { 
        denominator = 2 * i * (2 * i - 1); 
        x1 = -x1 * n * n / denominator; 
        cosx = cosx + x1; 
        i = i + 1; 
    } while (accuracy <= fabs(cosval - cosx));
    return cosx; 
}
double calcAngle(double h, double m)  
{
    double hour_angle = 0.5 * (h * 60.0 + m);  
    double minute_angle = 6.0 * m; 
    double angle = fabs(hour_angle - minute_angle); 
    angle = min(360.0 - angle, angle);
    return angle;
}
int main()
{
    double aa1,bb1,hr,mnt,temp1,temp2;
    scanf("%lf%lf%lf%lf",&aa1,&bb1,&hr,&mnt);
    hr=calcAngle(hr,mnt);
    temp1=double(aa1*aa1 + bb1*bb1);
    temp2=double(aa1*bb1);
    double dd=sqrt( temp1 - 2.0*(temp2)*cal_cos(hr));
    printf("%.13f\n", dd);
    return 0;
}
/// empty() lld I64d push_back() top() pop() insert() upper_bound() lower_bound() memset() max() min() scanf continue


Measured memory_bytes: 4212
N = int(input())
bricks = [int(x) for x in input().split()]
count = 1
smash = 0
for x in bricks:
    if count == x: 
      count += 1
    else: 
      smash += 1
print(smash if smash != len(bricks) else 0 if len(bricks) == 1 else -1)

Measured memory_bytes: 25768
//People only find me interesting because they can't tell whether I'm serious or not
//#include <boost/multiprecision/cpp_int.hpp> 
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef long long int ll;
typedef double db;
typedef __int128 s128;
typedef __uint128_t u128;
typedef unsigned long long u64;
#define int long long int
#define P 998244353
#define Q 1000000006
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define bac(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define N 100005
#define PI 3.14159265359
#define inf LLONG_MAX
//using namespace boost::multiprecision; 
using namespace __gnu_pbds;
using namespace std;
ll powMod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
 
ll modInverse(ll n, ll p) 
{ 
    return powMod(n, p-2, p); 
}

void solve(){
    ll n,S,ans=0;
    cin>>n>>S;
    vl a(n+1);
    f(i,1,n+1) cin>>a[i];
    //vector<vector<bool>> isSum(n+1, vl(S+1,false));
    vvl dp(n+1, vl(S+1,0));
    f(i,0,n+1) dp[i][0] = powMod(2,n,P);
    f(i,1,n+1){
        f(s,1,S+1){
            ll p1=0,p2=0;
            p1 = dp[i-1][s];
            if(s>=a[i]) p2 = ((dp[i-1][s-a[i]])*(modInverse(2ll,P)))%P;
            dp[i][s] = (p1 + p2)%P;
        }
    }
    
    cout<<dp[n][S];

}
signed main() {
    teevra_gati
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    solve();

    return 0;
}

Measured memory_bytes: 73676
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define ll long long
//不要再爆long long了！！！！！！！！不要再爆long long了！！！！！！！ 

int main()
{
	string a,b;
	cin>>a>>b;
	int ans=0;
	for(int i=0;i<strlen(a.c_str());i++)
	{
		if(a[i]!=b[i])ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3892
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    long long int X, Y;
    cin >> X >> Y;
    
    if(X<Y) {
        if(X*Y>=0) {
            cout << abs(abs(X)-abs(Y)) << endl;
        } else {
            cout << abs(abs(X)-abs(Y))+1 << endl;
        }
    } else {
        if(X*Y>0) {
            cout << abs(abs(X)-abs(Y))+2 << endl;
        } else {
            cout << abs(abs(X)-abs(Y))+1 << endl;
        }
    }


    return 0;
    
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if x == y:
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]


N, M = na()
p = na()
count = 0
uf = UnionFind(N)

for i in range(M):
    x, y = na()
    x -= 1
    y -= 1
    uf.Unite(x, y)

for i in range(N):
    uf.Find_Root(i)

for i in range(N):
    if p[i] == i + 1:
        count += 1
    else:
        if uf.isSameGroup(p[i] - 1, p[p[i] - 1] - 1):
            count += 1
print(count)


Measured memory_bytes: 22180
#include <stdio.h>
#include <stdlib.h>
    long long int b[51], a[51];
    long long int e;

long long f(long long x, long long y)
{
    if (y <= x)
        return 0;
    if (y >= b[x] - 1)
        return a[x];
    if (y == b[x] / 2 + 1)
        return a[x] / 2 + 1;
    else if (y > b[x] / 2 + 1)
        return a[x] / 2 + 1 + f(x - 1, y - b[x] / 2 - 1);
    else
        return f(x - 1, y - 1);

}
int main()
{
    long long c, d;
    a[0]=1;
    b[0]=1;
    for(e = 1; e < 51; e++)
    {
        a[e] = (a[e-1] * 2) + 1;
        b[e] = (b[e-1] * 2) + 3;
    }


    while (scanf("%lld %lld", &c, &d) != EOF)
    {
        printf("%lld\n", f(c,d));
    }
    return 0;
}


Measured memory_bytes: 128