akhauriyash/Code-Regression huggingface dataset:
/*
  mail: mleautomaton@foxmail.com
  author: MLEAutoMaton
  This Code is made by MLEAutoMaton
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=100010,Mod=1e9+7;
int n,m,a[N],b[N],d[N],C[N],cnt,tot;
typedef pair<int,int> pii;
#define mp make_pair
pii c[N];
int lowbit(int x){return x&(-x);}
void Add(int x,ll d){while(x<=cnt){C[x]=(C[x]+d)%Mod;x+=lowbit(x);}}
ll sum(int x){
	ll ret=0;
	while(x){ret=(ret+C[x])%Mod;x-=lowbit(x);}
	return ret;
}
bool cmp(pii a,pii b){
	return a.first<b.first || (a.first==b.first && a.second>b.second);
}
int main(){
	n=gi();m=gi();
	for(int i=1;i<=n;i++)a[i]=gi();
	for(int i=1;i<=m;i++)b[i]=gi();
	for(int i=1;i<=n;i++)
		if(a[i]>b[1] && a[i]<b[m]){
			int x=lower_bound(b+1,b+m+1,a[i])-b;
			if(b[x]==a[i])continue;
			c[++tot]=mp(a[i]-b[x-1],b[x]-a[i]);
			d[tot]=b[x]-a[i];
		}
	sort(d+1,d+tot+1);cnt=unique(d+1,d+tot+1)-d-1;
	for(int i=1;i<=tot;i++)
		c[i].second=lower_bound(d+1,d+cnt+1,c[i].second)-d;
	sort(c+1,c+tot+1,cmp);tot=unique(c+1,c+tot+1)-c-1;
	ll ans=1;
	for(int i=1;i<=tot;i++){
		ll fi=sum(c[i].second-1)+1;
		ans=(ans+fi)%Mod;
		Add(c[i].second,fi);
	}
	printf("%lld\n",ans);
	return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  int N;
  cin >> N;
  vector<bool> xs(10100);
  xs[0] = true;
  REP(i,N){
	int x;
	cin >> x;
	for(int i=10100-1;i>=x;--i){
	  xs[i] =xs[i] || xs[i-x];
	}
  }

  int ans = 0;
  REP(i,10100) if(xs[i] && i%10 != 0) maxi(ans, i);
  cout << ans << endl;

  return 0;
}


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

int main(int argc, char *argv[])
{
    int D;
    std::cin >> D;

    if (D == 25) {
        std::cout << "Christmas" << std::endl;
    } else if (D == 24) {
        std::cout << "Christmas Eve" << std::endl;
    } else if (D == 23) {
        std::cout << "Christmas Eve Eve" << std::endl;
    } else if (D == 22) {
        std::cout << "Christmas Eve Eve Eve" << std::endl;
    } else {
        ;
    }

    return 0;
}

Measured memory_bytes: 256
import math
import bisect
N = int(input())
c  = 0 #あったらあかんやつ
now = 1
nums = list(map(int,input().split(" ")))
for temp in nums:
    if temp == now:

        now += 1
    else:
        c += 1
if c == N: # 全部あったらあかんやつだったら
    print(-1)
else:
    print(c)

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

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
*/

int checkpoint_num=0;
void pcheck(){
    cout << "----------------" << endl << checkpoint_num << endl << "----------------" << endl;
    checkpoint_num +=1;
}

template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
}

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
}


int main(void){
    long long n,m;
    long long a,b;
    cin >> n >> m;
    vector<vector<long long>> arr;
    for (int i = 0; i < n; ++i){
        cin >> a >> b;
        arr.push_back({a,b});
    }
    // cout << "********" << endl;
    sort(arr.begin(),arr.end());

    std::priority_queue<
      long long,
      std::vector<long long>,
      less<long long> // 比較関数オブジェクトを指定
    > que;
    int ind = 0;
    long long ans = 0;
    // cout << "+******" << endl;
    // debug(arr,2);
    for (int i = 0; i < m; ++i){
        // cout << i << endl;
        while(true){
                    if (ind > n-1){
            break;
        }
            // cout << ind << endl;
            if(arr[ind][0] <= i+1){
                que.push(arr[ind][1]);
                ind += 1;
                if (ind > n-1){
                    break;
                }
            }else{
                break;
            }
        }
        // cout<< i << " " << ind << endl;
        if (!que.empty()){
            long long temp = que.top();
            ans += temp;
            que.pop();
        }


    }

    // while (!que.empty()) {
    //   std::cout << que.top() << std::endl;
    //   que.pop();
    // }
    cout << ans << endl;
};


Measured memory_bytes: 8112
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

factorization(24) 

