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

#define fr(i, a, b) for (long long i = a; i < b; ++i)
#define fr2(i, b, a) for (long long i = b; i >= a; --i)
#define pb push_back

#define set0(a) memset(a, 0, sizeof(a))
#define setneg(a) memset(a, -1, sizeof(a))
#define setinf(a) memset(a, 126, sizeof(a))
#define trace(a) cerr << #a << ": " << a << endl

#define PI acos(-1.0)

typedef vector<long long> vll;
typedef vector<pair<long long, long long>> vllp;
typedef pair<long long, long long> llp;
typedef long long int ll;
typedef unsigned long long ull;
ll N = 1000000007;

template <typename T>
void show(T *a, int size)
{
	int i;
	cout << endl
		 << "The array is ";
	fr(i, 0, size)
	{
		cout << a[i] << " ";
	}
	cout << endl;
}

template <typename T>
void show_vector(vector<T> v)
{
	cout << endl
		 << "The vector is ";
	int i;
	fr(i, 0, v.size())
	{
		cout << v[i] << " ";
	}
	cout << endl;
}

ll Npow(ll x, ll n, ll M = N)
{
	if (n == 0)
		return 1;
	else if (n % 2 == 0)
		return Npow((x * x) % M, n / 2, M);
	return (x * Npow((x * x) % M, (n - 1) / 2, M)) % M;
}
//GLOBAL
#define M 100005

ll add()
{
	return 0;
}
template <typename T, typename... Types>
T add(T var1, Types... var2)
{
	return ((((ll(var1)) % N + ll(add(var2...))) % N) + N) % N;
}

ll mul()
{
	return 1;
}
template <typename T, typename... Types>
T mul(T var1, Types... var2)
{
	return ((ll(var1)) % N * ll(mul(var2...))) % N;
}

vll adj[M];
ll dp[M], dp2[M];
ll n, m;
ll ans[M];
ll phi_;

ll phi(ll x)
{
	ll rv = x;
	for (ll i = 2; i * i <= x; i++)
	{
		if (x % i == 0)
		{
			while (x % i == 0)
			{
				x /= i;
			}
			rv -= (rv / i);
		}
	}
	if (x > 1)
	{
		rv -= rv / x;
	}
	return rv;
}

//FUNCTIONS
ll dfs(ll parent, ll child)
{
	ll rv = 1;
	fr(i, 0, adj[child].size())
	{
		if (adj[child][i] != parent)
		{
			rv = mul(dfs(child, adj[child][i]) + 1, rv);
		}
	}
	dp[child] = rv;
	return rv;
}
void dfs2(ll parent, ll child)
{
	ll product = 1;
	vll suffix;
	vll prefix;
	fr(i, 0, adj[child].size())
	{
		if (adj[child][i] != parent)
		{
			prefix.pb(product);
			product = mul(product, dp[adj[child][i]] + 1);
		}
		else
		{
			prefix.pb(product);
		}
	}

	product = 1;
	fr2(i, adj[child].size() - 1, 0)
	{
		if (adj[child][i] != parent)
		{
			suffix.pb(product);
			product = mul(product, dp[adj[child][i]] + 1);
		}
		else
		{
			suffix.pb(product);
		}
	}
	reverse(suffix.begin(), suffix.end());

	fr(i, 0, adj[child].size())
	{
		if (adj[child][i] != parent)
		{
			dp2[adj[child][i]] = mul(prefix[i], suffix[i]);
			dp2[adj[child][i]] = mul(dp2[adj[child][i]], (1 + dp2[child]));
			dfs2(child, adj[child][i]);
		}
	}
}

void dfs3(ll parent, ll child)
{
	fr(i, 0, adj[child].size())
	{
		if (adj[child][i] != parent)
		{
			dfs3(child, adj[child][i]);
		}
	}
	ans[child] = mul(dp[child], 1 + dp2[child]);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	ll x, y;
	fr(i, 0, n - 1)
	{
		cin >> x >> y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	N = m;
	phi_ = phi(N);
	dfs(1, 1);
	dp2[1] = 0;
	dfs2(1, 1);
	dfs3(1, 1);
	// show(dp + 1, 12);
	// show(dp2 + 1, 12);

	fr(i, 1, n + 1)
	{
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 24064
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
 
  int n, q; rd(n, q);
  auto tree=new SquareRootDecomposition(n);
  while(q--){
    auto args=readln.split.to!(int[]);
    if(args[0]==0){
      tree.update(args[1], args[2]+1, args[3]);
    }else{
      writeln(tree.rmin(args[1], args[2]+1));
    }
  }
}
 
class SquareRootDecomposition{
  import std.algorithm;
  int D=1, nil=-1;
  int[] val, buc, laz;
  this(int n){
    while(D*D<n) D++;
    val.length=D*D;
    buc.length=laz.length=D;
    fill(val, (1<<31)-1);
    fill(buc, (1<<31)-1);
    fill(laz, nil);
  }
 
  void update(int ql, int qr, int x){
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        buc[k]=x;
        laz[k]=x;
      }else{
        push(k);
        val[max(l, ql)..min(r, qr)]=x;
        buc[k]=reduce!(min)(val[l..r]); 
      }
    }
  }
 
  int rmin(int ql, int qr){
    int ret=(1<<31)-1;
    foreach(k; 0..D){
      int l=k*D, r=(k+1)*D;
      if(r<=ql || qr<=l){
        // 
      }else if(ql<=l && r<=qr){
        chmin(ret, buc[k]);
      }else{
        push(k);
        chmin(ret, reduce!(min)(val[max(l, ql)..min(r, qr)]));
      }
    }
    return ret;
  }
 
  void push(int k){
    if(laz[k]<0) return;
    val[(k*D)..((k+1)*D)]=laz[k];
    laz[k]=-1;
  }
 
  void chmin(T)(ref T l, T r){
    if(l>r) l=r;
  }
}
 
