akhauriyash/Code-Regression huggingface dataset:
/*https://atcoder.jp/contests/abc121/tasks/abc121_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n, m, c, a[100][100], b[100], sum = 0;
	cin >> n >> m >> c;
	for (int i = 0; i < m; i++)
		cin >> b[i];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	}
	// for (int i = 0; i < n; i++)
	// {
	// 	for (int j = 0; j < m; j++)
	// 		cout << a[i][j] << " ";
	// 	cout << endl;
	// }

	int count = 0;
	for (int i = 0; i < n; i++)
	{
		sum = c;
		for (int j = 0; j < m; j++)
			sum += a[i][j] * b[j];
		// cout << sum << endl;
		if (sum > 0)
			count++;
	}
	cout << count;
}

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

int main() {
  ll q,h,s,d,n;
  cin >>q>>h>>s>>d>>n;
  n*=100;
  P Q = make_pair(q * 8,25), H = make_pair(h * 4,50), S = make_pair(s * 2,100), D = make_pair(d * 1,200);
  vector<P> t = {Q,H,S,D};
  sort(t.begin(),t.end());
  int i = 0;
  ll ans = 0;
  while(n > 0 || i < 4) {
    ll saizu = t[i].second;
    ll kakaku = t[i].first / (200 / saizu);
    ll kosuu = n / saizu;
    n -= kosuu * saizu;
    ans += kosuu * kakaku;
    i++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
  int N,X,i,place=0,ans=0;
  scanf("%d %d",&N,&X);
  int L[N];
  for(i=0;i<N;i++){
    scanf("%d",&L[i]);
  }
  for(i=0;i<N+1;i++){
    if(X>=place){
      ans=ans+1;
    }
     place=place+L[i];
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

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

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	int A,B; cin >> A>>B;
	string S; cin >> S;
	bool ok = true;
		for (int i = 0;i < A+B;i++) {
			if (i != A) {
				if (!(0 <= S[i]-'0'&&S[i]-'0' <= 9)) {
					ok = false;
				}
			}
		}
		if (S[A] != '-') ok = false;
		if (ok) cout << "Yes" << endl;
		else cout << "No" << endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#define size 1000000

int main()
{
    int n,i,c = 0,a[size],b = 0;

    scanf("%d",&n);
    for(i=0;i<n;i++)

      scanf("%d",&a[i]);

      for(i=0;i<n;i++)
        {
        c += a[i];
        if(a[i]>b)
           b = a[i];
        }

      if((c-b)>b)printf("Yes\n");
      else printf("No\n");
    return 0;
}


Measured memory_bytes: 1632
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N; cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) cin >> vec.at(i);
  int count = 0;
  for (int i = 0; i < N; i++){
    int count2 = 1;
    for (int j = 0; j < i; j++){
      if ( vec.at(i) == vec.at(j) ) count2 *= 0;
    }
    count += count2;
  }
  cout << count << endl;
}

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

using namespace std;

/*****************MACRO*****/

#define ll long long
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

/*******CONSTANT***********/
#define INF (1<<30) //infinity value
#define EPS 1e-9
#define MOD 10000007
#define SIZ 1005
#define PI (acos(-1))


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1; i<=n; i++) cin>>a[i];
    int rev[n+1];
    ///BOTH CASE 1 INDEXING IS USED
    for(int i=1; i<=n; i++){
        rev[a[i]]= i;
    }
    for(int i=1; i<=n; i++) cout<<rev[i]<<" ";
    cout<<"\n";
    return 0;
}

/**********************************************************************************







*************************************************************************************/


Measured memory_bytes: 1664
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <iomanip>
#include <bitset>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
vll d;
void get_div(ll m){
	for(int i=1;i*i<=m;i++){
		if(m%i==0)
			d.pb(i),d.pb(m/i);
	}
}
int main() {
	ll n,m;cin>>n>>m;
	get_div(m);
	sort(allv(d),greater<int>());
	for(auto x:d){
		if(x*n<=m)return cout<<x,0;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.Map.*;   // Entryを使うときは、paizaではこれを宣言する

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Sieve sieve = new Sieve(n);
        
        if (n < 105) {
            System.out.println(0);
            return;
        }
        
        int count = 0;
        for (int i = 105; i <= n; i++) {
            if (i % 2 == 0) continue;
            
            Map<Integer, Integer> map = sieve.factorMap(i);
            
            int yakusuu = 1;
            for (Entry<Integer, Integer> entry : map.entrySet()) {
                yakusuu *= (entry.getValue() + 1);
            }
            if (yakusuu == 8) count++;
        }
        
        System.out.println(count);
    }
}

class Sieve {
    int[] minFactor;    // 最小の素因数

    Sieve(int n) {
        minFactor = new int[n + 1];
        minFactor[0] = -1;
        minFactor[1] = -1;
        
        for (int i = 2; i <= n; i++) {
            if (minFactor[i] != 0) continue;
            
            minFactor[i] = i;
            
            if ((long)i * i > (long)n) continue;
            
            for (int j = i * i; j <= n; j += i) {
                if (minFactor[j] != 0) continue;
                
                minFactor[j] = i;
            }
        }
    }
    