n = int(input())
P = factorization(n)

Q = []
for i in range(len(P)):
    temp = 1
    while P[i][1] >= temp and P[i][0] != 1:
        t = P[i][0] ** temp
        Q.append(t)
        P[i][1] -= temp
        temp += 1

print(len(Q))

Measured memory_bytes: 9504
from collections import deque
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for i in range(m)]
rt = [[] for _ in range(n)]

for a, b in ab:
    a, b = a - 1, b - 1
    rt[a].append(b)
    rt[b].append(a)

q = deque([0])
INF = float('inf')
dis = [INF] * n
dis[0] = 0
back = [-1] * n

while q:
    zzz = q.popleft()
    for i in rt[zzz]:
        if dis[zzz] + 1 >= dis[i]:
            continue
        dis[i] = dis[zzz]
        back[i] = zzz + 1
        q.append(i)

print('Yes')
print(*back[1:], sep='\n')

Measured memory_bytes: 65880
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;

int main(void) {
	ll n, k, sum = 0, ans = INF;
	cin >> n >> k;
	vector<ll>x(n);
	vector<ll>xr, xl;
	for (ll i = 0;i < n;i++) {
		cin >> x[i];
		if (x[i] == 0)k--;
	}
	if (k == 0) {
		cout << 0 << endl;
		return 0;
	}
	for (ll i = 0;i < n;i++) {
		if (x[i] > 0) {
			xr.push_back(x[i]);
		}
	}
	sum = 0;
	for (ll i = n - 1;i >= 0;i--) {
		if (x[i] < 0) {
			xl.push_back(x[i]);
		}
	}
	//cout << xl.size() << " " << xr.size() << endl;
	for (ll i = 0;i < k;i++) {
		if (xr.size() == 0)break;
		if ((ll)xr.size() > i) {
			if (i == k - 1)ans = min(ans, xr[i]);
			else {
				if ((ll)xl.size() > (k - 1) - i - 1)ans = min(ans, xr[i] + xr[i] - xl[(k - 1) - i - 1]);
				else continue;
			}
		}
		else {
			if ((ll)xl.size() > k - (ll)xr.size() - 1)ans = min(ans, xr[(ll)xr.size() - 1] + xr[(ll)xr.size() - 1] - xl[k- (ll)xr.size() - 1]);
			else continue;
		}
	}
	for (ll i = 0;i < k;i++) {
		if (xl.size() == 0)break;
		if ((ll)xl.size() > i) {
			if (i == k - 1)ans = min(ans, -xl[i]);
			else {
				if (((ll)xr.size()!=0)&&(ll)xr.size() > k - 1 - i - 1)ans = min(ans, -xl[i] - xl[i] + xr[k - 1 - i - 1]);
				else continue;
			}
		}
		else {
			if ((ll)xr.size() > k - (ll)xl.size() - 1)ans = min(ans, -xl[(ll)xl.size() - 1] - xl[(ll)xl.size() - 1] + xr[k- (ll)xl.size() - 1]);
			else continue;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int n, k;
    if (scanf("%d %d", &n, &k) < 2) exit(1);
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        if (scanf("%d", &h[i]) < 1) exit(1);
    }
    vector<int> a = h;
    sort(a.begin(), a.end());
    //座圧 -> id 復元 -> res
    map<int, int> id;
    map<int, int> res;
    int now = 1;
    for (int i = 0; i < n; i++){
        if (id[a[i]] == 0) {
            id[a[i]] = now;
            res[now] = a[i];
            now++;
        }
    }
    long long INF = ((long long)1 << 40);
    vector<vector<vector<long long>>> dp(n + 1, vector<vector<long long>>(n - k + 1, vector<long long>(n + 1, INF)));
    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= n - k; j++){
            for (int m = 0; m <= n; m++){
                if (dp[i][j][m] == INF) continue;
                dp[i + 1][j][m] = min(dp[i + 1][j][m], dp[i][j][m]);
                if (j == n - k) continue;
                dp[i + 1][j + 1][id[h[i]]] = min(dp[i + 1][j + 1][id[h[i]]], dp[i][j][m] + max(0, h[i] - res[m]));
            }
        }
    }
    long long ans = INF;
    for (int i = 0; i <= n; i++) ans = min(ans, dp[n][n - k][i]);
    printf("%lld\n", ans);
}


Measured memory_bytes: 216832
#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>;