void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}


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

int floor(double t){
    return int(t);
}

int main(){
    double A, B, N;

    cin >> A >> B >> N;

    int maxValue = 0;
    double minx = min(B-1, N);

    // for(int i=1; i<N+1; i++){
    //     double id = (double)i;
    //     maxValue = max((double)maxValue, floor(A*id/B) - A * floor(id/B) );
    // }
    maxValue = floor(A*minx/B) - A * floor(minx/B);

    cout << (int)maxValue << endl;

    return 0;
}

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

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
 
typedef long long ll;
using namespace std;
 
int main() {
  string s,t;
	cin >> s >> t;

  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  
  if(s <t) printf("Yes\n");
  else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
T=[]
count=0
for i in range(K):
    d=int(input())
    A=list(map(int,input().split()))
    for j in range(d):
        if A[j] not in T:
            T.append(A[j])
for k in range(N):
    if k+1 not in T:
        count+=1
print(count)

Measured memory_bytes: 9188
#include <iostream>

using namespace std;

int main()
{
   string s;
   cin>>s;
   int i=0, x=0, y=0;



        if (s[0]!='A' || isupper(s[1])){
            cout<<"WA";
        }
        else {
            for(int i=2; i<s.size(); i++){
                if(s[i]=='C' && islower(s[s.size()-1])){
                    x++;
                }
                else if (islower(s[i])) {

                    y++;
                }

            }
            if (x==1 && y==s.size()-3){
                    cout<<"AC";
                }
            else {
                cout<<"WA";
            }

        }


    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MOD 1000000007

int n,k;
int a[2000];


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

	cin >> n >> k;
	rep(i, n)cin >> a[i];


	long long x = 0;
	rep(i,n) {
		rep(j,i) {
			if (a[j] > a[i]) {
				x++;
			}
		}
	}
	x *= k;
	x %= MOD;

	long long y = 0;
	rep(i, n) {
		rep(j, n) {
			if (a[j] < a[i]) {
				y++;
			}
		}
	}
	y *= (long long)(k - 1) * k / 2 % MOD;
	y %= MOD;



	cout << (x + y) % MOD << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n; cin >> n;
    string s;
    vector<int> ans(26, 50);
    for(int i = 0; i < n; i++) {
        cin >> s;
        vector<int> cur_vec(26, 0);
        for(char c: s)
            cur_vec[c-'a'] += 1;
        for(int i = 0; i < 26; i++)
            ans[i] = min(ans[i], cur_vec[i]);
    }
    for(int i = 0; i < 26; i++) {
        while(ans[i]--)
            cout << char('a'+i);
    }
    cout << endl;
    return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import *
def bf(n):
    variations = set()
    for comb in permutations(list(range(1,n+1))):
        top = sim(comb)
        if top not in variations:
            print(top, comb)
            variations.add(top)
        # if top != comb[ len(comb) // 2 ]:
        #     print("exception!")
        #     print("comb, result = ", comb, top)
    print(variations)

def sim(comb):
    comb = list(comb)
    while len(comb) != 1:
        n_comb = []
        for i in range(len(comb)-2):
            arr = comb[i:i+3]
            arr.sort()
            n_comb.append(arr[1])
        comb = n_comb
        # print(comb[0])
    return comb[0]

# bf(3)
# bf(5)
# bf(7)
# bf(9)
# bf(11)

def main():
    N,x = map(int,input().split())
    if N == 1:
        if x == 1:
            print('Yes')
            print(1)
        else:
            print('No')
    else:
        length = N * 2 - 1
        if 2 <= x <= length - 1:
            print('Yes')
            mid = (length + 1) // 2
            if x > mid:
                flip = True
                x = (length + 1 - x)
            else:
                flip = False

            ans = list(range(1,x-1)) + list(range(x+1,mid+1)) + list(range(x-1,x+1)) + list(range(mid+1,length+1))
            

            if flip:
                ans2 = [length + 1 - x for x in ans]
                ans = ans2
            for e in ans:
                print(e)
        else:
            print('No')

main()



Measured memory_bytes: 20532
import java.io.*;
import java.util.*;
import java.math.*;

class Main{

	public static void check_figure(ArrayList<String> list){
		String str="",chstr="";
		char ch;
		boolean check = false;
		int count = 0,fig;
		
		
		
		for(int i=0;i<8;i++){
			str = list.get(i);
			char[] strAry = str.toCharArray();
			
			for(int j=0;j<strAry.length;j++){
				ch = strAry[j];
				if(check == true)
					count++;
				if(ch=='1' && check == false)
					check = true;
				else if(ch=='1'){
					chstr += count;
				}
			}
		}
		
		fig = Integer.valueOf(chstr).intValue();
		
		switch(fig){
			case 189: System.out.println("A"); break;
			case 81624: System.out.println("B"); break;
			case 123: System.out.println("C"); break;
			case 7815: System.out.println("D"); break;
			case 1910: System.out.println("E"); break;
			case 8917: System.out.println("F"); break;
			default: System.out.println("G"); break;
		}
		
	}

	public static void print_figure(ArrayList<String> list){
		ArrayList <String> inp = new ArrayList<String>();
		
		for(int i=0;i<list.size()/8;i++){
			for(int j=0;j<8;j++){
				inp.add(list.get(i*8+j));
			}
			check_figure(inp);
			inp.clear();
		}
		
	}
		
	public static void main(String args[]) throws IOException{
		String str;
		ArrayList <String> inp = new ArrayList<String>();

		Scanner scan = new Scanner(System.in);

		while(scan.hasNext()){
			str = scan.next();
			inp.add(str);
		}
		print_figure(inp);
	}
}

Measured memory_bytes: 12000
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M=1000000007;
const ll MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(a<=0)return 0;
  a%=m;
  if(!b)return 1;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e5+5;



int main()
{ 

IOS;


ll n;cin>>n;



string s;cin>>s;


vvl vf(n,vl(10));

vvl vb(n,vl(10));

vf[0][s[0]-'0']++;

for(int i=1;i<n;i++){
  for(int j=0;j<10;j++){
    vf[i][j]=vf[i-1][j];
  }
  ll dig=s[i]-'0';
vf[i][dig]++;
}

vb[n-1][s[n-1]-'0']++;

for(int i=n-2;i>=0;i--){
  for(int j=0;j<10;j++){
    vb[i][j]=vb[i+1][j];
  }
  vb[i][s[i]-'0']++;
}

set<pair<ll,pll>>se;

FOR(i,10)
FOR(k,10){
  for(int p=1;p<n-1;p++){
    ll dig=s[p]-'0';
    if(vf[p-1][i]&&vb[p+1][k]){
      se.insert({i,{dig,k}});
    }
  }
}

cout<<se.size();


//end_routine();

return 0;
 
}


Measured memory_bytes: 10384
import java.io.*;
import java.util.*;

@SuppressWarnings("unchecked")
public class Main {
    private static final long MOD = (int)1e9 + 7;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];

        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        for (int i = 0; i < n; ++i) {
            b[n - i - 1] = in.nextInt();
        }

        int x = -1;
        int maxI = Integer.MIN_VALUE;
        int minI = Integer.MAX_VALUE;

        for (int i = 0; i < n; ++i) {
            if (a[i] == b[i]) {
                minI = Math.min(minI, i);
                maxI = Math.max(maxI, i);
                x = a[i];
            }
        }

        int i = 0;
        int idx = minI;
        while (i < n) {
            if (idx >= minI && idx <= maxI && a[i] != x && b[i] != x && minI <= maxI) {
                int temp = b[i];
                b[i] = x;
                b[idx++] = temp;
            }
            ++i;
        }
        
        for (i = 0; i < n; ++i) {
            if (a[i] == b[i]) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
        for (i = 0; i < n; ++i) {
            System.out.print(b[i] + " ");
        }
    }
}

Measured memory_bytes: 52916
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  int n;
  cin >> n;
  vector<vint> red(n,vint(n));
  vector<vint> blue(n,vint(n));
  int count = 0;
  rep(i,n) cin >> red[i][1] >> red[i][0];
  rep(i,n) cin >> blue[i][0] >> blue[i][1];
  sort(red.begin(),red.end());
  sort(blue.begin(),blue.end());
  reverse(red.begin(),red.end());
  rep(i,n){
    bool key = false;
    rep(j,n){
      if(0 < blue[i][0] && 0 < blue[i][1]){
        if(red[j][1] < blue[i][0] && red[j][0] < blue[i][1]){
          red[j][0] = INF;
          red[j][1] = INF;
          count++;
          key = true;
          break;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define LD long double
const LL MOD=1e9+7;
#define vL vector<LL>

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    LL n;
    cin>>n;
    vL a(n);
    for(LL i=0;i<n;i++){
        cin>>a[i];
    }
    vL prefix(n);
    prefix[0]=a[0];
    for(LL i=1;i<n;i++){
        prefix[i]=a[i]+prefix[i-1];
    }
    LL mx=10000000000;
    for(LL i=0;i<n;i++){
        LL s1,s2;
        if(i==n-1){
            s1=prefix[i];
            s2=0;
        }
        else{
            s1=prefix[i];
            s2=prefix[n-1]-prefix[i];
        }
        LL d=abs(s1-s2);
        mx=min(mx,d);
    }
    cout<<mx;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const ll  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

/*vll adj[MAXN];ll visit[MAXN]={};
ll dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, y, m, k, d, w, summ;
string s, t;
//vll a,b;
// <------------- Implement Functions Here ----------> //
map<string,ll> cou;

// <------------- Start of main() -------------------> //

void MAIN(ll _) {
	cin >> n;
	while(n--) {
		cin>>s;
		cou[s]++;
	}
	cin >> n;
	while(n--) {
		cin>>s;
		cou[s]--;
	}
	ll maxi = 0;
	for(auto it : cou) maxi = max(maxi,it.s);
	cout<<maxi;
}

int main() {
	fastio; randomINT;
	//freopen("out_hc.txt","w+",stdout);
	//cin >> T;
	for (ll i = 1; i <= T; i++) {
		MAIN(i);
	}
	return 0;
}



Measured memory_bytes: 3616
S = input()

if S[0]=="R" and S[1]=="R" and S[2]=="R":
	print(3)
elif S[0]=="R" and S[1]=="R":
	print(2)
elif S[1]=="R" and S[2]=="R":
	print(2)
elif S[0]=="R" or S[1]=="R" or S[2] =="R":
	print(1)
else:
	print(0)

Measured memory_bytes: 8932
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return a;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }

int main() {
  char c; cin >>c;
  c += 1;
  cout <<c <<endl;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i+100*j+50*k:
                count += 1

print(count)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define loop(i) for(int i = 0;true; i++)
#define all(x) (x).begin(), (x).end()
#define mn 1000000007
int main() {
	int N;
	cin >> N;
	vvi A(N,vi(N,0));
	for (int i = 0; i < N; i++)
	{
		int u,k;
		cin >> u;
		cin >> k;
		u--;
		for (int j = 0; j < k; j++)
		{
			int temp;
			cin >> temp;
			temp--;
			A[u][temp] = 1;
		}
	}
	rep(i, 0, N) {
		rep(j,0,N) {
			if (j != 0) {
				cout << " ";
			}
			cout << A[i][j];
		}
		cout << endl;
	}
};




Measured memory_bytes: 3168
lst = [int(a) for a in input()]
for bit in range(1 << len(lst)):
    sum = 0
    op_lst = []
    for i in range(len(lst)):
        if bit & (1 << i):
            sum += lst[i]
            op_lst.append('+')
        else:
            sum -= lst[i]
            op_lst.append('-')
    if sum == 7:
        print(lst[0], op_lst[1], lst[1], op_lst[2], lst[2], op_lst[3], lst[3], '=7', sep='')
        break

Measured memory_bytes: 9208
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;

    auto st = s.begin() + (k-1);
    auto en = st + 1;
    transform(st, en, st, ::tolower);
    cout << s;
    return 0;
}


Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())
i0, j0 = map(lambda x: int(x) - 1, input().split())
i1, j1 = map(lambda x: int(x) - 1, input().split())
S = [input() for i in range(h)]
D = [[-1] * w for i in range(h)]
Q = deque([(i0, j0, 0)])
while Q:
    i, j, cnt = Q.popleft()
    if D[i][j] != -1:
        continue
    D[i][j] = cnt
    for di in range(-2, 3):
        for dj in range(-2, 3):
            if 0 <= i + di < h and 0 <= j + \
                    dj < w and S[i + di][j + dj] == "." and D[i + di][j + dj] == -1:
                if abs(di) + abs(dj) == 1:
                    Q.appendleft((i + di, j + dj, cnt))
                else:
                    Q.append((i + di, j + dj, cnt + 1))
print(D[i1][j1])


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

#ifdef LOCAL
#include "../debug.h"
#else
#define debug(x...) 141
#endif
#define forn(i,x,n) for(int i = x; i < n; ++i)
#define forit(it, m) for(auto it = m.begin(); it!=m.end(); ++it)
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,x,aa;

    {
        cin>>x>>n;
        set<int> s;
        forn(i,0,n){
        	cin>>aa;
        	s.insert(aa);
        }
        int i=1;
        if(s.count(x)==0){
        	cout<<x;
        	return 0;
        }
        while(true){
        	if(s.count(x-i)==0){
        		cout<<x-i;
        		return 0;
        	}
        	if(s.count(x+i)==0){
        		cout<<x+i;
        		return 0;
        	}
        	i++;
        }
    }
    return 0;
}

Measured memory_bytes: 3668
import java.util.Scanner;

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

          int x[] = new int[26];
          String str2 = "abcdefghijklmnopqrstuvwxyz";

          while(scan.hasNext()){
             String str = scan.nextLine();

                for(int i =0;i< str.length();i++){

                   int c=str.charAt(i);

                   if('A'<=c&&c<='Z'){
                      c-='A'-'a';
                   }

                   for(int h='a';h<='z';h++){

                      if(h==c){
                         x[h-'a']++;
                      }
                   }
                }
          }

          for(int j=0;j<26;j++){

             String str3 = str2.substring(j,j+1);
             System.out.println(str3+" "+":"+" "+x[j]);

          }

      }
   }


Measured memory_bytes: 26356
use io::*;

fn main() {
    let input = read_string();
    let mut sc = Scanner::new(&input);
    let n: usize = sc.next();
    let mut av: Vec<usize> = sc.next_vec(n);
    av.sort_by(|x,y| y.cmp(x));
    let mut h = 0;
    let mut w = 0;
    let mut prev = 0;
    for a in av {
        if a == prev {
            if h == 0 {
                h = prev;
                prev = 0;
            } else if w == 0 {
                w = prev;
                break;
            }
        } else {
            prev = a;
        }
    }
    println!("{}",h * w);
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }

        pub fn next_mat<T: FromStr>(&mut self, w: usize, h: usize) -> Vec<Vec<T>> {
            (0..h).map(|_| self.next_vec(w)).collect()
        }

        pub fn next_vec_char(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }

        pub fn next_mat_char(&mut self, n: usize) -> Vec<Vec<char>> {
            (0..n).map(|_| self.next_vec_char()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 6396
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for (int i=0; i<n; i++) cin >> l[i];

    sort(l.begin(), l.end());
    reverse(l.begin(), l.end());
    
    int ans = 0;
    for (int i=0; i<k; i++)
    {
        ans += l[i];
    }

    cout << ans << endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	int a[1000] = {};
	for(int i = 0; i < 3;i++){
		int b;
		cin >> b;
		a[b]++;
	}
	int cnt = 0;
	for (int i = 0; i < 1000; i++) {
		if (a[i] != 0) cnt++;
	}
	dump(cnt)
}

Measured memory_bytes: 256
import scala.io.StdIn._
import scala.math._

object Main extends App with StdInHelper {
  val Array(x1, x2, x3, x4, x5) = readInts
  if (x1 == 0) println(1)
  if (x2 == 0) println(2)
  if (x3 == 0) println(3)
  if (x4 == 0) println(4)
  if (x5 == 0) println(5)
}

trait StdInHelper {
  def readStrings = readLine.split(" ")
  def readInts = readStrings.map(_.toInt)
  def readLongs = readStrings.map(_.toLong)
  def readDoubles = readStrings.map(_.toDouble)
  def readBigInts = readStrings.map(BigInt.apply(_))
  def readBigDecimals = readStrings.map(BigDecimal.apply(_))
}


Measured memory_bytes: 54680
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <stdio.h>
using namespace std;
struct Query
{  int fr,to;
   bool operator < (const Query &cp) const
   {  if(fr!=cp.fr)
        return fr<cp.fr;
      return to<cp.to;
   }
}a[100101];
int ans;
int main()
{
	int n,m,i;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++)
	  scanf("%d%d",&a[i].fr,&a[i].to);
	sort(a+1,a+m+1);
	int p=n+1;
	for(i=1;i<=m;i++)
	{  if(a[i].fr>=p)
	     p=n+1,ans++;
	   if(a[i].to<=p)
	     p=a[i].to;
	}
	printf("%d",ans+1);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,m;
  cin >> n >> m;
  priority_queue<pll,vector<pll>,greater<pll>> f;
  priority_queue<ll> s;
  for(ll i=0;i<n;i++) {
    ll a,b;
    cin >> a >> b;
    f.push(pll(a,b));
  }
  ll ans=0;
  for(ll i=0;i<=m;i++) {
    while(f.size()&&f.top().first<=i) {
      s.push(f.top().second);
      f.pop();
    }
    if(s.size()) {
      ans+=s.top();
      s.pop();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3568
// ALDS1_13_A
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
namespace you {
    std::string to_string(char val) {
        return std::string(1, val);
        // return std::string{val};
        // you::to_string(char)
    }
}

vector<int> x;
vector<int> y;
vector<int> vx={-1,1,1,-1};
vector<int> vy={-1,1,-1,1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int k;
    cin>>k;
    rep(i,k){
        int xx,yy;
        cin>>xx>>yy;
        x.push_back(xx);
        y.push_back(yy);
    }
    vector<int> kind(8);
    rep(i,8) kind[i]=i;
    do{
        vector<vector<bool>> ban(8,vector<bool>(8,false)); //falseが. trueがQ
        rep(i,k){
            ban[x[i]][y[i]]=true;
        }
        int numq=k;
        rep(i,8){
            if(ban[i][kind[i]]==false){
                ban[i][kind[i]]=true;
                numq+=1;
            }
        }
        int okq=0;
        if(numq!=8) continue; //Qを8個以上おいてるときは無視
        else{  
            //cout<<kind<<endl;
            rep(i,8){ //8個のQについてみる。
                int ny=i,nx=kind[i];
                bool flag=true;
                rep(j,4){ //左右上下斜め方向の確認
                    int newx=nx+vx[j],newy=ny+vy[j];
                    while(0<=newx&&newx<=7&&0<=newy&&newy<=7){
                        if(ban[newy][newx]==true){
                            flag=false;
                            break;
                        }
                        newx+=vx[j];
                        newy+=vy[j];
                    }
                    if(!(flag)) break;
                }
                if(flag) okq+=1;
            }
        }
        //cout<<okq<<endl;
        if(okq==8) break;
    }while(next_permutation(all(kind))); 
    //cout<<kind<<endl;

    vector<vector<bool>> ans(8,vector<bool>(8,false));
    rep(i,8) ans[i][kind[i]]=true;
    rep(i,8){
        rep(j,8){
            if(ans[i][j]) cout<<"Q";
            else cout<<".";
        }
        cout<<endl;
    }
    return 0;
}


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

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

bool mark[100010];
bool usao[100010];
int minSum[100010];
set<tuple<int, int, int>> veze;
int k;

void dodaj(int sum, int cvor, int cif)
{
    //mark[cvor] = true;
    veze.insert(mt(sum, cvor, cif));
}

void bfs()
{
    while(!veze.empty())
    {
        set<tuple<int, int, int>>::iterator it = veze.begin();
        tuple<int, int, int> prim = *it;
        int kol = get<0>(prim);
        int cvor = get<1>(prim);
        int cif = get<2>(prim);
        
        veze.erase(*it);
        if(!usao[cvor])
        {
            mark[cvor] = true;
            usao[cvor] = true;
            minSum[cvor] = kol;
            if(cvor == 0) return;
            int nxtCvor = (10*cvor) % k;
            if(!usao[nxtCvor]) dodaj(kol, nxtCvor, 0);
            nxtCvor = (cvor + 1) % k;
            if(cif != 9)
                if(!usao[nxtCvor]) dodaj(kol + 1, nxtCvor, cif + 1);
        }
    }
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    cin >> k;
    veze.insert(mt(1, 1, 1));
    bfs();
    cout << minSum[0];

    return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#define MAX 10000
using namespace std;

int p[MAX], rank1[MAX];

void makeSet(int x){
  p[x] = x;
  rank1[x] = 0;
}

void link(int x, int y){
  if(rank1[x] > rank1[y]) p[y] = x;
  else{
    p[x] = y;
    if(rank1[x] == rank1[y]) rank1[y] = rank1[y] + 1;
  }
}

int findSet(int x){
  if(x != p[x]) p[x] = findSet(p[x]);
  return p[x];
}

void unite(int x, int y){
  link(findSet(x),findSet(y));
}

void same(int x, int y){
  if(findSet(x) == findSet(y)) cout << '1' << endl;
  else cout << '0' << endl;
}

int main(){
  int n, q, p, a, b;
  cin >> n >> q;
  for(int i = 0; i < n; i++) makeSet(i);
  for(int i = 0; i < q; i++){
    cin >> p >> a >> b;
    if(p == 0) unite(a,b);
    else same(a,b);
  }
  return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    static long[] Heights;
    static long[] MaxPutties;

    static Program()
    {
        Heights = new long[1 + 50];
        MaxPutties = new long[1 + 50];
        Heights[0] = 1;
        MaxPutties[0] = 1;
        for (int i = 1; i < Heights.Length; i++)
        {
            Heights[i] = 3 + Heights[i - 1] * 2;
            MaxPutties[i] = 1 + MaxPutties[i - 1] * 2;
        }
    }

    public static void Main()
    {
        var kx = Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        var k = kx[0];
        var x = kx[1];
        Console.WriteLine(CountPutties(k, x));
    }

    static long CountPutties(long level, long up)
    {
        if (up >= Heights[level] - 1)
        {
            return MaxPutties[level];
        }

        var lower = 1 + Heights[level - 1];
        var k = 0L;
        if (up >= lower)
        {
            k += MaxPutties[level - 1];
            if (up < lower + 1)
            {
                return k;
            }
            k += 1;
            up -= lower + 1;
            level--;
        }
        while (level > 0 && 1 + Heights[level - 1] >= up)
        {
            level--;
            up--;
        }
        if (up < 1)
        {
            return k;
        }
        k += CountPutties(level, up);
        return k;
    }
}

Measured memory_bytes: 13396
from collections import Counter

cnt = int(raw_input())
lines = []
for i in range(cnt):
    line = sorted([s for s in raw_input()])
    line = ''.join(line)
    lines.append(line)
counters = Counter(lines)
total = 0
for elm, counter in counters.items():
    total += sum(range(1, counter))
print total
    
    


Measured memory_bytes: 24936
#include <stdio.h>
#include <iostream>

using namespace std;

int N;
int A;
int B;
int x;

int main(){
	cin >> N >> A >> B;
	if (A * N > B) {
		x = B;
	}
	else {
		x = N * A;
	}
	cout << x;
  return 0;
}

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

int main(void){
    int N, a[4], i;
    cin >> N;
    for(i = 0; i < 4; i++){
        a[i] = N % 10;
        N = N /10;
    }
    if((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3])){
      cout << "Yes" << endl;
    }
    else 
      cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys,math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	A,B = MI()
	f = False
	for ans  in range(10000):
		if(int(ans * 0.08)==A and int(ans * 0.10)==B):
			print(ans)
			f = True
			break
	if(f==False):
		print(-1)

if __name__ == '__main__':
	main()

Measured memory_bytes: 38640
#include <stdio.h>
int main(void){
char s[50];
  int count=0;
  int n;
  scanf("%s",&s);
  for(n=0;n!=4;n++){
  if(s[n]=='+'){count++;}
   if(s[n]=='-'){count--;}
  }
  printf("%d",count);
  
return 0;
}

Measured memory_bytes: 128
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  s=input()
  if s=="AC":
    ac+=1
  elif s=="WA":
    wa+=1
  elif s=="TLE":
    tle+=1
  else:
    re+=1
print("AC","x",ac)
print("WA","x",wa)
print("TLE","x",tle)
print("RE","x",re)

Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
using namespace std;

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

//変数
int N,M;
vector<int> x, y;

//解法
void solve() {

	int x_max = -101, y_min = 101;
	rep(i, N + 1) {
		if (x[i] > x_max) x_max = x[i];
	}
	rep(i, M + 1) {
		if (y[i] < y_min) y_min = y[i];
	}

	if (x_max >= y_min) {
		cout << "War";
	}
	else {
		cout << "No War";
	}

	return;
}

int main() {
	//入力
	cin >> N >> M;
	x.resize(N+1);
	y.resize(M+1);
	cin >> x[0] >> y[0];
	rep(i, N) {
		cin >> x[i + 1];
	}
	rep(i, M) {
		cin >> y[i + 1];
	}
	solve();
	cout << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll tmp, n, tot = 0;
	vector<ll> viewpoint(1, 0);
	cin >> n;
	for ( int i = 0 ; i < n ; i++ ){
		cin >> tmp;
		tot += abs(viewpoint.back() - tmp);
		viewpoint.push_back(tmp);
	}
	tot += abs(viewpoint.back());
	viewpoint.push_back(0);

	for ( int i = 1 ; i < n + 1 ; i++ ){
		ll without = abs(viewpoint[i-1] - viewpoint[i+1]);
		ll with = abs(viewpoint[i-1] - viewpoint[i]) + abs(viewpoint[i] - viewpoint[i+1]);
		cout << tot - with + without << "\n";
	}


	return 0;
}


Measured memory_bytes: 2164
package main

import "fmt"
import "math"

func main() {
  var A, B, H, M int
  fmt.Scanf("%d %d %d %d", &A, &B, &H, &M)
  
  angleA, angleB := 0., 0.
  angleA = float64(H) * 2. * math.Pi / 12. + float64(M) * 2. * math.Pi / (12.0*60.0)
  angleB = float64(M) * 2. * math.Pi / 60.
  angle := math.Abs(angleA - angleB)
  fmt.Println(math.Sqrt(float64(A*A) + float64(B*B) - 2. * float64(A * B) * math.Cos(angle)))
}//4.56425719433005567605

Measured memory_bytes: 1820
#include <iostream>
using namespace std;
int main() {
	int N, A, B, a, b, c, d, e;
	int total = 0;
	cin >> N >> A >> B;
	
	for (int i = 1; i <= N; i++) {
		a = i / 10000;
		b = (i - a * 10000) / 1000;
		c = (i - a * 10000 - b * 1000) / 100;
		d = (i - a * 10000 - b * 1000 - c * 100) / 10;
		e = i - a * 10000 - b * 1000 - c * 100 - d * 10;
		if (A <= (a + b + c + d + e) && (a + b + c + d + e) <= B)
			total = total + i;
	}
	cout << total;
}

Measured memory_bytes: 3624
#ifdef LOCAL
 #include <P.hpp>
 #include <debugger.hpp>
 #define __int64 __int64_t
#else 
 #include <bits/stdc++.h>
 #define debug(a...) //
 // #define __int64 long long int
#endif
using namespace std;

int main()
{
 ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
 string s , t;
 cin >> s >> t;
 int n = (int) s.size();
 int cnt = 0;
 for(int i = 0; i < n; i++) if(s[i] != t[i]) cnt++;
 cout << cnt << '\n';
 return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
using ll         = long long;
constexpr ll MOD = 1000000007;
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REP2(i, x, n) for (ll i = x; i < (n); i++)
const long long INF = numeric_limits<long long>::max();
template <class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    string s;
    cin >> s;

    vector<string> words = {"dreamer", "dream", "eraser", "erase"};

    while (s != "") {
        bool isChanged = false;
        for (const auto& word : words) {
            if (s.length() < word.length()) continue;
            if (s.find(word, s.length() - word.length()) != string::npos) {
                s         = s.substr(0, s.length() - word.length());
                isChanged = true;
#ifdef SOURCE_TEST

                cout << word << " " << s << endl;
#endif
                break;
            }
        }
        if (!isChanged) break;
    }

    cout << (s == "" ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 3744
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;

using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x; cin >> x;
    int sum = 0;
    while(x>5) {
        if (x-500>=0) {
            sum += 1000;
            x-=500;
        } else if (x-5>=0) {
            sum += 5;
            x-=5;
        }
    }
    cout << sum << "\n";
}



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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int res = 0, l = 0;
    string abc = "ABC";
    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == abc.at(l))
        {
            l++;
        }
        else
        {
            if (S.at(i) == 'A')
                l = 1;
            else
                l = 0;
        }

        if (l == 3)
        {
            res++;
            l = 0;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
int main(){
    int n,k,r,s,p;
    scanf("%d %d",&n,&k);
    scanf("%d %d %d",&r,&s,&p);
    char t[n];
    scanf("%s",t);
    char s1[k][n/k+1];
    for(int i=0;i<n;i++){
        s1[i%k][i/k]=t[i];
        //printf("%d %d %d %c\n",i%k,i/k,i,t[i]);
    }
    int sum=0;
    int l;
    for(int i=0;i<k;i++){
        if(n%k>i){
            l=n/k+1;
        }
        else{
            l=n/k;
        }
        for(int j=0;j<l;j++){
            //printf("1:%c %d,",s1[i][j],sum);
            //printf("%c\n",s1[i][j]);
            if(j==0 || s1[i][j]!=s1[i][j-1]){
                if(s1[i][j]=='r'){
                    sum+=p;
                }
                else if(s1[i][j]=='s'){
                    sum+=r;
                }
                else{
                    sum+=s;
                }
            }
            else{
                s1[i][j]='k';
            }
            //printf("2:%c %d %d %d\n",s1[i][j],sum,i,j);
        }
    }
    printf("%d\n",sum);
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
#define Nmax 3000

int main()
{
	int x[Nmax] = { 0 }, y[Nmax] = { 0 };
	int n = -1;

	do
	{
		n++;
		cin >> x[n] >> y[n];
	} while ((x[n] != 0) || (y[n] != 0));

	for (int i = 0; i < n; i++) {
		if (x[i] < y[i]) {
			cout << x[i] << " " << y[i] << endl;
		}
		else
		{
			cout << y[i] << " " << x[i] << endl;
		}
	}

	return 0;
}


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

int n,m;
int i,j,k;
string str;
int a[200000];

bool test(){
    if(m == 1){
        for(i = 1;i < n;i++){
            if(a[i] <= a[i-1]){
                return false;
            }
        }
    }
    vector<int> d,dv;
    d.push_back(a[0]);
    dv.push_back(1);
    
    for(i=1;i<n;i++){
        if(a[i] > a[i-1]){
            d.push_back(a[i]);
            dv.push_back(1);
        }
        else if(a[i] == a[i-1]){
            dv[dv.size()-1]++;
        }
        else{
            while(d[d.size()-1] > a[i]){
                j = d[d.size()-1]-1;
                k = (dv[dv.size()-1]-1)/m;
                d.pop_back();
                dv.pop_back();
                if(k > 0){
                    if(j == 0)return false;
                    else if(d.size() > 0 && d[d.size()-1] == j){
                        dv[dv.size()-1] += k;
                    }
                    else{
                        d.push_back(j);
                        dv.push_back(k+1);
                    }
                }
                else if(d.size() == 0){
                    break;
                }
            }
            if(d.size() > 0 && d[d.size()-1] == a[i]){
                dv[dv.size()-1]++;
            }
            else{
                d.push_back(a[i]);
                dv.push_back(2);
            }
        }
    }
    while(d.size() > 0){
        j = d[d.size()-1]-1;
        k = (dv[dv.size()-1]-1)/m;
        d.pop_back();
        dv.pop_back();
        if(k > 0){
            if(j == 0)return false;
            else if(d.size() > 0 && d[d.size()-1] == j){
                dv[dv.size()-1] += k;
            }
            else{
                d.push_back(j);
                dv.push_back(k+1);
            }
        }
    }
    return true;
}
int main(){
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    int s = 0, e = n;
    while(e-s>1){
        m = (e+s+1)/2;
        if(test()){
            e = m;
        }
        else{
            s = m;
        }
    }
    cout << e << endl;
}

Measured memory_bytes: 4012