    boolean isPrime(int x) {
        if (minFactor[x] == x) {
            return true;
        }
        
        return false;
    }
    
    // nの素因数のリスト (60 => [2, 2, 3, 5])
    List<Integer> factorList(int x) {
        List<Integer> res = new ArrayList<Integer>();
        
        while (x != 1) {
            res.add(minFactor[x]);
            x /= minFactor[x];
        }
        
        return res;
    }
    
    // nの素因数の頻度 (60 => (2 => 2, 3 => 1, 5 => 1)
    Map<Integer, Integer> factorMap(int x) {
        Map<Integer, Integer> res = new HashMap<Integer, Integer>();
        
        List<Integer> factorList = factorList(x);
        
        for (Integer f : factorList) {
            if (!res.containsKey(f)) {
                res.put(f, 1);
            } else {
                int count = res.get(f);
                res.put(f, count + 1);
            }
        }
        
        // for (int i = 1; i <= x; i++) {
        //     if (!res.containsKey(i)) {
        //         res.put(i, 0);
        //     }
        // }
        
        return res;
    }
}

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

int main(){

int n,m;
  cin  >> n >> m;
int d[n] = {0};
  for(int i=0;i<m;i++){
  int a,b;
    cin >> a >> b;
    d[a-1]++;
    d[b-1]++;
  }
  for(int i=0;i<n;i++){
  cout << d[i] << endl;
  }
 return 0;
}

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

int main(){
  string S;
  cin >> S;

  S.at(3) = '8';

  cout << S << endl;
}

Measured memory_bytes: 3600
import java.io.*;
import java.util.*;

public class Main {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		int n = nextInt();
		int sum = 0;
		for (int i = 1;; i++) {
			sum += i;
			if (sum >= n) {
				out.println(i);
				return;
			}
		}
	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

int main(int argc, char const *argv[])
{
	string S;
	cin >> S;
	if (S == "Sunny")
	{
		cout << "Cloudy"; 
	}
	if (S == "Cloudy")
	{
		cout << "Rainy";
	}
	if (S == "Rainy")
	{
		cout << "Sunny";
	}

	return 0;
}

Measured memory_bytes: 256
using System;

class Program {
  	public static int CountChar(string s, char c) {
    return s.Length - s.Replace(c.ToString(), "").Length;
  }
 static void Main()
  {
	string s = Console.ReadLine();
	int x = CountChar(s,'o');
	int y = x * 100 +700;
	Console.Write ( "{0}\n", y );
  }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<ll> r(n),c(n);
    for(int i = 0; i < n; i++){
        cin >> r[i] >> c[i];
    }
    ll dp[n+1][n+1];
    pair<ll,ll> rc[n+1][n+1];
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            dp[i][j] = INF;
        }
    }

    for(int l = 1; l <= n; l++){
        for(int i = 0; i < n; i++){
            int j = i+l;
            if(j > n) break;
            if(i+1 == j){
                dp[i][j] = 0;
                rc[i][j] = make_pair(r[i],c[i]);
            }
            for(int mid = i; mid <= j; mid++){
                ll tmp = dp[i][j];
                dp[i][j] = min(dp[i][j], dp[i][mid]+dp[mid][j]+rc[i][mid].first*rc[mid][j].second*rc[i][mid].second);
                if(dp[i][j] != tmp){
                    rc[i][j] = make_pair(rc[i][mid].first,rc[mid][j].second);
                }
            }
        }
    }

    cout << dp[0][n] << endl;

    return 0;
}


