akhauriyash/Code-Regression huggingface dataset:
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const inf = 1001001001001

func main() {
	sc.Split(bufio.ScanWords)

	N, K := getInt(), getInt()
	a := make([]int, N)
	s := 0
	for i := 0; i < N; i++ {
		a[i] = getInt()
		s += a[i]
	}
	d := make([]int, 0)
	for i := 1; i*i <= s; i++ {
		if s%i == 0 {
			d = append(d, i)
			if s/i != i {
				d = append(d, s/i)
			}
		}
	}

	ans := 0
	for _, v := range d {
		m := make([]int, N)
		for i := 0; i < N; i++ {
			m[i] = a[i] % v
		}
		sort.Ints(m)
		x := make([]int, N)
		x[0] = (v - m[0]) % v
		for i := 1; i < N; i++ {
			x[i] = (v - m[i]) % v
			m[i] += m[i-1]
		}
		for i := N - 2; i >= 0; i-- {
			x[i] += x[i+1]
		}
		kk := inf
		for i := 0; i < N-1; i++ {
			if m[i] == x[i+1] {
				kk = m[i]
			}
		}
		if kk <= K {
			ans = max(ans, v)
		}
		// out(v, m, x, kk)
	}
	out(ans)
}


Measured memory_bytes: 5504
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int N = in.nextInt(), M = in.nextInt();
        int max = M / N;
        int rst = 1;
        for(int i = max; i >= 1; i--){
            if(M % i == 0){
                rst = i;
                break;
            }
        }
        System.out.println(rst);
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int a,b;
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                cout<<'#';
            }
            cout<<endl;
        }
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3092
import sys


sys.setrecursionlimit(10 ** 6)


def f(n):
    if memo[n] > 0:
        return memo[n]
    memo[n] = f(n - 1) + f(n - 2)
    return memo[n]


N, M, *A = map(int, open(0).read().split())
memo = [1, 1] + [-1] * N
A = list(A) + [N + 1]
MOD = 10 ** 9 + 7
ans = 1
prev = 0
for a in A:
    if a == prev:
        ans = 0
        break
    ans *= f(a - 1 - prev)
    ans %= MOD
    prev = a + 1
print(ans)


Measured memory_bytes: 494180
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    int a[100100];

    int sum[100100];
    cin >> n >> k;


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

    sum[0]=0;
    
    for(int j=1;j<n;j++)
    {
        for(int i=1;i<=k;i++)
        {
            if(j-i >= 0)
            {
                sum[j]=min(sum[j],sum[j-i]+abs(a[j]-a[j-i]));
            }
        }
    }
    cout << sum[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>

bool a[10000000];
int b,c;
int ans;

bool k(int n){
  string s = to_string(n);

  for(int i=0;i<s.size();i++){
    if(s[i]!=s[s.size()-1-i]) return false;
  }

  return true;
}

int main(){
  for(int i=10000;i<100000;i++)
    if(k(i)) a[i]=true;

  cin>>b>>c;

  for(int i=b;i<=c;i++)
    if(a[i]) ans++;

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=3000;
const int MOD=1e9+7;
ll f[N];
int s;
int main()
{
  cin>>s;
  f[0]=1;
  for(int i=3;i<=s;i++)
    for(int j=3;j<=i;j++)
    {
      f[i]=(f[i]+f[i-j])%MOD;
    }
  printf("%lld\n",f[s]);
}


Measured memory_bytes: 3780
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#define REP(i, a) for (int i = 0; i < (a); i++)
#define REPR(i, a) for (int i = (int)(a) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (int)(b) - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<long long>;
using vvl = vector<vl>;
using vs = vector<string>;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &a) { cout << a << ' '; }
void br() { putchar('\n'); }

bool solve() {
  int N = si(), M = si();
  vector<multiset<int>> G(N);
  vector<int> deg(N);
  REP(i, M) {
    int u = si() - 1, v = si() - 1;
    G[u].insert(v);
    G[v].insert(u);
    deg[u]++;
    deg[v]++;
  }
  REP(i, N) if (deg[i] % 2 == 1) return false;
  REP(i, N) if (deg[i] >= 6) return true;
  int c = count(ALL(deg), 4);
  if (c >= 3) return true;
  if (c == 1) return false;
  if (c == 0) return false;
  REP(i, N) if (deg[i] == 2) {
    int u = *G[i].begin();
    int v = *G[i].rbegin();
    G[u].erase(G[u].find(i));
    G[v].erase(G[v].find(i));
    G[i].clear();
    G[u].insert(v);
    G[v].insert(u);
  }
  REP(i, N) if (deg[i] == 4 && G[i].count(i)) return true;
  return false;
}

int main() {
  ps(solve() ? "Yes" : "No"); br();
}


Measured memory_bytes: 14720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int a, b;
  cin >> a >> b;
  if (a * b % 2 == 0) No();
  else Yes();
}

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

