akhauriyash/Code-Regression huggingface dataset:
import math
A, B, H, M = map(int, input().split())

h = 30*(M/60) + 30 * H
m = 360 * (M/60)
w = abs(h - m) if h > m else abs(m - h)
w = 360 - w if w > 180 else w
a = A
b = B


if w == 180:
    print(A+B)
else:
    w = math.radians(w)
    tmp = math.pow(a - b * math.cos(w), 2) + math.pow(b * math.sin(w), 2)
    c = math.sqrt(tmp)
    print(c)

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
 
int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int64_t ans = 0;
  if(A + B >= C*2){
    ans += C * 2 * min(X, Y);
    if(Y >= X){
      if(B < 2 * C){
        ans += B * (Y-X);
      }
      else{
        ans += C * 2 * (Y-X);
      }
    }
    else{
      if(A < 2 * C){
        ans += A * (X-Y);
      }
      else{
        ans += C * 2 * (X-Y);
      }
    }
  }
  else{
    ans += A*X + B*Y;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
const ll INF = 1145141919;
const ll MOD = 1000000007;
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}

int main(){

    string s;
    cin >> s;
    ll cnt[256] = {};
    rep(i, s.size())cnt[s[i]] ^= 1;
    rep(i, 256)if(cnt[i]){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 768
using System;
namespace ABC153A
{
    public class EmptyClass
    {
        public static void Main(string[] args)
        {
            int[] n = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int h = n[0];
            int a = n[1];
            int c = 0;
            while (h>0)
            {
                h -= a;
                c++;
            }
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
int main(int argc, char const *argv[]) {
  int i, n;

  scanf("%d", &n);

  for (i = 3; i <= n; i++) {
    if (i % 3 == 0) {
      printf(" %d", i);
    } else {
      int temp = i;
      do {
        if (temp % 10 == 3) {
          printf(" %d", i);
          break;
        }
        temp /= 10;
      } while (temp > 0);
    }
  }
  puts("");
  return 0;
}

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

namespace AtTest.AGC_038
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] hwab = ReadInts();
            int h = hwab[0];
            int w = hwab[1];
            int a = hwab[2];
            int b = hwab[3];
            for(int i = 0; i < h; i++)
            {
                for(int j = 0; j < w; j++)
                {
                    if ((i < b && j < a) || (i >= b && j >= a))
                    {
                        Write(0);
                    }
                    else
                    {
                        Write(1);
                    }
                }
                if (i < h - 1) WriteLine();
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 16204
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
#define srep(i, j, k) for (int i = j; i < k; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

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

//�G�X�g���l�X���
vector<ll> estora(vector<ll> num) {
    int sel = 0;
    while (sel < num.size()) {
        int d = num[sel];
        for (int i = 0; i < num.size(); i++) {
            if (num[i] % d == 0 && num[i] != d && d != 1) {
                num.erase(num.begin() + i);
                i--;
            }
        }
        sel++;
    }
    return num;
}

const int INF = 1001001001;

//mint�p�̒萔 (10��9�� + 7)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

string f(ll num) {
    if (num == 0) return "";
    num--;
    return f(num / 26) + string(1, num % 26 + 'a');
}
int main() {
    ll n;
    cin >> n;

    string ans = f(n);
    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
//i����ɑf���ɂ��Ă����Ȃ��Ƃ��܂��ł��Ȃ�&&�v�Z�ʃ��o�C
//�G�X�g���l�X��⿂őf����U����Ă����K�v�������肻��
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

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

int main(int argc, char const *argv[])
{
	long long a,b;
	int k;
	cin>>a>>b>>k;
	for (int i = 0; i < k; ++i)
	{
		if (i%2==0)
		{
			a-=a%2LL;
			b+=a/2LL;
			a/=2LL;
		}
		else
		{
			b-=b%2LL;
			a+=b/2LL;
			b/=2LL;
		}
	}
	cout<<a<<" "<<b<<endl;
	return 0;
}


Measured memory_bytes: 256
from heapq import heapify, heappop, heappush, heappushpop


class PriorityQueue:
    def __init__(self, heap):
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)


def main():

    N, M, s, t = map(int, input().split())
    s, t = s - 1, t - 1
    G = [{} for _ in range(N)]

    for _ in range(M):
        u, v, a, b = map(int, input().split())
        u, v = u - 1, v - 1
        G[u][v] = (a, b)    # (yen, snu)
        G[v][u] = (a, b)

    # Dijkstra
    ans = [0] * N
    # exchange at ith station
    # s to i
    q = PriorityQueue([(0, s)])  # (cost, id)
    vis = [False] * N
    while len(q):
        c, v = q.pop()
        if vis[v] is True:
            continue
        ans[v] = c
        vis[v] = True
        for n in G[v].keys():
            if vis[n] is True:
                continue
            q.push((c + G[v][n][0], n))    # pay by yen
    # i to t
    q = PriorityQueue([(0, t)])  # (cost, id)
    vis = [False] * N
    while len(q):
        c, v = q.pop()
        if vis[v] is True:
            continue
        ans[v] += c
        vis[v] = True
        for n in G[v].keys():
            if vis[n] is True:
                continue
            q.push((c + G[v][n][1], n))    # pay by snu

    # calc ans
    MONEY = pow(10, 15)
    for i in range(1, N):
        if ans[N - i] < ans[N - i - 1]:
            ans[N - i - 1] = ans[N - i]
    print('\n'.join(map(lambda x: str(MONEY - x), ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 142668
#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=a;i<b;i++) 
#define _For(i,a,b) for(int i=a;i>=b;i--)
#define LL long long 
inline LL CinLL(){LL x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
inline int Cin(){int x=0,f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();return f*x;}
const int INF = 0x3f3f3f3f;
const int N = 100005;
int t,n,m,ans;
int a[N];
vector<int> v;
char b[100][100];
int main(){
//	freopen("2.txt","r",stdin);
	 for(int i=0;i<3;i++)
	 cin>>b[i],cout<<b[i][i]; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> point;

double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}
int ccw(point a,point b,point c){
  point d = b-a,e = c-a;
  if(cross(d,e)>0) return 1;//"COUNTER_CLOCKWISE"
  if(cross(d,e)<0) return -1;//"CLOCKWISE"
  if(dot(d,e)<0) return 2;//"ONLINE_BACK"
  if(abs(d) < abs(e)) return -2;//"ONLINE_FRONT"
  return 0;//"ON_SEGMENT"
}

point crosspoint(point a,point b,point c,point d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

vector<point> ConvexCut(vector<point> &polygon,point a,point b){
  vector <point> res;
  for(int i=0;i<polygon.size();i++){
    point A=polygon[i],B=polygon[(i+1)%polygon.size()];
    if(ccw(a,b,A)!=-1)res.push_back(A);
    if(ccw(a,b,A)*ccw(a,b,B)==-1)res.push_back(crosspoint(a,b,A,B));
  }
  return res;
}

double get_area(vector <point> &polygon){
  if(polygon.size()<3)return 0;
  double res=0;
  for(int i=0;i<polygon.size();i++)
    res+=cross(polygon[i],polygon[(i+1)%polygon.size()])/2;
  return res;
}

int main(){
  while(1){
    int v,n,d;
    vector <point> pl;
    cin>>n>>d>>v;
    if(!n&&!d&&!v) break;
    for(int i=0,a,b;i<n;i++) cin>>a>>b,pl.push_back(point(a,b));
    
    double V=min(get_area(pl)*d,(double)v),ans=0;
    
    for(int i=0;i<n;i++){
      double L=0,M,R=2010;
      int I=1000;
      while(I--){
	M=(L+R)/2;
	point h=pl[(i+1)%n]-pl[i],b=h;
	h=(point(0,M)*h/abs(h))+pl[i];
	vector<point> a=ConvexCut(pl,h+b,h);
	if(get_area(a)*d>=V)R=M;
	else L=M+0.000000001;
      }
      ans=max(ans,L);
    }
    printf("%.8f\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1252
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD2 1000000007
#define MOD 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int fact[1100000];
Int revfact[1100000];
Int rev[1100000];

void init(){
    Int m = MOD;
    fact[0] = 1;
    revfact[0] = 1;
    rev[0] = 0;
    rev[1] = 1;
    for(int i = 1;i < 1100000;i++){
        fact[i] = fact[i-1] * i % m;
        if(i>1)rev[i] = MOD / i * (MOD-rev[MOD % i]) % MOD;
        revfact[i] = revfact[i-1] * rev[i] % MOD;
    }
}

Int nCk(Int n, Int k){
    if(n < k)return 0;
    return fact[n] * revfact[n-k] % MOD * revfact[k] % MOD;
}

Int calc(Int n, Int x){
    if(n % 2 == 1)return 0;
    n /= 2;
    return nCk(n+x, n);
}

Int dp[550][550];

int main(){
    init();
    int n, x;
    cin >> n >> x;
    dp[0][0] = 1;
    for(Int num = 0;num <= x;num++){
        for(int i = n;i > 0;i--){
            for(int j = 0;j < 550;j++){
                dp[i][j] += dp[i-1][j^num];
                dp[i][j] %= MOD;
            }
        }
    }
    Int ans=0;
    for(int i = 0;i <= n;i++){
        ans += dp[i][x] * calc(n-i, x);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 31036
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;
#[allow(unused_imports)]
use std::mem::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::HashMap;
#[allow(unused_imports)]
use std::collections::VecDeque;
#[allow(unused_imports)]
use std::usize;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();
    line.trim().to_string().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_cols<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).unwrap();

    line.trim()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let n = read::<String>();

    let digits: Vec<i32> = n.chars().map(|v| v.to_digit(10).unwrap() as i32).collect();
    let digits_sum = digits.iter().sum();
    let nine_sum = 9 * ((n.len() as i32) - 1);
    let mut ans = max(digits_sum, nine_sum);
    for i in 0..digits.len() - 1 {
        if digits[i] == 0 {
            continue;
        }

        let sum = digits
            .iter()
            .map(|v| *v)
            .enumerate()
            .map(|(i_digit, v)| {
                if i_digit > i {
                    9
                } else if i_digit == i {
                    v - 1
                } else {
                    v
                }
            })
            .sum();

        if sum > ans {
            ans = sum;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int k, t;
    cin >> k >> t;
    vector<ll> cakes(t);
    for (ll &c : cakes) cin >> c;

    sort(cakes.rbegin(), cakes.rend());

    ll ma = cakes.front();

    if ((k + 1) / 2 >= ma) {
        cout << 0 << endl;
        ret();
    }

    ll no = k - ma;

    cout << ma - 1 - no << endl;

}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int a,h,w,d,m,y[90001],x[90001],s[90001];
int main() {
	cin >> h >> w >> d;
	REP(i,h) REP(j,w) {
    cin >> a;
    y[a]=i,x[a]=j;
  }

	for (int i=d+1;i<=h*w;i++) {
		s[i] = s[i-d] + abs(x[i-d]-x[i]) + abs(y[i-d]-y[i]);
  }

	cin >> m;
  int l[m],r[m];
	REP(i,m) cin >> l[i] >> r[i];
  REP(i,m) {
		cout << s[r[i]]-s[l[i]] << endl;
	}

  return 0;
}

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

using namespace std;
#define ll long long
#define int long long

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif

#define MOD 1000000007

int N, A[110];

int culc(int x)
{
	int res = 0;
	rep(i, N) res += (A[i] - x) * (A[i] - x);
	return res;
}

signed main()
{
	cin >> N;
	rep(i, N) cin >> A[i];
	int mi = 100000000;
	reps(i, -100, 101) {
		mi = min(culc(i), mi);
	}
	cout << mi << endl;
}

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

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

    string s;
    cin >> s;
    int cnt[30] = {};
    for (int i = 0; i < s.size(); i++)
    {
        cnt[s[i] - 'a'] = 1;
    }
    char ans = 'A';
    for (int i = 0; i < 26; i++)
    {
        if (cnt[i] == 0)
        {
            ans = 'a' + i;
            break;
        }
    }
    if (ans == 'A')
        cout << "None" << endl;
    else
        cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#define N 55555
using namespace std;
int n, pr[N+5];
vector<int> vt;

int main() {
	int i, j, k, x, sum;
	cin>>n;
	for(i=2; i<=N; i++) pr[i] = 1;
	for(i=2; i<=N; i++) {
		if(pr[i]) for(j=i*2; j<=N; j+=i) pr[j] = 0;
	}
	for(i=11; i<=N; i+=5) {
		if(pr[i]) {
			cout<<i<<' ';
			n--;
			if(!n) return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define ii pair<ll,ll>
#define v vector<ll>
#define vii vector<ii>
#define vv vector<vector<ll> >
#define mp make_pair
#define INF LLONG_MAX
#define pb push_back
#define EPS 1e-9
const ll MOD = 1000000007; // 998244353
ll n,W;
ll w[101],V[101];
ll dp[101][100001];
ll solve(ll idx,ll sum){
    if(sum>W)return -INF;
    if(idx==(n))return 0;
    if(dp[idx][sum]!=-1)
        return dp[idx][sum];
    ll ans=V[idx]+solve(idx+1,sum+w[idx]);
    return dp[idx][sum]=max(ans,solve(idx+1,sum));
}
int main(){
    boost;
    cin>>n>>W;
    memset(dp,-1,sizeof dp);
    for (ll i = 0; i < n; ++i)
        cin>>w[i]>>V[i];
    cout<<solve(0,0)<<"\n";
    return 0;
}
//long long
//array bounds
//special cases
//binary search

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

using namespace std;

int main(){
    int n,m,l = 1,r = 100000;
    cin >> n >> m;


    for(int i = 0;i < m;i++){
        int a,b;
        cin >> a >> b;
        l = max(l,a);
        r = min(r,b);
    }

    if(r < l)cout << 0 << endl;
    else cout << r - l + 1 << endl;



    return 0;
}

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

int main(void)
{
    char s[10]={};
    scanf("%s",s);
    if(strcmp(s,"Sunny")==0){
        printf("Cloudy");
    }
    else if(strcmp(s,"Cloudy")==0){
        printf("Rainy");
    }
    else {
        printf("Sunny");
    }
    return 0;
}


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

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define ldb long double 
#define db double
#define int long long

#define fr first
#define se second
#define lb lower_bound 
#define ub upper_bound 
#define pb push_back
#define mpr make_pair

#define pi pair<int,int>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >

#define mi map<int,int>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(a,b) for (int i = (a); i < (b); ++i)
#define rrof(a,b) for (int i = (b)-1; i >= (a); --i)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int md = 1e9+7;
const int MX = 2e5+5;
const int INF = 1e18; 
const ldb PI = 4*atan((ldb)1);

int power_md(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res=(res%md*a%md)%md;
  a=(a%md*a%md)%md;
  n/=2;
}
res%=md;
return res;
}

int power(int a,int n)
{
 int res=1;
 while(n)
{
 if(n%2)
  res*=a;
  a=a*a;
  n/=2;
}
return res;
}

int abst(int a)
{
 return ((a<0)?(-1*a):(a));
}

class cmp_set{
public:
	bool operator() (int a, int b){
		return a > b;
	}
};

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

int32_t main()
{
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
     cin>>arr[i];
     sort(arr,arr+n);
     int minn=1e12;
     for(int i=0;i<=(n-k);i++)
     {
         minn=min(minn,(arr[i+k-1]-arr[i]));
     }
     cout<<minn<<"\n";
     return 0;
}

Measured memory_bytes: 1024
export class Main {
  static main(input): string {
    const [w, h, x, y]: number[] = input.split("\n")[0].split(" ").map(Number);
    return `${w * h / 2} ${w / 2 == x && h / 2 == y ? 1 : 0}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 7628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  string S;
  cin >> S;
  if(S.at(0) == '>'){
    reverse(all(S));
    S += "<";
    reverse(all(S));
  }
  if(S.at(S.size()-1) == '<'){
    S += ">";
  }
  vector<int64_t> ans(0);
  int cnt = 1;
  rep(i, S.size()-1){
    if(S.at(i) == S.at(i+1)){
      cnt++;
    }
    else{
      ans.push_back(cnt);
      cnt = 1;
    }
  }
  ans.push_back(cnt);
  int64_t answer = 0;
  rep(i, ans.size() / 2){
    if(ans.at(2*i) >= ans.at(2*i+1)){
      answer += ans.at(2*i) * (ans.at(2*i)+1) / 2;
      answer += (ans.at(2*i+1)-1) * ans.at(2*i+1) / 2;
    }
    else{
      answer += ans.at(2*i+1) * (ans.at(2*i+1)+1) / 2;
      answer += (ans.at(2*i)-1) * ans.at(2*i) / 2;
    }
  }
  cout << answer << endl;
}

Measured memory_bytes: 3068
from fractions import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
ans=""
if max(A)<k:
  ans="IMPOSSIBLE"
elif k in A:
  ans="POSSIBLE"
else:
  g=gcd(A[0], A[1])
  for i in range(2,n):
    g=gcd(g,A[i])
  if g!=0 and k%g==0:
    ans="POSSIBLE"
  else:
    ans="IMPOSSIBLE"
print(ans)

Measured memory_bytes: 16292
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.parseInt(in.next());
            }
            int ans = 0;
            int pos = 0;

            pos = k;
            if (pos == n) {
                ans = 1;
            } else {
                ans += ((n - pos) + (k - 1) - 1) / (k - 1) + 1;
            }
            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 59388
//DEEPANSHU RAWAT
//BTECH/10530/18
 
#include<bits/stdc++.h>
#define ull unsigned long long
#define lld long long int
#define infi LLONG_MAX
#define ninfi LLONG_MIN
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define e endl
#define mod 998244353
using namespace std;
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    */
    lld n,k;
    cin>>n>>k;
    if(n>10)
    {
        cout<<k;
    }
    else
    {
        cout<<k+100*(10-n);
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MAX (10001)

bool prime[MAX];

int main(){
	int n;
	for(int i=2; i<MAX; i++) prime[i] = true;
	for(int i=2; i<MAX; i++){
		if( prime[i] ){
			for(int j=i+i; j<MAX; j+=i){
				prime[j] = false;
			}
		}
	}
	while( cin >> n, n ){
		for(int i=n; 0<i; i--){
			if( prime[i] && prime[i-2] ){
				cout << i-2 << " " << i  << endl;
				break;
			}
		}
	}
}

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

int main() {
  string S;
  cin >> S;
  int N=S.size();
  int ans=0;
  for(int i=0;i<N/2;i++){
    if(S[i]==S[(N-1)-i]){
      ans+=0;
    }
    else{
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>	//Frog 1
using namespace std;
const int N = 100010;
const int M = 110;
const int INF = 1e9 + 7;
int dp[N][M],v[N];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	for(int i=0;i<N;++i)
		for(int j=0;j<M;++j)
			dp[i][j] = INF;

	int n,k;
	cin>>n;
	k = 2;
	
	for(int i=1;i<=n;++i) cin>>v[i];

	dp[1][0] = 0;

	for(int i=1;i<=n;++i)
		for(int j=1;j<=k;++j)
		{
			dp[i][j] = min(dp[i][j],dp[i][j-1]);
			int id = i - j;
			if(id < 0) continue;

			int x = abs(v[id] - v[i]);
			dp[i][j] = min(dp[i][j],dp[id][k] + x);
		}

	cout<<dp[n][k]<<"\n";
}

Measured memory_bytes: 46988
import java.util.Scanner;
import java.math.*;
class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        double r = scan.nextDouble();

        double area = Math.PI * r * r;
        double circumference = 2 * Math.PI * r;

        String areastr = String.format("%.6f", area);
        String circumferencestr = String.format("%.6f", circumference);

        System.out.println(areastr + " " + circumferencestr);

    }
}

Measured memory_bytes: 28172
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
using namespace std;
int main() {
	string s; cin >> s;
	while (1) {
		s.pop_back();
		s.pop_back();
		int i = s.length();
		if (s.substr(0, s.length() / 2 - 1) ==
			s.substr(s.length() / 2, s.length() / 2 - 1)) {
			cout << i << endl;
			break;
		}
   }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}


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

  ll N;
  cin >> N;


  ll even = 0;
  rep(i,N){
    ll inp; cin >> inp;
    if(inp%2==0) even++;
  }

  cout << pow(3,N)-pow(2,even) << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int>ans(N);
  
  for(int i=0; i<N-1; i++){
    int x;
    cin >> x;
    ans[x-1]++;
  }
  for(int x :ans){
    cout << x << endl;
  }
}

Measured memory_bytes: 4028
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    vector<int> a;
    int input;
    while(cin >> input){
        if(input==0){
            break;
        }
        a.push_back(input);
    }
    int n = a.size();
    int m = 1e6+1;
    vector<int> dp(m,0);
    vector<int> dp2(m,0);
    Rep(i,m){
        dp[i] = i;
        dp2[i] = i;
    }
    REP(i,m){
        for(int j=2;(j)*(j+1)*(j+2)/6+i<m;j++){
            int k = (j)*(j+1)*(j+2)/6;
            chmin(dp[i+k],dp[i]+1);
            if(k%2==1){
                chmin(dp2[i+k],dp2[i]+1);
            }
        }
    }
    REP(i,n){
        cout << dp[a[i]] << " " << dp2[a[i]] << "\n";
    }
    return 0;
}





Measured memory_bytes: 10708
#include <bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i, a, b) for (int i = a; i < (b); i++)
#define FOR(i, n) for (int i = n; i >= 0; i--)
using namespace std;
//R,Y,B,G
int main(){
    int h,w,d;
    cin >> h >> w >> d;
    char table[h][w];
    char color[2][2] = {{'R','Y'},{'B','G'}};
    if(d % 2 == 1){
        REP(i,h){
            REP(j,w){
            table[i][j] = (i+j) % 2 == 0? 'B':'G';
            }
        }
    }
    else{
        REP(i,h){
            REP(j,w){
                int x = j, y = -i;
                int xx = x + y;
                int yy = y - x;
                //cout << xx << yy << "\n";
                int divx = ceil(double(xx)/double(d)), divy = ceil(double(yy)/double(d));
                divx = divx % 2; divy = divy % 2;
                if(divx < 0) divx = divx + 2;
                if(divy < 0) divy = divy + 2;
                table[i][j] = color[divx][divy];
            }
        }
    }

    REP(i,h){
        REP(j,w){
            cout << table[i][j];
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) //これでiやjを定義しなくていいらしい
using namespace std;

int main(){
  int k;
  string s;
  cin >> k >> s;

  if(s.length()<=k)
    cout << s << endl;
  else{
    cout << s.substr(0,k) << "..." << endl;
  }

  return 0;
}


Measured memory_bytes: 3624
/*                    */
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
namespace my {
char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }
lint gcd(lint a, lint b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
lint lcm(lint a, lint b) { return a * b / my::gcd(a, b); }
}  // namespace my
/*                    */

int main() {
  int r;
  cin >> r;
  cout << 2.0 * r * 3.1415926535 << endl;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using node = tuple<int,int,int>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9+7;

ll pow2[10];
ll row[10];

int main(void){
  pow2[0] = 1;
  for(int i = 1;i < 10;++i){
    pow2[i] = (pow2[i-1] * 2) % mod;
  }
  ll calc[10][2] = {};
  calc[0][0] = 1;
  calc[0][1] = 0;
  row[0] = 1;
  for(int i = 1;i < 10;++i){
    calc[i][0] = calc[i-1][0] + calc[i-1][1];
    calc[i][1] = calc[i-1][0];
    row[i] = calc[i][0] + calc[i][1];
    //cout << row[i] << " ";
  }
  //cout << endl;
  int h,w,k;
  cin >> h >> w >> k;
  --k;
  ll dp[110][10] = {};
  dp[0][0] = 1;
  for(int i = 0;i < h;++i){
    for(int j = 0;j < w;++j){
      if(j > 0){
        ll delta = dp[i][j];
        delta = (delta * row[max(0,j-2)]) % mod;
        delta = (delta * row[max(0,w-1-(j+1))]) % mod;
        dp[i+1][j-1] = (dp[i+1][j-1] + delta) % mod;
      }
      if(j < w-1){
        ll delta = dp[i][j];
        delta = (delta * row[max(0,j-1)]) % mod;
        delta = (delta * row[max(0,w-1-(j+2))]) % mod;
        dp[i+1][j+1] = (dp[i+1][j+1] + delta) % mod;
      }
      ll delta = dp[i][j];
      delta = (delta * row[max(0,j-1)]) % mod;
      delta = (delta * row[max(0,w-1-(j+1))]) % mod;
      dp[i+1][j] = (dp[i+1][j] + delta) % mod;
    }
  }
  /*
  for(int i = 0; i <= h;++i){
    for(int j = 0;j < w;++j){
      printf("%10ld ", dp[i][j]);
    }
    cout << endl;
  }
  */
  cout << dp[h][k] << endl;
  return 0;
}


Measured memory_bytes: 256
import math
import itertools
N = int(input())
nums = []
for i in range(1, N + 1):
    nums.append(i)
permutaions_list = list(itertools.permutations(nums, N))
Ps = tuple(map(int, input().split()))
Qs = tuple(map(int, input().split()))

print(abs(permutaions_list.index(Ps) - permutaions_list.index(Qs)))


Measured memory_bytes: 44656
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;

void Main()
{
	int N;
  	cin >> N;
  	vector<int> H(N);
  	rep(i,N) cin >> H[i];
  	
  	int count = 0;
  	int tempmax = 0;
  	rep(i,N-1) {
      if(H[i] >= H[i+1]){
      	count++;
      }
      else{
      	tempmax = max(tempmax, count);
        count = 0;
      }
    }
    tempmax = max(tempmax, count);
  	cout << tempmax << endl;
	return;
}

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


Measured memory_bytes: 640
N, A = gets.split.map(&:to_i)

X = gets.split.map(&:to_i)

dp = Array.new(N + 1) { Array.new(N + 1) { Array.new(N * 50 + 1, 0) } }
dp[0][0][0] = 1
N.times do |i|
  x = X[i]
  (i + 1).times do |j|
    (0..(50 * j)).each do |k|
      c = dp[i][j][k]
      dp[i + 1][j][k] += c
      dp[i + 1][j + 1][k + x] += c
    end
  end
end
ans = 0
(1..N).each do |i|
  ans += dp[N][i][i * A]
end
puts ans

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

typedef long long lli;

const lli MAXN = 12;
const lli ten[9] = {1,10,100,1000,10000,100000,1000000,10000000,100000000};
lli N, ans;
string S[MAXN];
lli num[128], mini[MAXN], maxi[MAXN];

void rec(lli i, lli j, lli sum, lli used) {
  if(j == S[i].size()) ++i, j = 0;
  if(i == N) {
    ans += !sum;
    return;
  }
  if(sum < 0) return;
  if(i && !j) {
    lli low = 0, high = 0;
    for(lli k = i; k < N; ++k) {
      low += mini[k];
      high += maxi[k];
    }
    if(sum - low < 0) return;
    if(sum - high > 0) return;
  }
  if(num[S[i][j]] == -1) {
    for(lli d = S[i].size()-1 && !j; d < 10; ++d) {
      if(used >> d & 1) continue;
      num[S[i][j]] = d;
      lli nsum = sum;
      if(i) nsum -= ten[S[i].size()-j-1] * d;
      else  nsum += ten[S[i].size()-j-1] * d;
      rec(i, j+1, nsum, used | (1<<d));
    }
    num[S[i][j]] = -1;
  } else {
    lli d = num[S[i][j]];
    lli nsum = sum;
    if(S[i].size()-1 && !j && !d) return;
    if(i) nsum -= ten[S[i].size()-j-1] * d;
    else  nsum += ten[S[i].size()-j-1] * d;
    rec(i, j+1, nsum, used);
  }
}

struct LT {
  bool operator () (const string &a, const string &b) const {
    return ( a.size() != b.size() ? a.size() > b.size() : a > b );
  }
};

int main() {
  while(cin >> N && N) {
    for(lli i = 0; i < N; ++i) cin >> S[i];
    swap(S[0], S[N-1]);
    //sort(S+1, S+N, LT());
    for(lli i = 0; i < N; ++i) {
      map<char, lli> d;
      maxi[i] = 0;
      for(lli j = 0, used = 0; j < S[i].size(); ++j) {
        if(!d.count(S[i][j])) {
          for(lli k = 9; k >= (S[i].size()-1 && !j); --k) {
            if(used >> k & 1) continue;
            used |= 1 << k;
            d[S[i][j]] = k;
            break;
          }
        }
        maxi[i] = maxi[i] * 10 + d[S[i][j]];
      }
    }

    for(lli i = 0; i < N; ++i) {
      map<char, lli> d;
      mini[i] = 0;
      for(lli j = 0, used = 0; j < S[i].size(); ++j) {
        if(!d.count(S[i][j])) {
          for(lli k = S[i].size()-1 && !j; k < 10; ++k) {
            if(used >> k & 1) continue;
            used |= 1 << k;
            d[S[i][j]] = k;
            break;
          }
        }
        mini[i] = mini[i] * 10 + d[S[i][j]];
      }
    }

    ans = 0;
    memset(num, -1, sizeof(num));
    rec(0, 0, 0, 0);
    cout << ans << endl;
  }
  return 0;
}

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

int main()
{
  int a;
  int b;
  cin >> a >> b;
  if (a > b)
  {
    for (int i = 0; i < a; i++)
    {
      cout << b;
    }
  }
  else
  {
    for (int i = 0; i < b; i++)
    {
      cout << a;
    }
  }
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O #-}

import Control.Monad
import Control.Monad.ST
import Data.List
import Control.Monad.Trans.State.Strict
import Data.Char (isSpace)
import Data.Maybe (fromJust,fromMaybe)
import qualified Data.ByteString.Lazy.Char8 as B

import Data.Array.ST
import Data.Array.Unboxed
type Dist s = STUArray s (Int,Int) Int

type Parser a = StateT B.ByteString Maybe a

parseInt :: Parser Int
parseInt = StateT (B.readInt . B.dropWhile isSpace)

parseInt3 :: Parser (Int,Int,Int)
parseInt3 = liftM3 (,,) parseInt parseInt parseInt

parse :: Parser ((Int,Int,Int), [(Int,Int,Int)])
parse = do
    (n,ma,mb)<-parseInt3
    abcs<-replicateM n parseInt3
    return ((n,ma,mb),abcs)

main=do
    ((n,ma,mb),abcs)<-fromJust.evalStateT parse <$> B.getContents
    let dp = fdp n abcs :: UArray (Int,Int,Int) Int
    print $ solve n ma mb dp
--
fdp n abcs = runSTUArray $ do
    dp <- newArray ((0,0,0),(n,10*n,10*n)) 5000 :: ST s (STUArray s (Int,Int,Int) Int)
    writeArray dp (0,0,0) 0
    forM_ [(ii,u,v)|ii<-zip abcs [1..n],u<-[0..10*n],v<-[0..10*n]] $ \(((a,b,c),i),u,v) -> do
        writeArray dp (i,u,v) =<< min <$> readArray dp (i-1,u,v) <*> readArray dp (i,u,v)
        when (u-a>=0 && v-b>=0) $ writeArray dp (i,u,v) =<< min <$> ((+c) <$> readArray dp (i-1,u-a,v-b)) <*> readArray dp (i,u,v)
    return dp
--
solve n ma mb dp
    | ar < 5000 = ar
    | otherwise = -1
    where
        ca = takeWhile (\c->c*ma<=10*n && c*mb<=10*n) [1..]
        ar = minimum $ map (\c -> dp ! (n,c*ma,c*mb)) ca


Measured memory_bytes: 53244
N,H = map(int,input().split())
kill = []
throw = []
ans = 0
for i in range(N):
    a,b = map(int,input().split())
    kill.append(a)
    throw.append(b)
throw.sort()
throw.reverse()
const = max(kill)
for j in throw:
    if j <= const:
        break
    else:
        H -= j
        ans += 1
        if H <= 0:
            break
if H > 0:
    time = H//const
    if H % const == 0:
        ans += time
    else:
        ans += time+1
print(ans)

Measured memory_bytes: 86796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll H;
    while(cin >> H) {
        if(H == 0) return 0;

        vvll c(20, vll(5, 0));

        rep(i, H) rep(j, 5) cin >> c[H-1-i][j];

        ll ans = 0;
        bool end = false;

        while(!end) {
            vector<vector<bool>> blank(20, vector<bool>(5, false));
            end = true;

            rep(i, H) {
                ll left = 0, right = 0, cnt = 1;
                for(ll j = 1; j < 5; j++) {
                    if(c[i][j-1] == c[i][j] && c[i][j] != 0) {
                        cnt++;
                        right = j;
                        if(j == 4 && cnt >= 3) {
                            ans += c[i][j] * cnt;
                            end = false;
                        }
                    }
                    else {
                        if(cnt >= 3) {
                            ans += c[i][j-1] * cnt;
                            end = false;
                            break;
                        }
                        else {
                            left = right = j;
                            cnt = 1;
                        }
                    }
                }
                if(cnt >= 3) for(ll k = left; k <= right; k++) blank[i][k] = true;
            }

            rep(j, 5) rep(i, H) {
                ll k = i;
                while(blank[k][j]) {
                    k++;
                }
                c[i][j] = c[k][j];
                if(c[k][j] != 0) blank[k][j] = true;
            }
        }
        cout << ans << endl;
    }
}



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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(max({a,b,c})==a+b+c-max({a,b,c})){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v;
string S, T;
vl A, B;
void input() { cin >> S; }
void solve() {
    x = S[0] - 'A';
    if(x > -1 && x < 26)
        cout << "A" << endl;
    else
        cout << "a" << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 3652
#include <stdio.h>

int main() {
	int N;
	scanf("%d", &N);
	int flag = 0;
	char S[2];
	for (int i = 0; i < N; i++) {
		scanf("%s", S);
		if (S[0] == 'Y') flag = 1;
	}
	if (flag == 0) printf("Three\n");
	else printf("Four\n");
	return 0;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef pair<int, int> P;

void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

class Heap {
    int n;
    vector<ll> heap;
public:
    Heap(int n) : n(n), heap(n + 1, 0) {}

    void set(int i, ll v) {
        heap[i + 1] = v;
    }

    ll get(int i) {
        return heap[i + 1];
    }

    ll parent_value(int i) {
        if (i == 0) return -INF;
        int j = (i + 1) / 2;
        return heap[j];
    }

    ll left_value(int i) {
        int j = 2 * (i + 1);
        if (j > n)return -INF;
        return heap[j];
    }

    ll right_value(int i) {
        int j = 2 * (i + 1) + 1;
        if (j > n) return -INF;
        return heap[j];
    }

    void buildMaxHeap() {
        for (int i = (n + 1) / 2; i > 0; i--) {
            max_heapify(i);
        }
    }

    void print() {
        for (int i = 1; i <= n; i++) cout << ' ' << heap[i];
        cout << endl;
    }

private:
    void max_heapify(int i) {
        int left = 2 * i;
        int right = 2 * i + 1;

        int largest;
        if (left <= n && heap[left] > heap[i]) {
            largest = left;
        } else {
            largest = i;
        }

        if (right <= n && heap[right] > heap[largest]) {
            largest = right;
        }
        if (largest != i) {
            swap(heap[i], heap[largest]);
            max_heapify(largest);
        }
    }

};

int main() {

    int n;
    cin >> n;

    Heap heap(n);

    rep(i, n) {
        ll v;
        cin >> v;
        heap.set(i, v);
    }

    heap.buildMaxHeap();
    heap.print();


}




Measured memory_bytes: 6720