Measured memory_bytes: 3232
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int n;
  cin >> n;
  int f=0, t=0, o=0;
  for (int i = 0; i < n; ++i) {
    u64 a;
    cin >> a;
    if (a%4==0) f++;
    else if (a%2==0) t++;
    else o++;
  }
  cout << (f+1>=o+(t%2) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <valarray>
#include <string>
#include <algorithm>
#include <set>
typedef unsigned long long ull;
typedef long long ll;
#define fst first
#define snd second
#define rep(i,n) for(ull i = 0;i<(n);i++)
#define rep1(i,n) for(ull i = 1;i<=(n);i++)
#define revrep(i,n) for(ull i = (n-1);i>=0;i--)
#define all(n) (n).begin(),(n).end()
#define show(x) cout << "debug " << #x << ":" << x << endl;
#define showvec(x) cout << endl << "debug " << #x << ";" << endl; \
    for(ull __i = 0;__i < x.size();__i++){ \
        for(ull __j = 0;__j<x[0].size();__j++){ \
            cout << x[__i][__j] << " "; \
        } \
        cout << endl; \
    } \
    cout << endl;
using namespace std;

ll P[510];
bool V[510];
bool C[510][510];
ll B[510];
ll R[510];

int M,N;
ll gcd(ll a, ll b){
  ll c;
  while ( a != 0 ) {
     c = a; a = b%a;  b = c;
  }
  return b;
}

bool match(ll m){
	if(m < 0) return true;
	rep(n,N){
		if(!C[m][n] || V[n]) continue;
		V[n] = true;
		if(match(P[n])){
			P[n] = m;
			return true;
		}
	}
	return false;
}


int main(){
	while(cin >> M >> N, M){
		rep(m,M){
			int b;
			cin >> b;
			B[m] = b;
		}
		rep(n,N){
			int r;
			cin >> r;
			R[n] = r;
		}
		rep(i,510){
			P[i] = -1;
		}
		rep(m,M)rep(n,N){
			C[m][n] = (gcd(B[m],R[n]) >= 2);
		}
		ll count = 0;
		rep(m,M){
			rep(n,N){
				V[n] = false;
			}
			if(match(m)) count++;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1432
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")        
}
fn main() {
    let n: usize = read();
    let mut v = Vec::new();
    for i in 0..n {
        let vi: i32 = read();
        v.push(vi);
    }
    let mut c = Vec::new();
    for i in 0..n {
        let ci: i32 = read();
        c.push(ci);
    }

    let mut ans = 0;
    for i in 0..n {
        if v[i] - c[i] > 0 {
            ans += v[i] - c[i];
        }
    }
    println!("{}", ans);
//    println!("{:?}", v);
//    println!("{:?}", c);
//    let ans = if ( (a * b) % 2 == 0 ) { "Even" } else { "Odd" };
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
    int i,j;

    int n;cin >> n;
    vector<string> s(n);
    for(i=0;i<n;i++) cin >> s.at(i);

    int m;cin >> m;
    vector<string> t(m);
    for(i=0;i<m;i++) cin >> t.at(i);

    int h=0;
    
    for(i=0;i<n;i++){
        int tmp=0;
        for(j=0;j<n;j++){
            
            if(s.at(i)==s.at(j))
            tmp++;
        }
        for(j=0;j<m;j++){
            if(s.at(i)==t.at(j))
            tmp--;
        }
        if(tmp>h)h=tmp;
    }
    cout << h << endl;
    return 0;
    }

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

MI, MA = min(A),max(A)
num = MA - MI + 1
L = [0] * num

if num < 3:
    print(N)
    exit()

for ctr in A:
    L[ctr-MI] += 1

ans,tmp = sum(L[0:3]),sum(L[0:3])
for j in range(num-3):
    tmp = tmp - L[j] + L[j+3]
    ans = max(ans,tmp)

print(ans)


Measured memory_bytes: 13964
r, c = map(int,input().split())

Tbl = [list(map(int,input().split())) for i in range(r)]

for j in range(r):
	rS = sum(Tbl[j])
	Tbl[j].append(rS)

cS =[]
for k in range(c+1):
	s = 0
	for l in range(r):
		s += Tbl[l][k]
	cS.append(s)

Tbl.append(cS)

Tblp = [print(" ".join(map(str, Tbl[m]))) for m in range(r+1)]

Measured memory_bytes: 7728
package main

import (
	"fmt"
)

func main() {
	var H, A int
	fmt.Scan(&H)
	fmt.Scan(&A)
	i := 0
	for i = 1; ; i++ {
		if H-(A*i) <= 0 {
			break
		}
	}

	fmt.Println(i)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int a, b, c; cin >> a >> b >> c;
    int ans = 0;

    if(a%2 == 1 || b%2 == 1 || c%2 == 1){
            cout << ans << endl;
            return 0;
        }

    if(a == b && b == c){
        cout << -1 << endl;
        return 0;
    }

    while(true){
        int aa = a;
        int bb = b;
        int cc = c;

        if(a%2 == 1 || b%2 == 1 || c%2 == 1){
            cout << ans << endl;
            return 0;
        }

        a = bb/2 + cc/2;
        b = aa/2 + cc/2;
        c = bb/2 + aa/2;
        ans++;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto 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; }

int W[2000][2000], H[2000][2000];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    FOR(i, 0, h)cin >> c[i];

    FOR(i, 0, h){
        FOR(j, 0, w) {
            if (j == 0) {
                if (c[i][0] == '.')W[i][0] = 1;
                else W[i][0] = 0;
            }
            else {
                if (c[i][j] == '.')W[i][j] = W[i][j - 1] + 1;
                else W[i][j] = 0;
            }
        }
        FOR(j, 1, w) {
            if (c[i][w - j] == '.' && c[i][w - j - 1] == '.') {
                W[i][w - j - 1] = W[i][w - j];
            }
        }
    }
    FOR(j, 0, w) {
         FOR(i, 0, h){
            if (i == 0) {
                if (c[0][j] == '.')H[0][j] = 1;
                else H[0][j] = 0;
            }
            else {
                if (c[i][j] == '.')H[i][j] = H[i - 1][j] + 1;
                else H[i][j] = 0;
            }
        }
        FOR(i, 1, h) {
            if (c[h - i][j] == '.' && c[h - i - 1][j] == '.') {
                H[h - i - 1][j] = H[h - i][j];
            }
        }
    }
    int ans = 0;
    FOR(i, 0, h)FOR(j, 0, w)chmax(ans, W[i][j] + H[i][j] - 1);
    cout << ans << "\n";
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, ll> P;

#define N_OVERSIZE 100050
vector<P> root[N_OVERSIZE];
int color[N_OVERSIZE] = {0}; //white 0, black 1

void dfs(int v, int p){
    for (auto next: root[v]){
        if (next.first == p) continue;
        if (next.second % 2 == 0) color[next.first]=color[v];
        else color[next.first]=color[v]^1;
        dfs(next.first, v);
    }
    return;
}

bool visited[N_OVERSIZE];
void dfs_(int v){
    //if (root[v].size() == 1)
    visited[v] = true;
    for(auto next: root[v]){
        if (visited[next.first]) continue;
        dfs_(next.first);
        color[next.first] = 1;
    }
    return;
}

void dfs__(int v){
    visited[v] = true;
    for(auto next: root[v]){
        if (visited[next.first]) continue;
        if (next.second % 2 == 0) color[next.first]=color[v];
        else color[next.first]=color[v]^1;
        dfs__(next.first);
    }
    return;
}

int main()
{
    int n;
    cin >> n;
    rep(i, n-1){ 
        int tmpu, tmpv, tmpw; 
        cin >> tmpu >> tmpv >> tmpw;
        tmpu--; tmpv--; 
        root[tmpu].push_back(P(tmpv, tmpw));
        root[tmpv].push_back(P(tmpu, tmpw));
    }

    color[0] = 0; //white_start

//    dfs_(0);
//    rep(i, n) cout << color[i] << endl;
    dfs__(0); 

    rep(i, n){
        cout << (color[i] == 1 ? 1: 0) << endl;
    }

}



Measured memory_bytes: 9088
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int main(){

  long long a, b, x; cin >> a >> b >> x;
  
  long long ans = (b / x + 1) - ((a - 1) / x + 1);
  if (a == 0 && x >= 2) ans ++;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int Maxn=3010;
int N;
double P[Maxn],Dp[Maxn][Maxn],Ans=0.0;
int main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		cin>>P[i];
	}
//	for(int i=0;i<N;i++)
//	{
//		cout<<P[i]<<" ";
//	}
//	cout<<endl;
	Dp[0][0]=1.0;//initialize
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<=i;j++)
		{
			Dp[i+1][j]+=Dp[i][j]*(1.0-P[i]);//tail
			Dp[i+1][j+1]+=Dp[i][j]*P[i];  //head
		}
	}
//	for(int i=0;i<=N;i++)
//	{
//		for(int j=0;j<=N;j++)
//		{
//			cout<<Dp[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	//from the number of head > the number of tail
	for(int i=(N>>1)+1;i<=N;i++)
	{
		Ans+=Dp[N][i];
	}
	printf("%0.9lf\n",Ans);
}

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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template<typename T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	while(1){
		int N,M,S;
		cin >> N >> M >> S;
		if(N == 0 && M == 0 && S == 0) return 0;
		N *= N;
		N += 1;
		S += 1;
		auto dp = make_v(N*S,0);
		dp[0] = 1;
		for(int i = 0; i < M; ++i){
			auto tmp = make_v(N*S,0);
			for(int j = 0; j < N; ++j){
				if(j+1<N)for(int k = 0; k < S; ++k){
					if(k+i+1<S) tmp[(j+1)*S+k+(i+1)] += dp[j*S+k];
					else break;
				}
				for(int k = 0; k < S; ++k){
					(tmp[j*S+k] += dp[j*S+k]) %= 100000LL;
				}
			}
			dp = tmp;
		}
		cout << dp[N*S-1] << endl;
	}

	return 0;
}



