akhauriyash/Code-Regression huggingface dataset:
import Control.Monad
import Data.Array.IO

readPair :: Read a => IO (a,a)
readPair = do
    [a,b] <- map read . words <$> getLine
    return (a,b)

main = do
    (n,q) <- readPair :: IO (Int,Int)
    s <- getLine
    e <- newArray (1,n) 0
    a <- accumACIndices 0 1 e s
    r <- replicateM q $ solve a
    mapM_ print r

accumACIndices :: Int -> Int -> IOArray Int Int -> String -> IO (IOArray Int Int)
accumACIndices _ n arr []           = return arr
accumACIndices c n arr ('A':'C':ls) = do
    let c' = c+1
    ar <- accumACIndices c' (n+2) arr ls
    writeArray ar n c'
    writeArray ar (n+1) c'
    return arr
accumACIndices c n arr (_:ls)       = do
    ar <- accumACIndices c (n+1) arr ls
    writeArray ar n c
    return arr

solve :: IOArray Int Int -> IO Int
solve arr = do
    (l,r) <- readPair
    l' <- if l > 1 then readArray arr (l-1) else return 0
    r' <- readArray arr (r-1)
    return (r' - l')


Measured memory_bytes: 18172
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define endl 		"\n"
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define trace(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) {std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " : " << arg1;
	ZZ(comma, args...);
}

