akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N, C[4]={}, ans=0; cin >> N;
REP(i, N){ 
  string S; cin >> S;
  if(S=="AC"){ C[0]++; }
  if(S=="WA"){ C[1]++; }
  if(S=="TLE"){ C[2]++; }
  if(S=="RE"){ C[3]++; }
}
cout << "AC x " << C[0] << "\n";
cout << "WA x " << C[1] << "\n";
cout << "TLE x " << C[2] << "\n";
cout << "RE x " << C[3] << "\n";
}


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


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

int main() {
	int a,b;
	cin >> a >> b;
	int sum = 0;
	for (int i = a; i <= b; i++) {
		int x = i;
		string s = to_string(x);
		string old = s;
		reverse(s.begin(), s.end());
		if(s == old) sum++;
	}
	cout << sum << endl;
}

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

int *tree[10];

int main(void) {

  int n,m;
  scanf("%d %d", &n, &m);
  int tree_s[n+1];
  for (int i = 0; i <= n; i++) {
    tree_s[i] = 0;
  }
  int a,b;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    tree[a] = realloc(tree[a], sizeof(int)*(tree_s[a]+1));
    tree[a][tree_s[a]] = b;
    tree_s[a]++;
    tree[b] = realloc(tree[b], sizeof(int)*(tree_s[b]+1));
    tree[b][tree_s[b]] = a;
    tree_s[b]++;
  }
  int visited[n+1],prev[n+1],path[n+1];
  int cur,next,distance;
  int count = 0;

  for (int i = 0; i <= n; i++) {
    visited[i] = 0;
    prev[i] = 0;
    path[i] = -1;
  }
  visited[1] = 1;
  cur = 1;
  distance = 1;
  while (1) {
    path[cur]++;
    if (path[cur] < tree_s[cur]) {
      next = tree[cur][path[cur]];
      if (visited[next] == 1) {
        continue;
      }
      distance++;
      visited[next] = 1;
      prev[next] = cur;
      cur = next;
    } else {
      if (cur == 1) {
        break;
      } else {
        if (distance == n) {
          count++;
        }
        distance--;
        visited[cur] = 0;
        next = prev[cur];
        prev[cur] = 0;
        path[cur] = -1;
        cur = next;
      }
    }
  }
  printf("%d\n", count);

  return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000


int main() {
	char a[N + 1];
	char b[N + 1];
	char c[N + 1];
	f(i, N + 1) {
		a[i] = 0;
		b[i]=0;
		c[i] = 0;
	}
	int n, k;
	int x, y, z,q;
	long long s, ans;
	bool v = true;
	ans = 0;

	scanf("%d %d", &n,&q);
	scanf("%s", a);
	f(i, q) {
		scanf("%s %s", &b[i],&c[i]);
	}
	int ll = -1;
	int lr = n;
	int rl = -1;
	int rr = n;
	while ((ll+1) < lr) {
		v = true;
		x = (ll + lr) / 2;
		f(i, q) {
			if (a[x] == b[i]) {
				if (c[i] == 'L')x--;
				else x++;
			}
			if (x < 0) {
				v = false;
				break;
			}
			else if (x >= n) {
				v = true;
				break;
			}
        }

		if(v)lr = (ll + lr) / 2;
		else ll= (ll + lr) / 2;
	}

	while ((rl + 1) < rr) {
		v = true;
		x = (rl + rr) / 2;
		f(i, q) {
			if (a[x] == b[i]) {
				if (c[i] == 'L')x--;
				else x++;
			}
			if (x < 0) {
				v = true;
				break;
			}
			else if (x >= n) {
				v = false;
				break;
			}
		}
   			if (v)rl = (rl + rr) / 2;
			else rr = (rl + rr) / 2;
	}



	printf("%d\n",max(rl-ll,0));


	return 0;
}


Measured memory_bytes: 768
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string.h>
#include <stdlib.h>

using namespace std;

int main(void){
    char S[51];
    cin >> S;
    
    int len = 0;
    while(S[len])
        len++;
    
    for(int i = 0; i < (len - 8); i++){
        cout << S[i];
    }
    putchar('\n');
    return 0;
        }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<ll>())
#define vfind(v, target) find(v.begin(), v.end(), target)
#define notFound(v, target) (vfind(v, target) == v.end())
#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
using namespace std;

int main()
{
  ll N; cin >> N; N = N % 10;
  if (N == 3) cout << "bon" << endl;
  else if (N == 0 || N == 1 || N == 6 || N == 8) {
  	cout << "pon" << endl;
  }
  else cout << "hon" << endl;
  
}