Measured memory_bytes: 4068
def main():
    N, M = map(int, input().split())
    C = [0] * (N + 1)
    for _ in range(M):
        a, b = map(int, input().split())
        if a == 1:
            C[b] += 1
        elif b == N:
            C[a] += 1
    if C.count(2) > 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')


main()


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

int f[102][102];

void DFS(int x,int y,int c){
    if(f[x][y]!=c)  return;

    f[x][y]=10;
    DFS(x+1,y,c);
    DFS(x-1,y,c);
    DFS(x,y+1,c);
    DFS(x,y-1,c);
}

int main(){
    int w,h;
    int xs,ys;
    int xg,yg;
    int n;
    while(true){
        cin>>w>>h;
        if(w+h==0)  break;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                f[i][j]=-1;
            }
        }
        cin >> xs >> ys;
        cin >> xg >> yg;
        cin >> n;
        for(int i=0;i<n;i++){
            int c,d,x,y;
            cin >> c >> d >> x >> y;
            if(d==0){
                for(int j = 0; j<4; j++){
                    for(int k = 0; k<2; k++){
                        f[x+j][y+k] = c;
                    }
                }
            }else{
                for(int j = 0; j<2; j++){
                    for(int k = 0; k<4; k++){
                        f[x+j][y+k] = c;
                    }
                }
            }
        }
        DFS(xs,ys,f[xs][ys]);
        if(f[xg][yg]==10){
            cout<<"OK"<<endl;
        }else{
            cout<<"NG"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3040
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <math.h>
#include <string.h>
#include <map>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#define INF 1000000
#define MAX 500000
#define pb push_back
#define mp make_pair
#define UNVISITED 0
using namespace std;
typedef long long int ll;
typedef vector <ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
int main()
{
//  freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 ll n,num;
 cin>>n;
 ll a=sqrt(n);
 //cout<<a<<endl;
 for(ll i=a;i>=1;i--)
 {
  //cout<<a<<endl;
  if(i*(n/i)==n)
  {
    num=max(a,n/i);
    break;
  }
 }
 //cout<<num<<endl;
 ll cnt=0;
 while(num>0)
 {
  cnt++;
  num=num/10;
 }
 cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool chk(ll a,ll b,ll k){
    if(b+k>=a*b)return 0;
    if(k*(b+1)>=a*b)return 0;
    if(b+k+1>=2*k)return 1;
    if((b+k+1)*(b+k+1)<4*a*b)return 1;
    return 0;
}
void solve(){
    ll a,b;cin>>a>>b;
    if(a<b)swap(a,b);
    ll s=1,e=a-1,ans=0;
    while(s<=e){
        ll mid=(s+e)>>1;
        if(chk(a,b,mid))ans=mid,s=mid+1;
        else e=mid-1;
    }
    cout<<ans+b-1<<"\n";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N-1);
    rep(i,0,N)cin >> A[i];
    rep(i,0,N)cin >> B[i];
    rep(i,0,N-1)cin >> C[i];

    int sum = 0;
    rep(i,0,N)sum += B[i];
    rep(i,0,N-1){
        if(A[i] + 1 == A[i+1]){
            sum += C[A[i]-1];
        }
    }
    cout << sum << endl;
}

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

int main(void) {
  int N;
  cin >> N;
  vector<vector<int>> h(N, vector<int>(3));
  for (int i = 0; i < N; i++) {
    cin >> h[i][0] >> h[i][1] >> h[i][2];
  }

  vector<vector<long long>> dp(100001, vector<long long>(3, -1));
  dp[0][0] = dp[0][1] = dp[0][2] = 0LL;
  long long ret = -1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      if (dp[i][j] == -1) continue;
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[i + 1][k] = max(dp[i + 1][k], dp[i][j] + h[i][k]);
        ret = max(dp[i + 1][k], ret);
      }
    }
  }
  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define vi vector<ll>