void solve() {
	char c ;
	cin >> c;
	if (c - 'a' >= 0)cout << 'a';
	else cout << 'A';

}
int main() {
	fast_io;
	int t = 1;
	// cin>>t;
	while (t--) {
		solve();
	}
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

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

using namespace std;

int main(){
    int A, B, C;
    string ans = "No";
    cin >> A >> B >> C;

    if(A == B && A != C)
        ans = "Yes";

    if (A == C && A != B)
        ans = "Yes";

    if (C == B && A != C)
        ans = "Yes";
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  string S;
  cin >> S;
  int N = S.size();
  ll dp[100010][4] = {};
  for (int i = N; i >= 0; --i)
  {
    for (int j = 3; j >= 0; --j)
    {
      if (i == N)
        dp[i][j] = (j == 3 ? 1 : 0);
      else
      {
        dp[i][j] = (S[i] == '?' ? 3 : 1) * dp[i + 1][j];
        if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j]))
          dp[i][j] += dp[i + 1][j + 1];
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[0][0] << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <iostream>
using namespace std;
int a[100010], b[50010];
int n, q;

int binarySearch(int c)
{
	int mid;
	int left = 0, right = n - 1;
	while(left <= right)
	{
		mid = left + (right - left) / 2;
		if(a[mid] == c)	
		{
			return 1;
		}
		else if(c < a[mid]) 
		{
			right = mid - 1;
		}
		else 
		{
			left = mid + 1;
		}
	}
	
	return 0;	
}

int main()
{
	int sum = 0;
	cin >> n;
	for(int i = 0; i < n; ++ i)
		cin >> a[i];
	
	cin >> q;
	for(int i = 0; i < q; ++ i)
	{
		cin >> b[i];
		if(binarySearch(b[i]))	sum ++;
	}
	
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 3600
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();

		System.out.println(a*b+" "+(a+a+b+b));




	}

}



Measured memory_bytes: 26212
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
#define FOR(i, a, b) for(int i=(a); i<=(b); ++i)
#define iFOR(i, a, b) for(int i=(a); i>=(b); --i)
#define make_unique(a) sort(all((a))), (a).resize(unique(all((a)))-(a).begin())

using namespace std;

typedef pair<int,int> PII;
typedef long long LL;
typedef double DD;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<DD,DD> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
const LL mod = 1000000007;
LL gcd(LL a, LL b){
    if(!b) return a;
    return gcd(b, a%b);
}
struct A{
    LL a, b;
    void red(){
        LL c = gcd(a, b); a/=c; b/=c;
    }
    A (LL aa, LL bb){
        if(bb < 0) aa *= -1, bb *= -1;
        a = aa, b = bb; red();
    }
    bool operator <(const A& o) const{
        return PLL(a,b) < PLL(o.a,o.b);
    }
};
map<A, int> mp;
LL bp(LL a, LL b){
    LL i, ans = 1, res = a;
    for(i=1;i<=b;i<<=1,res=res*res%mod){
        if(i&b) ans = ans*res%mod;
    }
    return ans;
}
int main(){
    int n;
    scanf("%d",&n);
    LL x = 0, y = 0, z = 0;
    FOR(i, 1, n){
        LL a, b;
        scanf("%lld %lld",&a,&b);
        if(a == 0 && b == 0) {
            z++; continue;
        }
        if(a == 0){
            ++x; continue;
        }
        if(b == 0){
            ++y; continue;
        }
        mp[ A(a, b) ]++;
    }
    LL ans = 1;
    map<A, int>::iterator it2, it;
    for(it2 = mp.begin(); it2 != mp.end(); it2++){
        auto e = (*it2);
        LL res = bp(2,e.y);
        it = mp.find( A(-e.x.b, e.x.a) );
        if(it != mp.end()) res += bp(2,it->y)-1, res %= mod, mp.erase(it); 
        ans = ans*(res)%mod;
    }
    LL res = 0;
    ans = ans*((bp(2,y)+bp(2, x)-1)%mod)%mod;
    ans = (ans+z+mod-1)%mod;
    printf("%lld",ans);
	return 0;
}
/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

Measured memory_bytes: 16260
import sys
input = sys.stdin.readline

N = int(input())
vec = [[] for _ in range(N)]
for _ in range(N - 1) :
  a, b = map(int, input().split())
  vec[a - 1].append(b - 1)
  vec[b - 1].append(a - 1)

mod = 10 ** 9 + 7

fac = [1]
for i in range(1, N + 1) :
  fac.append(fac[-1] * i % mod)

inv = [pow(fac[-1], mod - 2, mod)]
for i in range(N, 0, -1) :
  inv.append(inv[-1] * i % mod)
inv = inv[::-1]

def comb(n, r) :
  return fac[n] * inv[n-r] * inv[r] % mod

pattern = [1] * N
subtree = [0] * N

# DFS
stack = [(0, -1, 0)]
while stack :
  cur, pre, op = stack.pop()
  
  if op == 0 :
    stack.append((cur, pre, 1))
    for nex in vec[cur] :
      if nex == pre : continue
      stack.append((nex, cur, 0))
  else :
    for nex in vec[cur] :
      pattern[cur] *= pattern[nex] * comb(subtree[cur] + subtree[nex], subtree[nex]) % mod
      pattern[cur] %= mod
      subtree[cur] += subtree[nex]
    subtree[cur] += 1

# BFS
queue = [(0, -1)]
while queue :
  cur, pre = queue.pop()
  for nex in vec[cur] :
    if nex == pre : continue
    pattern[nex] = pattern[cur] * subtree[nex] * inv[N - subtree[nex]] * fac[N - subtree[nex] - 1] % mod
    queue.append((nex, cur))
  
for i in range(N) :
  print(pattern[i])

Measured memory_bytes: 126208
#include "stdio.h"
#include "string.h"
#include "math.h"

int main(int argc, char const *argv[]) {
  char S[300000];
  scanf("%s", S);
  int N=strlen(S);

  int i;
  int w=0;
  long long int ans=0;
  for (i = 0; i < N; i++) {
    if (S[i]=='W') {
      ans=ans+i-w;
      w++;
    }
  }
  if (w==N||w==0) {
    ans=0;
  }
  printf("%lld",ans);
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
#define rep(i, n) for (int i = 0; i < n; i++)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    priority_queue<int> pq;
    int x;
    string s;
    while (1) {
        cin >> s;
        if (s == "end") break;
        if (s == "insert") {
            cin >> x;
            pq.push (x);
        } else {
            x = pq.top();
            pq.pop();
            cout << x << "\n";
        }
    }
}


Measured memory_bytes: 7148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

// 00011
// 00011
// 11100
// 11100
// 11100

int solve(){
  ll H,W,A,B; cin>>H>>W>>A>>B;
  REP(i,B){
    cout << string(A,'1') << string(W-A,'0') <<"\n"; 
  }
  REP(i,H-B){
    cout << string(A,'0') << string(W-A,'1') <<"\n"; 
  }
  return 0;
}

int main(){
  solve();
}

Measured memory_bytes: 1280
#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
const ll INF = 999999999999999;
const ll MOD = 1000000007 /*988244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, g, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
void solve() {
    vector<string> VS = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};
    cout << VS[n % 10] << endl;
}
int main() {
    // cout<<fixed<<setprecision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    solve();
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin >>a>>b>>c>>k;
    int sum=0;
    if(k>=a){
        sum+=a;
        k-=a;
    }
    else
        sum+=k;
    if (k>=b)
    {
        k-=b;
    }
    else
        k=0;

    sum-=k;
    cout << sum;



    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#define INF (1e9)

using namespace std;
map<int, int> mp;
int main()
{
	int r, g, b, n;
	cin >> r >> g >> b >> n;
	int counter = 0;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j + i <= n; ++j) {
			if (r * i + g * j <= n && (n - r * i - g * j) % b == 0) counter++;
		}
	}
	cout << counter << endl;
	return 0;
}

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

using namespace std;

int main() {
	int n; cin >> n;
	vector<int> a(n + 1), b(n);
	for (int i = 0; i < n + 1; ++i) cin >> a[i];
	for (int i = 0; i < n; ++i) cin >> b[i];
	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += min(a[i], b[i]);
		b[i] -= min(a[i], b[i]);
		ans += min(a[i + 1], b[i]);
		a[i + 1] -= min(a[i + 1], b[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1152
n = int(input())
A = list(map(int, input().split()))

A_dict = {}
for a in A:
    if a in A_dict.keys():
        A_dict[a] += 1
    else:
        new = {a:1}
        A_dict.update(new)

ans = 'YES'
for value in A_dict.values():
    if value > 1:
        ans = 'NO'
print(ans)


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, std::vector<long double> p) {
  vector<vector<double> > dp(N + 1, vector<double>(N + 1, 0.0));
  dp.at(0).at(0) = 1.0;

  FOR(i, 1, N + 1) {
    rep(j, N + 1) {
      dp.at(i).at(j) = dp.at(i - 1).at(j) * (1 - p.at(i - 1));
      if (j - 1 >= 0) dp.at(i).at(j) += dp.at(i - 1).at(j - 1) * p.at(i - 1);
    }
  }

  double ans = 0.0;
  FOR(i, (N + 1) / 2, N + 1) { ans += dp.at(N).at(i); }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  std::vector<long double> p(N);
  for (int i = 0; i < N; i++) {
    scanf("%Lf", &p[i]);
  }
  solve(N, std::move(p));
  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll x; cin >> x;
  ll ans = x;
  bool is_continue = true;
  while (is_continue) {
    if (ans <= 2) {ans = 2; is_continue = false;}
    else if (ans%2==0) ans+=1;
    else {
      double rt = sqrt(ans);
      bool finddiv = false;
      for (ll i = 3; i <= rt; i += 2) {
        if (ans%i == 0) {finddiv = true; break;}
      }
      if (!finddiv) is_continue = false; else ans += 2;
    }
  }
  cout << ans << endl;
  return 0;
}

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

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

const ll INF = 1LL << 60;

int main(){
int n,r=0,b=0;
cin >> n;
string s;
cin >> s;
FOR(i,n){
  if(s[i]=='R'){
    r++;
  }else{
    b++;
  }
}
if(r>b){
  cout << "Yes" << endl;
}else{
  cout << "No" << endl;
}
}


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

int main()
{
    int N,len,i,X;
    string S;
    cin>>N;
    cin>>S;
    len=S.length();
    for(i=0;i<len;i++)
    {
        S[i]=S[i]+N;
        if(S[i]>90)
        {
            X=S[i]-90;
            S[i]=64+X;
        }
    }
    cout<<S;
}

Measured memory_bytes: 256
#![allow(dead_code, unused_imports, non_snake_case)]

use std::io::*;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::str::FromStr;

const MOD: i32 = 1_000_000_007;

fn main() {
    let (n, k): (u32, u32) = input();
    println!("{}", if n % k == 0 { 0 } else { 1 });
}

trait Read {
    fn read(s: &str) -> Self;
}

fn input<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl {
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s,t;
  cin>>s>>t;
  int n=s.size();
  if(t.size()==n+1 && t.substr(0,n)==s){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")

/*
dp[dgt][d][isless] := 上位dgt桁目まで確定して各桁の数字の総和modDがdであり、K未満かどうかがislessである場合の数
*/

int dp[10101][111][2];

int main()
{
	string K;
	cin >> K;
	int D, N = K.size();
	cin >> D;

	dp[0][0][0] = 1;

	for (int digit = 0; digit < N; digit++) // 桁数
	{
		for (int d = 0; d < D; d++) // 総和 mod D
		{
			int c = K[digit] - '0';
			for (int isless = 0; isless < 2; isless++) // K 未満であるか (isless = true -> K 未満)
			{

				for (int next = 0; next < 10; next++) // digit 桁目にくる数字
				{
					if (c > next) // 上位の状態に依らずisless = trueになる
					{
						(dp[digit + 1][(d + next) % D][1] += dp[digit][d][isless]) %= mod;
					}
					if (c == next) // isless = false -> Kと同じ, isless = true -> 既にK以下
					{
						(dp[digit + 1][(d + next) % D][isless] += dp[digit][d][isless]) %= mod;
					}
					if (c < next) // isless = false だとnextは置けない(Kより大きくなる)
					{
						if (isless)
							(dp[digit + 1][(d + next) % D][isless] += dp[digit][d][isless]) %= mod;
					}
				}
			}
		}
	}

	cout << (dp[N][0][1] + dp[N][0][0] - 1 + mod) % mod << "\n";
}

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

using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int main(){
  int a,b;cin>>a>>b;
  if((a+b)%2==0)
    cout<<(a+b)/2;
  else
    cout<<"IMPOSSIBLE";
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
using namespace std;
#define i64  long long
#define lint long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD_Q 1e9 + 7
#define MOD_A 998244353

 #define int long long



void solve()
{
  int N;
  cin>>N;
  if((N==7)||(N == 5) ||(N==3))
  {
    cout<<"YES"<<endl;
  } 
  else
  {
    cout<<"NO"<<endl;
  }
  return;
}
 
int32_t main(int32_t argc, const char *argv[])
{
 
  solve();
 
  return 0;
}

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

typedef unsigned long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll N;
    cin >> N;
    vector<pair<int,int>> A;
    REP(i,N){
        ll a;
        cin >> a;
        A.push_back(make_pair(a,i+1));
    }

    sort(A.begin(), A.end());

    REP(i,N){
        cout << A[i].second << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1780
#include <iostream>

using namespace std;

 

int main() 
{
    int a, b, c;
    
    cin >> a >> b >> c;
    if (a <= b && b <= c)
        cout << a << " " << b << " " << c << endl;
    else if(a <= c && c <= b)
        cout << a << " " << c << " " << b << endl;
    else if(b <= c && c <= a)
        cout << b << " " << c << " " << a << endl;
    else if(b <= a && a <= c)
        cout << b << " " << a << " " << c << endl;
    else if(c <= a && a <= b)
        cout << c << " " << a << " " << b << endl;
    else if(c <= b && b <= a)
        cout << c << " " << b << " " << a << endl;
    
}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main() 
{
	int i, j, H, W;
	while (1) {
    		cin >> H >> W;
		if(H == 0 && W == 0) {
        			break;
		}	
		for (i = 1; i <= H; i++) {
			for (j = 1; j <= W; j++) {
				if(i > 1 && i < H && j < W && j > 1)
                        			cout << ".";
            			else
                     				cout << "#";
            		}
		 	cout << endl;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const ll E16 = 1e16;

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll K;cin >> K;
  int N = 50;
  vector<ll> a(N);
  ll x = K/N;
  K = K%N;
  rep(i,N) a[i] = x+i;
  rep(i,N){
    if(i<K) a[i] += N+1;
    a[i] -= K;
  }

  cout << N << endl;
  rep(i,N) cout << a[i] SPF;
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
long long minb=10000000000,a,b,n;
bool flag;
long long ans;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%d%d",&a,&b);
		ans+=b;
		if(a>b) {
			minb=min(b,minb);
			flag=1;
		}
		if(a!=b)
			flag=1;
	}
	if(flag)
		printf("%lld",ans-minb);
	else
		puts("0");
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	int n;
	cin >> n;
	string s, h;
	cin >> s >> h;
	bool bre = false;
	int mon = 2 * n;
	for (int i = 0; i < n; ++i) {
		bool m = 1;
		for (int j = 0; j < n - i; ++j) {
			if (s[i + j] != h[j]) m = 0;
		}
		if (m) mon = min(mon, i + n);
	}
	cout << mon << endl;
}

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

int main(int argc, char const *argv[]) {
    string n;
    cin >> n;

    int ans = 0;
    for (size_t i = 0; i < n.size(); i++) {
        ans += n[i] - '0';
    }

    if (ans%9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3716
function Main(arg) {
  let S = arg.trim();
  let ret = 1;
  if(S == 'RRR'){
    ret = 3;
  } else if (S.indexOf('RR') > -1){
    ret = 2;
  } else if(S == 'SSS'){
    ret = 0;
  }
  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29668
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	string str ; 
	cin>> str ;
	if(str[1]=='B')cout<<"ARC"<<endl;
	else cout<<"ABC"<<endl;

	return 0;
}

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

int main(){
    int n,m,x; cin >> n >> m >> x;
    int a[m];

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

    // X -> 1と X -> Nのコストを計算する

    int x20cost = 0;
    int x2Ncost = 0;
    
    for(int i=0;i<x;i++){
        for (int j=0;j<m;j++){
            if (i == a[j]) {
                x20cost++;
            }
        }
    }

    for (int i=x;i<n+1;i++){
        for (int j=0;j<m;j++){
            if (i == a[j]) {
                x2Ncost ++;
            }
        }
    }

    cout << min(x20cost,x2Ncost) << endl;

    return 0;
}

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

long long rec(int n, long long x) {
    if (n == 0) return 1;
    long long len = (1LL<<(n+1)) - 3;
    long long num = (1LL<<n) - 1;
    if (x == 1) return 0;
    else if (x <= len + 1) return rec(n-1, x-1);
    else if (x == len + 2) return num + 1;
    else if (x <= (len + 1) * 2) return num + 1 + rec(n-1, x-len-2);
    else return num * 2 + 1;
}

int main() {
    int N; long long X;
    cin >> N >> X;
    cout << rec(N, X) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)
    {int count=0;
        if(i%2!=0)
        {
            for (int j=1;j<=i;j++)
                if (i%j==0)count++;
        }
        if(count==8)ans++;

    }
    cout<<ans<<endl;
    return  0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	try(Scanner sc= new Scanner(System.in)){
		final int n = sc.nextInt();
		int i= 1;
		do {
		    int x = i;
		    if(x%3==0){
			System.out.print(" " + i);
		    }else{
			do{
			    if (x % 10 == 3) {
				System.out.print(" " + i);
				break;
			    }
			    x /= 10;
			}while(x != 0);
		    }
		}while (++i <= n);
		System.out.println();
	    }
    }
}

Measured memory_bytes: 28832
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, M;
	cin >> N >> M;
	bool A[701][701] = {};
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		A[a][b] = true;
		A[b][a] = true;
	}

	vector<int> V;

	int dame = 0;
	int tukatta[701] = {};
	int msum = 0;

	rep1(q, N) {
		if (tukatta[q] == 0) {
			tukatta[q] = 1;
			queue<pair<int, int>> que;
			que.push(mp(q, 1));
			int n[3];
			n[1] = 1;
			n[2] = 0;

			while (que.size()) {
				auto p = que.front();
				que.pop();
				int i = p.first;
				int d = p.second ^ 3;
				for (int j = 1; j <= N; j++) {
					if (i != j && !A[i][j]) {
						if (tukatta[j] == 0) {
							tukatta[j] = d;
							que.push(mp(j, d));
							n[d]++;
						}
						else if (tukatta[j] != d) dame = 1;
					}
				}
			}
			V.pb(abs(n[1] - n[2]));
			msum += min(n[1], n[2]);
		}
	}

	if (dame) {
		co(-1);
	}
	else {
		bool dp[701] = {};
		dp[0] = true;
		for (auto p : V) {
			for (int i = 700; i >= 0; i--) {
				if (dp[i]) dp[i + p] = true;
			}
		}
		int saishou = 1e9;
		for (int i = 0; i <= 700; i++) {
			if(dp[i]) saishou = min(saishou, abs(N - msum - i - msum - i));
		}
		int X = (N + saishou) / 2;
		int Y = (N - saishou) / 2;
		int kotae = X * (X - 1) / 2 + Y * (Y - 1) / 2;
		co(kotae);
	}

	Would you please return 0;
}

Measured memory_bytes: 768
import java.util.*;
class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();
        int a = 0;
        int t = 0;
        for(int i=0;i<n;i++){
            a = sc.nextInt();
            t = t + a;
        }
        if(h<=t){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;
int main(void){
    
    long long n, x;
    cin >> n >> x;
    
    vector<long long> a;
    for(long long i=0; i<n; i++) {
        long long temp;
        cin >> temp;
        a.push_back(temp);
    }
    
    long long result = 0;
    for(long long i=1; i<n; i++) {
//        cout << a[i-1] << " " << a[i] << " " << x << endl;
        if(a[i-1] + a[i] > x) {
            long long temp = (a[i-1] + a[i]) - x;
            if(a[i] - temp < 0) {
                result += a[i];
                result += temp - a[i];
                a[i-1] -= temp - a[i];
                a[i] = 0;
            }
            else {
                result += temp;
                a[i] -= temp;
            }
        }
    }
    
 //   for(long long i=0; i<n; i++) {
 //       cout << a[i] << " ";
 //   }
 //   cout << endl;
    
    cout << result << endl;
    
    return 0;
    
}


Measured memory_bytes: 1400
import math
a,b,C=map(int,input().split())
S = a * b * 0.5 * math.sin(math.radians(C))
L = a + b + (a * a + b * b - 2 * a * b * math.cos(math.radians(C))) ** 0.5
h = b * math.sin(math.radians(C))

print('{:.8f}'.format(S))
print('{:.8f}'.format(L))
print('{:.8f}'.format(h))


Measured memory_bytes: 5724
N = input()

def f(s):
    if int(s) > int(N):
        return 0
    for t in '3','5','7':
        if all(['3' in s,'5' in s,'7' in s]):
            ans.append(1)
        f(s+t)

ans=[]
f('0')
print(sum(ans)//3)

Measured memory_bytes: 60680
#include<iostream>
using namespace std;
int main()
{
	int n,i,j;
	cin>>n;
	for(i=1;i<=9;i++)
    {
    	for(j=1;j<=9;j++)
		{	if(n==i*j)
			{n=1;
			break;
			}
		}
    }
	if(n==1)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
	
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
    if((i%2==0&&j%2==0)||(i%2==1&&j%2==1))
      cout << "#";
    else cout << ".";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
}



Measured memory_bytes: 3128
n, d = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(n)]
D = []
ans = 0
for i in range(n):
    j = i + 1
    while j < n:
        sum = 0
        for k in range(d):
            sum += (L[i][k] - L[j][k]) ** 2
        D.append(sum ** 0.5)
        j += 1
for l in D:
    if l % 1 == 0:
        ans += 1
print(ans)


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
signed main() {
    cin >> N;
    int ans = LLONG_MAX;
    for (int i = 0; i <= N; i++) {
        int cur = 0;
        int a = i, b = N - i;
        while (a != 0) {
            cur += a % 6;
            a /= 6;
        }
        while (b != 0) {
            cur += b % 9;
            b /= 9;
        }
        ans = min(ans, cur);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
a = [0] * ((N + 1) // 2)
for i in A:
	if N % 2:
		if i % 2:
			print(0)
			exit()
	else:
		if i % 2 == 0:
			print(0)
			exit()
	a[i // 2] += 1
if N % 2:
	if any(i != 2 for i in a[1:]) or a[0] != 1:
		print(0)
		exit()
else:
	if any(i != 2 for i in a):
		print(0)
		exit()
print(2 ** (N // 2) % 1000000007)

Measured memory_bytes: 13880
fun main(args: Array<String>) = abc155c()

fun abc155c() {
    val n = readLine()!!.toInt()
    val list = (1..n).map { readLine()!! }

    val map = list.groupBy { it }.map { it.key to it.value.size }
    val max = map.maxBy { it.second }!!.second

    val answer = StringBuilder()

    val sorted = map.filter { it.second == max }.map { it.first }.sorted()
    for (it in sorted) {
        answer.appendln(it)
    }

    print(answer)
}


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

//vector…可変長、データの大きさに合わせてサイズを変える
//list…双方向リスト、要素を挿入、削除の多いとき
//forward_list
//array…固定長配列
//set…集合
//multiset
//bitset…2進数、固定長ビット列
//map…連想配列、キーと値を関連付ける
//multimap
//deque…双方向リスト
//stack…FILO, 深さ優先探索
//queue…FIFO, 幅優先探索
//priority_queue…格納された最大値から順に取り出す
//pair…二つの値を一組
//tuple…複数の値を一組

const int mod = 1e9+7;

template<typename T>
void remove(std::vector<T>& vector, char index) {
    vector.erase(vector.begin() + index);
}

template<class T>
T ma(std::vector<T> &v) {
    T maxi = 0;
    for(auto &i:v) maxi = max(maxi, i);
    return maxi;
}
template<class T>
T mi(std::vector<T> &v) {
    T mini = 0;
    for(auto &i:v) mini = min(mini, i);
    return mini;
}
template <class T>
T pow(T x, T y, T n = numeric_limits<T>::max()) {
    if(y == 0) return 1;
    if(y % 2 == 0) return pow((x * x) % n, y / 2);
    return (x * pow(x, y - 1)) % n;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    return !y ? x : gcd(x % y, y);
}

using Graph = vector<vector<int>>;

template <class T, class S>
class Edge {
  T to;  //辺の行き先
  S weight;  //辺の重み

public:
  Edge(T t, S w) : to(t), weight(w) {}
};

int ansi = 0;
ll ansl = 0;
double ansd = 0.0;

int accumul(int mul) {
  if (mul == 0) {
    return 1;
  } else {
    return mul * accumul(mul-1);
  }
}

int main() {
  double n, d;
  cin >> n >> d;
  d = 2*d + 1;
  double ans = n / d;
  cout << ceil(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
using namespace std;
typedef long long int lli;



int main()
{   
    int A, B, N;
    cin >> N >> A >> B;
    if(N * A < B){
        cout << N * A  << endl;
    } else {
        cout << B << endl;
    }
    return 0;
}


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

int main() {
    unsigned long long a, b, c; cin >> a >> b >> c;
    if(a + b < c && 4 * a * b < (c - a - b) * (c - a - b)) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 256
def solve(abc):
    dp1 = [0, 0, 0]
    dp2 = [0, 0, 0]
    for i in abc:
        for j in range(3):
            for k in range(3):
                if j == k:
                    continue
                dp2[j] = max(dp2[j], dp1[k] + i[j])
        for j in range(3):
            dp1[j] = dp2[j]
    return max(dp2)

N = int(input())
abc = []
for i in range(N):
    abc.append(list(map(int, input().split())))
print(solve(abc))

Measured memory_bytes: 65112
#include<bits/stdc++.h>
#include<climits>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int              long long
#define umapii           unordered_map<int,int>
#define pqmaxi           priority_queue<int>
#define pqmini           priority_queue<int,vector<int>,greater<int>>
#define arr(type,a,n)    type* a = new type[n];
#define ff               first
#define ss               second
#define pb               push_back
#define w(t)             int t;cin>>t;while(t--)
#define popb             pop_back
#define mod              pow(10,9)+7;
#define mapii            map<int,int>
#define mp               make_pair
#define vint             vector<int>
#define presesion        fixed<<presesion(y)<<x
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>pbds;
int32_t main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	bool flag = false;
	int a, b, c;
	cin >> a >> b >> c;
	int t = 0;
	for (int i = 1; i < 1e6; i++) {
		t += a;
		if (t % b == c) {
			flag = true;
		}
	}
	if (flag) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

}


Measured memory_bytes: 3572
n = int(input())
a_list = list(map(int, input().split()))
a1_list = a_list
res_list =[]
a_score = 0
s_score = 0
for i in range(n):
    a_score += a_list[i]    
for i in a1_list:
    a_score -= i
    s_score += i
    res = abs(s_score - a_score)
    res_list.append(res)
del res_list[n-1]
print(min(res_list))

Measured memory_bytes: 24812
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L

int main() {
	int d, t, s; cin >> d >> t >> s;
	double tmp;
	if ( d % s != 0 ) {
		tmp = d/s + 1e-5;
		if (tmp <= t) cout << "Yes" << endl;
		else cout << "No" << endl;
	} else {
		if ( d/s <= t  ) cout << "Yes" << endl;
		else cout << "No" << endl;
	}	
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>

using namespace std;


int main(int argc, char** argv) {
    int a, b, c, d, e;
    std::vector<int> vec;
    cin >> a >> b >> c >> d >> e;

    int small{100};
    int answer{0};
    int sum{0};

    vec.push_back(a);
    vec.push_back(b);
    vec.push_back(c);
    vec.push_back(d);
    vec.push_back(e);

    for (int i = 0; i <  5; ++i) {
        int mod = vec[i] % 10;
        sum += vec[i];
        if (mod == 0) answer += vec[i];
        else if (mod < small) {
            small = mod;
            answer += vec[i] + (10-mod);
        } else {
            answer += vec[i] + (10-mod);
        }
    }
    if (sum % 10 != 0) {
        answer = answer-(10-small);
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC157a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            if (n % 2 == 0)
            {
                Console.WriteLine(n / 2);
            }
            else
            {
                Console.WriteLine((n + 1) / 2);
            }
        }
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<cstring>
#include<queue>
#define inRange(x,a,b) (a <= x && x < b)

using namespace std;
int di[8] = {0,0,1,-1,1,1,-1,-1};
int dj[8] = {1,-1,0,0,1,-1,1,-1};

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

    char mat[h][w];
    int arr[h][w];
    memset(arr, 0, sizeof(arr));
    queue<pair<int,pair<int,int>>> q;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> mat[i][j];
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(mat[i][j] == '.'){
                for(int k = 0; k < 8; k++){
                    int ni = i+di[k], nj = j+dj[k];
                    if(!inRange(ni,0,h) || !inRange(nj,0,w)) continue;
                    arr[ni][nj]++;
                    if(mat[ni][nj] != '.' && mat[ni][nj]-'0' == arr[ni][nj]){
                        q.push({1, {ni,nj}});
                    }
                }
            }
        }
    }
    
    int ans = 0;
    while(!q.empty()){
        auto p = q.front(); q.pop();
        ans = p.first;
        int i = p.second.first, j = p.second.second;
        mat[i][j] = '.';
        for(int k = 0; k < 8; k++){
            int ni = i+di[k], nj = j+dj[k];
            arr[ni][nj]++;
            if(mat[ni][nj] != '.' && mat[ni][nj]-'0' == arr[ni][nj]){
                q.push({ans+1, {ni,nj}});
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 8044
#include <iostream>
#include <stdio.h>
#include <math.h> 
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <string>
#include <numeric>
#include <bitset>
#include <queue>
#include <map>
#include <typeinfo>
#include <iomanip>

using namespace std;

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

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; } //最大公約数


int main() {

	//入力
	int n, k;

	cin >> n >> k;

	double ans = 0.0;
	for (int i = 1; i <= n; ++i) {
		double cnt = 0;
		int hikaku = i;
		while(1){
			if (hikaku >= k) {
				//cout << pow(0.5, cnt)/n << endl;
				ans = ans +  pow(0.5, cnt)/n;
				break;
			}
			cnt++;
			hikaku = hikaku * 2;
		}
	}
	cout << setprecision(12) << ans << endl;
}

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

using namespace std;

using ll = long long int;

const ll MOD = 1000000007;

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

    vector<ll> a(n);
    for(auto &x: a){
        cin >> x;
    }

    ll ans = 0;
    for(int i = 0; i < 61; i++){
        ll trueCount = 0;
        for(const auto x: a){
            if(x & (1LL << i)){
                trueCount++;
            }
        }
        ans += (((trueCount*(n - trueCount))%MOD)*((1LL << i)%MOD))%MOD;
        ans %= MOD;
    }

    cout << ans << endl;
    return 0;
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    b = b.at(0);
    cout << "A" + b + "C"  << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { 1, -1, 0, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, 0, 1, -1 , 1,  1, -1, -1 };
static const char Move[] = { 'E', 'W', 'N', 'S' };

int n, y, m, d;
vector<PII> gems;

int gcd( int m, int n ) {
	if ( n == 0 ) return m;
	return gcd( n, m % n );
}

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%d %d %d", &y, &m, &d );
		int ans = 196470;
		ans -= (( ( y - 1 ) / 3 ) * 590 + ( ( y - 1 ) % 3 ) * 195);
		if ( !(y % 3) ) {
			ans -= (( m - 1 ) * 20);
		}
		else {
			ans -= (( ( m - 1 ) / 2 ) * 39 + ( ( m - 1 ) % 2 ) * 20);
		}
		ans -= (d - 1);
		printf( "%d\n", ans );
	}
	return 0;
}

Measured memory_bytes: 1192
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        hoge();
        //System.Console.ReadLine();
    }

    public static void hoge()
    {
        var vars = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var n = vars[0];
        var m = vars[1];
        var a = System.Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var sum = a.Sum();

        System.Console.WriteLine(n - sum >= 0 ? n - sum : -1 );
    }
}

Measured memory_bytes: 29132
#include <iostream>
#include <cmath>
using namespace std;

int main(){
	
	int N, M;
	long long sum = 1;
	long long d = (long long)pow(10.0, 9.0) + 7;
	
	cin >> N >> M;
	
	if(N == M + 1 || M == N + 1){
		if(N > M){
			int a = N;
			N = M;
			M = N;
		}
		
		for(int i = 1 ; i <= N; i++){
			sum *= i;
			sum %= d;
		}
		sum *= sum;
		sum %= d;
		
		sum *= (N + 1);
		sum %= d;
	}
	else if(N == M){
		for(int i = 1 ; i <= N; i++){
			sum *= i;
			sum %= d;
		}
		sum *= sum;
		sum %= d;
		sum *= 2;
		sum %= d;
	}
	else sum = 0;
	
	cout << sum;
	return 0;
}

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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    string s; cin >> s;
    int res = 0;
    if (s == "SUN") res = 7; 
    if (s == "MON") res = 6; 
    if (s == "TUE") res = 5; 
    if (s == "WED") res = 4; 
    if (s == "THU") res = 3; 
    if (s == "FRI") res = 2; 
    if (s == "SAT") res = 1;
    cout << res << endl; 
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int N, M;
  char A[60][60] = {};
  char B[60][60] = {};

  scanf("%d %d", &N, &M);
  for(int i = 0; i < N; i++){
    scanf("%s", A[i]);
  }
  for(int i = 0; i < M; i++){
    scanf("%s", B[i]);
  }

  for(int i = 0; i <= N - M; i++){
    for(int j = 0; j <= N - M; j++){

      int flag = 1;
      for(int k = 0; k < M; k++){
        for(int l = 0; l < M; l++){

          if(A[i+k][j+l] != B[k][l]){
            flag = 0;
            break;
          }

        }
      }
      if(flag == 1){
        printf("Yes\n");
        return 0;
      }

    }
  }

  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();


		int canBuy = 0;
		if ((X /105 < X / 100) || X %105 == 0){
			canBuy = 1;
		}
		System.out.print(canBuy);
	}
}


Measured memory_bytes: 23508