int main(){
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3596
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
l = []
for i, v in C.items():
    if v >= 2:
        l.append(i)
    if v >= 4:
        l.append(i)

if len(l) < 2:
    ans = 0
else:
    l = sorted(l, reverse=True)
    ans = l[0]*l[1]
print(ans)


Measured memory_bytes: 18600
/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-7-14 21:56:02
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
string S;
typedef tuple<string, string> P;
map<P, ll> M;
string T;

void make_dic()
{
  for (auto i = 0; i < (1 << N); i++)
  {
    string A = "", B = "";
    for (auto j = 0; j < N; j++)
    {
      if ((i >> j) & 1)
      {
        A = A + T[j];
      }
      else
      {
        B = B + T[j];
      }
    }
    auto it = P(A, B);
    if (M.find(it) == M.end())
    {
      M[it] = 1;
    }
    else
    {
      M[it]++;
    }
  }
}

ll cnt_dic()
{
  ll ans = 0;
  for (auto i = 0; i < (1 << N); i++)
  {
    string A = "", B = "";
    for (auto j = 0; j < N; j++)
    {
      if ((i >> j) & 1)
      {
        A = A + S[j];
      }
      else
      {
        B = B + S[j];
      }
    }
    auto it = P(A, B);
    if (M.find(it) != M.end())
    {
      /*
      if (N < 12)
      {
        cerr << "A = " << A << ", B = " << B
             << ", M = " << M[it] << endl;
      }
      */
      ans += M[it];
    }
  }
  return ans;
}

int main()
{
  cin >> N >> S;
  T = S.substr(N, N);
  S = S.substr(0, N);
  reverse(T.begin(), T.end());
  make_dic();
  cout << cnt_dic() << endl;
}

Measured memory_bytes: 44032
import java.util.Scanner;

public class Main {


    static double next(double y, double q) {
        return y - (Math.pow(y, 3) - q) / (Math.pow(y, 2) * 3);
    }

    static double error(double y, double q) {
        return Math.abs(Math.pow(y, 3) - q);
    }

    public static void main(String... args) throws Exception {

        Scanner sc = new Scanner(System.in);
        while (true) {
            double q = (double) sc.nextInt();
            if (q < 0) break;
            double x = q / 2;
            while (error(x, q) >= q*0.00001) {
                x = next(x, q);
            }
            System.out.println(x);
        }
    }
}

Measured memory_bytes: 17228
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
h=abs(A-(T-(H[0]*0.006)))
m=1
for i in range(1,N):
    if h>abs(A-(T-(H[i]*0.006))):
        h=abs(A-(T-(H[i]*0.006)))
        m=i+1
print(m)

Measured memory_bytes: 62304
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < int(Y);++(X))
#define rrep(X,Y) for (int (X) = int(Y-1);(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int v,e;

int main(){
  int i,j,k;
  cin>>v>>e;
  vector<char> cs(v);
  vector<int> edges[v];
  rep(i,v)
    cin>>cs[i];
  int te,mp;
  rep(i,e){
    cin>>te>>mp;
    edges[te].pb(mp);
    edges[mp].pb(te);
  }
  rep(i,v){
    if(cs[i]!='?')continue;
    vector<int> memo(256,0);
    rep(j,edges[i].size())
      memo[cs[edges[i][j]]]=1;
    char cc;
    for(cc='a';cc<='z';cc++)
      if(!memo[cc])break;
    cs[i]=cc;
  }
  rep(i,v)
    cout<<cs[i];cout<<endl;
  return 0;
}


Measured memory_bytes: 7868
def update(s, x, y, h, w):
    if s[x][y] == ".":
        s[x][y] = 0
        return
    if type(s[x][y]) is int:
        return

    for i in range(-1, 2):
        for j in range(-1, 2):
            if i == 0 and j == 0:
                continue
            if x + i not in range(0, H) or y + j not in range(0, W):
                continue

            if s[x + i][y + j] == ".":
                s[x + i][y + j] = 1
            elif type(s[x + i][y + j]) is int:
                s[x + i][y + j] += 1
            else:
                continue


if __name__ == "__main__":
    H, W = [int(x) for x in input().split(" ")]
    S = [list(input()) for _ in range(H)]
    for i in range(H):
        for j in range(W):
            update(S, i, j, H, W)
    for s in S:
        for item in s:
            print(item, end="")
        print()

Measured memory_bytes: 3444
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	H := nextInt()
	W := nextInt()
	as := make([]string, H)
	for i := 0; i < H; i++ {
		as[i] = nextString()
	}

	s := make([]rune, W+2)
	for i := 0; i < W+2; i++ {
		s[i] = '#'
	}

	fmt.Println(string(s))
	for _, a := range as {
		fmt.Print("#")
		fmt.Print(a)
		fmt.Println("#")
	}
	fmt.Println(string(s))
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
n,k = map(int, input().split())
D=[]
A=[]
for i in range(1,k+1):
    d = set(map(int, input().split())) 
    a = set(map(int, input().split())) 
    D.extend(d)
    A.extend(a)
