akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
using P = pair<int,int>;

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int H; cin >> H;
    vector<int> A(H);
    rep(i,H) cin >> A[i];
    rep(i,H){
        printf("node %d: key = %d, ", i+1, A[i]);
        if(i != 0) printf("parent key = %d, ", A[(i-1)/2]);
        if(i*2+1 <= H-1) printf("left key = %d, ", A[i*2+1]);
        if(i*2+2 <= H-1) printf("right key = %d, ", A[i*2+2]);
        cout << endl;
    }
}


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

ll dp[105][100005];
int main(){
    int N,W;cin>>N>>W;
    ll val[N+1][2];
    for(int i=1;i<=N;i++)cin>>val[i][0]>>val[i][1];
    ll sumval=0;
    for(int i=1;i<=N;i++)sumval+=val[i][1];
    for(int i=1;i<100005;i++)dp[0][i]=1000000007;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=100005;j++){
            if(j>=val[i][1])dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i][1]]+val[i][0]);
            else dp[i][j]=min(dp[i-1][j],val[i][0]);
        }
    }
    for(int i=sumval;i>0;i--){
        for(int j=N;j>0;j--){
            if(dp[j][i]<=W){
                cout<<i<<endl;;
                i=0;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 80128
use std::io::{BufRead, Write};
use std::io;

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let n = s.trim().parse::<usize>().unwrap();
    s.clear();
    input.read_line(&mut s).unwrap();
    let mut a = s.split_whitespace()
        .map(|s| s.parse::<u64>().unwrap())
        .collect::<Vec<_>>();
    a.sort();
    let mut result=0u64;
    for i in 0..n {
        result+=a[n+2*i];
    }
    writeln!(output,"{}",result).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v = Vec::<u8>::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }
    #[test]
    fn case1() {
        test("2
5 2 8 5 1 5\n", "10\n");
    }
    #[test]
    fn case2() {
        test("10
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "10000000000\n");
    }
}



Measured memory_bytes: 13428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    ll n;
    string s;
    cin >> n;
    for (ll i = floor(sqrt(n)); i > 0 ; --i) {
        if (n % i == 0) {
            n /= i;
            break;
        }
    }
    s = to_string(n);
    cout << s.size() << endl;
    return 0;
}


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

using namespace std;

int main() {
	int N;
	string S, T;

	cin >> N;
	cin >> S >> T;

	for (int i = 0; i < N; i++) {
		cout << S[i] << T[i];
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n;
    cin >> n;
    vector< int > v[105];
    for( int i = 0; i < n; ++i ) {
        for( int j = 0; j < 10; ++j ) {
            int f;
            cin >> f;
            v[i].pb( f );

        }
    }

    vector< int > p[105];
    for( int i = 0; i < n; ++i ) {
        for( int j = 0; j < 11; ++j ) {
            int a;
            cin >> a;
            p[i].pb( a );

        }
    }

    int res = MIN;
    for( int i = 1; i < (1 << 10); ++i ) {
        int tmp = 0;
        for( int j = 0; j < n; ++j ) {
            unsigned int bi = i;
            int pos = 0;
            int cnt = 0;
            while( bi > 0 ) {
                if( (bi & 1) && v[j][pos] == 1 ) {
                    ++cnt;

                }
                bi >>= 1;
                ++pos;

            }
            tmp += p[j][cnt];

        }
        res = max( res, tmp );

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,N) for (int i=0;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main(){
    int A,B;
    cin >>A>>B;
    int ans;
    ans=max(A+B,max(A-B,A*B));
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

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

	int n, k;
	cin >> n >> k;

	vector<int> a(n);
	for(auto &x : a) cin >> x;

	sort(all(a));

	ll res = 0;
	for(int i = 0; i + k < n; ++i) res += a[i];
	
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);++i)

int w,h;
int ans;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool visit[10][10];


inline bool check(int y,int x){
	return 0<=y&&y<h&&0<=x&&x<w;
}
int neighbor(int y,int x,char color,char panel[10][10]){
	int res=0;
	if(!check(y,x) || visit[y][x])return 0;
	if(panel[y][x]!=color){
		if(panel[y][x]=='R')return 1;
		if(panel[y][x]=='G')return 2;
		if(panel[y][x]=='B')return 4;
	}
	visit[y][x] = true;
	rep(i,4){
		res |= neighbor(y+dy[i],x+dx[i],color,panel);
	}
	return res;
}
void change(int y,int x,char from,char to,char panel[10][10]){
	if(!check(y,x) || from!=panel[y][x])return;
	panel[y][x] = to;
	rep(i,4){
		change(y+dy[i],x+dx[i],from,to,panel);
	}
}
void search(int depth,char panel[10][10]){
	if(ans<=depth)return;
	memset(visit,false,sizeof(visit));
	int diff = neighbor(0,0,panel[0][0],panel);
	if(diff==0){
		ans = depth;
		return;
	}
	char buf[10][10];
	rep(i,3){
		if((diff&1<<i)==0)continue;
		memcpy(buf,panel,sizeof(buf));
		change(0,0,buf[0][0], (i==0?'R':(i==1?'G':'B')),buf);
		search(depth+1,buf);
		if(ans <= depth+1)return;
	}
}
int main(){
	char panel[10][10];
	while(cin>>w>>h,w|h){
		rep(i,h)rep(j,w)cin>>panel[i][j];
		ans = INF;
		search(0,panel);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 876
def f(num, ret):
    for i in range(2, min(num+1, int(num**0.5) + 5)):
        if not num % i:
            ret.append(i)
            return f(num//i, ret)
    if num != 1: ret.append(num)
    return ret


from collections import Counter
n = int(input())
l = []
prime = [1]*(n+1)
prime[0] = 0
prime[1] = 0
for i in range(2, n+1):
    if prime[i]:
        l.append(i)
        for j in range(i*2, n+1, i):
            if prime[j]:
                r = f(j, [])
                for ri in r: l.append(ri)
                prime[j] = 0
l = Counter(l)
res = 1
for v in l.values():
    res *= (v+1)
    res %= 10**9+7
print(res)

Measured memory_bytes: 3444
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





int n, k;
vector<int> edge[100000];


int a[100000];


vector<int> bucket[1100000];


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

	scanf("%d", &n);
	rep(i,n-1) {
		int a, b;
		scanf("%d%d", &a, &b);
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	

	fill_n(a, n, INF);
	scanf("%d", &k);
	rep(i,k) {
		int v, p;
		scanf("%d%d", &v, &p);
		v--;
		a[v] = p;
		bucket[p].push_back(v);
	}
	int idx = 0;
	rep(i,n){
		int v, p;
		while (bucket[idx].empty())idx++;
		p = idx;
		v = bucket[idx].back();
		bucket[idx].pop_back();

		for (int u : edge[v]) {
			if (a[u]==INF) {
				a[u] = p + 1;
				bucket[p + 1].push_back(u);
			}
			else if (abs(a[u] - a[v]) != 1) {
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	rep(i, n)printf("%d\n", a[i]);

	
	return 0;
}

Measured memory_bytes: 35328
#include <bits/stdc++.h>
using namespace std;
vector<int>v[100005],v1[100005];
bool vis[100005];
vector<int>st;
long long ans[100005];
long long pos[100005];
void dfs(int s)
{
    vis[s]=1;
    int i;
    for(i=0;i<v[s].size();i++)
    {
        if(!vis[v[s][i]])
        {
            dfs(v[s][i]);
        }
    }
    st.push_back(s);
}
int main()
{
    int n,m;
    cin>>n>>m;
    int i,a,b;
    for(i=1;i<=n+m-1;i++)
    {
        cin>>a>>b;
        v[a].push_back(b);
        v1[b].push_back(a);
    }
    for(i=1;i<=n;i++)
    {
        if(!vis[i])
            dfs(i);
    }
    reverse(st.begin(),st.end());
    ans[st[0]]=0;
    pos[st[0]]=1;
    int kk=0,j;
    for(i=1;i<st.size();i++)
    {
        int ans1=0;
        for(j=0;j<v1[st[i]].size();j++)
        {
            if(pos[v1[st[i]][j]]>ans1)
            {
                ans1=pos[v1[st[i]][j]];
                kk=v1[st[i]][j];
            }
        }
        pos[st[i]]=i+1;
        ans[st[i]]=kk;
    }
    for(i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 15996
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
using namespace std;

int main() {

	queue< pair<string, int> > que;
	string name;
	int n, q, t;
	cin >> n >> q;

	for(int i = 0; i < n; i++) {
		cin >> name >> t;
		que.push(make_pair(name, t));
	}

	pair<string, int> u;
	int elapse = 0, a;

	while( que.empty() == false) {
		u = que.front(); que.pop();
		a = min(u.second, q);
		elapse += a;
		u.second -= a;
		if(u.second > 0) que.push(u);
		else cout << u.first << " " << elapse <<endl;
	}
	return 0;
}

Measured memory_bytes: 4404
#include <stdio.h>
#define mod 998244353
typedef long long ll;

ll mul(ll a, ll b) {
  return a * b % mod;
}

ll pow(ll a, ll b) {
  ll ans = 1;
  while(b) {
    if(b & 1) ans = mul(ans, a);
    a = mul(a, a), b >>= 1;
  }
  return ans;
}

int main(void) {
  ll i, j, n, s, a, m = (mod + 1) / 2;
  scanf("%lld%lld", &n, &s);
  ll dp[s + 1];
  for(i = 0; i <= s; ++i) dp[i] = 0;
  dp[0] = pow(2, n);
  for(i = 0; i < n; ++i) {
    scanf("%lld", &a);
    for(j = s - a; j >= 0; --j) dp[j + a] += mul(dp[j], m), dp[j + a] %= mod;
  }
  printf("%lld", dp[s]);
  return 0;
}

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

using namespace std;

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

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

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

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

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

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

int main(){
  int x,y,a,b,c; cin >> x >> y >> a >> b >> c;
  vector<int> va(a); cin >> va;
  vector<int> vb(b); cin >> vb;
  vector<int> vc(c); cin >> vc;
  sort(va.rbegin(), va.rend());
  sort(vb.rbegin(), vb.rend());
  heaP<int> ha;
  heaP<int> hb;
  for(int i = 0; i < x; ++i)ha.push(va[i]);
  for(int i = 0; i < y; ++i)hb.push(vb[i]);
  Heap<int> hc;
  for(int e:vc)hc.push(e);
  while(!hc.empty()){
    heaP<int>&hp = (ha.top() > hb.top() ? hb : ha);
    if(hp.top() > hc.top()) break;
    hp.pop();
    hp.push(hc.top());
    hc.pop();
  }
  ll ans = 0;
  while(!ha.empty()){ans += ha.top(); ha.pop();}
  while(!hb.empty()){ans += hb.top(); hb.pop();}
  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 2936
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

bool isGetuyoudoyousoinsuu(int n){
  bool res;
  if(n%7 != 6 && n%7 != 1){
    res = false;
  }else{
    res = true;

    for(int i=6;i<=sqrt(n);i+=7){
      if(n%i == 0){
	res = false;
	break;
      }
    }
    for(int i=8;res && i<=sqrt(n);i+=7){
      if(n%i == 0){
	res = false;
	break;
      }
    }
  }

  return res;
}

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

  while(n>1){
    vector<int> ans;

    for(int i=6;i<=n;i+=7){
      if(n%i==0 && isGetuyoudoyousoinsuu(i)){
	ans.push_back(i);
      }
    }
    for(int i=8;i<=n;i+=7){
      if(n%i==0 && isGetuyoudoyousoinsuu(i)){
	ans.push_back(i);
      }
    }

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

    printf("%d: ",n);
    for(int i=0;i<ans.size();i++){
      printf("%d",ans[i]);
      if(i+1 != ans.size()){
	printf(" ");
      }
    }
    printf("\n");
    cin>>n;
  }
  return 0;
}

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

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    bool possible = false;
    for (int i = 0; i < 1000; i++){
        if (A * i % B == C){
            cout << "YES" << endl;
            possible = true;
            break;
        }
    }
    if (possible == false){
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

/**
 * Created by Santa on 2016/10/16.
 */
public class Main {

    static int N;
    static long A;
    static long B;
    static long C;
    static long[] map;





    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();

        map = new long[N];

        for (int i = 0; i < N; i++) {
            map[i] = scanner.nextLong();
        }

        long temp = 0;
        long  old = temp;

        long ans = 0;
        int left = 0;
        for (int i = 0; i < N; i++) {

            if((map[i] ^ temp) == map[i] + temp){
                temp = map[i] ^ temp;
                ans += i - left + 1;
            }else {
                int cnt = 0;
                while (true) {
                    temp = map[left] ^ temp;
                    left++;
                    if ((temp ^ map[i]) == temp + map[i]) {
                        ans += i - left + 1;
                        temp = map[i] ^ temp;
                        break;
                    }
                }



            }

        }

        System.out.println(ans);

    }



}



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

const int dx[] = {0, 0, 1, -1}, dy[] = {-1, 1, 0, 0};

int h, w;
int n;
int lx[1010], ly[1010], rx[1010], ry[1010];
vector<int> x, y;

bool d[2020][2020];

void dfs(int i, int j)
{
  if (i < 0 || j < 0 || h < i || w < j) return;
  if (d[i][j]) return;
  d[i][j] = true;

  for (int k = 0; k < 4; k++){
    dfs(i + dy[k], j + dx[k]);
  }
}

int main()
{
  while (cin >> h >> w, h){
    x = vector<int>();
    y = vector<int>();
    memset(d, false, sizeof(d));
    
    cin >> n;

    for (int i = 0; i < n; i++){
      cin >> lx[i] >> ly[i] >> rx[i] >> ry[i];
      x.push_back(lx[i]); x.push_back(rx[i]);
      y.push_back(ly[i]); y.push_back(ry[i]);
    }
    x.push_back(0); x.push_back(w);
    y.push_back(0); y.push_back(h);

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    y.erase(unique(y.begin(), y.end()), y.end());

    for (int i = y.size() - 2; i >= 0; i--){
      for (int j = x.size() - 2; j >= 0; j--){
        bool f = false;
        for (int k = 0; k < n; k++){
          if (lx[k] <= x[j] && x[j + 1] <= rx[k] && 
              ly[k] <= y[i] && y[i + 1] <= ry[k]) f = true;
        }
        d[i][j] = f;
      }
    }

    h = y.size() - 2;
    w = x.size() - 2;

    int ans = 0;
    for (int i = 0; i < y.size() - 1; i++){
      for (int j = 0; j < x.size() - 1; j++){
        if (d[i][j]) continue;
        dfs(i, j);
        ans++;
      }
    }

    cout << ans << endl;
  }
}

Measured memory_bytes: 11824
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int a,b,n;
    cin>>a>>b>>n;
    if (n<b) {
        cout<<float((a*n)/b)-a*float(n/b)<<endl;
    } else {
        cout<<float((a*(b-1))/b)-a*float((b-1)/b)<<endl;
    }
}


Measured memory_bytes: 3776
#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>

int main(void)
{
    uint32_t n;
    std::string s;

    std::cin >> n >> s;

    int32_t x = 0;
    int32_t max = 0;

    for (auto c : s) {
        if (c == 'I') ++x;
        if (c == 'D') --x;
        if (x > max) max = x;
    }

    std::cout << max << std::endl;

    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t h, w, n;
  std::cin >> h >> w >> n;
  int64_t sr, sc;
  std::cin >> sr >> sc;
  std::string s, t;
  std::cin >> s >> t;
  int64_t l = 0, r = w + 1, u = 0, d = h + 1;

  for (int64_t i = n - 1; 0 <= i; i--) {
    switch (t[i]) {
      case 'L' :
        r = std::min(w + 1, r + 1);
        break;
      case 'R' :
        l = std::max<int64_t>(0, l - 1);
        break;
      case 'U' :
        d = std::min(h + 1, d + 1);
        break;
      case 'D' :
        u = std::max<int64_t>(0, u - 1);
    }
    switch (s[i]) {
      case 'L' :
        l += 1;
        break;
      case 'R' :
        r -= 1;
        break;
      case 'U' :
        u += 1;
        break;
      case 'D' :
        d -= 1;
    }
    if (r - l < 2 || d - u < 2) {
      std::cout << "NO" << std::endl;
      return 0;
    }
  }

  if (l < sc && sc < r && u < sr && sr < d) {
    std::cout << "YES" << std::endl;
  } else {
    std::cout << "NO" << std::endl;
  }
  return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,M,Q;
    cin >> N >> M >> Q;
    vector<vector<int>>cnt(N+2,vector<int>(N+2));
    for(int i = 0; i < M; i++) {
        int L,R;
        cin >> L >> R;
        cnt[L][R]++;
    }
    for(int i = N; i >= 1; i--) {
        for(int j = 1; j <= N; j++) {
           cnt[i][j] = cnt[i][j]+cnt[i+1][j]+cnt[i][j-1]-cnt[i+1][j-1];
        }
    }
    for(int i = 0; i < Q; i++) {
        int p,q;
        cin >> p >> q;
        cout << cnt[p][q] << endl;
    }
}

Measured memory_bytes: 5568
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, K;
    cin >> N >> K;
    vector<double> D(N);
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        D[i] = 0.5 * (p + 1);
    }

    vector<double> S(N+1);
    for (int i = 0; i < N; i++) S[i+1] = S[i] + D[i];

    double ret = -1;
    for (int i = 0; i + K - 1 < N; i++) {
        ret = max(ret, S[i+K] - S[i]);
    }
    cout << fixed << setprecision(10) <<  ret << endl;
    return 0;
}

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

int main() {
    
    int H, K, W;
    cin >> H >> W >> K;
    string S;
    vector<vector<int>> data(H, vector<int>(W));
    stack<pair<int, int>> cherry;
    char c;
    for(int i=0;i<H;i++){
        cin >> S;
        for(int j=0;j<W;j++){
            c = S.at(j);
            if(c=='#'){
                data.at(i).at(j) = 1;
                cherry.push(make_pair(i, j));
            }
        }
    }
    int group_number = 2;
    for(int i=0;i<K;i++){
        auto che = cherry.top();
        cherry.pop();
        // 最大の長方形を作成する
        int u = che.first;
        int d = che.first;
        int l = che.second;
        int r = che.second;
        
        // r
        for(int j=r+1;j<W;j++){
            bool ok = true;
            for(int k=u;k<=d;k++){
                if(data.at(k).at(j)!=0){
                    ok = false;
                    break;
                }
            }
            if(!ok){
                r = j - 1;
                break;
            }else{
                r = j;
            }
        }
        // l
        for(int j=l-1;j>=0;j--){
            bool ok = true;
            for(int k=u;k<=d;k++){
                if(data.at(k).at(j)!=0){
                    ok = false;
                    break;
                }
            }
            if(!ok){
                l = j + 1;
                break;
            }else{
                l = j;
            }
        }
        // u
        for(int j=u-1;j>=0;j--){
            bool ok = true;
            for(int k=l;k<=r;k++){
                if(data.at(j).at(k)!=0){
                    ok = false;
                    break;
                }
            }
            if(!ok){
                u = j + 1;
                break;
            }else{
                u = j;
            }
        }
        // d
        for(int j=d+1;j<H;j++){
            bool ok = true;
            for(int k=l;k<=r;k++){
                if(data.at(j).at(k)!=0){
                    ok = false;
                    break;
                }
            }
            if(!ok){
                d = j - 1;
                break;
            }else{
                d = j;
            }
        }
        // change data
        for(int j=u;j<=d;j++){
            for(int k=l;k<=r;k++){
                data.at(j).at(k) = group_number;
            }
        }
        group_number++;
    }
    int g;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            g = data.at(i).at(j) % (K);
            if(g==0){
                g = K;
            }
            cout << g << " ";
            // if(g<10){
            //     cout << " ";
            // }
            // if(g<100){
            //     cout << " ";
            // }
        }
        cout << endl;
    }

    return 0;

}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
int64_t MOD=1000000007;


int main() {

  int a,b,c,k; cin>>a>>b>>c >>k;

  for (int i=0; i<k; i++) {
    if (b<=a) b *= 2;
    else if (c<=b) c *= 2;
  }
  //cout << a<< "-"<<b<< "-" <<c<<endl;
  if (c>b && b>a) cout << "Yes" << endl;
  else cout<< "No" <<endl;
}


Measured memory_bytes: 3628
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		char c = s.charAt(0);
		int d = 1;
		for(int i=1; i<n; i++) {
			char x = s.charAt(i);
			if ( x != c ) {
				c = x;
				d++;
			}
		}
		
		
		System.out.println(d);
		sc.close();
	}
	
}

Measured memory_bytes: 23892
#include<stdio.h>
main()
{
int x,a,b,c,d;

x: scanf("%d%d%d",&x,&a,&b);
if(x<1||x>1000||a<1||a>1000||b<1||b>1000){
goto x;}

if(x-a>0){c=x-a;}
else{c=a-x;}

if(x-b>0){d=x-b;}
else{d=b-x;}

if(c<d){printf("A");}
else{printf("B");}
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t N, K, Q, A[(int)1e5];
    intmax_t ans[(int)1e5] = {0};

    scanf("%jd%jd%jd", &N, &K, &Q);
    for (size_t i = 0; i < Q; i++) {
        scanf("%jd", &A[i]);
        ans[A[i] - 1]++;
    }

    for (size_t i = 0; i < N; i++) {
        if (ans[i] > (Q - K)) puts("Yes");
        else puts("No");
    }

    return 0;
}


Measured memory_bytes: 2048
package main

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

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

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

	n, k := scanInt(), scanInt()

	for {
		n %= k
		tmp := math.Abs(float64(n - k))
		if int(tmp) >= n {
			break
		}
		n = int(tmp)
	}
	fmt.Println(n)
}


Measured memory_bytes: 1760
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (i * j == N) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x;
int a[100001];
int now,ans;
int main(){
    cin>>n>>x;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        now=__gcd(now,abs(a[i+1]-a[i]));
    for(int i=0;i<n;i++){
        int cur=__gcd(now,abs(a[i]-x));
        ans=max(ans,cur);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
def main():
    n,a,b=map(int,input().split())
    mod=(10**9)+7
    ans=pow(2,n,mod)-1
    comb=1
    for i in range(n-a+1,n+1):
        comb*=i
        comb%=mod
    for i in range(1,a+1):
        comb*=pow(i,mod-2,mod)
        comb%=mod
    comb2=1
    for i in range(n-b+1,n+1):
        comb2*=i
        comb2%=mod
    for i in range(1,b+1):
        comb2*=pow(i,mod-2,mod)
        comb2%=mod
    ans=ans-comb-comb2
    ans%=mod
    print(ans)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    vector<int> data(n-1);
    for (int i=0; i<n-1; i++){
        int a;
        cin>>a;
        data[i]=a;
    }
    sort(data.begin(),data.end());
    reverse(data.begin(),data.end());
    for (int i=0; i<n; i++){
        int l=data.size();
        int count=0;
        for (int j=l-1; j>=0; j--){
            if (i==(data[j]-1)){
                count+=1;
            }
            else{
                break;
            }
        }
        for (int j=l-count; j<l; j++){
            data.pop_back();
        }
        cout<<count<<endl;
    }
}

Measured memory_bytes: 4048
import java.util.Scanner;

public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int d = nextInt();
        int t = nextInt();
        int s = nextInt();
        yesNo(d <= s*t );
    }


    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

Measured memory_bytes: 35600
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<complex>
#include<string>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

string z;
string y;

bool isaz(int p,string str){
	
	const int C = 333;
	int sum[C]={0};
	int sum2[C]={0};
	
	rep(i,z.size())sum[z[i]]++;
	reps(i,p,p+z.size())sum2[str[i]]++;
	
	
	rep(i,C){
		if(sum[i]!=sum2[i])return false;
	}
	return true;
}

string setaz(int p,string str){
	rep(i,z.size()){
		str[i+p] = y[i];
	}
	return str;
}

int main(){
	string str;
	cin>>str;
	z = "AIDUNYAN";
	y = "AIZUNYAN";
	
	rep(i,str.size()-z.size()+1){
		if(isaz(i,str)){
			str = setaz(i,str);
			i+=z.size()-1;
		}
	}
	
	cout<<str<<endl;
}

/*
AIDUNYANAIDUNYAN
*/

Measured memory_bytes: 1196
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecstr vector<string>
#define vecch vector<char>
#define vecpii vector<pii>
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}

string strin(){string s;cin>>s;return s;}
char chin(){char c;cin>>c;return c;}
ll lin() {ll x;scanf("%lld",&x);return x;}

int main(){
    int n=in();
    ll x=lin();
    vecll a(n);
    rep(i,n)a[i]=in();
    vector<vector<ll>> b(n,vector<ll>(n));
    rep(i,n){
        b[i][0]=a[i];
        rep2(j,1,n-1) b[i][j]=min(b[i][j-1],a[(i-j+n)%n]);
    }
    ll ans=LONG_MAX;
    rep(k,n){
        ll tmp=x*k;
        rep(i,n) tmp+=b[i][k];
        ans=min(ans,tmp);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 31616
n,a=int(input()),sorted(list(map(int,input().split())))
m=a[-1]+n
dp=[0]*m
for i in a:dp[i]+=1
for i in set(a):
    if dp[i]:
        for j in range(i*2,m,i):
            dp[j]=0

print(dp.count(1))

Measured memory_bytes: 41668
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222





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



  cin >> n >> m;
  ans = (n + 1) / 2;
  if (ans >= m) cout << "YES" << endl;
  else cout << "NO" << endl;





  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

int MOD = 998244353;
// int MOD = 1000000007;

//----------------------------------------------------------------
signed main(){
   
    int a,b;
	cin >> a >> b;
	cout << max(a-2*b,0LL) << endl;
	

	return 0;
}

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

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://nikkei2019-2-qual.contest.atcoder.jp/tasks/nikkei2019_2_qual_b
// rm -r -f test;oj dl https://abc143.contest.atcoder.jp/tasks/abc143_a

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    int a[5];
    char t;
    while(cin >> a[0] >> t >> a[1] >> t >> a[2] >> t >> a[3] >> t >> a[4])
    {
        sort(a,a+5);
        if(a[0] == a[3] || a[1] == a[4])
        {
            cout << "four card" << endl;
        }
        else if((a[0] == a[1] && a[2] == a[4]) || (a[0] == a[2] && a[3] == a[4]))
        {
            cout << "full house" << endl;
        }
        else if((a[0]+1==a[1]&&a[1]+1==a[2]&&a[2]+1==a[3]&&a[3]+1==a[4]) || (a[0]==1&&a[1]==10&&a[2]==11&&a[3]==12&&a[4]==13))
        {
            cout << "straight" << endl;
        }
        else if(a[0] == a[2] || a[1] == a[3] || a[2] == a[4])
        {
            cout << "three card" << endl;
        }
        else if((a[0]==a[1]&&(a[2]==a[3]||a[3]==a[4]))||(a[1]==a[2]&&a[3]==a[4]))
        {
            cout << "two pair" << endl;
        }
        else if((a[0]==a[1])||(a[1]==a[2])||(a[2]==a[3])||(a[3]==a[4]))
        {
            cout << "one pair" << endl;
        }
        else
        {
            cout << "null" << endl;
        }
    }
    return 0;
}




Measured memory_bytes: 3044
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 305
using namespace std;


ll n;
bool vis[sz][sz][sz];
double dp[sz][sz][sz];
double get(ll on,ll tw,ll thr)
{
  //ggg(on,tw,thr);
  if(on < 0|| thr < 0 || tw < 0)return 0;
  if(on == 0 && tw == 0 && thr == 0)return 0;
  if(vis[on][tw][thr])return dp[on][tw][thr];
  vis[on][tw][thr] = true;
  dp[on][tw][thr] = (1 + ((1.0*on)/(n))*get(on-1,tw,thr) + ((1.0*tw)/n)*get(on+1,tw-1,thr) + ((1.0*thr)/n)*get(on,tw+1,thr-1) );
  double zero = ((1.0)*(n-on-tw-thr))/(1.0*n);
  double dev = 1 - zero;
  dp[on][tw][thr]/=dev;
  return dp[on][tw][thr];

}
int main()
{


    FASTIO
    cin.tie(NULL);

    cin >> n;
    ll on,tw,thr;
    on = tw = thr = 0;
    for(ll i=1;i<=n;i++)
    {
      ll x;cin >> x;if(x == 1)on++;if(x == 2)tw++; if(x == 3)thr++;
    }
    double ans = get(on,tw,thr);

    cout << fixed << setprecision(11) <<  ans << endl;


return 0;
}


Measured memory_bytes: 246144
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

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

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> b(m);
	for(int i = 0; i < m; i++){
		cin>>b[i];
	}
	int ans=0;
	for(int i = 0; i < n; i++){
		vector<int> a(m);
		for(int j = 0; j < m; j++){
			cin>>a[j];
		}
		int res=c;
		for(int j = 0; j < m; j++){
			res+=b[j]*a[j];
		}
		if(res>0)ans++;
	}
	cout <<ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define pf push_front
#define ll long long
#define uxy pair<int, pair<int, int> >
using namespace std;
void TxtRead(){
    freopen("closing.in","r", stdin);
    freopen("closing.out","w", stdout);
}
void TheTime(){
    ios_base::sync_with_stdio(false);
	cin.tie();
}
const int N = 1e5+5;
const ll INF = 1e9+5;
const ll MOD = 1e9+7;
const double PI = 3.141592653589793116;

int n, m;
vector<int> g[N];
bool used[N];
int dp[N];

void DFS(int v)
{
    used[v]=true;
    for(int i=0; i<g[v].size(); i++){
        int to=g[v][i];
        if(!used[to]) DFS(to);
        dp[v]=max(dp[v], dp[to]+1);
    }
}

int main()
{
    //TxtRead();
    TheTime();

    scanf("%d %d", &n, &m);
    for(int i=0; i<m; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        g[a].pb(b);
    }

    int ans=0;
    for(int i=1; i<=n; i++){
        if(!used[i]) DFS(i);
        ans=max(ans, dp[i]);
    }
    printf("%d\n", ans);
}



Measured memory_bytes: 8320
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int ans=mod,n;
	cin>>n;
	FOR(i,1,n){
		int a=i,b=n-a;
		int t=0;
		while(a!=0||b!=0){
			t+=a%10+b%10;
			a/=10;b/=10;
		}
		if(ans>t)ans=t;
	}
	cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<int>())
using namespace std;
int main()
{
  speed_up;
  int i, j, h, w, n;
  cin>>h>>w;
  n = 2;
  char a[h][w];
  for(i = 0; i<h; i++)
  {
      for(j = 0 ; j<w; j++)
      {
           cin>>a[i][j];
      }
  }
  //cout<<endl;
  for(i = 0; i<h; i++)
  {  while(n--)
  {
      for(j = 0; j<w; j++)
      {
          cout<<a[i][j];
      }
      cout<<endl;

  }
  n = 2;
  }




  return 0;
}


Measured memory_bytes: 3548
#include <iostream>
#include <string>
#include <time.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
static const ll INF = (ll)1 << 62;
static const ll MOD = 1e9 + 7;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	ll a, b; cin >> a >> b;
	if (a >= 13) {
		cout << b << endl;
	}
	else if (a >= 6) {
		cout << b / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    a_list = list(map(int, input().split()))
    visited_list = [-1] * n  # 何ワープ目で訪れたか
    visited_list[0] = 0
    city, loop, non_loop = 1, 0, 0  # 今いる街、何ワープでループするか、最初にループするまでのワープ数

    for i in range(1, n + 1):
        city = a_list[city - 1]
        if visited_list[city - 1] != -1:
            loop = i - visited_list[city - 1]
            non_loop = visited_list[city - 1] - 1
            break
        else:
            visited_list[city - 1] = i

    city = 1
    if k <= non_loop:
        for _ in range(k):
            city = a_list[city - 1]
    else:
        for _ in range(non_loop + (k - non_loop) % loop + loop):
            city = a_list[city - 1]

    print(city)


if __name__ == "__main__":
    main()


Measured memory_bytes: 99896
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef unsigned long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 1e9;
constexpr int mod = 1e9+7;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  int l = 0, r = INF + 1;
  
  auto ok = [&](int m){
    ll cnt = 0;
    for (int i = 0; i < n; i++) {
      ll add = a[i] / m;
      if (a[i] % m == 0) add--;
      cnt += add;
    }
    return cnt <= k;
  };

  while (r - l > 1) {
    int m = (r + l) / 2;
    if (ok(m)) r = m;
    else l = m;
  }

  cout << r << endl;
  return 0;
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int a;cin >> a;
    int ans=a+a*a+a*a*a;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3564
#include <stdio.h>
int main(){
  int a, b, c, d, e, k;

  scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &k);

  if((b-a) > k || (c-a) > k || (d-a) > k || (e-a) > k ||  (c-b) > k || (d-b) > k || (e-b) > k || (d-c) > k || (e-c) > k || (e-d) > k){
    printf(":(");
  }else{
    printf("Yay!");
  }

  printf("\n");

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int maxxx, minnn;
int n, x[120], ans, i;
int main () {
	
	maxxx = 0; 
	minnn = 1000;
		
	cin >> n;
	for (i=0; i<n; i++) {
		cin >> x[i];
		maxxx=max(maxxx,x[i]);
		minnn=min(minnn,x[i]);
	}
	ans = maxxx - minnn;
	cout << ans;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long

using namespace std;

llint n, x, y;

int main(void)
{
	while(1){
		cin >> n >> x >> y;
		if(n == 0 && x == 0 && y == 0) break;
		x--, y--;
		
		llint flip = 0;
		for(llint i = 0; i < n; i++){
			llint rem = (x / (1LL <<(n-1-i))) & 3;
			if(rem == 1 || rem == 2) flip |= (1LL << i);
		}
		flip ^= 1;
		
		llint ans = y;
		for(llint i = 0; i < n; i++){
			if(flip & (1LL<<i)){
				ans ^= (1LL<<(i+1)) - 1;
			}
		}
		
		for(llint i = n-1; i >= 0; i--){
			if(ans & (1LL<<i)) cout << "L";
			else cout << "R";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3064