const ll mod = 1000000007;
struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;
    // init struct with \"n\" of \"nCk\" (maximum number in other words)
    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    // c(n,k) returns mint that contains nCk (mod p (= 1e9+7)) in x
    // i.e.) mint num = c(n,k), then num.x == nCk (mod p (= 1e9+7))
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    // nPk - permutation
    mint p(int n, int k) {
        return fact[n] * ifact[n - k];
    }
};

int main() {
	int n;
    cin >> n;
    vector<ll> a(n);
    vector<mint> ps(n+1);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        ps[i+1] = mint(a[i]) + ps[i];
    }

    mint ans;
    for (int i = 0; i+1 < n; ++i) {
        mint sum = ps[n] - ps[i+1];
        ans += sum * mint(a[i]);
    }
    cout << ans.x << endl;
}


Measured memory_bytes: 6376
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

vector<int> g[200005];
int d[200005];

void dfs(int x, int p) {
    for (int i : g[x]) if (i != p) {
        d[i] += d[x];
        dfs(i, x);
    }
}

int main() {
    ios::sync_with_stdio(false);
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s;
    else cout << "red";
}


Measured memory_bytes: 8308
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>

using namespace std;

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

    int ans = 0;

    ans += (x / 500) * 1000;
    x = x % 500;

    ans += (x / 5) * 5;

    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 256
from collections import Counter
def solve():
  N = int(input())
  A = list(map(int, input().split()))
  c = Counter(A)
  Q = int(input())
  ans = [0]*Q
  total = sum(A)
  for i in range(Q):
    x,y = map(int, input().split())
    total += c[x]*(y-x)
    c[y] += c[x]
    c[x] = 0
    ans[i] = total
  return ans
print(*solve(),sep='\n')


Measured memory_bytes: 26972
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;
bool u=0,v=0;
char a[1000001],c[1000001],f[1000001],tot=0,sum=0;
int main(){
	scanf("%s",a);
	int l=strlen(a);
	for(int i=0;i<l;i++)
		if(a[i]=='C'){
			u=1;
			tot++;
			c[tot]=i;
		}
	for(int i=0;i<l;i++)
		if(a[i]=='F'){
			v=1;
			sum++;
			f[sum]=i;
		}
	if(!u||!v){cout<<"No";return 0;}
	sort(c+1,c+tot+1);
	sort(f+1,f+sum+1);
	if(c[1]<f[sum])cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef int ll;
typedef unsigned long long int sll;
typedef long double ld;
#define A 1000000007
#define D 100000000000000ll
#define B 998244353ll
#define C 1000000000000000000ll
#define M 4000
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less_equal<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI acos(-1)
#define subt cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n" 

ll co[1000005];

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        co[a[i]]++;
    }
    sort(a,a+n);
    ll ans=0;
    set<ll> s;
    for(int i=0;i<n;i++)
    {
        bool b=1;
        for(int j=1;j*j<=a[i];j++)
            if(a[i]%j==0)
            {
                if(s.find(j)!=s.end())
                    b=0;
                if(s.find(a[i]/j)!=s.end())
                    b=0;
            }
        if(b && co[a[i]]==1)
            ans++;
        s.insert(a[i]);
    }
    cout<<ans;
    subt;
    return 0;
}


Measured memory_bytes: 16928
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    L, R = map(int, input().split())
    if R - L >= 2019:
        print(0)
    elif R % 2019 == 0 or L % 2019 == 0:
        #どっちかが、2019の倍数の時
        print(0)
    elif R % 2019 <= L % 2019:
        # 200 2020みたいな
        print(0)
    else:
        min_value = 2020
        for i in range(L, R + 1):
            for j in range(i + 1, R + 1):
                mod_value = (i * j) % 2019
                min_value = min(mod_value, min_value)
        print(min_value)

if __name__ == '__main__':
    main()

Measured memory_bytes: 20780
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