l = set(A)
print(n-len(l))

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
//#pragma GCC optimize(2)
using namespace std;
//const double eps=1e-6;
//typedef complex<double>C;
//const double PI(acos(-1.0));
//for(int mask=i;mask>0;mask=(mask-1)&i)
//int a[25]= { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 };
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){int s=0;while(x){s+=BIT[x];x-=x&-x;}return s;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a,LL b){LL t=1;for(;b;b>>=1,a=a*a%M)b&1?t=t*a%M:0;return t;}
//log() = ln() , log(x)/log(y)=log(y)-base-x
//INT_MAX 127,INT_MIN 128
//isalnum() decimal digit or an uppercase or lowercase letter
//int dw[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
//int dw[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
//cout<<fixed<<setprecision(12)<<ans<<endl;
//__builtin_popcount(mask)
const int N=200010;
const int M=1e9+7;

int n;
int a[3];
int main() {
	REP(i,3)
		cin>>a[i];
	sort(a,a+3);
	int k;
	cin>>k;
	LL t=a[0]+a[1]+(a[2]<<k);
	cout<<t<<endl;
}

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

using namespace std;

bool isSameCharacter(char c1, char c2);

int main(){
	int count = 0;
	string W, T;
	cin >> W;
	while(1){
		cin >> T;
		if("END_OF_TEXT" == T){ break; }
		if(W.length() == T.length()) {
			for(int i = 0; i < W.length(); ++i){
				if(!isSameCharacter(W[i], T[i])) { break; }
				if(W.length() - 1 == i) { count++; }
			}				
		}
	}
	cout << count << endl;
	return 0;
}

bool isSameCharacter(char c1, char c2){
	if(c1 == c2) { return true; }

	if('A' <= c1 && c1 <= 'Z'){
		if(c1 + ('a' - 'A') == c2) { return true; }
	}
	else if('a' <= c1 && c1 <= 'z') {
		if(c1 - ('a' - 'A') == c2) { return true; }
	}
	return false;
}


Measured memory_bytes: 3132
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji Rabbi Minkulli Jamio
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
int i,j,k;
 main()
 {
     int a,b,h;
     cin>>a>>b>>h;
     cout<<((a+b)*h)/2<<endl;
 }


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

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

    int64_t sum=0;
    for(int i=1;i<=N;i++){
        int64_t D=N/i;
        sum+=i*D*(D+1)/2;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
ll a, b, c, k;

int main(){
	IOS
	cin >> a >> b >> c >> k;
	if(k<=a){
		cout << k << '\n';
	}
	else if(a+b>=k){
		cout << a << '\n';
	}
	else{
		cout << a-(k-a-b) << '\n';
	}
}

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

int main()
{
    int n,k,sum=0;
    cin>>n>>k;
    int ara[n+2];
    for(int i=0;i<n;i++) cin>>ara[i];
    sort(ara,ara+n,greater<int>());
    for(int i=0;i<k;i++) sum+=ara[i];
    cout<<sum<<endl;
}


Measured memory_bytes: 256
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
 
for item in F:
  votes = int(item)
  X.append(votes)

S = sum(X)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Char

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, k] <- getIntList
    s <- getLine
    putStr $ take (k - 1) s
    putChar . toLower . head $ drop (k - 1) s
    putStrLn $ drop k s

Measured memory_bytes: 380
#include<iostream>
using namespace std;
int main(void){
  int a= 0;
  string s,t;
  cin >> s >> t;
  for(int i = 0;i < s.size();i++){
    if(s.at(i) == t.at(i)){
      a++;
    }
  }
      cout << a;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef  long long   ll;
typedef  long double ld;
#define ceil(n, m) ((n / m) + ( n % m ? 1 : 0))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
int n, m;
const int mod = 1e9 + 7;
vector<string> grid;
vector<vector<int>> dp;
bool valid(int i, int j) {
	return i < n && j < m && grid[i][j] == '.';
}
int solve(int i, int j, int dep = 0) {
	if (!valid(i, j))
		return 0;
	//cout << string(dep, ' ') << i << " " << j << '\n';
	if (i == n - 1 && j == m - 1)
		return 1;
	int& ret = dp[i][j];
	if (~ret)
		return ret;
	int p1 = solve(i + 1, j, dep + 1);
	int p2 = solve(i, j + 1, dep + 1);
	return ret = (p1%mod + p2%mod)%mod;

}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);
	cin >> n >> m;
	grid = vector<string>(n);
	dp = vector<vector<int>>(n, vector<int>(m, -1));
	for (int i = 0; i < n; ++i)
		cin >> grid[i];
	cout << solve(0, 0);


}