Measured memory_bytes: 3632
MOD = int(1e9) + 7


def f(n):
    ans = 1
    for i in range(1, n + 1):
        ans *= i
        ans %= MOD
    return ans


N, M = map(int, input().split())

if abs(N - M) >= 2:
    print(0)
    exit()

maxv = max(N, M)
minv = min(N, M)

if maxv == minv:
    ans = f(maxv)
    ans *= f(minv)
    ans *= 2
    ans %= MOD
    print(ans)
    exit()

ans = f(maxv)
ans *= f(minv)
ans %= MOD
print(ans)


Measured memory_bytes: 3064
def main():
    a, b, c = list(map(int, input().split()))
    if a == b:
        if a == c:
            print(1)
        else:
            print(2)
    elif a == c:
        print(2)
    elif b == c:
        print(2)
    else:
        print(3)
    
    pass
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
//#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int n;cin>>n;
    vi v(n);cin>>v;
    
    int k=0;
    for(int i:v)k+=i;
    k/=n;
    int k2=k+1;
    int sm=0,sm2=0;
    for(int i:v){
        sm+=((i-k)*(i-k));
        sm2+=((i-k2)*(i-k2));
    }
    cout<<min(sm,sm2);
}




Measured memory_bytes: 256
for i in range(input()):
  s = raw_input()
  l = (len(s) - 4) / 2
  if l > 0 and s == ">'%s#%s~" % (('=' * l,) * 2):
    print('A')
  elif l > 0 and s == '>^%s~~' % ('Q=' * l):
    print('B')
  else:
    print('NA')

Measured memory_bytes: 4364
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
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(){
    ll H,W;
    cin>>H>>W;
    ll M;
    cin>>M;
    vector<pair<ll,ll>>B(H);
    for(ll i=0;i<H;i++){
        B[i]=make_pair(0,i);
    }
    vector<pair<ll,ll>>C(W);
    for(ll i=0;i<W;i++){
        C[i]=make_pair(0,i);
    }
    set<pair<ll,ll>>A;
    for(ll i=0;i<M;i++){
        ll h,w;
        cin>>h>>w;
        h--;w--;
        A.insert(make_pair(h,w));
        B[h].first++;
        C[w].first++;
    }
    sort(B.begin(),B.end());
    reverse(B.begin(),B.end());
    sort(C.begin(),C.end());
    reverse(C.begin(),C.end());
    ll ans=0;
    ans=B[0].first+C[0].first;
    if(!A.count(make_pair(B[0].second,C[0].second))){
        cout<<ans<<endl;
    }
    else{
        ll cnt1=1;
        ll cnt2=1;
        for(ll i=1;i<H;i++){
            if(B[i].first<B[i-1].first){
                break;
            }
            else{
                cnt1++;
            }
        }
        for(ll i=1;i<W;i++){
            if(C[i].first<C[i-1].first){
                break;
            }
            else{
                cnt2++;
            }
        }
        bool frag=false;
        for(ll i=0;i<cnt1;i++){
            for(ll j=0;j<cnt2;j++){
                if(!A.count(make_pair(B[i].second,C[j].second))){
                    frag=true;
                }
            }
        }
        if(frag){
            cout<<ans<<endl;
        }
        else{
            cout<<ans-1<<endl;
        }
    }
}


Measured memory_bytes: 31504
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    x,a,b = map(int,input().split())
    if abs(x-a)>abs(x-b):
        print('B')
    else:
        print('A')
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38892
#include <bits/stdc++.h>
#define ll long long
#define N 200010
#define M 1010

using namespace std;
int n, ans;
int d[N];