template <class T>
inline void read(T &x) {
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int k, n;
bool b[20];

bool check(int n) {
    while (n) {
        if (b[n % 10])  return false;
        n /= 10;
    }
    return true;
}

int main() {
    read(n), read(k);
    for (int i = 1, x; i <= k; ++i) {
        read(x);
        b[x] = true;
    }
    while (n) {
        if (check(n)) {
            break;
        }
        ++n;
    } 
    printf("%d\n", n);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,M;cin>>N>>M;
	multiset<ll> items;
	rep(i,N){
		ll t; cin>>t;
		items.insert(t);
	}
	// cout<<"inputted"<<endl;
	rep(i,M){
		auto it = items.rbegin();
		ll t = *it; t /= 2;
		items.erase(items.find(*it));
		items.insert(t);
	}
	ll ans = 0;
	for(auto x:items){
		ans += x;
	}
	cout<<ans<<endl;
	return 0;
}


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


int count_K_non_zero_digit(string s, int k){
	while(s[0]=='0'){
		s.erase(0,1);
	}
	int ret=0;
	int x = s.size();
	if (k==3 && x>2){
		if (x >3)
			ret+= ((x-1)*(x-2)*(x-3)/6)*9*9*9;
		ret += (s[0]-'0'-1)* ((x-1)*(x-2)/2)*9*9;
		ret += count_K_non_zero_digit(s.substr(1,x-1), k-1);
	}
	if (k==2 && x>1){
		if (x >2)
			ret+= (((x-1)*(x-2))/2)*9*9;
		ret += (s[0]-'0'-1)* (x-1) *9;
		ret += count_K_non_zero_digit(s.substr(1,x-1),k-1);
	}

	if (k==1 && x >0){
		ret += (x-1)*9;
		ret += (s[0]-'0');
	}
	return ret;
}

int main(){
	string n;
	int k;
	cin >>n;
	cin >>k;
	int ans =0;
	printf("%d\n",count_K_non_zero_digit(n,k));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
   
using namespace std;
     
#define PB(x) push_back(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLR(x) (x).rbegin(), (x).rend()
#define MP(x) make_pair(x);
    
#define debug(x) cerr << #x << '=' << x << endl;
#define debug2(x, y) cerr << #x << '=' << x << ' ' << #y << '=' << y << endl;
#define debugn(a) for (int x: a) cerr << x << ' '; cerr << endl;
#define debugm(a, n, m) for (int i = 0; i < n; i++, cout << endl)           \
						for (int j = 0; j < m; j++) cout << a[i][j] << ' ';

#define int long long
     
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vii;
typedef vector<string> vs;
typedef unsigned long long ull;

const int INF = LONG_LONG_MAX;
const int NINF = LONG_LONG_MIN;
const int mmod = 1000000007;

int32_t main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;
	
	string t;
	cin >> t;
	
	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) cnt++;
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
n, x = input().split()
n = int(n)
x = int(x)
m = []
i_min = 0
result = 0
#リストに値を読み込み
for i in range(n):
  m.append(int(input()))
#一個ずつ作る
for i in range(n):
  x = x - m[i]
  result = result + 1
#最小量の粉量を確定
for i in range(n):
  if m[i_min] > m[i]:
    i_min = i
#i_minを作れるだけ作る
for i in range(x):
  if x >= m[i_min]:
    x = x - m[i_min]
    result = result + 1
  else:
    break
#結果の表示
print(result)

Measured memory_bytes: 3064
#include <cstdio>
#include <vector>

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);

    vector<int> c(n-1), s(n-1), f(n-1);
    for (int i = 0; i < n-1; i++) {
        scanf("%d %d %d", &c[i], &s[i], &f[i]);
    }

    for (int i = 0; i < n; i++) {
        int t = 0;
        for (int j = i; j < n-1; j++) {
            if (t < s[j]) {
                t = s[j];
            } else if (t % f[j] == 0);
            else {
                t = t + f[j] - (t % f[j]);
            }
            t += c[j];
        }
        printf("%d\n", t);
    }

    return 0;
}

Measured memory_bytes: 256
using System;

namespace A___Rated_for_Me
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = int.Parse(Console.ReadLine());
            if(r<1200)
            {
                Console.WriteLine("ABC");
            }
            else if(r<2800)
            {
                Console.WriteLine("ARC");
            }
            else
            {
                Console.WriteLine("AGC");
            }
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 1e5+1;

int main(){
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200)cout << s << "\n";
    else cout << "red\n";
}


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

using namespace std; 