Measured memory_bytes: 8732
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int maxn = 2000005;
const int mod = 998244353;
const int inf = 1<<30;

void solve(){
	string s;
	cin >> s;
	int cont =0;
	int ans =0;
	for(char c : s){
		if(c == 'R') cont++;
		else {
			ans = max(ans,cont);
			cont =0;
		}
	}
	ans = max(ans,cont);
	cout << ans << endl;
}

int main(){__
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3632
import itertools

def main():
    N = int(input())
    P = list(map(int,input().split()))
    Q = list(map(int,input().split()))

    N_range = [i for i in range(1,N+1)]

    p = list(itertools.permutations(N_range,N))
    #print(list(p[0]))
    #print(P)

    start = 0
    end = 0

    for i in range(len(p)):
        if(list(p[i]) == P):
            start = i
        if(list(p[i]) == Q):
            end = i

    if(start > end):
        print(start - end)
    else:
        print(end - start)

if __name__ == "__main__":
    main()

Measured memory_bytes: 8052
#include <bits/stdc++.h> 
using namespace std;
#define int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
#define N 201000
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define mp make_pair
#define INF 1000000000000000000
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)


signed main() 
{
    speed;
    //freopen("input.tXt","r",stdin);
    //freopen("output.tXt","w",stdout);

    int n;
    cin>>n;
    int dp[n][3];
    fn(i,n)
    {
        int a,b,c;
        cin>>a>>b>>c;
        if(i==0) dp[i][0]=a,dp[i][1]=b,dp[i][2]=c;
        else
        {
            dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
            dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
            dp[i][2]=c+max(dp[i-1][1],dp[i-1][0]);
        }
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
}   

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))
#define MAX(x,y) ((x)<(y)?(y):(x))

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

#define INF 1000000000

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

