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

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < 3; i++){
        ans += (s[i] == t[i]);
    }
    cout << ans << endl;
    return 0;
}

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

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

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

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var po = new int[n][];

        if(n <= 1) return 1;

        for(int i=0; i<n; i++) {
            po[i] = ToIntArray(input.ReadLine(), 2);
        }

        var dic = new Dictionary<string, int>();

        Action<string> add = (key) => {
            if(dic.ContainsKey(key)) dic[key]++;
            else dic[key] = 1;
        };
        
        for(int i=0; i<n; i++) {
            for(int j =i+1; j<n; j++) {
                string x = $"{(po[i][0]-po[j][0])},{(po[i][1] - po[j][1])}";
                add(x);
                x = $"{(po[j][0] - po[i][0])},{(po[j][1] - po[i][1])}";
                add(x);
            }
        }

        var max = dic.Values.Max();

        return n-max;
    }

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


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

using namespace std;

typedef long long ll;

const int MAX_N = 25, MAX_C = 60;

int main(int argc, char const *argv[])
{
    int n, v[MAX_N], c[MAX_N];

    ll dp[MAX_N*MAX_C] = {0};
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }

    for (int i = 0; i < n; ++i) {
        for (int j = n*MAX_C; j >= c[i]; --j) {
            dp[j] = max(dp[j], dp[j-c[i]] + v[i]);
        }
    }

    ll ans = dp[0] - 0;
    for (int i = 0; i < n*MAX_C; ++i) {
        ans = max(ans, dp[i] - i);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N;

int ans[501][501];

int main(){
  cin>>N;

  for(int i=1;i<=N;i++){
      for(int j=i+1;j<=N;j++){
          for(int k=0;k<30;k++){
              if((i&(1<<k))!=(j&(1<<k))){
                  ans[i][j]=k+1;
                  break;
              }
          }
      }
  }

  for(int i=1;i<=N;i++){
    for(int j=i+1;j<=N;j++){
      cout<<ans[i][j]<<" ";
    }
    cout<<endl;
  }

  return 0;
}


Measured memory_bytes: 1408
MAX = 1000000 #階乗のmodを求めたい中で最大のもの
MOD = 10**9+7

fac = [0]*MAX   #階乗のmod
inv = [0]*MAX    #その数の逆元
finv = [0]*MAX   #階乗の逆元

def COMinit():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2,MAX):
        fac[i] = (fac[i-1] * i) % MOD
        inv[i] = MOD-(inv[MOD%i] * (MOD//i))%MOD
        finv[i] = (finv[i-1]*inv[i]) %MOD
        
    
def COM(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return (fac[n] * (finv[k]*finv[n-k]))%MOD

#pが素数でないと使えない

COMinit()

x,y = map(int,input().split())
ans = 0
if 2*y-x < 0 or 2*x-y < 0:
  pass
elif (2*y-x)%3 != 0 or (2*x-y)%3 != 0: 
  pass
else:
  s = (2*y-x)//3
  t = (2*x-y)//3
  ans = COM(s+t,s)
  
print(ans)

Measured memory_bytes: 121716
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a;
  cin >> n;
  vector<int> v(n);
  
  for (int i = 0; i < n; i++)
    cin >> v.at(i);
  
  sort(v.begin(), v.end());
  
  a = n;
  for (int i = 0; i < n-1; i++) {
    if (v.at(i) == v.at(i+1) )
      a--;
  }
  
  cout << a << endl;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  string s; cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  if(s == "ARC") cout << "ABC" << endl;
  return 0;
}


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

#define int long long

signed main(){
	string s;
	cin >> s;

	if(s[0] == s[1] && s[1] == s[2]){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#define PB push_back
#define pii pair<int,int>
#define fir first
#define sec second
#define ll long long
#define MP make_pair
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=1010;
int sgn(int x) { return x>0?1:-1; }
int Abs(int x) { return x>0?x:-x; }
ll Xi[N],Yi[N];
int n;
vector<char> s[N];
char dy(int x) { return x>0?'U':'D'; }
char dx(int x) { return x>0?'R':'L'; }
int main() {
	rd(n);
	for(int i=1;i<=n;++i) rd(Xi[i]),rd(Yi[i]);
	int ty=((Xi[1]+Yi[1])%2+2)%2;
	for(int i=2;i<=n;++i) if(((Xi[i]+Yi[i])%2+2)%2!=ty) {
		printf("-1");
		return 0;
	}
	if(ty==0) {
		for(int i=1;i<=n;++i) {
			if(Abs(Xi[i])>Abs(Yi[i])) {
				s[i].PB(dx(Xi[i]));
				Xi[i]-=sgn(Xi[i]);
			}
			else {
				s[i].PB(dy(Yi[i]));
				Yi[i]-=sgn(Yi[i]);
			}
		}
	}
	for(int j=30;j>=0;--j)
		for(int i=1;i<=n;++i)
			if(Abs(Xi[i])>Abs(Yi[i])) {
				s[i].PB(dx(Xi[i]));
				Xi[i]-=sgn(Xi[i])*(1ll<<j);
			}
			else {
				s[i].PB(dy(Yi[i]));
				Yi[i]-=sgn(Yi[i])*(1ll<<j);
			}
	printf("%d\n",31+(!ty));
	if(!ty) printf("1 ");
	for(int j=30;j>=0;--j) printf("%d ",(1<<j));
	puts("");
	for(int i=1;i<=n;++i) {
		for(int j=0;j<s[i].size();++j) printf("%c",s[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 384
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
 
for (var i = 0; i < lines.length; i++) {
    if (lines[i] == '') break;
    var vals = lines[i].split(' ').map(function(i){return +i;});
    var a = vals[0] + vals[1];
    var str = a + '';
    console.log(str.length);
}

Measured memory_bytes: 16040
N=int(input())
B=list(map(int,input().split()))
A=list(map(int,input().split()))
cnt=0
for i in range(N):
    if i==0:
         if A[i]<=B[i]:
             cnt+=A[i]
             B[i]=B[i]-A[i]
         else:
             cnt+=B[i]
             A[i]-=B[i]
             B[i]=0
             if B[i+1]>=A[i]:
                B[i+1]-=A[i]
                cnt+=A[i]
             else:
                cnt+=B[i+1]
                B[i+1]=0
    else:
        if A[i]<=B[i]:
             cnt+=A[i]
             B[i]=B[i]-A[i]
        else:
             cnt+=B[i]
             A[i]-=B[i]
             B[i]=0
             if B[i+1]>=A[i]:
                     cnt+=A[i]
                     B[i+1]-=A[i]
             else:
                     cnt+=B[i+1]
                     A[i]-=B[i+1]
                     B[i+1]=0
print(cnt)

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;

int main() {
    cin >> n;

    set<int> s;
    REP(i, n) {
        int a;
        cin >> a;
        if (s.count(a) == 1) {
            std::cout << "NO" << '\n';
            return 0;
        }
        s.insert(a);
    }

    std::cout << "YES" << '\n';

    return 0;
}


Measured memory_bytes: 9600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;


public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintStream out = System.out;

		while(true){
			StringBuilder sb = new StringBuilder();
			String[] str = in.readLine().split(" ");
			int H = Integer.parseInt(str[0]);
			int W = Integer.parseInt(str[1]);
			if(H==0&&W==0)break;
			if(300<H||300<W)throw new RuntimeException("range over");
			for(int i=1; i<=H;i+=1){
				for(int j=1; j<=W; j+=1){
					if((2<=i && i<H)&&(2<=j&&j<W)){
						sb.append(".");
					}else {
						sb.append("#");
					}
				}
				sb.append(System.getProperty("line.separator"));
			}
			out.println(sb);
		}
	}
}

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

int main() {
  int n,k;
  cin>>n>>k;
  vector<int>a(n);
  int b=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    if(a.at(i)>=k){
      b++;
    }
  }
  cout<<b;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct RMQ {
	UL N;
	vector<UL> V;
	void init(UL n) {
		N = 1; while (N < n) N *= 2;
		V.resize(N * 2 - 1);
	}
	void update(UL p, UL v) {
		UL i = N - 1 + p;
		V[i] = v;
		while (i != 0) {
			i = (i - 1) >> 1;
			V[i] = max(V[(i << 1) + 1], V[(i << 1) + 2]);
		}
	}
	UL query(UL l, UL r, UL a = -1, UL b = -1, UL i = -1) {
		if (i == -1) { a = i = 0; b = N; }
		if (l <= a && b <= r) return V[i];
		if (r <= a || b <= l) return 0;
		return max(
			query(l, r, a, (a + b) >> 1, (i << 1) + 1),
			query(l, r, (a + b) >> 1, b, (i << 1) + 2)
		);
	}
};

struct Problem {

	static const ULL M = 998244353;

	void Solve() {
		UL N; cin >> N;
		vector<pair<UL, UL>> X(N);
		rep(i, N) {
			int x, d; cin >> x >> d;
			UL ux = x + 1000000000, ud = d;
			X[i] = { ux, ux + ud };
		}
		sort(X.begin(), X.end());

		vector<UL> To(N + 1); To[N] = N;
		{
			set<pair<UL, UL>> Q;
			RMQ T; T.init(N + 1); T.update(N, N - 1);
			rep(i, N) Q.insert({ X[i].first, i });
			Q.insert({ -1, N });
			for (int i = N - 1; i >= 0; i--) {
				To[i] = Q.lower_bound({ X[i].second, 0 })->second;
				T.update(i, To[i]);
				To[i] = T.query(i, To[i]);
				T.update(i, To[i]);
			}
		}

		vector<ULL> dp(N + 1); dp[N] = 1;
		for (int i = N - 1; i >= 0; i--) {
			dp[i] = (dp[i + 1] + dp[To[i]]) % M;
		}
		/*
		cout << endl;
		rep(i, N) cout << X[i].first << " " << X[i].second << endl;
		cout << endl;
		rep(i, N) cout << To[i] << " "; cout << endl;
		rep(i, N + 1) cout << dp[i] << " "; cout << endl;
		cout << endl;
		*/
		cout << dp[0] << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

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

int main () {
    int n;
    std::string s;
    std::cin >> n >> s;

    for (int i = 0; i < s.size(); i++) {

        s[i] = s[i] + n;
        if(s[i] > 'Z') {
            s[i] = 'A' - 1 + (s[i] - 'Z');
        }
        std::cout << s[i];
    }

    std::cout << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  vector<vector<int64_t>> vec(10,vector<int64_t>(10,0));

  for (int k = 1; k <= n; ++k)
  {
    string s=to_string(k);
    int i=s[0]-'0',j=*s.rbegin()-'0';
    vec[i][j]++;
  }
  int64_t ans=0;
  for (int i = 0; i < 10; ++i)
  {
    for (int j = 0; j < 10; ++j)
    {
      ans+=vec[i][j]*vec[j][i];
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#define MOD 1000000007
#define N_MAX 100001

int main() {
  int dp[27] = {};
  char enter[N_MAX], exit[N_MAX];
  int N;
  std::cin >> N;
  std::cin >> enter >> exit;
  dp[enter[0] - 'a'] += 1;
  for (int i = 1; i < N - 1; i++) {
    dp[enter[i] - 'a'] += dp[exit[i] - 'a'];
    dp[enter[i] - 'a'] %= MOD;
  }
  std::cout << dp[exit[N - 1] - 'a'] << std::endl;
  return 0;
}



Measured memory_bytes: 3292
/* 
 * Project: AtCoder Beginners Contest 171 A - αlphabet
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/21
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

char a;

void solve() {
    if (a > 0x60)
        printf("a\n");
    else
        printf("A\n");

}

int main() {

    scanf("%c", &a);

    solve();

}

Measured memory_bytes: 3156
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;

namespace AtCoder
{
    class Program
    {
        private static long mod = 1000000007;
        static void Main(string[] args)
        {
            //var n = long.Parse(ReadLine());
            //var line = ReadLine().Split(' ').Select(value => long.Parse(value)).ToArray();

            var s = ReadLine();

            for(var i = s.Length / 2 - 1; i > 0; i--)
            {
                if(s.Substring(0, i) == s.Substring(i, i))
                {
                    WriteLine(i * 2);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 25836
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vll V(3);
	REP(i,3){
		cin >> V[i];
		if(V[i]%2==0){
			cout << 0 << endl;
			return 0;
		}
	}
	so(V);
  	ll ans = V[0]*V[1]; 
	cout <<	ans << endl;
	return 0;
}

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

int gcd(int a, int b) {
    return b ? gcd(b, a%b) : a;
}

int main() {

    int K;
    long long ans = 0;

    cin >> K;

    for (int i = 1; i <= K; ++i) {
        for (int j = 1; j <= K; ++j) {
            for (int k = 1; k <= K; ++k) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#define SQ(X) \
  ( (X) * (X) )

const int rV[ ] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff };
const int gV[ ] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff };
const int bV[ ] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
const char *cV[ ]
  = { "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white" };

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    double d = DBL_MAX;
    int dn = 0;
    char s[ 16 ];
    int r, b, g;

    scanf ( " %s", s );
    if ( *s == '0' )  break ;

    r = g = b = strtol ( s + 1, NULL, 16 );
    r = ( r & 0xFF0000 ) >> 0x10;
    g = ( g & 0x00FF00 ) >> 0x08;
    b = ( b & 0x0000FF ) >> 0x00;

    for ( i = 0; i < 8; ++i )
    {
      const double dk
        = sqrt ( SQ( rV[ i ] - r ) + SQ( gV[ i ] - g ) + SQ( bV[ i ] - b ) );

      if ( dk < d )
      {
        d = dk;
        dn = i;
      }
    }

    puts ( cV[ dn ] );
  }

  return ( 0 );
}

Measured memory_bytes: 0
def get_two_int():
    two_int = input().split()
    for i in range(2):
        two_int[i] = int(two_int[i])
    return two_int

def make_sorted_num_list(num):
    num_list = [None] * num
    for i in range(num):
        num_list[i] = int(input())
    sorted_num_list = sorted(num_list)
    return sorted_num_list

def shuffle(first_list, second_list):
    flag = False
    dif_value = sum(first_list) - sum(second_list)
    if abs(dif_value) % 2 != 0:
        return flag, -1
    for i in first_list:
        for j in second_list:
            if i - j == (dif_value // 2):
                flag = True
                return flag, i, j
    return flag, -1


if __name__ == "__main__":
    while True:
        taro_num, hanako_num = get_two_int()
        if taro_num == hanako_num == 0:
            break
        taro_list = make_sorted_num_list(taro_num)
        hanako_list = make_sorted_num_list(hanako_num)
        ans = shuffle(taro_list, hanako_list)
        if ans[0] == False:
            print(ans[1])
        else:
            print(ans[1], ans[2])



Measured memory_bytes: 5612
/* Author- Abhijeet Trigunait */

#include<bits/stdc++.h>
#define lld long long int
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define mod 1e9+7
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define gcd(x,y) __gcd(x,y)
#define endl '\n'

using namespace std;

lld dp[100010]={0};

namespace MinCost{
	lld getMin(lld *arr,lld n){
        dp[0]=arr[0];
        dp[1]=abs(arr[1]-arr[0]);
        dp[2]=abs(arr[2]-arr[0]);
        for(lld i=3;i<n;++i){
        	lld op1=dp[i-1]+abs(arr[i]-arr[i-1]);
        	lld op2=dp[i-2]+abs(arr[i]-arr[i-2]);
        	dp[i]=min(op1,op2);
        }
        return dp[n-1];
	}
}

int main(){

 	lld n;
 	cin>>n;
 	lld arr[n];
 	for(lld i=0;i<n;++i)cin>>arr[i];
 	cout<<MinCost::getMin(arr,n);
}

Measured memory_bytes: 5184
fun main(args: Array<String>) = println((1..readLine()!!.toInt()).filter { div2Completely(it) }.max() ?: 1)

private fun div2Completely(n: Int): Boolean = when {
    n % 2 != 0 -> false
    n > 2 -> div2Completely(n / 2)
    else -> true
}

Measured memory_bytes: 31904
import java.util.*;
class Main{
	public static void main(String[] args){
	  Scanner scan = new Scanner(System.in);
	  int N = scan.nextInt();
      int X = scan.nextInt();
      int T = scan.nextInt();
      int time = 0;
      if(N%X == 0) time = (N/X) * T;
      else time = ((N/X)+1)*T;
      System.out.println(time);
	}
}

Measured memory_bytes: 35628
import numpy as np


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

h_dig = 360 // 12 * (h + m / 60)
m_dig = 360 // 60 * m
dig1 = abs(h_dig-m_dig) 
dig2 = 360 - dig1

rad = max(np.cos(np.deg2rad(dig1)), np.cos(np.deg2rad(dig2)))
print(np.sqrt(a ** 2 + b ** 2 - (2 * a * b * rad)))



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

vector<vector<int>> G;
vector<long long> v, res;

void solve1(int s, int t){
    res[s] = t + v[s];
    for(int k:G[s]){
        solve1(k, res[s]);
    }
    return;
}

void solve(long long N, long long Q, std::vector<long long> a, std::vector<long long> b, std::vector<long long> p, std::vector<long long> x){
    v = vector<long long>(N);
    res = vector<long long>(N);
    vector<long long> deg(N);
    for(int i=0;i<Q;++i){
        v[p[i]-1] += x[i];
    }
    G = vector<vector<int>>(N);
    for(int i=0;i<N-1;++i){
        G[a[i]-1].push_back(b[i]-1);
        deg[b[i]-1]++;
    }
    int r = -1;
    for(int i=0;i<N;++i){
        if(deg[i]==0)r=i;
    }
    solve1(r, 0);
    for(int i=0;i<N-1;++i){
        cout<<res[i]<<" ";
    }
    cout<<res[N-1]<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    std::vector<long long> p(Q);
    std::vector<long long> x(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&p[i]);
        scanf("%lld",&x[i]);
    }
    solve(N, Q, std::move(a), std::move(b), std::move(p), std::move(x));
    return 0;
}


Measured memory_bytes: 30592
#include <bits/stdc++.h>
using namespace std;
#define benfero freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define mm ' '
#define nl '\n'
#define MOD 1000007
typedef unsigned long long int ull;
typedef long long int ll;
int main()
{
    //benfero
    int n;
    cin>>n;
    int ar[n];
    int i;
    for(i=0;i<n;i++){
        cin>>ar[i];
    }
    ll dp[n];
    for(i=0;i<n;i++){dp[i]=0;}
    dp[1]=abs(ar[1]-ar[0]);
    for(i=2;i<n;i++){
        dp[i]=min(abs(ar[i]-ar[i-1])+dp[i-1],abs(ar[i]-ar[i-2])+dp[i-2]);
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1408
h,n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]

dp = [10**10]*(h+1)
dp[h] = 0
for i in range(h,0,-1):
    for j in ab:
        tmp = max(0,i-j[0])
        dp[tmp] = min(dp[tmp], dp[i]+j[1])

print(dp[0])


Measured memory_bytes: 42076
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#include <queue>
#include <functional>
#include <sstream>
#include <climits>
#include <map>
using namespace std;

void dayminute(int t, int &d, int &m){
	t %= 60 * 24 * 7;
	d = t / (60 * 24);
	m = t % (60 * 24);
}

bool inrange(int t, int r){
	if(r == 3){ return true; }
	if(r == 1){
		return t >= 60 * 6 && t < 60 * 18;
	}
	return t < 60 * 6 || t >= 60 * 18;
}

double solve(int s, int n, int t, int wd, int r, int p, int m){
	double ans = 0.0;
	double pr0 = pow(1.0 - 1.0 / p, n);

	for(int start = 0; start < 60 * 24; ++start){
		int u = start;
		double pr = 1.0;
		for(int k = 0; k < m; ++k){
			int d1, m1, d2, m2;
			dayminute(u, d1, m1);
			dayminute(u + s, d2, m2);
			
			if((wd >> d1 & 1) && (wd >> d2 & 1)){
				if(inrange(m1, r) && inrange(m2, r)){
					pr *= pr0;
				}
			}
			u += t;
		}
		ans = max(ans, 1.0 - pr);
	}
	return ans;
}

int main(){
	int s, n, t, p, m;
	string weekday, time;
	while(cin >> s >> n >> t >> weekday >> time >> p >> m, s){
		int wd, r;
		if(weekday == "All"){
			wd = 0x7f;
		}
		else{
			wd = 1;
		}
		if(time == "All"){
			r = 3;
		}
		else if(time == "Day"){
			r = 1;
		}
		else{
			r = 2;
		}
		
		printf("%.15f\n", solve(s, n, t, wd, r, p, m));
	}
}

Measured memory_bytes: 1264
n,m=map(int,input().split())
h=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(m)]
from math import gcd
ans=[1 for _ in range(n)]

for ab in AB:
    if h[ab[0]-1]>h[ab[1]-1]:
        ans[ab[1]-1]=0
    elif h[ab[0]-1]<h[ab[1]-1]:
        ans[ab[0]-1]=0
    else:
        ans[ab[0]-1]=0
        ans[ab[1]-1]=0


print(sum(ans))

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

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


int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    REP(i, N) cin >> d[i];

    sort(d.begin(), d.end());
    cout << d[N/2]-d[N/2-1] << endl;
    
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int x = sc.nextInt();
        System.out.println(IntStream.range(x - k + 1, x + k).mapToObj(Integer::toString).collect(Collectors.joining(" ")));
    }
}


Measured memory_bytes: 28756
s=raw_input()
n=len(s)
ans="Yes"
for i in range(n):
  if s[i]!=s[n-1-i]:
    ans="No"
    break
for i in range((n-1)/2):
  if s[i]!= s[(n-1)/2-1-i]:
    ans="No"
    break
print ans

Measured memory_bytes: 2568
a,b=map(int,input().split())

A=[1]
B=[1]

for i in range(2,10**6+5):
    if a%i==0:
        A.append(i)
        while a%i==0:
            a//=i
if a!=1:
    A.append(a)
        
for i in range(2,10**6+5):
    if b%i==0:
        B.append(i)
        while b%i==0:
            b//=i
if b!=1:
    B.append(b)

ans=0
for i in range(len(A)):
    if A[i] in B:
        ans+=1
print(ans)

Measured memory_bytes: 40556
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String N;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        long m = 0;
        if (!N.equals("0")) {
        	for (int i=0; i<N.length(); i++) {
        		int tmp = N.charAt(i);
        		m += tmp-48;
        	}
        }
        
        if (m%9 == 0) {
        	answer = "Yes";
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}


Measured memory_bytes: 40180
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
b_ls = [int(i) for i in sys.stdin.readline().split()]
# 全部正ならok
# 負に1足して正から2を引く
diff_ls = [b - a for a, b in zip(a_ls, b_ls)]
diff_ls.sort()
diff_ls = [i if i <= 0 else i // 2 for i in diff_ls]
if sum(diff_ls) >= 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 41328
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a * b) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}

Measured memory_bytes: 35476
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
 

int main(){
    int N,M;
    int a[55],b[55];
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> a[i] >> b[i];
        a[i] -= 1;
        b[i] -= 1;
    }
 
    int ans[55];
    for(int i =0; i < N; i++){
        ans[i] = 0;
    }
 
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(a[j] == i || b[j] == i){
                ans[i] += 1;
         }
    }
}
for(int i=0; i < N; i++){
    cout << ans[i] << endl;
}
}

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

using namespace std;

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

    vector<long long int> val(w+10, 0);

    vector<long long int> nval(w+10, 0);
    for (int i = 0; i < n; i++) {
        int ew, ev;
        cin >>ew >>ev;

        for (int j = 0; j <= w; j++) {
            if(j + ew <= w){
                nval[j+ew] = max(val[j+ew], val[j]+ev);
            }
        }
        val = nval;
    }
    printf("%lld\n", *max_element(val.begin(), val.begin()+w+1));
}

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

int main(){
    int N;
    long long X;
    cin >> N >> X;
    long long len[N+1];
    long long numP[N+1];
    len[0] = 1;
    numP[0] = 1;
    rep(i, N){
        len[i+1] = 2*len[i] + 3;
        numP[i+1] = 2*numP[i] + 1;
    }
    long long ans = 0;
    for(int i = N-1; i >= 0; i--){
        X--;
        if(X == 0) break;
        else if(X >= len[i]){
            ans += numP[i];
            X -= len[i];
            if(X > 0){
                ans++;
                X -= 1;
                if(X >= len[i]){
                    ans += numP[i];
                    X -= len[i];
                }
            }
            if(X == 0){
                break;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
    vector<int> a(3);
    rep(i,3) cin>>a[i];
    int sum=0;
    sort(a.begin(),a.end());
    sum+=a[2]-a[0];
    cout<<sum<<endl;
}   


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;

int main() {
    str s; cin>>s;
    map<char,ll> data;
    rep0(i,s.size()){
        data[s[i]]++;
    }
    if(data.size()==s.size()){cout<<"yes"<<endl;}
    else{cout<<"no"<<endl;}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD (long long)(1e9+7)
typedef long long int ll;
typedef unsigned long long int ull;

ll modularExponentiation(ll x, ll y, ll  p){
  ll res = 1;
  x = x % p;
  while (y > 0){
      if (y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
  }
  return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t=1;
  // cin>>t;
  while(t--){
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

n,m,k = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
prea = [0,]
preb = [0,]
for i in range(n):
    prea.append(prea[-1] + a[i])
for i in range(m):
    preb.append(preb[-1] + b[i])
ans = 0
j = m
for i in range(n+1):
    t = prea[i]
    while j>0 and t + preb[j] > k:
        j -= 1
    if t + preb[j] <= k:
        ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 135224
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll A(N);
        rep(i, 0, N) cin >> A[i];
        set<ll> s;
        rep(i, 0, N) {
                s.insert(A[i]);
        }

        if (len(s) == N) {
                puts("YES");
        } else {
                puts("NO");
        }
}

Measured memory_bytes: 13940
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N;cin >> N;
	vector<ll>A(N),B(1000007),C(N);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		B[A[i]]++;
	}
	ll m=0;
	for (int i = 0;i <= 200005;i++) {
		m += B[i] * (B[i] - 1) / 2;
	}
	for (int i = 0;i < N;i++) {
		ll a = B[A[i]]*(B[A[i]]-1)/2;
		ll b = (B[A[i]] - 1) * (B[A[i]] - 2) / 2;
		cout << m - a + b << endl;
	}
}

Measured memory_bytes: 13568
package main

import "fmt"

func iwai(x int) string {
	if x == 3 || x == 5 || x == 7 {
		return "YES"
	} else {
		return "NO"
	}
}

func main() {
	var x int
	fmt.Scan(&x)
	fmt.Println(iwai(x))
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
#define debug(x) cout << #x << " = " << x << endl;
#define sq(x) ((x)*(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

int Lcost[205][205];
int Scost[205][205];

int dp[1005][205];

int main(){
	int n, m;
	while(cin >> n >> m, n|m){
		static const int INF = 1e8;
		rep(i, n) rep(j, n){
			if(i == j) continue;
			Lcost[i][j] = INF;
			Scost[i][j] = INF;
		}
		rep(i, m){
			int x, y, t;
			char sl;
			cin >> x >> y >> t >> sl;
			x--, y--;
			if(sl == 'L'){
				Lcost[x][y] = Lcost[y][x] = t;
			}else{
				Scost[x][y] = Scost[y][x] = t;
			}
		}
		rep(i, n) rep(j, n) rep(k, n){
			Lcost[j][k] = min(Lcost[j][k], Lcost[j][i] + Lcost[i][k]);
			Scost[j][k] = min(Scost[j][k], Scost[j][i] + Scost[i][k]);
		}

		int r;
		cin >> r;
		vector<int> z(r);
		rep(i, r){
			cin >> z[i];
			z[i]--;
		}

		rep(i, r) rep(j, n) dp[i][j] = INF;
		dp[0][z[0]] = 0;
		for(int i = 1; i < r; i++){
			int pos = z[i-1];
			int next = z[i];
			rep(j, n){
				dp[i][j] = min(dp[i][j], dp[i-1][j]+Lcost[pos][next]);
				rep(k, n){
					dp[i][k] = min(dp[i][k], dp[i-1][j]+Lcost[pos][j]+Scost[j][k]+Lcost[k][next]);
				}
			}
		}
		int ans = INF;
		rep(i, n) ans = min(ans, dp[r-1][i]);
		cout << ans << endl;
	}

    return 0;
}

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

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

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

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


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

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

  int N;
  cin >> N;
  for(int i=1;;++i){
	int sum = 0;
	for(int d=1;d<=i;++d){
	  if(i % d == 0)
		++sum;
	}
	if(sum == N){
	  cout << i << endl;
	  break;
	}
  }

  return 0;
}



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


int main(){
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int ans = 0;
  for(int ii=0; ii<=A; ii++){
    for(int jj=0; jj<=B; jj++){
      for(int kk=0; kk<=C; kk++){
        if(500*ii+100*jj+50*kk==X){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main()
{
    string S;

    cin >> S;

    int cnt = 0;
    long long int sum = 0;
    const int s_len = S.size();
    for (int i = 0; i < s_len; i++){
        if (S[i] == 'B'){
            cnt++;
            sum += (s_len - i);
        }
    }

    long long int diff = (long long int)(cnt + 1) * cnt / 2;

    cout << (sum - diff) << endl;

    return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>

int main(int argc, char **argv)
{
    int N, M;
    std::cin >> N >> M;
    std::vector<int> A(M);
    std::vector<int> B(M);

    for(int i = 0; i < M; i++){
        std::cin >> A.at(i) >> B.at(i);
    }

    std::vector<std::vector<int>> C(N, std::vector<int>());

    for(int i = 0; i < M; i++){
        int a = A.at(i);
        int b = B.at(i);
        C.at(a-1).push_back(b-1);
        C.at(b-1).push_back(a-1);
    }

    std::vector<int> P(N, -1);
    std::queue<int> Q;
    P.at(0) = 0;
    for(int i = 0; i < C.at(0).size(); i++){
        int c = C.at(0).at(i);
        //std::cout << " " << c;
        P.at(c) = 1;
        Q.push(c);
    }
    //std::cout << std::endl;
    
    for(int i = 1; i < N; i++){
        int v = Q.front();
        Q.pop();
        auto c = C.at(v);
        for(int j = 0; j < c.size(); j++){
            if(P.at(c.at(j)) == -1){
                P.at(c.at(j)) = (v+1);
                Q.push(c.at(j));
            }
        }
        //std::cout << std::endl;
    }
    
    for(int i = 1; i < N; i++){
        if(P.at(i) < 0){
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;
    for(int i = 1; i < N; i++){
        std::cout << P.at(i) << std::endl;
    }

}


Measured memory_bytes: 11592
#include <stdio.h>
int main(int argc, char *argv[])
{
	int n,a,b,x,y;
	scanf("%d %d %d",&n,&a,&b);
	x=n*a;
	y=b;
	if(x>=y)printf("%d",y);
	else printf("%d",x);	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ip;
#define MOD 1000000007


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string S,T,s1,s2;
    ll i,j,k,m,n;
    cin>>S;
    cin>>T;
    ll ss=S.size();
    ll ts=T.size();
    ll x=INT_MAX,y;
    for(i=0;i<ss-ts+1;i++){
        y=0;
        for(j=0;j<ts;j++){
            if(S[i+j]!=T[j])
            y++;
        }
        x=min(x,y);
    }
    cout<<x<<"\n";
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define ll long long
//#define int long long
#define D double
#define F first
#define S second
#define sc scanf
#define pr printf
#define B break
#define R return
#define C continue
#define pb push_back
//#define double long double
//#define sz size()
#define P pair <ll,ll>
#define pi acos(-1)
using namespace std;
ll mod=1e9+7;;
ll inf=1e18+1;
ll n,m;
double nn;
ll w[20];
double dp[304][304][304];
double f(ll x,ll y,ll z){
    //cout <<x<<' '<<y<<' '<<z<<endl;
    if ((x<0||y<0)||z<0) R 0;
    if (!x&&!y&&!z) R 0;
    double &ret=dp[x][y][z];
    if (ret!=-1) R ret;
    double xx=x;
    double yy=y;
    double zz=z;
    //cout <<(1.0-(nn-xx-yy-zz)/nn)<<endl;
    ret=((1.0+f(x-1,y,z))*(xx/nn)+(1.0+f(x+1,y-1,z))*(yy/nn)+(1.0+f(x,y+1,z-1))*(zz/nn)+(nn-xx-yy-zz)/nn)/(1.0-(nn-xx-yy-zz)/nn);
    //cout <<x<<' '<<y<<' '<<z<<endl;
    //cout <<ret<<endl;
    R ret;
}
int main() {
    //freopen("dull.in","r",stdin);
    //ios::sync_with_stdio(0);
    //cin.tie(0);
    //cout.tie(0);
    for  (int i=0;i<=300;i++){
        for (int j=0;j<=300;j++){
            for (int o=0;o<=300;o++){
                dp[i][j][o]=-1;
            }
        }
    }
    cin >>n;
    nn=n;
    for (int i=1;i<=n;i++){
        int x;
        cin >>x;
        w[x]++;
    }
    cout <<setprecision(9)<<fixed<<f(w[1],w[2],w[3]);
    return 0;
}


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

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

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  ll H, W, K;
  cin >> H >> W >> K;
  string c[H];
  rep(h, H) cin >> c[h];

  ll ans = 0;
  rep(i, 1<<H)rep(j, 1<<W){
    ll cnt = 0;
    rep(h, H) rep(w, W){
      if((i & (1<<h) && j & (1<<w)) && (c[h][w] == '#'))
        cnt++;
    }
    if(cnt == K) ans++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int N=55,MOD=1e9+7;
LL dp[N][N][N*N]; // dp(i,j,k): i之前保留j個空格分數為k

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    dp[0][0][0]=1;
    REP(i,n) REP(j,n+1) REP(k,n*n) {
        // i-i
        dp[i+1][j][k+j*2]+=dp[i][j][k]; dp[i+1][j][k+j*2]%=MOD;
        // i-x i-x
        dp[i+1][j+1][k+(j+1)*2]+=dp[i][j][k]; dp[i+1][j+1][k+(j+1)*2]%=MOD;
        // i-j i-x
        dp[i+1][j][k+j*2]+=dp[i][j][k]*j*2; dp[i+1][j][k+j*2]%=MOD;
        // i-j i-j
        dp[i+1][j-1][k+(j-1)*2]+=dp[i][j][k]*j*j; dp[i+1][j-1][k+(j-1)*2]%=MOD;
    }

    cout << dp[n][0][k] << '\n';
    return 0;
}


Measured memory_bytes: 66000
num = int(input())
numbers = [ int(i) for i in input().split()]
count = 0
for i in range(len(numbers)):
    if i == 0:
        continue
    elif i == num-1:
        continue
    else:
        if numbers[i] < numbers[i-1] and numbers[i] > numbers[i+1]:
            count +=1
        elif numbers[i] > numbers[i-1] and numbers[i] < numbers[i+1]:
            count +=1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld double
long double PI =3.14159265;
using ll = long long;

const ll modo=1e9+7;
const ll ms=1e6+5;
const ll inf=1e17;

int ar[ms]={0};

int main(){
    idfc;

    int n;
    cin>>n;
    int i,j;

    for(i=1;i<=n;i++)
    {
        for(j=i;j<=n;j+=i)ar[j]++;
    }
    ll ans=0;
    int pp=n-1;
    for(i=1;i<n;i++)
    {
        ans+=(pp/i);
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 7500
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define repr(i,a,b) for (int i = a; i > b; --i)
#define mm(lamb, tttt) memset(lamb, tttt, sizeof lamb)
 
#define null NULL
#define eps 0.000000001
#define mod 1000000007
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
#define _ <<" "<<
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;

vector<int > v[200000];
int dp[200000];

int dfs(int p)
{
	int t = 0;

	if(dp[p] != -1)
	{
		return dp[p];
	}
	for (int i = 0; i <v[p].size() ; ++i)
	{
		t = max(t , dfs(v[p][i]) + 1 );
	}

	dp[p]  = t;
	return t;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 	//ll ans = 1;
	//freopen ("test.txt","r",stdin);
 	
 	int n,m;
 	cin>>n>>m;
 	

 	for (int i = 0; i < m; ++i)
 	{
 		int x,y;
 		cin>>x>>y;
 		v[x].pb(y);
 	}
 	
 	//cout<<v[1].size()<<endl;
 	//int dp[n+1];
 	for(int i=0;i<=n;i++)
 	{
 		dp[i] = -1;
 	}
 	int ans = -1;

 	for(int i=1;i<=n;i++)
 	{
 		int t = dfs(i);
 		ans = max(ans , t);
 		//cout<<t<<endl;
 	}
 	cout<<ans;



}

Measured memory_bytes: 10496