#define vivi vector<vector<ll>> 
#define vipa vector<pair<ll,ll>>
#define F first
#define S second
#define M 1000000007
#define kl endl

typedef long long ll;
void solve()
{
   ll n;
   cin>>n;
   ll ans=n/500;
   n=n-ans*500;
   ll k=n/5;
   cout<<1000*ans+5*k;
   
}
int  main() 
{ 
    ios;
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {   
        solve();
    }
	
	return 0; 
} 




Measured memory_bytes: 256
module Main where

main = ant 0 []

ant i as
    | 5 == i = readLn >>= doChk as
    | otherwise = readLn >>= (ant (i+1)) . (:as)

doChk as k =
    case (chk as k) of
        True -> putStrLn "Yay!"
        False -> putStrLn ":("

chk :: [Int] -> Int -> Bool
chk as k = all (les k) $ [(x,y)|x<-as,y<-as,x < y]

les k (a,b) = (b - a) <= k

Measured memory_bytes: 508
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector<int> a(n);

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

    vector<int> c(4);

    for (int i = 0; i < n; i++) {
        c[a[i]]++;
    }

    static double dp[301][301][301] = {0};

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= n; k++) {
                if (i + j + k == 0 || i + j + k > n) {
                    continue;
                }
                
                double s = 0;

                if (k - 1 >= 0) {
                     s += dp[i][j][k - 1] * k / (i + j + k);
                }

                if (j - 1 >= 0 && k + 1 <= n) {
                    s += dp[i][j - 1][k + 1] * j / (i + j + k);
                }

                if (i - 1 >= 0 && j + 1 <= n) {
                    s += dp[i - 1][j + 1][k] * i / (i + j + k);
                }
 
                dp[i][j][k] = s + (double)n / (i + j + k);
            }
        }
    }

    cout << fixed << setprecision(12) << dp[c[3]][c[2]][c[1]] << endl;
}


Measured memory_bytes: 213248
// created_by  Rishi_Mohan

#include<bits/stdc++.h>

#define    ll           long long
#define    db1(x)       cout<<#x<<"="<<x<<'\n'
#define    db2(x,y)     cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define    db3(x,y,z)   cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'

using namespace std;