ll twoRow(ll a, ll b, ll mod)
{
	ll ret = 1;
	for(ll i = 1 ;i <= a+b;++i)
	{
		ret *= i;
		ret %= mod;
	}
	for(ll i = 1 ;i <= a;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	for(ll i = 1 ;i <= b;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	return ret;
}

struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return (ret);
}

int main()
{
	ll N,M,P;
	ll i,j,k;
	ll a,b,c;
	ll d[4096] = {0};
	vector<edge> edges; //移動の情報を保存する
	cin>>N>>M>>P;
	struct edge e;
	fill(d, d+4096, INF);
	d[0] = 0;
	for(i=0;i<M;++i)
	{
		cin>>a>>b>>c;
		e.from = a-1;
		e.to   = b-1;
		e.cost = P-c;
		edges.push_back(e);
	}
	k = 0;
	a = 0;
	for (i = 0; i < N*3; i++) {
        for (j = 0; j < M; j++) {
            e = edges[j];
            if (d[e.to] > d[e.from] + e.cost) {  //移動した後のコストが小さいと、頂点のコストを更新
                d[e.to] = d[e.from] + e.cost;
                if (i == N-1) {         //頂点の数と同じ回数ループすると、負の閉路があるのでループをぬける
                    k = 1;
                } 
                if(k==1&&e.to==N-1&&i >= N) {
                	cout << -1 << endl;
                	return 0;
                }
            }
        }
    }
	cout << MAX(-d[N-1],0) << endl;
	return 0;
}




















Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

int main()
{
  string a,b,c;
  cin >> a >> b >> c;
  printf("%c%c%c\n",toupper(a[0]),toupper(b[0]),toupper(c[0]));
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end()
#define int long long
#define double long double
main()
{
	string s, t;
	cin >> s >> t;
	map<char, char> S, T;
	for (int i = 0; i < s.size(); ++i)
	{
		if (S.count(s[i]) == 0)
		{
			S[s[i]] = t[i];
		}
		if (T.count(t[i]) == 0)
		{
			T[t[i]] = s[i];
		}
		if(S[s[i]] != t[i] || T[t[i]] != s[i])
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 776
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    cout<<s[0]<<s.size()-2<<s.back()<<endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sn = 0;
        int m = n;
        while (m > 0) {
            sn += m % 10;
            m /= 10;
        }
        System.out.println((n % sn == 0 ? "Yes" : "No"));
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll n, cnt, ans;

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	n = read();
	if (n % 2 == 0 || n % 10 == 5){
		puts("-1");
		exit(0);
	}
	cnt = 7, ans = 1;
	for (ll i = 1; cnt % n > 0; ++i){
		cnt = (cnt * 10 + 7) % n;
		ans++;
	}
	printf("%lld\n", ans);
	
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define endl        '\n'
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b)
#define pf(x) 		push_front(x)
#define pb(x)       push_back(x)
#define eb(x)		emplace_back(x)
#define all(x)      (x).begin(), (x).end()
#define rall(x) 	(x).rbegin(), (x).rend()
#define sz(x) 		(int)x.size()
#define debug(x) 	cerr << #x << " = " << (x) <<endl
#define unsyncIO    ios_base::sync_with_stdio(0); cin.tie(0)

const ld PI = acos((ld)-1);
const int MOD = 1e9+7;
const ll INF = 1e18; 

using namespace std;

int main()
{
    //freopen("/home/taalpatar_shepai/Documents/my_codes/out.txt", "w", stdout);
    char a, b;
    cin >> a >> b;
    if (a == 'H')
        cout << b << endl;
    else if(a == 'D') {
        if(b == 'H')
            cout << 'D';
        else if(b == 'D')
            cout << "H" << endl;
    }
    return 0;
}

Measured memory_bytes: 3492
n = int(input())
s = list(input())
l = 0
r = n-1
c = 0
while l < r:
  for i in range(l, r):
    if s[i] == "W":
      c += 1
      l = i+1
      break
  else:
    l = r
  for i in range(r, l-1, -1):
    if s[i] == "R":
      r = i-1
      c += 1
      break
  else:
    r = l

print(c//2)
      
    

Measured memory_bytes: 10812
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while(sc.hasNext()) {
			String[] numbers = sc.nextLine().split(" ");

			Integer ans = Integer.parseInt(numbers[0]) + Integer.parseInt(numbers[1]);
			System.out.println(String.valueOf(ans).length());
		}

	}

}

Measured memory_bytes: 26376
s = input()
ans = 1
num = 1 #文字数

if len(s) == 1:
    print(1)
    exit()


for i in range(1, len(s)):
    if num == 1:
        if s[i - 1] != s[i]:
            ans += 1
        else:
            if i != len(s) - 1:
                num = 2
                ans += 1
    elif num == 2:
        num = 1.5
    elif num == 1.5:
        ans += 1
        num = 1
print(ans)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int func(int k){
  int a,b,x;
  a = k%10;
  b = k/10;
  x = a*b;
  return x;
}

int main() {
  int m,d;
  cin >> m >> d;
  int ans = 0;
  for(int i=1;i<=m;i++){
    for(int j=1;j<=d;j++){
      if(i == func(j) && j%10 >=2 && j/10 >= 2){
        ans++;
      }
    }
  }
  cout << ans << endl;  
  
  return 0;
}


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define REPR(i, n) for (ll i = (n); i >= 0; i--)
#define FOR(i, m, n) for (ll i = (m); i < (n); i++)
#define FORR(i, m, n) for (ll i = (m); i >= (n); i--)
#define INF 1e9
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define dump(x) cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl

int main(int argc, char const *argv[])
{
    double n, k;
    cin >> n >> k;
    double res = 1.0;
    double y = 0.0;
    FOR(i, 1, n + 1)
    {
        if (i >= k)
            continue;
        double x = ceil(log2(k / i));
        // dump(x);
        // double y = (1.0 / n) * pow(1.0 / 2.0, x);
        y += (1.0 / n) * (1.0 - pow(0.5, x));
    }
    res -= y;
    cout << std::setprecision(13) << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) puts("error")
    #define rep(i,l,r) for(int i=(l);i<=(r);i++)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;GG(e<0);
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=400+10;

    ll fac[N],facinv[N];
    ll f[N][N];ll a[N][N],b[N],aa[N];
    void main()
    {
        fac[0]=1;for(int i=1;i<N;i++) fac[i]=fac[i-1]*i%MOD;
        facinv[N-1]=invm(fac[N-1]);for(int i=N-2;i>=0;i--) facinv[i]=facinv[i+1]*(i+1)%MOD;

        int n=qread(),Sa=0,Sb=0;
        for(int i=1;i<=n;i++) aa[i]=qread(),Sa+=aa[i],b[i]=qread(),Sb+=b[i];
        for(int i=1;i<=n;i++)
        {
            a[i][0]=1;a[i][1]=aa[i];
            for(int t=2;t<N;t++) a[i][t]=a[i][t-1]*a[i][1]%MOD;
        }

        f[0][0]=MOD-1;
        for(int i=1;i<=n;i++) for(int sa=Sa;sa>=0;sa--) for(int sb=Sb;sb>=0;sb--) if(f[sa][sb])
            for(int ad=0;ad<b[i];ad++) add(f[sa+aa[i]][sb+ad],MOD-f[sa][sb]*a[i][ad]%MOD*facinv[ad]%MOD );
        ll ans=0;
        for(int sa=1;sa<=Sa;sa++) for(int sb=0;sb<=Sb;sb++)
            add(ans, f[sa][sb]*fac[sb]%MOD*Sa%MOD*invm( qpower(sa,sb)*sa%MOD )%MOD );
        write(ans);
    }
};//(ans+MOD)%MOD
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 2816
a=int(input())
b=[]
for _ in range(a):
    b.append(input())
if len(b)!=len(set(b)):
    print('No')
    exit()
for i in range(a-1):
    if b[i][-1]!=b[i+1][0]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 9084
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        long[] h = new long[n];
        for (int i = 0; i < n; i++) {
            h[i] = std.nextInt();
        }

        boolean isNone = false;
        for (int i = n - 1; i > 0; i--) {
            long diff = h[i] - h[i - 1];
            if (diff < 0) {
                diff++;
                h[i - 1] = h[i - 1] - 1;
            }

            if (diff < 0) {
                isNone = true;
                break;
            }
        }

        if (isNone) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 50576
#include<stdio.h>

int main(void){
  int a,b,i,n,ans=0;
  scanf("%d %d",&a,&b);
  n = b-a;
  for(i=0;i<n;i++){
    ans+=i;
  }
  ans = ans-a;
  printf("%d\n",ans);
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N)cin >> A[i];
    vector<int> nums;
    int cnt = 0;
    rep(i,N){
        cnt++;
        if(A[i]==A[i+1]){
            nums.push_back(cnt);
            cnt=0;
        }
    }
    nums.push_back(cnt);
    int res = 0;
    for(int i=0;i+2<nums.size();i++){
        res = max(res,nums[i]+nums[i+1]+nums[i+2]);
    }
    if(nums.size()<3){
        rep(i,nums.size())res+=nums[i];
    }
    cout << res <<  endl;
    return 0;
}


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