int main() 
{ 
	int r, g, b;
	cin>>r>>g>>b;
	r*=100;
	g*=10;
	int ans = r+g+b;
	if (ans%4==0)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	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 rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N;
	while(~scanf("%d", &N)) {
		vector<int> a(N + 1, 0), b(N + 1, 0);
		rep(i, N) a[i] += 1;
		rep(i, N) b[i] -= 1;
		for(int i = 0; i < N; ++ i) {
			int p;
			scanf("%d", &p), -- p;
			a[p] += i + 1;
			b[p + 1] -= i + 1;
		}
		b[0] += (int)1e9;
		rep(i, N)
			a[i + 1] += a[i];
		rep(i, N)
			b[i + 1] += b[i];
		for(int i = 0; i < N; ++ i) {
			if(i != 0) putchar(' ');
			printf("%d", a[i]);
		}
		puts("");
		for(int i = 0; i < N; ++ i) {
			if(i != 0) putchar(' ');
			printf("%d", b[i]);
		}
		puts("");
		rep(i, N)
			cerr << i + 1 << ": " << a[i] + b[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 768
N=int(input())
A=0
B=0
C=0
D=0

for i in range(N+1):
  A+=i

for i in range(N+1):
  if i % 3 == 0:
    B+=i
    
for i in range(N+1):
  if i % 5 == 0:
    C+=i
    
for i in range(N+1):
  if i % 15 == 0:
    D+=i
    
print(A-B-C+D)

Measured memory_bytes: 66384
#include<bits/stdc++.h>
#define int long long
#define vi vector<long long>
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAX 500 
#define FORN(start,end) for(int i=start; i<=end; i++)
#define cout std::cout
#define cin std::cin
#define PI 4*atan(1)
using namespace std;

void printVector(vi a) {
    cout<<"\n*********DEBUG**********\n";
    FORN(i,a.size()-1) {
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

void printArray(int a[], int n) {
    cout<<"\n*********DEBUG**********\n";
    FORN(i,n-1) {
        cout<<a[i]<<" ";
    }
    cout<<endl;
}

int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findPos(vi &vecCopy,int key) {
    for(int i=0; i<vecCopy.size(); i++) {
        if(vecCopy[i]==key) {
            vecCopy[i]=-1;
            return i+1;
        }
    }
}

void solve() {

    int a,b,h,m;

    cin>>a>>b>>h>>m;

    double angle=abs((6*(h*60+m))%360-(0.5*(h*60+m)));
    
    double ans=sqrt(a*a+b*b-2*a*b*cos((angle*PI/180.0)));

    cout<<setprecision(25)<<ans<<endl;

}
 
int32_t main() {
    // fastio;

    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
 
    int t=1;
//    cin>>t;
 
    while(t--) {
        solve();
    }
    return 0;
}


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

int main(){
	int x,y,s1,s2,s3,a,b;
  
  	cin >> x;
  	s1 = x/100 ;
  	a = x%100;
  	s2 = a/10;
  	b = a%10;
  	s3 = b/1;
  
  	y = s1 + s2 + s3;

	cout << y << endl;
}

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

bool comp(string s, string t, int num) {
    if (s.size() != t.size() + 1) return s.size() < t.size() + 1;

    t += to_string(num);
    for (int i = 0; i < (int)s.size(); i++) {
        if (s.at(i) != t.at(i)) return s.at(i) < t.at(i);
    }
    return false;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i = 0; i < m; i++) {
        cin >> a.at(i);
    }
    sort(a.rbegin(), a.rend());
    const vector<int> num_use = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    vector<string> dp(n + 1, "0");
    dp.at(n) = "";

    for (int i = 0; i < m; i++) {
        int x = a.at(i);
        for (int j = n; j >= 2; j--) {
            if (dp.at(j) == "0") continue;
            
            if (0 <= j - num_use.at(x)) {
                if (comp(dp.at(j - num_use.at(x)), dp.at(j), x)) {
                    dp.at(j - num_use.at(x)) = dp.at(j) + to_string(x);
                }
            }
        }
    }
    cout << dp.at(0) << endl;
}  

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

int main(int argc, char **argv)
{
    long long A, B, C, K;
    std::cin >> A >> B >> C >> K;

    if(A >= K){
        std::cout << K << std::endl;
    }else if(A + B >= K){
        std::cout << A << std::endl;
    }else{
        int c = K - (A + B);
        std::cout << (A - c) << std::endl;
    }
    
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int n,m;
    cin>>n>>m;
    const int INF=1001001001;
    vector<vector<int>> key(m,vector<int>(2));
    rep(i,m){
        int a,b,s=0;
        cin>>a>>b;
        rep(j,b){
            int c;
            cin>>c;
            s|=1<<(c-1);
        }
        key.at(i)={s,a};
    }
    vector<int> dp(1<<n,INF);
    dp.at(0)=0;
    rep(s,1<<n){
        rep(i,m){
            int t=s|key.at(i).at(0);
            int cost=key.at(i).at(1)+dp.at(s);
            dp.at(t)=min(cost,dp.at(t));
        }
    }
    int ans=dp.at((1<<n)-1);
    if (ans==INF) ans=-1;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
import collections,sys
S=list(input())
alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
c=collections.Counter(S)
for i in alpha:
    if c[i]==0:
        print(i)
        sys.exit()
print("None")

Measured memory_bytes: 10156
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		int i;
		if(a < b) {
			for(i = 0; i < b; i++) {
				System.out.print(a);
			}
		}else {
			for(i = 0; i < a; i++) {
				System.out.print(b);
			}
		}
	}
}

Measured memory_bytes: 23764
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
pair<double, int> a[3][8], b[18], res[8];
int main()
{
    for (int i = 0; i < 24; ++i) {
        int t;
        double f;
        scanf("%d%lf", &t, &f);
        a[i / 8][i % 8] = make_pair(f, t);
    }
    int k = 0, l = 0;
    for (int i = 0; i < 3; ++i) {
        sort(a[i], a[i]+8);
        res[k++] = a[i][0];
        res[k++] = a[i][1];
        for (int j = 2; j < 8; ++j) b[l++] = a[i][j];
    }
    sort(b, b+18);
    res[k++] = b[0];
    res[k++] = b[1];
    for (int i = 0; i < 8; ++i)
        printf("%d %.2f\n", res[i].second, res[i].first);
    return 0;
}

Measured memory_bytes: 0
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////
    int N;
    cin >> N;
    vector<int>H(N);
    for ( int i = 0; i < N; i++ ) cin >> H.at(i);
    
    int hotelCount = 0;
    for ( int i = 0; i < N; i++) {
        bool canSeeOcean = true;
        for ( int compared_i = 0; compared_i < N; compared_i++ ) {
            if (i < compared_i) {
                break;  // 検索対象外のとき
            }
            if ( H.at(i) < H.at(compared_i) ) {
                canSeeOcean = false;
            }
        }
        if (canSeeOcean) {
            hotelCount++;
        }
    }
    
    cout << hotelCount << endl;
    
    return 0;
}


Measured memory_bytes: 256
import numpy as np
from itertools import product

H, W, K = map(int, input().split())

A = np.zeros((H, W), dtype=int)
for r in range(H):
    for c, v in enumerate(input()):
        A[r, c] = 1 if v == '#' else 0

ans = 0
ttl = A.sum().item()

for choses_r in product([0, 1], repeat=H):
    for choses_c in product([0, 1], repeat=W):
        mask = np.zeros_like(A)
        mask[np.flatnonzero(choses_r), :] = 1
        mask[:, np.flatnonzero(choses_c)] = 1

        if ttl - A[mask > 0].sum() == K:
            ans += 1

print(ans)


Measured memory_bytes: 27316
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define endl "\n"

ll H, W, K;
vector<string> a(300);
vvll aa(300, vll(300, -1));

void paint(int i, int j, int num){
  if(num == 0) cout << "aa" << endl;
  aa.at(i).at(j) = num;
  if(j+1 <= W-1 && aa[i][j+1] == -1 && a[i][j+1] != '#') paint(i, j+1, num);
  if(j-1 >= 0 && aa[i][j-1] == -1  && a[i][j-1] != '#') paint(i, j-1, num);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  cin >> H >> W >> K;
  
  ll count = 1;
  vll flag(H, false);
  for(int i = 0; i < H; i++){
    cin >> a.at(i);
    for(int j = 0; j < W; j++){
      if(a.at(i).at(j) == '#'){
        paint(i, j, count);
        flag.at(i) = true;
        count++;
      }
    }
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(!flag.at(i)){
        for(int k = 1; k <= H; k++){
          if(i-k >= 0 && flag[i-k]){
            aa.at(i) = aa.at(i-k);
            flag.at(i) = true;
            break;
          }
          if(i+k <= H-1 && flag[i+k]){
            aa.at(i) = aa.at(i+k);
            flag.at(i) = true;
            break;
          }
        }
      }

      cout << aa.at(i).at(j);
      if(j == W-1) cout << endl;
      else cout << ' ';
    }
  }

}

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

int main() {
    int n, q;
    cin >> n >> q;
    vector<queue<int>> a(n);
    for (int i = 0; i < q; ++i) {
        int p, t;
        cin >> p >> t;
        if (p == 0) {
            int x;
            cin >> x;
            a[t].push(x);
        } else if (p == 1) {
            if (!a[t].empty()) cout << a[t].front() << endl;
        } else {
            if (!a[t].empty()) a[t].pop();
        }
    }
}



Measured memory_bytes: 4440
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = INF+7;
const ll LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)