void solve()
{
    int n;
    cin >> n;
    int k = n%10;
    if(k==2 || k==4 || k==5 || k==7 || k==9)
        cout << "hon" ;
    else if(k==0 || k==1 || k==6 || k==8)
         cout << "pon";
    else cout << "bon";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
}


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

def main():
    N = int(input())
    D = sorted(list(map(int, input().split())))
    M = int(input())
    T = sorted(list(map(int, input().split())))

    t = 0
    for d in range(N):
        if T[t] == D[d]:
            t += 1
            if t >= M:
                break
    if t == M:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()


Measured memory_bytes: 35300
#include <iostream>
#include <climits>
#include <set>
#include <string>
#include <algorithm>
#include <vector>
#define MAX 1000000007


using namespace std;
#define ll long long
#define dbg if(0)
#define ISRANGE(val,lo,hi) ((lo<=val)&&(val<hi))



int main(){
    ll ans,n,k;
    cin >>n>>k;

    for(int i=0;i<n;i++){
        char s;
        cin >>s;
        if(i==k-1){
            cout <<(char)(s+0x20);
        }else{
            cout <<s;
        }
    }
    cout <<endl;

    return 0;

}

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

using namespace std;

int main(int argc,char *argv[])
{
    string ans[] = {"Sunny","Cloudy","Rainy"};
    string ask;
    while(cin>>ask)
    {
        for(int i=0;i<3;i++)
        {
            if(ask==ans[i])
            {
                cout<<ans[(i+1)%3]<<endl;
                break;
            }
        }
    }
    return 0;
}


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

int main(){
	int a,b;
	cin >> a >> b;
	
	int x = a*b;
	
	if(x % 2 ==0) cout << "Even" << endl;
	else cout << "Odd" << endl;
	
	return 0;
}
		
	

Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
  if ((p[i-1] > p[i]) and (p[i+1] < p[i])) or ((p[i-1] < p[i]) and (p[i+1] > p[i])):
    ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
ll n,m,s,t,ans;
vector<vector<ll>> edge(300300);
using P = pair<ll, ll>;
ll dijkstra(ll s,ll g) {
    ll d[300300];
    For(i,0,300300) d[i]=1e9;
    priority_queue<P,vector<P>,greater<P>> que;
    d[s] = 0;
    que.push(P(0, s));
    while (!que.empty()){
        P p = que.top();
        que.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;
        For(i,0,edge[v].size()) {
            ll e = edge[v][i];
            if (d[e] > d[v] + 1) {
                d[e] = d[v] + 1;
                que.push(P(d[e],e));
            }
        }
    }
    return d[g];
}

void Main(){    
    cin>>n>>m;
    For(i,0,m){
        ll u,v;cin>>u>>v;u--;v--;
        edge.at(u).push_back(v+100000);
        edge.at(u+100000).push_back(v+200000);
        edge.at(u+200000).push_back(v);
    }
    cin>>s>>t;s--;t--;
    ans=dijkstra(s,t);
    cout<<(ans<1e9?ans/3:-1)<<endl;
}
int main(){
    Main();
    return 0;
}


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

int main(){
  int a;
  cin >> a;
  for(int i=0; i < 3; i++){
    if(a%10 == 7){
      cout << "Yes";
      return 0;
    }
    a = a/10;
  }
  cout << "No";
  return 0;
}

Measured memory_bytes: 3588
a, b, c, k = map(int, input().split())
ans = 0
if a <= k:
    ans += a
    k -= a
else:
    ans += k
    print(ans)
    exit()
if b <= k:
    k -= b
else:
    print(ans)
    exit()
ans -= min(c, k)
print(ans)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>

int n,l,q;
int x[110000],d[20][110000];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  cin>>n;
  rep(i,n){
    cin>>x[i];
  }
  cin>>l>>q;
  int p=0;
  rep(i,n){
    while(x[i]-x[p]>l) p++;
    d[0][i]=p;
  }
  FOR(i,1,17){
    rep(j,n+1){
      d[i][j]=d[i-1][d[i-1][j]];
    }
  }

  while(q--){
    int a,b;
    cin>>a>>b;
    a--;b--;
    if(a==b){
      cout<<0<<endl;
    }else{
      if(a>b) swap(a,b);
      int res=1;
      rrep(i,16){
        if(d[i][b]>a){
          res+=1<<i;
          b=d[i][b];
        }
      }
      cout<<res<<endl;
    }
  }


}

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

typedef long long ll;
const int maxn=70+10,mod=1e9+7;
int n,k,cnt[maxn],a[maxn],m,beg[maxn];
char s[maxn];
bool vis[maxn];
ll ans,fac[maxn],inv[maxn],c[maxn*10][maxn*10];