int main(void) {
  int N, M;
  cin >> N >> M;
  int maxx = M / N;
  for (int x = maxx; x >= 1; x--) {
    if ((M - x * N) % x == 0) {
      cout << x << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
//
// Created by ?????°?????? on 2016/05/15.
//

#include <iostream>
#include <vector>
#include <stack>
using namespace std;

const int MAX = (1 << 21);
const int NIL = -1;

int n;
vector <int> G[MAX];
int color[MAX];

void dfs(int r,int c){
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(! S.empty()){
        int u = S.top(); S.pop();
        for (int i = 0; i < G[u].size() ; ++i) {
            int v = G[u][i];
            if (color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for (int i = 0; i < n ; ++i)  color[i] = NIL;
    for (int u = 0; u < n ; ++u) {
        if(color[u] == NIL) dfs(u,id ++);
    }
}

int main(){
    int s,t,m,q;
    cin >> n >> m;
    for (int i = 0; i < m ; ++i) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    assignColor() ;
    
    cin >> q;
    for (int i = 0; i < q ; ++i) {
        cin >> s >> t;
        if (color[s] == color[t]){
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 53880
import math

a,b,h,m = map(int, input().split())

hAngle = 360*((h/12) + (1/12) * (m/60))
mAngle = 360*(m/60)

angle = abs(hAngle - mAngle)

c = a*a + b*b - 2*a*b*math.cos(math.radians(angle))

print(math.sqrt(c))

Measured memory_bytes: 9416
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  vector<ll> num(13);
  num[4] = 1;
  num[6] = 1;
  num[9] = 1;
  num[11] = 1;
  num[2] = 2;
  int a, b;
  cin >> a >> b;
  if(num[a] == num[b]) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 3628
#D問題
N=int(input())
S=str(input())
Slist=list(S)
BSUM=Slist.count("#")
WSUM=Slist.count(".")
Lb=[]
Rw=[]
for i in range(N+1):
    if i == 0:
        Lb.append(0)
        Rw.append(WSUM)
    else:
        if Slist[i-1] == "#":
            Lb.append(Lb[i-1]+1)
            Rw.append(Rw[i-1])
        else:
            Lb.append(Lb[i-1])
            Rw.append(Rw[i-1]-1)
MIN=2000001
for i in range(N+1):
    kari=Lb[i]+Rw[i]
    MIN=min(MIN,kari)
print(MIN)

Measured memory_bytes: 14388
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cstring>

// ---------- PBDS -----------------

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
// slow but fast ORZ :)
// ----------------------------------

using namespace std;
using namespace __gnu_pbds; 

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a) // care when use
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
// #define ll long long int
#define int long long int

#define DEBUG

#ifdef DEBUG

    #define debug(args...)(Debugger()) , args

    class Debugger{
        public:
        Debugger(const std::string& _separator = " | ") :
        first(true), separator(_separator){}

        template<typename ObjectType> Debugger& operator , (const ObjectType& v)
        {
            if(!first)
                std::cerr << separator;
            std::cerr << v;
            first = false;
            return *this;
        }
        ~Debugger() {  std::cerr << std::endl;}

        private:
        
        bool first;
        std::string separator;
    };

#else
    #define debug(args...)
#endif

void solve(){

	string s;
	cin >> s;

	if(s[0] == 'R' and s[1] == 'R' and s[2] == 'R'){
		cout << 3 << "\n";
	}else if((s[0] == 'R' and s[1] == 'R') or (s[1] == 'R' and s[2] == 'R')){
		cout << 2 << "\n";
	}else if(s[0] == 'R' or s[1] == 'R' or s[2] == 'R'){
		cout << 1 << "\n";
	}else{
		cout << 0 << "\n";
	}

}


int32_t main(){

	boost;
	
	int T;
	
	// cin >> T;
	T = 1;
	
	while(T--){
		solve();
	}
}



Measured memory_bytes: 3632
while true
  m, l, r = gets.chomp.split.map(&:to_i)
  break if m == -1 && l == -1 && r == -1

  if m == -1 || l == -1
    puts 'F'
  elsif m + l >= 80
    puts 'A'
  elsif m + l >= 65
    puts 'B'
  elsif m + l >= 50 || r >= 50
    puts 'C'
  elsif m + l >= 30
    puts 'D'
  else
    puts 'F'
  end
end



Measured memory_bytes: 6872
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
using namespace std;
using ll = long long;
using Lf = long double;
using plong = pair<ll,ll>;
const int mod = 1000000007;
vector<ll> prime(ll _max){
    vector<ll> res;
    res.push_back(2);
    for(ll i=3;i<=_max;i+=2){
        bool flag = true;
        for(ll j=0;j<res.size();j++){
            if(i%res[j]==0)flag=false;
            if(res[j]*res[j]>i)break;
        }
        if(flag){
            res.push_back(i);    
        }
    }
    return res;

}
int main(){
    ll N;
    cin>>N;
    vector<ll> ps = prime(55555);
    ll cnt=0;
    for(ll i=0;;i++){
        if(ps[i]%5==1){
            cout<<ps[i]<<" ";
            cnt++;
        }
        if(cnt>=N)break;
    }
    cout<<endl;

}

Measured memory_bytes: 384
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var a     = long.Parse(spl[0]);
        var b     = long.Parse(spl[1]);
        var c     = long.Parse(spl[2]);
        var k     = long.Parse(spl[3]);

        //a-b  b-a   a-b     b-a
        //(a) (b+c) (2a+b+c) (2a+3b+3c)
        //(b) (a+c) (a+2b+c) (3a+2b+3c)
        //(c) (a+b) (a+b+2c) (3a+3b+2c)

        long y = (k%2 == 0) ? a-b : b-a;

        if(Math.Abs(y) > 1000000000000000000) return "Unfair";
        return y;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }

}


Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	
	int a, b;
	
	scanf("%d %d", &a, &b);
	
	if (a < b){
		printf("a < b\n");
	}
	else if (a > b){
		printf("a > b\n");
	}
	else {
		printf("a == b\n");
	}
	
	
	return (0);
}

Measured memory_bytes: 580
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
void YN(bool ans){
    if(ans)cout<<"Yes"<<endl;
    else cout <<"No"<<endl;
    return;
}
int main(){
    ll A,B,C,D;
    cin>>A>>B>>C>>D;
    YN((A-1)/D >= (C-1)/B);
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
const int MD = 1e9+7;
int n, c, a[405], b[405];
long long e[405][405], f[405][405], dp[405] = {1};
int main(){
	scanf("%d%d", &n, &c);
	rep(i,401) rep(j,401) f[i][j] = j ? f[i][j-1] * i % MD : 1; // i^j
	rep(i,401) rep(j,401) if(j) e[i][j] = (e[i][j-1] + f[j][i]) % MD;
	rep(i,n) scanf("%d", a+i);
	rep(i,n) scanf("%d", b+i);
	rep(i,n) for(int j = c; j >= 0; j--){
		long long t = 0;
		rep(k,j+1) (t += dp[j-k] * (e[k][b[i]] - e[k][a[i]-1] + MD)) %= MD;
		dp[j] = t;
	}
	printf("%lld\n", dp[c]);
}

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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int s, ss;
	s = a * b;
	ss = c * d;
	if (s > ss)
		cout << s << endl;
	else
		cout << ss << endl;
}

Measured memory_bytes: 256