akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace Ex160506_1{
    public class Program{
        public static void Main(string[] args){
            while(true){
                var input = Console.ReadLine().Split(' ');
                var h = int.Parse(input[0]);
                var w = int.Parse(input[1]);

                if(h + w == 0) break;
                Enumerable.Repeat(Enumerable.Repeat('#', w).ToArray(), h).ToList().ForEach(Console.WriteLine);
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9348
#include <stdio.h>//??????????????????????????¢???????????????????????°
#include <string.h>

int main(void)
{
	char c[1201]={0};
	int al[52];
	int i=0, l;
	memset(&al, 0, sizeof(al));

	for (;;)
	{
		
		if (scanf("%c", &c[i]) == -1)
		{
			break;
		}
		i+=1;
	}

	for (l=0;l<i;l++)
	{
		if(c[l] >= 'a' && c[l] <= 'z') {
			al[c[l]-'a']+=1;
		} else if (c[l] >= 'A' && c[l] <= 'Z') {
			al[c[l]-'A']+=1;
		}
	}

	for (i=0;i<='z'-'a';i++)
	{
		printf("%c : %d\n", i+'a', al[i]);
	}
	return 0;
}

Measured memory_bytes: 540
#include <bits/stdc++.h>
using namespace std;
const int MAXN=100010;
int n,a,ans[MAXN];
int main () {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d",&a);
		ans[a]=i;
	}
	for (int i=1;i<=n-1;i++) {
		printf("%d ",ans[i]);
	}
	printf("%d\n",ans[n]);
	return 0;
}

Measured memory_bytes: 1152
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    V vec1(n);
    rep(i, n) cin >> vec1[i];
    V vec2(n);
    rep(i, n) cin >> vec2[i];
    V vec3 = vec1;
    V vec4 = vec2;
    sort(all(vec3));
    sort(all(vec4));
    ll rega = 0;
    do{
        bool h = true;
        rep(i,n){
            if(vec1[i]!=vec3[i]){
                h = false;
                break;
            }
        }
        if(h){
            break;
        }else{
            rega++;
        }
    } while (next_permutation(all(vec3)));
    ll regb = 0;
    do
    {
        bool h = true;
        rep(i, n)
        {
            if (vec2[i] != vec4[i])
            {
                h = false;
                break;
            }
        }
        if (h)
        {
            break;
        }
        else
        {
            regb++;
        }
    } while (next_permutation(all(vec4)));
    cout << abs(rega - regb) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,l,r) for (ll i = (ll)l; i < (ll)(r); i++)

int main(){
  ll N;
  cin >> N;
  ll ans = 0;
  rep(i,1,N+1){
    ll c = i;
    ll cnt = 1;
    while(c <= N){
      ans += c;
      cnt++;
      c = i*cnt;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3616
# ALDS_10_C - 最長共通部分列

import sys


# def main():
#     q = int(input())
#
#     for _ in range(q):
#         X = list(str(sys.stdin.readline().strip()))
#         Y = list(str(sys.stdin.readline().strip()))
#
#         dp = [[0] * (len(X) + 1) for _ in range(len(Y) + 1)]
#
#         for y in range(len(Y)):
#             for x in range(len(X)):
#                 dp[y + 1][x + 1] = max(dp[y][x + 1], dp[y + 1][x])
#                 if X[x] == Y[y]:
#                     dp[y + 1][x + 1] = dp[y][x] + 1
#
#         print(dp[-1][-1])


def main():
    q = int(input())

    for _ in range(q):
        X = list(str(sys.stdin.readline().strip()))
        Y = list(str(sys.stdin.readline().strip()))

        dp = [0] * (len(X) + 1)

        for y in range(len(Y)):
            dp2 = dp[:]
            # print(dp2)
            for x in range(len(X)):
                if X[x] == Y[y]:
                    dp[x + 1] = dp2[x] + 1
                elif dp[x + 1] < dp[x]:
                    dp[x + 1] = dp[x]

        print(dp[-1])


if __name__ == '__main__':
    main()




Measured memory_bytes: 5640
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#pragma comment(linker, "/STACK: 20000000005")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

const int N = 3e5 + 5, MOD = 1e9 + 7;


int n;
string s;
int A, B, C, D;

bool F[2][N];

void dfs (int x, int y, int k){
    F[k][x] = 1;
    for (int i = x + 1; i <= x + 2 && i <= y; i++)
        if (F[k][i] == 0 && s[i] == '.')
            dfs (i, y, k);
}


int main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin >> n >> A >> B >> C >> D >> s;
    s = "#" + s;
    dfs (A, C, 0);
    dfs (B, D, 1);
    if (F[0][C] == 0 || F[1][D] == 0){
        cout << "No" << endl;
        return 0;
    }
    if (C < D){
        cout << "Yes" << endl;
        return 0;
    }
    for (int i = 1; i + 1 <= D && i + 2 <= C; i++){
        if (F[0][i] == 1 && F[1][i + 1] == 1 && s[i + 2] == '.'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3216
#include <stdio.h>
#include <math.h>
int sosuu(int);

int main(){
  int n,a,i;
  int count = 0;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&a);
    if(1 == sosuu(a))count++;
  }
  printf("%d\n",count);
}

int sosuu(int a){//素数=1
  int i = 3;
  if(a == 2) return 1;
  if(a < 2 || a % 2 == 0) return 0;
  while(i <= sqrt(a)){
    if(a % i == 0) return 0;
    i = i + 2;
  }
  return 1;
}



Measured memory_bytes: 2052
#include<stdio.h>
#include<math.h>
int main(){
	int n;
	while(scanf("%d",&n),n+1){
		float x=1, y=0, r, t;
		while(--n){
			r = hypotf(x,y);
			t = x-y/r;
			y = y+x/r;
			x = t;
		}
		printf("%f\n%f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 0
using System;

namespace Ex160424_1{
    public class Program{
        public static void Main(string[] args){
            var n = int.Parse(Console.ReadLine());
            for(var i = 1; i <= n; i++){
                if(i % 3 == 0 || i.ToString().IndexOf('3') != -1){
                    Console.Write(" " + i);
                }
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9264
#include <set>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstdlib>
#include <complex>

#define REP(i,n) for(int i=0; i<(int)(n); i++)
inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

typedef complex<double> P;

int main(){
  while(const int n = getInt()){
    vector<P>   pos(n);
    vector<double> v(n);

    REP(i,n){
      const int x = getInt();
      const int y = getInt();
      v[i] = getInt();
      pos[i] = P(x, y);
    }

    const double r = 0.98;
    P p(0, 0);

    auto calc = [&](P p){
      auto mx = make_pair(0.0, 0);
      REP(i,n) mx = max(mx, make_pair(abs(p - pos[i]) / v[i], i));
      return mx;
    };

    for(double d = 10; d > 1e-8; d *= r){
      auto mx = calc(p).second;
      p += (pos[mx] - p) / abs(pos[mx] - p) * d;
    }

    printf("%.8f\n", calc(p).first);
  }

  return 0;
}

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

int main(){
	int n;
	cin>>n;
	long a[n];
	for(int i=0;i<n;++i)cin>>a[i];
	vector<long>oddarr,evenarr;
	for(int i=0;i<n;++i){
		if(i%2==0)evenarr.push_back(a[i]);
		else oddarr.push_back(a[i]);
	}
	if(n%2==0){
		reverse(oddarr.begin(),oddarr.end());
		for(int i=0;i<n/2;++i){
			cout<<oddarr[i]<<" ";
		}
		for(int i=0;i<n/2;++i){
			cout<<evenarr[i]<<" ";
		}
		cout<<endl;
	}
	else{
		reverse(evenarr.begin(),evenarr.end());
		for(int i=0;i<n/2+1;++i){
			cout<<evenarr[i]<<" ";
		}
		for(int i=0;i<n/2;++i){
			cout<<oddarr[i]<<" ";
		}
		cout<<endl;
	}
}


Measured memory_bytes: 5484
#include "bits/stdc++.h"
using namespace std;  
 
#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }
 
const int MAXN=5000;
const int MAXK=5000;
 
int n,k;
int a[MAXN];
 
bool can[MAXK];
 
bool isneeded(int x) {
	if(x>=k) return true;
	memset(can,false,sizeof(can)); can[0]=true;
	int skip=-1; REP(i,n) if(a[i]==x&&skip==-1) skip=i;
	REP(i,n) if(i!=skip) for(int j=k-1;j>=0;--j) if(can[j]&&j+a[i]<k) can[j+a[i]]=true;
	REP(i,k) if(can[i]&&i+x>=k) return true;
	return false;
}
 
void run() {
	scanf("%d%d",&n,&k); REP(i,n) scanf("%d",&a[i]); sort(a,a+n);
	int l=-1,h=n; // (l,h]
	while(l+1<h) {
		int m=l+(h-l)/2;
		if(isneeded(a[m])) h=m; else l=m;
	}
	cout<<h<<endl;
}
 
int main() {
	run();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
 
const int MAX_N = 9;
int a[MAX_N];
   
int main(){
 
    for(int i=0; i<=MAX_N; i++){
        cin >> a[i];
    }
      
    sort(a, a+10);
    cout << a[9] << endl << a[8] << endl << a[7] << endl;
 
    return 0;
}

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

int s[100010] = {};
int p[100010] = {};

vector<int> v[100010];

int main() {
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; ++i) {
        int k;
        cin >> k;
        for(int j = 0; j < k; ++j) {
            int s;
            cin >> s;
            s--;
            v[i].push_back(s);
        }
    }
    for(int i = 0; i < M; ++i) {
        scanf("%d", p+i);
    }

    int ans = 0;
    for(int i = 0; i < 1 << N; ++i) {
        bool ok = true;
        for(int j = 0; j < M; ++j) {
            int on = 0;
            for(int k : v[j]) {
                if(i >> k & 1) on++;
            }
            if(!((p[j] == 0 && on % 2 == 0) || (p[j] == 1 && on % 2 == 1))) {
                ok = false;
                break;
            }
        }
        if(ok) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll N,X,D;
    cin>>N>>X>>D;
    if(D==0){
        cout<<(X?N+1:1)<<endl;
        return 0;
    }
    if(D<0){
        D=-D;
        X=-X;
    }
    ll x=X;
    if(X<0){
        x=X+(-X/D+1)*D;
    }
    map<int,vector<pair<ll,ll>>> mp;
    for(ll k=0;k<=N;++k){
        pair<ll,ll> p=make_pair(X*k/D+k*(k-1)/2,X*k/D+N*(N-1)/2-(N-k)*(N-k-1)/2);
        mp[x*k%D].push_back(p);
    }
    ll ans=0;
    for(auto v:mp){
        vector<pair<ll,ll>> V=v.second;
        sort(All(V));
        ll r=-1e18;
        //cout<<v.first<<endl;
        REP(i,V.size()){
            if(V[i].first>r){
                ans+=V[i].second-V[i].first+1;
            }
            else if(V[i].second>r){
                ans+=V[i].second-r;
            }
            r=max(r,V[i].second);
            //cout<<V[i].first<<" "<<V[i].second<<endl;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 22144
#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() {
    string s;
    cin>>s;
    int x=0;
    for (char c:s){
        x+=(c - '0');
        
    }
    int ans=x %9;
    if(ans==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
  return 0;
}


Measured memory_bytes: 3752
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
  int ans = 1;
  int a,b;

  cin >> a >> b;

  if(b == 1) cout << 0 << endl;
  else {
  int i;
  for(i = 1;a + (a - 1) * (i - 1) < b;i++){}

  cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// garnab27
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ll int64_t
#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
ll modex(ll a,ll b,ll p){ll res=1;a%=p;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b>>=1;}return res;}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};

int a[100005],b[100005];
int n;

ll dp[102][100005];

ll maximum(int i,int p){
	//cout<<i<<" "<<p<<"\n";
	if(i==n)
		return 0;

	if(dp[i][p]!=-1) return dp[i][p];

	ll w=0;

	if(a[i]<=p)
		w=max(w,maximum(i+1,p-a[i])+b[i]);

	w=max(w,maximum(i+1,p));

	return dp[i][p]=w;
}

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

	memset(dp,-1,sizeof dp);

	int w;
	cin>>n>>w;

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

	ll ans=maximum(0,w);

	cout<<ans;

	return 0;
}


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

using namespace std;

int main(void) {
  int n;
  cin >> n;

  vector<int> a(n);
  int ans = 60;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int cnt = 0;
    while (a[i] % 2 == 0) {
      a[i] >>= 1;
      cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
int main(){
  string n;
  cin>>n;
  if(n[0]==n[1]&&n[1]==n[2]||n[3]==n[1]&&n[1]==n[2]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
 
  return 0;
}

Measured memory_bytes: 256
# by the authority of GOD   author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase
from collections import Counter

def main():
    n = int(input())
    arr = list(map(int,input().split()))
    x = max(arr)
    sieve = [[] for _ in range(x+1)]
    lst = [0]*(x+1)
    for i in range(2,x+1):
        if lst[i]:
            continue
        lst[i] = 1
        sieve[i].append(i)
        y = 2*i
        while y <= x:
            lst[y] = 1
            sieve[y].append(i)
            y += i
    pr = Counter()
    for i in arr:
        for x in sieve[i]:
            pr[x] += 1
    fl = 0
    fl1 = 0
    for p in pr:
        if pr[p] > 1:
            fl = 1
        if pr[p] == n:
            fl1 = 1
    if not fl:
        print('pairwise coprime')
    elif not fl1:
        print('setwise coprime')
    else:
        print('not coprime')



#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

Measured memory_bytes: 263968
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    worst_score = 10 ** 12

    n, k = ns()
    a = na()
    f = na()
    a.sort()
    f.sort(reverse=True)
    score = [ai * fi for ai, fi in zip(a, f)]

    l = -1
    r = worst_score + 1

    while r - l > 1:
        middle = (l + r) // 2
        tmp_k = k
        for i in range(n):
            tmp = math.ceil((score[i] - middle) / f[i])
            tmp_k -= max(0, tmp)

            if tmp_k < 0:
                break

        if tmp_k >= 0:
            r = middle
        else:
            l = middle
    print(r)

if __name__ == '__main__':
    main()


Measured memory_bytes: 126656
#include <stdio.h>

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

int main()
{
    int N;

    scanf("%d", &N);

    printf("%d\n", N / 3);

    return 0;
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;
public class Main
{
	final int inf=(int)(1e9+1);
	private void solve()throws IOException
	{
		int n=nextInt();
		int m=nextInt();
		int X=nextInt();
		int c[]=new int[n+1];
		int a[][]=new int[n+1][m+1];
		for(int i=1;i<=n;i++)
		{
			c[i]=nextInt();
			for(int j=1;j<=m;j++)
				a[i][j]=nextInt();
		}
		int bigmask=(1<<n)-1;
		int mincost=inf;
		for(int i=1;i<=bigmask;i++)
		{
			int cost=0;
			int b[]=new int[m+1];
			for(int j=1;j<=n;j++)
			{
				if(((i>>(j-1))&1)==1)
				{
					for(int k=1;k<=m;k++)
						b[k]+=a[j][k];
					cost+=c[j];
				}
			}
			boolean flag=true;
			for(int k=1;k<=m;k++)
				if(b[k]<X)
					flag=false;
			if(flag)
				mincost=Math.min(mincost,cost);
		}
		out.println(mincost==inf?-1:mincost);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define f first
#define s second

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	vector<pii> arr (N);
	F0R(i, N) {
		int x; cin >> x; arr[i] = {x, i + 1};
	}
	arr.push_back({0, 0});
	sort(arr.begin(), arr.end());
	vll ans (N+1);
	ll count = 0;
	int minIndex = N + 1;
	ROF(i, 1, N+1) {
		++count;
		minIndex = min(minIndex, arr[i].second);
		ans[minIndex] += (arr[i].first - arr[i-1].first) * count;
	}
	FOR(i, 1, N+1) print(ans[i]);
}

Measured memory_bytes: 5008
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, M;
  
  int a, b; 
  cin >> N >> M;
  
  
  
  
  vector<int> city(N);
  
  for (int i = 0; i < M; i++) {
    
    cin >> a >> b;
    
    city.at(a - 1)++;
    city.at(b - 1)++;
    
    
  }

 
  for (int i = 0; i < N; i++) {
    
    cout << city.at(i) <<endl;
    
  }
  
}

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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define N 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define debug(x) cout << '>' << #x << ':' << x << " ";
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);
#define int long long int
main()
{
    IO;
	string s;
    cin >> s;
    int n = s.size();
    int sum = 0;
    for(int i = 0; i < n; i++){
        sum += (s[i]-'0');
    }
    if(sum % 9 == 0){
        cout << "Yes" << nl;
    }
    else cout << "No" << nl;
    return 0;
}

Measured memory_bytes: 3740
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
# include <climits>
#define ll long long int
#define rep(i,rept) for (ll i = 0; i < rept; i++)
using namespace std;
/*int ketawa(ll num) {
	int dig, sum = 0;
	while (num) {
		dig = num % 10;
		sum = sum + dig;
		num = num / 10;
	}
	return sum;
}
*/
ll wasum(double n, double m) {
	return (n + m)*(m - n + 1) / 2;
}
int main()
{
	double n, m, d;
	double sum;
	cin >> n >> m >> d;
	if (d == 0) {
		cout << (m - 1) / n;
		return 0;
	}
	sum = (m - 1) / n * (n - d) / wasum(1, n - 1)*(n - 1);
	
	std::cout << std::fixed;
	cout << std::setprecision(10) << sum;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s, t;
set<string> S;
 
void Work()
{
    int lens = s.size();
    int lent = t.size();
    for(int i = 0; i < lens; i++)
    {
        if(s[i] == '?' || s[i] == t[0])
        {
            string tmp = s;              
            for(int j = 0; j < i; j++)
                if(tmp[j] == '?')
                    tmp[j] ='a';    
            bool can = false;
            for(int j = 0; j < lent; j++)    
            {
 
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j])  
                    break;
                tmp[i+j] = t[j];
                if(j == lent - 1) can = true;
            }
            if(can)
            {
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';
                S.insert(tmp);  
            }
        }
    }
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;
    else cout << *S.begin() << endl;
}
int main()
{
    cin >> s >> t;
    Work();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
     

int main() {
  ll x,y,z=0,k,n,m,h,w,ans=0,sum=0,Max=-1,Min=1e9+1;
  bool ok = true;
  string s,t,r;
  cin >> x >> y >> z;

  
  cout << z << " " << x << " " <<  y << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;

const double PI  = 3.141592653589793238463;

int main() {
    double a;
    cin >> a;    
    cout << PI*a*2;
    cout << endl;
}


Measured memory_bytes: 3724
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    string s,t;cin>>s>>t;
    int sn = SIZE(s);
    int tn = SIZE(t);

    REP(i,sn){
        s[i] -= 'a';
    }
    REP(i,tn){
        t[i] -= 'a';
    }

    VVL c(26);
    REP(i,sn){
        c[s[i]].PB(i+1);
    }
    REP(i,tn){
        if(SIZE(c[t[i]]) == 0){
            cout<<-1<<endl;
            return;
        }
    }

    LL result = 0;
    LL now = 0;
    REP(i,tn){
        auto itr = upper_bound(ALL(c[t[i]]), now);
        if(itr == c[t[i]].end()){
            result += sn;
            now = c[t[i]][0];
            //i--;
        }

        else{
            now = *itr;
        }

    }

    cout<<result+now<<endl;
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


#include <bits/stdc++.h>
using namespace std;
signed main(){
    int N,M,C; cin>>N>>M>>C;
    vector<int> B(M); REP(i,M) cin>>B[i];
    vector<vector<int>> A(N,vector<int>(M));
    REP(i,N) REP(j,M) cin>>A.at(i).at(j);
    int ans =0;
    REP(i,N){
        int sum =0;
        REP(j,M){
            sum += B[j]*A.at(i).at(j);
        }
        if(sum+C>0) ans ++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
static const int N = 100;

int main(){
    int M[N][N];
    int n, u, k, v;

    scanf("%d",&n);

    for( int i = 0; i < n; ++i ){
        for( int j = 0; j < n; ++j ) M[i][j] = 0;
    }

    for( int i = 0; i < n; ++i ){
        scanf("%d %d",&u,&k);
        u--;
        for( int j = 0; j < k; ++j ){
            scanf("%d",&v);
            v--;
            M[u][v] = 1;
        }
    }

    for( int i = 0; i < n; ++i ){
        for( int j = 0; j < n; ++j ){
            if( j ) putchar(' ');
            printf("%d",M[i][j]);
        }
        puts("");
    }

    return 0;
}



Measured memory_bytes: 3220
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define ll long long
const int mod = 1e9 + 7;

ll pow(ll a, ll b, ll m)
{
	ll ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)ans = (ans % m) * (a % m) % m;
		b /= 2;
		a = (a % m) * (a % m) % m;
	}
	ans %= m;
	return ans;
}
ll inv(ll x, ll p)//x关于p的逆元，p为素数
{
	return pow(x, p - 2, p);
}
ll C(ll n, ll m, ll p)//组合数C(n, m) % p
{
	if (m > n)return 0;
	ll up = 1, down = 1;//分子分母;
	for (int i = n - m + 1; i <= n; i++)up = up * i % p;
	for (int i = 1; i <= m; i++)down = down * i % p;
	return up * inv(down, p) % p;
}
ll Lucas(ll n, ll m, ll p)
{
	if (m == 0)return 1;
	return C(n % p, m % p, p) * Lucas(n / p, m / p, p) % p;
}

void solve()
{
	int n, a, b;
	cin >> n >> a >> b;

	int ans = ((1ll * pow(2, n, mod) - Lucas(n, a, mod) - Lucas(n, b, mod) + mod) % mod - 1 + mod) % mod;
	ans %= mod;

	cout << ans;
}

int main()
{
	//freopen("Testin.txt", "r", stdin);
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int _x, _y, x, y;
			_x = parseInt(line.substring(0, line.indexOf(' ')));
			_y = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((_x | _y) == 0) break;

			x = _x > _y ? _x : _y;
			y = _x > _y ? _y : _x;

			int t, step = 0, gcd;
			while (true) {
				x %= y;
				t = y;
				y = x;
				x = t;
				step++;
				if (y == 0) {
					gcd = x;
					break;
				}
			}
			System.out.println(gcd + " " + step);
		}
	}
}

Measured memory_bytes: 21296
/* In the name of Allah */

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pb push_back
#define LL_INF 1LL << 62
#define INF 1 << 30
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define CheckBit(x, k) (x & (1LL << k))
#define mod 1000000007

string s, t;
int n, m;

int dp[3001][3001];
int x[3001][3001];

int solve(int p1, int p2){
  if(p1 >= n || p2 >= m) return 0;

  if(dp[p1][p2]!=-1) return dp[p1][p2];

  int res = 0;
  if(s[p1]==t[p2]){
    res = 1+solve(p1+1, p2+1);
    x[p1][p2] = 0;
  }
  int r = solve(p1, p2+1);
  if(r>res){
    res = r;
    x[p1][p2] = 1;
  }
  r = solve(p1+1, p2);
  if(r > res){
    res = r;
    x[p1][p2] = 2;
  }

  return dp[p1][p2] = res;
}

string ans = "";

void get_ans(int p1, int p2){
  if(p1>=n || p2>=m) return;
  if(s[p1]==t[p2]) ans += s[p1];
  if(x[p1][p2]==0) get_ans(p1+1, p2+1);
  if(x[p1][p2]==1) get_ans(p1, p2+1);
  if(x[p1][p2]==2) get_ans(p1+1, p2);
}

int main()
{
  memset(dp, -1, sizeof dp);
  cin >> s >> t;
  n = s.size();
  m = t.size();

  solve(0, 0);
  get_ans(0, 0);
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 74284
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#define  ll long long
#define mod 1000000007
void solve(){

  ll n; cin>>n; 
     vector<ll> arr(n+1,0);
     arr[0]=1;
     arr[1]=1;
     for(int i=2;i<=n;i++){
      arr[i]=(i*(arr[i-1])%mod)%mod;
     }
     cout<<arr[n]<<endl;

  }

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

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

  int t =1;  /*cin>>t ;*/

  while(t--){
        solve();
  }

 return 0;
}


Measured memory_bytes: 3980
n,m = map(int,input().split())
h_list = list(map(int,input().split()))
roads = [list(map(int,input().split())) for _ in range(m)]

bad_view = set()

for road in roads:
    a = h_list[road[0]-1]
    b = h_list[road[1]-1]
    
    if a > b:
        bad_view.add(road[1]-1)
    elif a < b:
        bad_view.add(road[0]-1)
    elif a == b:
        bad_view.add(road[1]-1)
        bad_view.add(road[0]-1)


print(n-len(bad_view))

Measured memory_bytes: 35568
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int n;
	cin >> n;
	vector<int> c(n + 1);
	REP(i, n) {
		int r;
		cin >> r >> c[i + 1];
		if (i == 0) {
			c[0] = r;
		}
	}
	static int dp[101][101];
	FOR(i, 2, n + 1) {
		REP(j, n - i + 1) {
			int res = INT_MAX;
			FOR(k, 1, i) {
				int l = i - k;
				res = min(res, dp[k][j] + dp[l][j + k] + c[j] * c[j + k] * c[j + i]);
			}
			dp[i][j] = res;
		}
	}
	cout << dp[n][0] << endl;

	return 0;
}


Measured memory_bytes: 3228
from collections import defaultdict


# 初項a，交差dの数列n個の和
def arithmetic_series(a, d, n):
    return n * (2 * a + (n - 1) * d) // 2


def main():
    X = int(input())
    for i in range(10 ** 9):
        if X <= arithmetic_series(1, 1, i):
            print(i)
            return


if __name__ == '__main__':
    main()


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

bool isLower(char x){return 'a'<=x && x<='z';}
int main(){

    string s;
    cin>>s;
    bool isok=s[0]=='A';
    isok&=isLower(s[1]);
    int cnt=0;
    for(int i=2;i+1<s.size();i++){
        if(s[i]=='C'){
            cnt++;
        }
        else{
            isok&=isLower(s[i]);
        }
    }
    isok&=isLower(s.back());
    cout<<(isok && cnt==1 ? "AC" : "WA")<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const double pi=acos(-1);

int main(){
    double a,b,h,m;
    cin>>a>>b>>h>>m;

    vector<double> A={a,0};
    vector<double> B={b,0};

    double time=60*h+m;

    double theta=pi*time/360;
    double phi=pi*time/30;

    A={a*cos(theta),a*sin(theta)};
    B={b*cos(phi),b*sin(phi)};

    cout<<setprecision(10);
    cout<<sqrt(a*a+b*b-2*(a*cos(theta)*b*cos(phi)+a*sin(theta)*b*sin(phi)))<<endl;
}

Measured memory_bytes: 4168
def cal_sum(n)
  sum = 0
  while n > 0 do
    sum += n % 10
    n /= 10
  end
  return sum
end

res = gets.chomp.split(' ').map(&:to_i)
i = 1
total = 0
while i <= res[0] do
  sum = cal_sum(i)
  total += i if (sum >= res[1] && sum <= res[2])
  i += 1
end
puts total

Measured memory_bytes: 1788
#include <iostream>
using namespace std;
typedef long long ll;
ll n,q,a,b,c,dp[100001];
void bitadd(ll a,ll b){
    while(a<=100000){
        dp[a]+=b;
        a+=a&(-a);
    }
    return ;
}
ll bitsum(ll a){
    ll tot=0;
    while(a>0){
        tot+=dp[a];
        a-=a&(-a);
    }
    return tot;
}
int main(void){
    cin>>n>>q;
    while(q--){
        cin>>a>>b>>c;
        if(a==0){
            bitadd(b,c);
        }
        else cout<<bitsum(c)-bitsum(b-1)<<endl;
    }
}



Measured memory_bytes: 3892
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    bool flg = false;
    for (int i = 0; i < 100; i++)
    {
        for (int j = 0; j < 100; j++)
        {
            if (4 * i + 7 * j == n)
            {
                flg = true;
            }
        }
    }
    cout << (flg ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	int ans = log(N) / log(K) + 1;
	cout << ans << "\n";

	return 0;
}

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

using namespace std;

int main()
{
	string s;
	cin >> s;
	int c1=0,c2=0;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='0')
			c1++;
		else
			c2++;
	}
	cout << 2*min(c1,c2) << endl;
}


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

/* define const */

/* finish defineing const */

int n, m;
long cnt = 0;
int a[100] = {};
int b[100] = {};
pair<int, int> p[100];

bool allt(bool *b)
{
    bool f = true;
    for (int i = 1; i <= n; i++)
    {
        if (b[i] == false)
        {
            f = false;
        }
    }
    return f;
}

void solve(int a, bool *b)
{
    bool tmp[10];
    for (int i = 1; i <= n; i++)
    {
        tmp[i] = b[i];
    }
    // コピー
    tmp[a] = true;

    if (allt(tmp))
    {
        cnt++;
        return;
    }
    else
    {
        for (int i = 0; i < m; i++)
        {
            if (p[i].first == a)
            {
                if (tmp[p[i].second] == false)
                {
                    // tmp[p[i].second] = true;
                    solve(p[i].second, tmp);
                }
                else
                {
                    //  continue;
                }
            }
            else if (p[i].second == a)
            {
                if (tmp[p[i].first] == false)
                {
                    // tmp[p[i].first] = true;
                    solve(p[i].first, tmp);
                }
                else
                {
                    // continue;
                }
            }
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        p[i] = make_pair(a[i], b[i]);
    }
    sort(p, p + m);
    bool b[10] = {false, true};
    solve(1, b);

    cout << cnt << endl;
}


Measured memory_bytes: 764
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		solve();
	}

	public static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		Map<Integer, List<Integer>> graph = new HashMap<>();

		for (int i = 0; i < m; i++) {
			Integer from = sc.nextInt();
			Integer to = sc.nextInt();
			if (graph.containsKey(from)) {
				List<Integer> before = graph.get(from);
				before.add(to);
			} else {
				List<Integer> bridges = new ArrayList<>();
				bridges.add(to);
				graph.put(from, bridges);
			}
			if (graph.containsKey(to)) {
				List<Integer> before = graph.get(to);
				before.add(from);
			} else {
				List<Integer> bridges = new ArrayList<>();
				bridges.add(from);
				graph.put(to, bridges);
			}
		}
		sc.close();

		int count = 0;
		for (int i = 0; i < m; i++) {
			for (Integer key : graph.keySet()) {
				if (graph.get(key).size() == 1) {
					Integer deleteKey = graph.get(key).get(0);
					graph.get(key).remove(0);
					graph.get(deleteKey).remove(key);
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

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

    rep2(i, 1, 10)
    {
        if (n % i == 0)
        {
            if (1 <= n / i && n / i <= 9)
            {
                cout << "Yes" << endl;
                return (0);
            }
        }
    }
    cout << "No" << endl;
    return (0);
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  ll a,b,x;
  cin >> a >> b >> x;
  ll ans=0;
  if (a==0) ans=(b/x)+1;
  else ans=b/x-(a-1)/x;
  cout << ans << endl;
}


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

#pragma GCC optimize("O3")

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;

int main() {
    ll h, n;
    cin >> h >> n;
    
    ll sum = 0;
    for(int i = 0; i < n; ++i) {
		ll value;
		cin >> value;
		sum += value;
	}
    if(sum >= h) cout << "Yes";
    else cout << "No";
    
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long N, M;
	cin >> N >> M;

	if (N >= M / 2) {
		cout << M / 2 << endl;
	}
	else {
		M -= 2 * N;
		M = N + M / 4;
		cout << M << endl;
	}

	return 0;
}

Measured memory_bytes: 3564
import math
a,b,h,m = map(float, input().split()) 

h_kaku=(math.pi/6)*h
h_kaku+=(math.pi/360)*m
m_kaku=(math.pi/30)*m


h_x=a*math.cos(h_kaku)
h_y=a*math.sin(h_kaku)
m_x=b*math.cos(m_kaku)
m_y=b*math.sin(m_kaku)

ans=(h_x-m_x)**2+(h_y-m_y)**2

print(ans**(1/2))

Measured memory_bytes: 9436