int main(){
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    int x = -INF, y = INF;
    rep(i,N){
        int a; cin >> a;
        x = max(x,a+1);
    }
    rep(i,M){
        int a; cin >> a;
        y = min(y,a);
    }
    if(X < x && x <= Y && X < y && y <= Y && x <= y) cout << "No War" << endl;
    else cout << "War" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int X = 3998;
 
int a[1234][1234];
 
int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i % h == h - 1 && j % w == w - 1) {
        a[i][j] = -X * (h * w - 1) - 1;
      } else {
        a[i][j] = X;
      }
    }
  }
  long long total = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      total += a[i][j];
    }
  }
  if (total <= 0) {
    puts("No");
    return 0;
  }
  puts("Yes");
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (j > 0) putchar(' ');
      printf("%d", a[i][j]);
    }
    printf("\n");
  }
  return 0;
}

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

#define N 202

int n, d[N][N];
char s[N][N];

int vis[N];
bool dfs(int u, int c) {
    vis[u] = c;
    for (int v = 0; v < n; v ++) if (s[u][v]) {
            if (vis[v] >= 0) {
                if (vis[u] == vis[v]) return false;
            } else {
                if (!dfs(v, c ^ 1)) return false;
            }
        }
    return true;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for (int i = 0; i < n; i ++) {
		cin>>s[i];
		for (int j = 0; j < n ;j ++) s[i][j] -= '0';
    }
    memset(vis, -1, sizeof vis);
    if (!dfs(0, 0)) {
        cout<<-1;
        return 0;
    }
    const int inf = 0x3f3f3f3f;
    for (int i = 0; i < n; i++) {
		for (int j = 0; j < n ;j++) if (i != j) {
			d[i][j] = (s[i][j]?1:inf);
		}
    }
    for (int k = 0; k < n; k ++) {
        for (int i = 0; i < n; i ++) {
            for (int j = 0; j < n; j ++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j ++) ans = max(ans, d[i][j]);
    cout<<ans+1;
}


Measured memory_bytes: 3816
def solve():
    mod = 10**9+7
    L = input()
    N = len(L)
    dp = [0]*2
    dp[0] = 1
    dp[1] = 2
    for i in range(1, N):
        if L[i]=='0':
            dp[0], dp[1]=dp[0]*3, dp[1]
        else:
            dp[0], dp[1]=dp[0]*3+dp[1], dp[1]*2
    print((dp[0]+dp[1])%mod)
solve()

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

#define __STDC_FORMAT_MACROS
#define p64 PRId64

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define ALL(f, x, ...)                                                         \
    ([&] (decltype ((x)) ALL) {                                                \
        return (f) (begin (ALL), end (ALL), ##__VA_ARGS__);                    \
    }) (x)

using namespace std;
using ll = int64_t;

bool checkPal (string s) {
    string pre = s;
    ALL (reverse, pre);
    return s == pre;
}

int main() {
    string S;
    cin >> S;
    string str = S.substr (0, S.length() / 2);
    cout << (checkPal (S) && checkPal (str) ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  immutable mod = 1_000_000_007;
  int n, m;
  readf("%d %d\n", &n, &m);
  bool[int] a;
  auto b = new long[](n+3);
  foreach (i; 0..m) {
    auto x = readln.chomp.to!int;
    a[x] = true;
  }
  b[0] = 1;
  foreach (i; 0..n) {
    if (a.get(i, false)) {
      continue;
    }
    b[i+1] += b[i] % mod;
    b[i+2] += b[i] % mod;
  }

  writeln(b[n] % mod);
}


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

using namespace std;

int main()
{
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int min = (60 - m1) + (h2 - h1 - 1) * 60 + m2;
    cout << min - k << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=2e5+100;
ll d[mm];
int main()
{
   ll n,m,i,j,t,a,b,c,p,k,kk; 
	 scanf("%lld",&n);
	 if(n==1) cout<<0<<endl;
	 else cout<<1<<endl; 
} 

Measured memory_bytes: 3256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int ans;
  int n;
  while(1){
    cin>>n;
    if(n == 0) break;
    ans=0;
    while(n){
      ans += n/=5;
    }
    cout<<ans<<endl;
  }
}
	 

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int count = k;
    int ans = 0;
    if(k == 1){
        if(a == 0 && b == 0) cout << -1 << endl;
        else if(a == 0) cout << 0 << endl;
        else cout << 1 << endl;
        return 0;
    }
    if(a > k){
        ans = k;
        cout << ans << endl;
        return 0;
    }
    ans += a;
    count = k - a;
    // cout << ans << endl;
    if(count > 0) count -= b;
    // cout << count << endl;
    if(count > 0){
        ans -= count;
    }
    // if(ans < 0) cout << 0 << endl;
    // else cout << ans << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include<stdio.h>
int main()
{
	int N,K,X,Y;
	long long int sum;
	scanf("%d""%d""%d""%d",&N,&K,&X,&Y);
	if(N>K)	printf("%lld\n",sum=K*X+(N-K)*Y);
	else if(N<=K) printf("%lld\n",sum=N*X);
	return 0;
	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define LL long long
using namespace std;

int main()
{
  
    ios_base::sync_with_stdio(false); 
            cin.tie(NULL);
    LL N,K;
    cin>>N>>K;
    vector<LL>arr(N);
    for(auto &it:arr)
    {
        cin>>it;
    }
    LL front=0;
    LL back=K;
    while(back<N)
    {
        if(arr[front]>=arr[back])
        {
            cout<<"No"<<endl;
        }
        else
            cout<<"Yes"<<endl;
        front++;
        back++;
    }
}



Measured memory_bytes: 4780
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N), B(N);
    for (int i = 0; i < N; i++) {
      cin >> A[i] >> B[i];
    }
    ll add = 0;
    for (int i = N - 1; i >= 0; i--) {
      ll a = A[i] + add;
      ll bk = (a + B[i] - 1) / B[i] * B[i];
      add += bk - a;
    }
    cout << add << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  double L;
  cin >> L;
  
  cout.precision(10);
  cout<<showpoint << L*L*L/27. << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n,a,b;
  cin>>n>>a>>b;
  int num=a+b;
  int ans=0;
  ans+=(n/num)*a;
  ans+=min(n%num,a);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt();
        int C = sc.nextInt();
        char[][] grid = new char[R][C];
		for(int i = 0; i < R; i++)
          		grid[i] = sc.next().toCharArray();

        for(int i = 0; i < R; i++)
          	for(int j = 0; j < C; j++)
              if(grid[i][j] == '#') 
                if(adjacentBlack(grid, i, j, R, C) == 0) {
                	 System.out.println("No");
                  	 return;
                }
        System.out.println("Yes");
    }
  
  	 private static int adjacentBlack(char[][] gird, int row, int col, int R, int C) {
     	int[] rows = new int[]{1, -1, 0, 0};
        int[] cols = new int[]{0, 0, -1, 1};
       	int cnt = 0;
        for(int i = 0; i < rows.length; i++) {
        	int nextRow = row + rows[i];
            int nextCol = col + cols[i];
            if(0 <= nextRow && nextRow < R && 0 <= nextCol && nextCol < C && gird[nextRow][nextCol] == '#')
				cnt++;
        }
       return cnt;
     }
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

main() {
  int64_t x, y;
  cin >> x >> y;

  if (x % y == 0) {
    cout << -1 << endl;
  } else {
    cout << x << endl;
  }
}

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

int main(){
    int h,w,n;
    cin>>h>>w>>n;
    if (n<=min(h,w)){
        cout<<1;
        return 0;
    }
    int ans = max(h,w);
    if (n%ans==0){
        cout<<n/ans;
    }
    else{
        cout<<n/ans+1;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    ll N = sqrtl(n);
    cout << N*N << endl;
}

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

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    string str[4]={"SS","SW","WS","WW"};

    string two;
    for(int i = 1; i < n+1; i++){
        for(int j = 0; j < 4; j++){
            two = str[j].substr(i-1,2);
            if(two == "SS"){
                str[j] += s[i%n]=='o' ? "S" : "W";
            }else if(two == "SW"){
                str[j] += s[i%n]=='o' ? "W" : "S";
            }else if(two == "WS"){
                str[j] += s[i%n]=='o' ? "W" : "S";
            }else if(two == "WW"){
                str[j] += s[i%n]=='o' ? "S" : "W";
            }
        }
    }
    for(int i = 0; i < 4; i++){
        if(str[i][0] == str[i][n] && str[i][1] == str[i][n+1]){
            cout << str[i].substr(0,n) << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}


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

int main() {
    string s;

    cin >> s;

    int a = 0;
    int z = 0;

    for(int i=0;i<s.size();i++){
        if(s.at(i) == 'A'){
            a = i;
            break;
        }
    }

    for(int i=s.size() - 1;i>0;i--){
        if(s.at(i) == 'Z'){
            z = i;
            break;
        }
    }

    cout << z - a + 1 << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int x, hp = 0;
    scanf("%d",&x);
    if(x>=500){
        while(x>=500){
            x = x - 500;
            hp = hp + 1000;
        }
    }
    if(x >= 5){
        while(x >= 5){
            x = x-5;
            hp = hp+5;
        }
    }
    printf("%d",hp);
    return 0;
}


Measured memory_bytes: 1712
#include<stdio.h>
int main()
{
    int K,A,B,i,c=0;
    scanf("%d",&K);
    scanf("%d %d",&A,&B);
    for(i=A;i<=B;i++)
    {
        if(i%K==0)
        c=1;
    }
    if(c==1)
        printf("OK");
    else
        printf("NG");
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    int n;
    cin >> n;

    cout << (1000 - n % 1000) % 1000 << newl;

    return 0;
}

Measured memory_bytes: 3636
<?php
list($s) = strs();
$p = strpos($s, 'C');
if ($p === false) exit('No' . PHP_EOL);
$p = strpos($s, 'F', $p);
echo $p !== false ? 'Yes' : 'No';
echo PHP_EOL;
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 16192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class36
    {
        static void Main()
        {
            var HA = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int h = HA[0];
            int a = HA[1];
            int ans = h / a;
            if (h % a != 0) ans++;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


// const double PI = acos(-1);
// int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
// int a[12][12];



void solve() {
  int m,f,r;
  while(true) {
    cin >> m >> f >> r;
    if (m==-1&&f==-1&&r==-1) break;

    if (m==-1 || f==-1) cout << 'F' << endl;
    else {
      if (m+f >= 80) cout << 'A' << endl;
      else if (m+f >= 65) cout << 'B' << endl;
      else if (m+f >= 50) cout << 'C' << endl;
      else if (m+f >= 30) {
        if (r >=50) cout << 'C' << endl;
        else cout << 'D' << endl;
      }
      else cout << 'F' << endl;
    }

  }

}

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






Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;

int main()
{
	int h, w, m;
	cin >> h >> w >> m;

	vector<int> ch(h + 1, 0);
	vector<int> cw(w + 1, 0);

	vector<pair<int, int>> v(m);
	for (auto& a : v) {
		cin >> a.first >> a.second;
		++ch[a.first];
		++cw[a.second];
	}

	//１番大きいやつをみつける
	int mh = 0;
	{
		int check = 0;
		for (int i = 1; i <= h; ++i) {
			if (check < ch[i]) {
				mh = i;
				check = ch[i];
			}
		}
	}

	int mw = 0;
	{
		int check = 0;
		for (int i = 1; i <= w; ++i) {
			if (check < cw[i]) {
				mw = i;
				check = cw[i];
			}
		}
	}



	int ret = 0;
	//もう一個のほうで１番大きいやつをみつける
	{
		vector<int> cw2(w + 1, 0);
		for (auto& a : v) {
			if (a.first == mh) {
				continue;
			}
			++cw2[a.second];
		}

		sort(cw2.rbegin(), cw2.rend());
		ret = max(ret, cw2[0] + ch[mh]);
	}

	//うらがえしてもう一回
	{
		vector<int> ch2(h + 1, 0);
		for (auto& a : v) {
			if (a.second == mw) {
				continue;
			}
			++ch2[a.first];
		}

		sort(ch2.rbegin(), ch2.rend());
		ret = max(ret, ch2[0] + cw[mw]);
	}
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 9112
import java.util.*;

public class Main {

    static int INF = (1<<31)-1;
    static int n;
    static int[] dat;

    static void update(int x, int y) {
        dat[x+n-1] = y;
        int tmp = x+n-1;
        while (tmp>0) {
            tmp = (tmp-1)/2;
            dat[tmp] = Math.min(dat[tmp*2+1], dat[tmp*2+2]);
        }
    }

    static int query(int a, int b, int k, int l, int r) {
        if (a<=l && r<=b) return dat[k];
        if (b<=l || r<=a) return INF;
        int lv = query(a, b, 2*k+1, l, (l+r)/2);
        int rv = query(a, b, 2*k+2, (l+r)/2, r);
        return Math.min(lv, rv);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n_ = sc.nextInt();
        n = 1;
        while (n<n_) n*=2;
        dat = new int[2*n-1];
        Arrays.fill(dat, INF);
        int q = sc.nextInt();
        for (int i=0;i<q;i++) {
            int com = sc.nextInt();
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (com==0) {
                update(x, y);
            } else { // com==1
                System.out.println(query(x, y+1, 0, 0, n));
            }
        }
    }
}


Measured memory_bytes: 104288
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve(){
  	int n;
  	cin>>n;
  	cout<<((24-n)+24)<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


Measured memory_bytes: 256
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
D = [0] * N
T = [0] * N
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
for i in range(N):
  D[i] = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
  T[i] = t[i+1] - t[i]
ans = 'Yes'
for i in range (N):
  if D[i] <= T[i] and (D[i] - T[i])%2 == 0:
    ans = 'Yes'
  else:
    ans = 'No'
print(ans)

Measured memory_bytes: 14856
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
  cin>>n;
  vector<int> h(n);
  for(int i=0;i<n;i++){
  	cin>>h[i];
  }
  vector<int> dp(n);
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++){
  	dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i-2]-h[i]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

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

int main() {
  int n; cin >>n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  int kotae=INT_MAX;
  for(int i=0;i<n;i++){
    int tmp=0;
    while(a[i]){
      if(a[i]%2==0){
        tmp++;
        a[i]/=2;
      }else{
        break;
      }
    }
    kotae=min(kotae,tmp);
  }
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 256