int read() {
	int s = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

int main() {
	n = read();
	for (int i = 1; i <= n; i++)
		d[i] = read(), ans ^= d[i];
	for (int i = 1; i <= n; i++)
		cout << (ans ^ d[i]) << " ";
	puts("");
}

Measured memory_bytes: 4328
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;

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

	cin >> N >> M;
	vector<int>v(N + 1);
	while (M--) {
		cin >> L >> R;
		v[L]++;
		v[R]--;
	}
	for (int i = 1; i <= N; i++) {
		v[i] += v[i - 1];
	}
	int ans = N + 1;
	for (int i = 1; i <= N; i++) {
		if (v[i])ans += 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3220
from itertools import product
a, b, c, d, e, f = map(int, input().split())
A = sorted(list(set(filter(lambda x: 100*x <= f and x,
           [i*a+j*b for i, j in product(range(31), range(16))]))))
B = [min(x*e, f-100*x) for x in A]

C = []
for i in range(len(A)):
    m = 0
    for k in range(29):
        if k*d <= B[i]:
            m = max(m, k*d+(B[i]-k*d)//c*c)
    C.append(m)

Table = [100*a, 0]
for x, y in zip(A, C):
    if y/(100*x+y) > Table[1]/Table[0]:
        Table = [100*x+y, y]
print(Table[0], Table[1])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ff first
#define ss second
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;

int main() {
    IO;
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    for(int &x: a)
        cin >> x;
    int curr = 1;
    vector<int> v;
    v.push_back(curr);
    unordered_map<int, int> mp;
    mp[curr] = 1;
    int next;
    while(1){
        next = a[curr - 1];
        v.push_back(next);
        if(mp[next] == 1){
            break;
        }
        mp[next] = 1;
        curr = next;
    }
    int pos = 0;
    for(; pos < v.size(); pos++){
        if(v[pos] == v.back()) break;
    }
    if(k <= pos)
        cout << v[k] << '\n';
    else {
        k -= pos;
        k %= v.size() - 1 - pos;
        cout << v[pos + k] << '\n';
    }
    return 0;
}
/*
5 1000000
4 5 2 3 5
 */

Measured memory_bytes: 12832
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long mod_pow(long long a,long long n)
{
    if(n==0)
        return 1;
    long long p=mod_pow(a,n/2);
    long long a1=(p*p)%mod;
    if(n%2)
        return a*a1;
    else return a1;
}

int main()
{
    long long n;
    cin>>n;
    vector <long long> vect(n,0);
    for(int i=0;i<n;i++)
        cin>>vect[i];
    //reverse(vect.begin(),vect.end());
    stack <long long> st1;
    long long count1=1;
    st1.push(vect[0]);
    for(int i=1;i<n;i++)
    {
        long long a=st1.size();
        count1=max(count1,a);
        if(st1.top()>=vect[i])
            st1.push(vect[i]);
        else
        {
            while(!st1.empty())
            {
                st1.pop();
            }
            st1.push(vect[i]);
        }
        a=st1.size();
        count1=max(count1,a);
    }
    cout<<count1-1;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep2(i,start,end) for(ll i = start; i < end; ++i)
#define dwn(i,n) for(int i = n; i >= 0; --i)
#define dwn2(i,start,end) for(ll i = start; i >= end; --i)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 0x3f3f3f;
const ll mode = 1e9 + 7;


int main(){
	int m,d;
	cin>>m>>d;
	ll sum = 0;
	rep2(j,1,m+1){
		for(int i = 1; i <= d; i++){
			int x = i /10;
			int y = i%10;
			if(x >= 2 && y >= 2 && x*y == j) sum++;
			}
	}
	cout<<sum<<endl;
	return 0;
}








Measured memory_bytes: 256
#include <stdio.h> 
int main(){
	int n;
	int a[100005];
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int nx=1;int cn=0;
	for(int i=1;i<=n;i++){
		nx=a[nx];cn++;
		if(nx==2)break;
	}
	if(nx==2)printf("%d",cn);
	else printf("-1");
	return 0;
}

Measured memory_bytes: 512
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int x = parseInt(sc.next());
		int[] c = new int[n];
		int[][] a = new int[n][m];
		for (i = 0; i < n; i++) {
			c[i] = parseInt(sc.next());
			for (j = 0; j < m; j++) {
				a[i][j] = parseInt(sc.next());
			}
		}
		sc.close();
		int ans=12000001;
		int[] b = new int[m];
		for (int k = 0; k < pow(2,n); k++) {
			Arrays.fill(b, 0);
			int mask=1;
			int yen=0;
			for (int l = 0; l < n; l++) {
				if((k&mask)!=0) {
					yen+=c[l];
					for (int p = 0; p < m; p++) {
						b[p]+=a[l][p];
					}
				}
				mask<<=1;
			}
			boolean f =true;
			for (int p = 0; p < m; p++) {
				if(b[p]<x) {
					f= false;
					break;
				}
			}
			if(f) {
				ans=Math.min(ans, yen);
			}
		}
		if(ans==12000001) {
			ans=-1;
		}
		out.println(ans);
	}
}


Measured memory_bytes: 28052
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    ll N; cin >> N;
    cout << N * (N - 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long k = sc.nextLong();
        if (k <= a) {
            System.out.println(a - k + " " + b);
        } else if (k < a + b) {
            System.out.println(0 + " " + (b - k + a));
        } else {
            System.out.println(0 + " " + 0);
        }
    }
}

Measured memory_bytes: 23892
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

    
        
t = int(input())
for i in range(t):
    ans = {}
    def sub(n,A,B,C,D):
        if n==1:
            ans[1] = D
            return D
        if n==0:
            return 0
        if n in ans:
            return ans[n]
        v = n * D
        if n%2==0:
            v = min(v, sub(n//2, A, B, C, D)+A)
        else:
            v = min(v, sub(n//2, A, B, C, D)+A+D)
            if n>2:
                v = min(v, sub(n//2+1, A, B, C, D)+A+D)
        if n%3==0:
            v = min(v, sub(n//3, A, B, C, D)+B)
        else:
            if n>=3:
                v = min(v, sub(n//3, A, B, C, D)+B+(n%3)*D)
                v = min(v, sub(n//3+1, A, B, C, D)+B+(3-(n%3))*D)
        if n%5==0:
            v = min(v, sub(n//5, A, B, C, D)+C)
        else:
            if n>=5:
                v = min(v, sub(n//5, A, B, C, D)+C+(n%5)*D)
                v = min(v, sub(n//5+1, A, B, C, D)+C+(5-(n%5))*D)
        ans[n] = v
        return v

    n, A,B,C,D = map(int, input().split())
    print(sub(n,A,B,C,D))
#     print(ans)

Measured memory_bytes: 86520
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b,answer;
    char c;
    
    while (c !='?') {
        scanf("%d %c %d",&a,&c,&b);
        if (c=='+') {
            answer = a+b;
        }
        else if (c=='-'){
            answer = a-b;
        }
        else if (c=='*'){
            answer = a*b;
        }
        else if (c=='/'){
            answer = a/b;
        }
        else if (c=='?'){
            break;
        }
        printf("%d\n",answer);
        
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int;

#define int long long
const int INF = 100000000000000000;

int N, M, D;

signed main()
{
    cin >> N >> M >> D;

    int ans = 0;
    if(1+D <= N-D && D != 0) {
        ans += 2*(N-D - (1+D) + 1);
        ans += 2*D;
    } else {
        ans += N;
    }

    cerr << ans << endl;

    printf("%.10f\n", (double)ans * (M-1) /(N*N));

    // int ans = 0;

    // int N = 13;
    // int M = 7;

    // for(int i = 1; i <= N; i++) {
    //     for(int j = 1; j <= N; j++) {
    //         for(int k = 1; k <= N; k++) {
    //             for(int l = 1; l <= N; l++) {
    //             if(abs(i-j) == M) {
    //                 ans++;
    //             }
    //             if(abs(j-k) == M) {
    //                 ans++;
    //             }
    //             if(abs(k-l) == M) {
    //                 ans++;
    //             }
    //             }
    //         }
            
    //     }
    // }

    // cout << (double)ans/(N*N*N*N) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    int minutes = h * 60  + m;
    double k = (double)(minutes) / 2;
    while(k >= 360) k -= 360;
    double l = (minutes * 6)%360;
    //cout << setprecision(20) << k <<" " << l << endl;
    double t = abs(k-l);
   // cout << t << endl;
    double p = min(t,360-t);
   // cout << p << endl;
    //cout << p << endl;
    double ans = sqrt(a*a + b*b - 2*a*b*cos((p*acos(-1))/180));
    cout << setprecision(29) << ans << endl;
    return 0;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a-c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }
    if (abs(a-b) <= d && abs(b-c) <= d) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 10000;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
struct edge { int to; int cost; };

signed main() {
	int r, g, b, n; cin >> r >> g >> b >> n;
	int cnt = 0;
	rep(i, 3002) {
		rep(j, 3002) {
			int x = n - r*i - b*j;
			if (x >= 0 && x%g == 0)cnt++;
		}
	}cout << cnt << endl;
}

Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))

P_ = P.copy()
P.sort()
r = 0
for p, p_ in zip(P, P_):
  if p != p_:
    r += 1
  if r > 2:
    break
else:
  print("YES")
  exit()
print("NO")

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int a, b, c, d, ta, ao;

int main()
{
  cin >> a >> b >> c >> d;
  while (a > 0 and c > 0) {
    a -= d;
    c -= b;
  }
  if (c <= 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rs64() {
	int64_t n;
	scanf("%" SCNd64, &n);
	return n;
}

int main() {
	int n = ri();
	int a[n], b[n];
	for (auto &i : a) i = ri() - 1;
	for (auto &i : b) i = ri() - 1;
	int fact[10];
	fact[0] = 1;
	for (int i = 1; i < 10; i++) fact[i] = fact[i - 1] * i;
	std::function<int(int *, int *, int)> calc = [&] (int *start, int *end, int i) {
		if (start == end) return 0;
		int k = 0;
		for (int *i = start + 1; i < end; i++) if (*i < *start) k++;
		return k * fact[n - 1 - i] + calc(start + 1, end, i + 1);
	};
	int x = calc(a, a + n, 0), y = calc(b, b + n, 0);
	std::cout << std::abs(x - y) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define DB double
#define SG string
#define LL long long
#define Fp(A,B,C,D) for(A=B;A<=C;A+=D)
#define Fm(A,B,C,D) for(A=B;A>=C;A-=D)
#define Clear(A) memset(A,0,sizeof(A))
using namespace std;
const LL Max=1e3+5;
const LL Mod=1e9+7;
const LL Inf=1e18;
inline LL Read(){
	LL X=0;char CH=getchar();bool F=0;
	while(CH>'9'||CH<'0'){if(CH=='-')F=1;CH=getchar();}
	while(CH>='0'&&CH<='9'){X=(X<<1)+(X<<3)+CH-'0';CH=getchar();}
	return F?-X:X;
}
inline void Write(LL X){
	if(X<0)X=-X,putchar('-');
	if(X>9)Write(X/10);
	putchar(X%10+48);
}
bool Check(LL X){
	LL I;
	Fp(I,2,sqrt(X),1){
		if(X%I==0){
			return 1;
		}
	}return 0;
}
int main(){
	LL I,J,K=0;
	LL N=Read();
	Fp(I,1,N,1){
		while(true){
			J=(++K)*10+1;
			if(Check(J)==0){
				Write(J);putchar(' ');
				break;
			}
		}
	}
	return 0;
}

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

using namespace std;

const int MD = 1000000007;

int solve(int x, int n) {
	int a = ((long long) n * (n + 1) / 2 - (long long) (n - x) * (n - x + 1) / 2) % MD;
	int b = (long long) (x - 1) * x / 2 % MD;
	int c = a - b + 1;
	while (c < 0)
		c += MD;
	return c;
}

int main() {
	int n, k; cin >> n >> k;
	int ans = 0;
	for (int a = k; a <= n + 1; a++)
		ans = (ans + solve(a, n)) % MD;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3588
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

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

n = ni()
h = na()
ans = h[0]
for i in range(1,n):
  ans += max(0, h[i]-h[i-1])
print(ans)

Measured memory_bytes: 10912
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s,t;

	bool ans=true;
	cin >>s>>t;
	rep(i,s.size()){
		if(s[i]!=t[i]){
			ans=false;
		}
	}
	cout<<solve(ans)<<endl;
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
 
bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}
 
int main(){
    string s;
    cin>>s;
    int n=(int)s.size();
    if(is_palindrome(s) && is_palindrome(s.substr(0,(n-1)/2)) && is_palindrome(s.substr((n+1)/2,n))){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = INF;
  rep(i, n - k + 1) {
    int tmp = 0;
    tmp = abs(a[i + k - 1] - a[i]);
    tmp += min(abs(a[i + k - 1]), abs(a[i]));
    cmin(ans, tmp);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
N, A = map(int, input().split())
X = list(map(int, input().split()))
s = [{} for i in range(N+1)]
s[0][0] = 1

for i in range(N):
  cur = X[i]
  for j in range(N, 0, -1):
    for k, v in s[j-1].items():
      s[j][cur + k] = s[j].get(cur + k, 0) + v

ans = 0
for i in range(1, N+1):
  ans += s[i].get(i*A, 0)
print(ans)

Measured memory_bytes: 5228
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for(int i = 0; i < s.size(); i++){
		ans += (s[i] != t[i]);
	}
	cout << ans << '\n';
}


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

int main(){
    string s,s2,s3;
	cin >> s >> s2 >> s3;
	if(s[s.size()-1]==s2[0]&&s2[s2.size()-1]==s3[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 764
package main

import (
	"fmt"
	"strconv"
)

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

	var sum int
	for i := 1; i <= n; i++ {
		str := strconv.Itoa(i)
		if len(str)%2 == 1 {
			sum++
		}
	}

	fmt.Println(sum)
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 100000007
#define sz 1005
#define szz 15005

using namespace std;

int main()
{
    char str1[5],str2[5];

    scanf("%s %s",str1,str2);

    if(str1[0]==str2[2]&&str1[1]==str2[1]&&str1[2]==str2[0])
        printf("YES\n");

    else
        printf("NO\n");

    return (0);
}


Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n,a,b,c = get_nums_l()
lengths = list(map(int,sys.stdin.readlines()))

ans = 999999999999999

for x in range(4 ** n):
    lll = [0] * 4
    gattai=0
    for i in range(n):
        tmp = x >> (i*2)
        tmp %= 4
        
        if tmp != 0 and lll[tmp] > 0:
            gattai += 1
        lll[tmp] += lengths[i]

    if min(lll[1:]) == 0:
        continue

    mp = gattai*10 + abs(a-lll[1]) + abs(b-lll[2]) + abs(c-lll[3])
    ans = min(ans, mp)

print(ans)

Measured memory_bytes: 44892
#coding:utf-8
import math

if __name__ == "__main__":
    a = raw_input()
    b = raw_input()

    if len(a) > len(b):
        print "GREATER"
    elif len(a) < len(b):
        print "LESS"
    elif len(a) == len(b):
        for i in range(len(a)):
            if a[i] > b[i]:
                print "GREATER"
                break
            elif a[i] < b[i]:
                print "LESS"
                break
            elif a[i] == b[i] and i == len(a) - 1:
                print "EQUAL"




Measured memory_bytes: 2568
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int L,R;cin>>L>>R;

  if (R-L > 2020){
    cout << 0 << endl;
  }
  else{
    int res = INF;
    rep(i, L, R+1){
      rep(j, i+1, R+1){
        chmin(res, (i%2019)*(j%2019)%2019);
      }
    }
    cout << res << endl;
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
from collections import deque

H, W = map(int, input().split())
a = [input() for _ in range(H)]

dist = [[-1] * W for _ in range(H)]
dq = deque()

for r in range(H):
    for c in range(W):
        if a[r][c] == '#':
            dist[r][c] = 0
            dq.append((r, c))


def in_range(r, c):
    return 0 <= r < H and 0 <= c < W


dr_s = (0, 0, -1, 1)
dc_s = (-1, 1, 0, 0)

d = 0
while dq:
    r, c = dq.popleft()
    d = dist[r][c]
    for dr, dc in zip(dr_s, dc_s):
        nr = r + dr
        nc = c + dc
        if not in_range(nr, nc): continue
        if dist[nr][nc] != -1: continue
        dist[nr][nc] = d + 1
        dq.append((nr, nc))

print(d)


Measured memory_bytes: 89692
fun main(args:Array<String>?): Unit {
    while(true){
        val (w, h) = readLine()!!.trim().split(' ').map(String::toInt)
        if (w == 0 && h == 0) return
        val state = Array(h){ readLine()!!.trim().split(' ').map{it == "1"}.toBooleanArray()}
        val union = UnionFind(w * h)
        for (i in 0 until h) for (j in 0 until w) if (state[i][j]) {
            for (di in -1 .. 1) for (dj in -1 .. 1) if (i + di in 0 until h && j + dj in 0 until w && state[i + di][j + dj]){
                union.merge(i * w + j, i * w + j + di * w + dj)
            }
        }
        println((0 until h).sumBy{i -> (0 until w).count{j -> state[i][j] && union.findRoot(i * w + j) == i * w + j}})
    }
}
class UnionFind(val size: Int){
    private val mArray = IntArray(size){-1}
    fun merge(a: Int, b: Int): Unit {
        val ar = findRoot(a)
        val br = findRoot(b)
        if (ar != br){
            if (mArray[ar] < mArray[br]){
                mArray[ar] += mArray[br]
                mArray[br] = ar
            }else {
                mArray[br] += mArray[ar]
                mArray[ar] = br
            }
        }
    }
    fun findRoot(a: Int): Int {
        return if (mArray[a] >= 0){
            mArray[a] = findRoot(mArray[a])
            mArray[a]
        }else {
            a
        }
    }
    fun sizeOf(a: Int): Int {
        return -mArray[findRoot(a)]
    }
    fun isSame(a: Int, b: Int): Boolean {
        return findRoot(a) == findRoot(b)
    }
}



Measured memory_bytes: 38572
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            int N = scanner.nextInt();
            int M = scanner.nextInt();
            TreeSet<Triple> map = new TreeSet<>((lhs,rhs)->lhs.Year - rhs.Year);

            for (int i = 0; i < M; i++) {
                int prefecture = scanner.nextInt();
                int year = scanner.nextInt();
                map.add(new Triple(i, prefecture, year));
            }

            Map<Integer, Integer> prefectureToCount = new HashMap<>();
            TreeMap<Integer, String> numToFormat = new TreeMap<>();
            for (final Triple triple : map) {
                int count = prefectureToCount.compute(triple.Prefecture, (k,v) -> v == null ? 1 : v + 1);
//                String format = String.format("%06d%06d", triple.Prefecture, count);
                String format = leftpad(triple.Prefecture) + leftpad(count);
                numToFormat.put(triple.num, format);
            }
            for (final String format : numToFormat.values()) {
                System.out.println(format);
            }
        }
    }

    static String leftpad(int v) {
        StringBuilder sb = new StringBuilder();
        while(v != 0) {
            sb.append(v % 10);
            v /= 10;
        }
        while(sb.length() < 6) {
            sb.append("0");
        }
        return sb.reverse().toString();
    }

    static class Triple {
        final int num;
        final int Prefecture;
        final int Year;

        Triple(int num, int prefecture, int y) {
            this.num = num;
            Prefecture = prefecture;
            Year = y;
        }
    }
}


Measured memory_bytes: 112272
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

/*
全員リーダーの方を向かせる普通にやるとN^2オーダー
E->リーダーが右だと嬉しい
W->

最初にE,Wの数を数える
i番めまでに何人出たかを数える
これでオーダーN
*/
#define INF 2147483647

int min(int a,int b){
    if(a<b){
        return a;
    }
    else{
        return b;
    }
}

int main(void){
    int n,i,E_c = 0,W_c = 0,prev = INF,ans = INF;
    scanf("%d",&n);
    char *s = (char*)malloc((n+1)*sizeof(char));
    int *w = (int*)malloc((n)*sizeof(int)),*e = (int*)malloc((n)*sizeof(int));
    scanf("%s",s);
    for(i=0;i<n;i++){
        if(s[i] == 'W'){
            
            W_c++;
            if(i== 0){
                w[i] = 1;
                e[i] = 0;
            }
            else{
                w[i] = w[i-1] + 1;
                e[i] = e[i-1];
            }
        }
        else{
            E_c++;
            if(i==0){
                w[i] = 0;
                e[i] = 1;
            }
            else{
                w[i] = w[i-1];
                e[i] = e[i-1] + 1;
            }
        }
    }
    for(i=0;i<n;i++){//n番の人がリーダーの時(西から)
            prev= ans;
            if(i == 0){
                ans = E_c - e[0];
            }
            else{
                ans = w[i-1] + E_c -e[i];
                ans = min(ans,prev);
            }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include<math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)

int main() {
    int a ,b,c,d;
    cin >> a>>b>>c>>d ;
    
    rep(i, 100) {
       
            a = a - d;
            c = c - b;
            
            if (c <= 0) {
                cout << "Yes" << endl;
                return 0;
            }
            
            
            
            
            if (a <= 0) {
                cout << "No" << endl;
                return 0;
        }
           

    }
    return 0;
}

Measured memory_bytes: 3636
n = int(input())

count = 0
for i in range(1, n+1, 1):
  if i % 2 == 1:
    divCount = 0
    for j in range(1, i+1, 1):
      if i % j == 0:
        divCount += 1
    if divCount == 8:
      count += 1
print(count)

Measured memory_bytes: 38640
import java.io.*;
import java.util.*;
import java.util.regex.*;


public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		solutionA(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void solutionA(String[] args) throws Exception{

		int N = nextInt();
		int[] h = nextInts();
		int ans = 0;
		int idx=0;
		for(int i=idx;i<N;i++) {
			if(i==0) {
				if(h[i]==0) {
					idx++;
				}else {
					break;
				}
			}else {
				if(h[i]==0||h[i-1]==0&h[i]==0) {
					idx++;
				}else {
					break;
				}
			}
		}

		while(idx!=N) {
			int min=Integer.MAX_VALUE;
			int end=N;
			for(int i=idx;i<N;i++) {
				if(h[i]!=0) {
					min=Math.min(min, h[i]);
				}else {
					end=i;
					break;
				}
			}
			for(int i=idx;i<end;i++) {
				h[i]-=min;
			}
			ans+=min;
			for(int i=idx;i<N;i++) {
				if(i==0) {
					if(h[i]==0) {
						idx++;
					}else {
						break;
					}
				}else {
					if(h[i]==0||h[i-1]==0&h[i]==0) {
						idx++;
					}else {
						break;
					}
				}
			}
			if(idx==N) {
				break;
			}
		}
		pw.println(ans);
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 21332
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

a = int(input())
b = int(input())
h = int(input())

print ((a+b)*h//2)


Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#ifdef LOCAL
#include<debug.h>
#else
#define db(...) 21
#endif
#define sz(a) ((int)(a).size())
#define found(m,x) ((m).find(x)!=(m).end())
#define uset unordered_set
#define umap unordered_map
#define a(x) (x).begin(),(x).end()
#define fo(i,n) for(int i=0;i<(int)n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<=(int)n:i>=(int)n;k<n?i++:i--)
#define input(v,n) fo(i,n)cin>>v[i]
using vi = vector<int>;
using vpi = vector<pair<int,int>>;
using pi = pair<int,int>;

const int nax = 1e5+7;
const int mod = 1e9+7; //1e9+2667 :: 0xcf : inf, 0xc0 -inf
const int inf = numeric_limits<int> :: max() - (int)9e6;
// ===================== MANASH =================== //

int n;

void test() {

	cin >> n;
	map<string,int> m;
	fo(_,n) {
		string s;
		cin >> s;
		m[s]++;
	}
	cout << "AC x " << m["AC"] << '\n';
	cout << "WA x " << m["WA"] << '\n';
	cout << "TLE x " << m["TLE"] << '\n';
	cout << "RE x " << m["RE"] << '\n';
}

signed main() {

	ios_base :: sync_with_stdio(false);
	cin.tie(NULL);

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	#endif

	int T = 1;
	//cin >> T;
	while(T--) {
		test();
		cout << "\n";
	}
	return 0;

}

Measured memory_bytes: 3664
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
N = int(input())
if N == 1:
  print(0)
  exit()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)
  
  
  
  
  
  

Measured memory_bytes: 9444
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

ll gcd(ll n, ll m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        ll r = n % m;
        n = m;
        m = r;
    }
    return n;
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    b++;

    ll e = c * d / gcd(c, d);

    auto f = [&](ll t) {
        ll k = b - a;
        ll l = k / t;
        ll r = l;
        ll a1 = a % t;
        ll b1 = (b - l * t) % t;
        if (a1 == b1) return r;
        if (a1 < b1) {
            if (a1 == 0) r++;
        } else {
            if (b1 != 0) r++;
        }
        return r;
    };

    cout << f(1) - (f(c) + f(d) - f(e)) << endl;

    return 0;
}

Measured memory_bytes: 256
def move_dice(d, dir):
    if(dir == 'N'):
        d[0], d[1], d[4], d[5] = d[1], d[5], d[0], d[4]
    if(dir == 'S'):
        d[0], d[1], d[4], d[5] = d[4], d[0], d[5], d[1]
    if(dir == 'E'):
        d[0], d[2], d[3], d[5] = d[3], d[0], d[5], d[2]
    if(dir == 'W'):
        d[0], d[2], d[3], d[5] = d[2], d[5], d[0], d[3]

def rotate_right_dice(d):
    d[1], d[2], d[3], d[4] = d[3], d[1], d[4], d[2]

def to_up_dice(d, num_index):
    move_num = {0:0, 1:3, 2:2, 3:0, 4:1, 5:2}
    if(num_index==2 or num_index==3):
        move_dice(d, 'E')
    for _ in range(move_num[num_index]):
        move_dice(d, 'N')

def to_front_dice(d, num):
    while(d[1] != num):
        rotate_right_dice(d)

def equal_dice(d1, d2):
    for i in range(6):
        tmp_d = list(d1)
        to_up_dice(tmp_d, i)
        for _ in range(4):
            if(tmp_d == d2): return 'Yes'
            else: rotate_right_dice(tmp_d)
    return 'No'



dice1 = list(map(int, input().split()))
dice2 = list(map(int, input().split()))

print(equal_dice(dice1, dice2))

Measured memory_bytes: 7832
S = input()

if S=='SUN':
  ans = 7
elif S=='MON':
  ans = 6
elif S=='TUE':
  ans = 5
elif S=='WED':
  ans = 4
elif S=='THU':
  ans = 3
elif S=='FRI':
  ans = 2
elif S=='SAT':
  ans = 1
print(ans)

Measured memory_bytes: 38384
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cout<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void solveforthiscase(const int & test)
{//deb(test);
int a[]={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<<a[k-1];





return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: i64,
        m: i64,
    }
    let time = i64::pow(2, m as u32);
    println!("{}", time * ((1900 * (m)) + 100 * (n-m)) );
}

Measured memory_bytes: 4352