inline ll qpow(ll a,ll n){
	ll res=1;
	while(n){
		if(n&1ll)
			res=res*a%mod;
		a=a*a%mod;
		n>>=1;
	}
	return res;
}
void init(){
	fac[0]=1;
	for(int i=1;i<maxn;++i)
		fac[i]=fac[i-1]*i%mod;
	inv[maxn-1]=qpow(fac[maxn-1],mod-2);
	for(int i=maxn-1;i;--i)
		inv[i-1]=inv[i]*i%mod;
	for(int i=0;i<maxn*10;++i){
		c[i][0]=1;
		for(int j=1;j<=i;++j)
			c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
}
void judge(int rest){
	m=0;
	for(int i=n;~i;--i)
		for(int j=0;j<cnt[i];++j)
			a[m++]=i;
	if(m==0){
		ans=(ans+1)%mod;
		return;
	}
	memset(vis,0,sizeof(vis));
	for(int i=0,j=0;i<m;++i){
		while(j<k&&s[j]=='b')
			++j;
		if(j==k)
			return;
		vis[j]=true;
		beg[i]=++j;
	}
	for(int i=0,j=0;i<m&&a[i]>=1;++i){
		if(j<beg[i])j=beg[i];
		while(j<k&&(s[j]=='r'||vis[j]))
			++j;
		if(j==k)
			return;
		vis[j]=true;
		beg[i]=++j;
	}
	for(int i=0,j=0;i<m&&a[i]>=2;++i){
		if(j<beg[i])j=beg[i];
		int rest=a[i]-1;
		while(rest){
			while(j<k&&vis[j])
				++j;
			if(j==k)
				break;
			else
				vis[j]=true,--rest;
		}
		if(rest)
			return;
		++j;
	}
	ll res=fac[m];
	for(int i=0;i<=n;++i)
		res=res*inv[cnt[i]]%mod;
	int box=1;
	for(int i=0;i<m;++i)
		if(a[i])
			box+=2*a[i]+2;
		else
			box+=2;
	res=res*c[box+rest-1][rest]%mod;
	ans=(ans+res)%mod;
}
void dfs(int pos,int rest){
	if(!pos){
		for(int i=0;i*2<=rest;++i){
			cnt[0]=i;
			judge(rest-i*2);
		}
		return;
	}
	for(int i=0;i*2*pos<=rest;++i)
		cnt[pos]=i,dfs(pos-1,rest-i*2*pos);
}

int main(){
	init();
	cin>>n>>k>>s;
	dfs(n,n+1);
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int n;//入力します。
  cin >> n;
  char s[n];
  cin >> s;
  int count;
  int ans;
  //最初の状態を考えます。
  //リーダーである西端以外の人で東を向いている人の数を数えます。
  //この値をとりあえず「現在の最小」としておきます。
  for(int i=1;i<n;++i){
    if(s[i]=='E'){
      ++count;
		}
  }
  ans = count;
  
  for(int i=1;i<n;++i){//西の端からリーダーを変えていきます。
    //リーダーを変える前の人が西を向いていたなら、数を1増やします。
    //リーダーを変えた後の人が東を向いていたなら、数を1減らします。
    //数を「現在の最小」と比較して、最小だったら更新します。
    if(s[i]=='E'){
      --count;
    }
    if(s[i-1]=='W'){
      ++count;
		}
    if(count<ans){
      ans = count;
    }
  }
  //「現在の最小」を出力します。
  cout << ans << endl;
  return 0;
}

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

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

Measured memory_bytes: 5148
#include<stdio.h>
 
int main()
{
  int length = 0;
  int height = 0;
  int area = 0;
  int cir = 0;
 
  scanf("%d %d", &length, &height);
  area = length * height;
  cir = length*2 + height*2;
 
  printf("%d %d\n", area, cir);
 
  return 0;
}
  

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

using namespace std;

#define PI 3.1415926535897932

int main(){
    char a[102],b[102];
    scanf("%s",a);
    scanf("%s",b);
    if (strlen(a)>strlen(b)) {
        printf("GREATER\n");
        return 0;
    } else if (strlen(a)<strlen(b)) {
        printf("LESS\n");
        return 0;
    }
    for (int i=0;i<strlen(a);i++) {
        if (a[i]-0>b[i]-0) {
            printf("GREATER\n");
            return 0;
        } else if (a[i]-0<b[i]-0) {
            printf("LESS\n");
            return 0;
        }
    }
    printf("EQUAL\n");
    return 0;
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#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 <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

#define MAX_V 2000010
struct edge {int to, cap, rev;};
vector<vector<edge> > G(MAX_V);
bool used[MAX_V];
void add_edge(int from, int to, int cap){
    edge F;
    edge T;
    F.to = to;
    F.cap = cap;
    F.rev = G[to].size();
    G[from].push_back(F);

    T.to = from;
    T.cap = 0;
    T.rev = G[from].size() - 1;
    G[to].push_back(T);
}
int dfs(int v, int t, int f){
    if(v == t) return f;
    used[v] = true;
    for(int i = 0; i < G[v].size(); i++){
        edge &e = G[v][i];
        if(!used[e.to] && e.cap > 0){
            int d = dfs(e.to, t, min(f, e.cap));
            if(d > 0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}
int max_flow(int s, int t){
    int flow = 0;
    while(1){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if(f == 0) return flow;
        flow += f;
    }
}

int main(void){
  int V, E; cin >> V >> E;
  int u, v, c;
  rep(i, E){
    cin >> u >> v >> c;
    add_edge(u, v, c);
  }
  cout << max_flow(0, V-1) << endl;
}



Measured memory_bytes: 51736
import sys
from io import StringIO
import unittest


def resolve():
    s = input()
    # n = int(input())
    # a, b = map(int, readline().split())
    # l = [list(map(int, readline().split())) for _ in range(n)]
    hon = ['2','4','5','7','9']
    pon = ['0','1','6','8']

    if s[-1] in hon:
        print('hon')
    elif s[-1] in pon:
        print('pon')
    else:
        print('bon')


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """16"""
        output = """pon"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2"""
        output = """hon"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """183"""
        output = """bon"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16332
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
    	new B().doIt();
    }
    class B{
    	void doIt(){
    		int n = sc.nextInt();
    		int k = sc.nextInt();
    		boolean array[] = new boolean[10];
    		boolean nn[] = new boolean[100000];
    		ArrayList<Integer> number = new ArrayList<Integer>();
    		for(int i = 0;i < k;i++){
    			int num = sc.nextInt();
    			array[num] = true;
    		}
    		for(int i = 0;i < 10;i++){
    			if(!array[i])number.add(i);
    		}
    		nn[0] = true;
    		for(int i = 0;i < 100000;i++){
    			if(nn[i]){
//    				System.out.println(i);
    				if(i >= n){
    					System.out.println(i);
    					break;
    				}
    				for(int j = 0;j < number.size();j++){
    					if(i+number.get(j) > 100000)continue;
    					nn[i*10+number.get(j)] = true;
    				}
    			}
    		}
    	}
    }
}

Measured memory_bytes: 10068
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//#define rnd(x, y) uniform_int_distribution<ll>(x, y)(rng)

//struct custom_hash {
//    static uint64_t splitmix64(uint64_t x) {
//        // http://xorshift.di.unimi.it/splitmix64.c
//        x += 0x9e3779b97f4a7c15;
//        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
//        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
//        return x ^ (x >> 31);
//    }
//    size_t operator()(uint64_t x) const {
//        static const uint64_t FIXED_RANDOM = 
//            chrono::steady_clock::now().time_since_epoch().count();
//        return splitmix64(x + FIXED_RANDOM);
//    }
//};

#define fi first
#define se second

vector<ll>red,green,colorless;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	for(ll i=0;i<a;i++)
	{
	    ll tmp;
	    cin>>tmp;
	    red.eb(tmp);
	}
	for(ll i=0;i<b;i++)
	{
	    ll tmp;
	    cin>>tmp;
	    green.eb(tmp);
	}
	for(ll i=0;i<c;i++)
	{
	    ll tmp;
	    cin>>tmp;
	    colorless.eb(tmp);
	}
	sort(red.rbegin(),red.rend());
	sort(green.rbegin(),green.rend());
	for(ll i=0;i<x;i++)
	{
	    colorless.eb(red[i]);
	}
	for(ll i=0;i<y;i++)
	{
	    colorless.eb(green[i]);
	}
	sort(colorless.rbegin(),colorless.rend());
	ll ans=0;
	for(ll i=0;i<(x+y);i++)
	{
	    ans+=colorless[i];
	}
	cout<<ans;
    return 0;
}


//252908XL

/*
comments:-

*/


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

using namespace std;

int main () {
  int K;
  string S;
  cin >> K;
  cin >> S;
  if ( S.size() > K )
  {
    S = S.substr(0, K) + "...";
  }
  cout << S << "\n";
  return 0;
}


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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pii pair<int, int>
#define sz size()

const int mod = 1e9 + 7;

void add(int &x, int y)
{
	x += y;
	if(x >= mod)
		x -= mod;
}

int main()
{
	ios::sync_with_stdio(0);
	int i, j, k, n;
	string s;

	cin >> n;
	cin >> s;

	vector<int> dp(n+10);
	// dp[i][j] = count of permutations till i prefix, placing first i numbers
	// with j as the last number in the permutation
	
	dp[1] = 1;
	for(i=2;i<=n;++i)
	{
		vector<int> newdp(n+10), pre(n+10);
		for(j=1;j<=i;++j)
			pre[j] = (pre[j-1] + dp[j]) % mod;
		
		for(int newlast = 1; newlast <= i; ++newlast)
		{
			int L, R;
			if(s[i-2] == '>')
				L = newlast, R = i;
			else
				L = 1, R = newlast - 1;

			// for(int last = L; last <= R; ++last)
			// 	add(newdp[newlast], dp[last]);

			add(newdp[newlast], (pre[R] - pre[L-1] + mod) % mod);
		}
		dp = newdp;
	}

	int ans = 0;
	for(i=1;i<=n;++i)
		add(ans, dp[i]);

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256