akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

int main(){
	
	string str, s1;
	cin >> str >> s1;
	
	bool flag = false;
	for(int i = str.size() - s1.size(); i >= 0; i--){
		for(int j = 0; j < s1.size(); j++){
			if(str[i + j] != s1[j] && str[i + j] != '?'){
				break;
			}
			if(j == s1.size() - 1){
				flag = true;
				for(int k = 0; k < s1.size(); k++){
					str[i + k] = s1[k];
				}
			}
		}
		if(flag){
			break;
		}
	}
	
	for(int i = 0; i < str.size(); i++){
		if(str[i] == '?'){
			str[i] = 'a';
		}
	}
	
	if(flag){
		cout << str << endl;
	}else{
		cout << "UNRESTORABLE" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long
#define mod 1000000007

int N,M,ans=0;
pair<int,int>AB[111111];
priority_queue<int>pq;

int main() {
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>AB[i].first>>AB[i].second;
	sort(AB,AB+N);
	AB[N].first=999999;
	int ok=0;
	for(int i=1;i<=M;i++){
		while(AB[ok].first<=i){
			pq.push(AB[ok].second);
			ok++;
		}
		if(pq.size()==0)continue;
		ans+=pq.top();
		pq.pop();
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 4640
N,L=map(int,input().split())
lis=list(range(L,N+L,1))
#print(lis)
min=1000
index=0
sum=0
for i in range(len(lis)):
    if abs(lis[i])<min:
        min=abs(lis[i])
        index=i
    sum=sum+lis[i]

print(sum-lis[index])

Measured memory_bytes: 3064
<?php
fscanf(STDIN, "%d %d", $a, $b);
fscanf(STDIN, "%s", $s);
for($i = 0; $i < $a; $i++) {
    if(!is_numeric($s[$i]) || $s[$i] < 0 && $s[$i] > 9) {
        echo 'No'. "\n";
        exit;
    }
}
if($s[$a] != '-') {
    echo 'No'. "\n";
    exit;
}
for($i = $a + 1; $i < $a + $b + 1; $i++) {
    if(!is_numeric($s[$i]) || $s[$i] < 0 && $s[$i] > 9) {
        echo 'No'. "\n";
        exit;
    }
}
echo 'Yes'. "\n";

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
using namespace std;

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

    for(int i=0; i<t.size(); i++){
        if(t[i] == '?'){
            t[i] = 'D';
        }
    }

    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <algorithm>
using namespace std;
int main() { 
	int N,M,i,j=0;
	cin >> N>> M;
	int a[M],ans[N]={};
	if(M>0){
		for (i=0;i<M;i++){
			cin >> a[i];
		}
	}
	if(N==1){
		if(M==0){
			ans[0]=1;
		}
	}else{
		if((M>=2)&&(a[0]==1)&&(a[1]==2)){
			ans[0]=0;
			ans[1]=0;
			j=2;
		} else if(a[0]==1){
			ans[0]=0;
			ans[1]=1;
			j=1;
		} else if(a[0]==2){
			ans[0]=1;
			ans[1]=0;
			j=1;
		} else {
			ans[0]=1;
			ans[1]=2;
			j=0;
		}
		if(N>2){
			for(i=2;i<N;i++){
				if(a[j]==i+1){
					ans[i]=0;
					j++;
				} else {
					ans[i]=ans[i-1]+ans[i-2];
					if(ans[i]==0){
						break;
					}
					if(ans[i]>=1000000007){
						ans[i]-=1000000007;
					}
				}		
			}
		}
	}
	cout << ans[N-1];
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    
    long long int i, N, K, min, max, mid, cut;
    cin >> N >> K;
    
    vector<long long int> A(N);
    
    for (i = 0; i < N; i++){
        cin >> A[i];
    }
    
    sort(A.begin(), A.end());
    
    if (K == 0){
        cout << A[N - 1] << "\n";
        return 0;
    }
    
    min = 0;
    max = A[N - 1];
    
    while(max - min > 1){
        
        mid = (min + max) / 2;
        cut = 0;
        
        for (i = 0; i < N; i++){
            cut += (A[i] - 1) / mid;
        }
        
        if (cut > K){
            min = mid;
        } else {
            max = mid;
        }
        
    }
    
    cout << max << "\n";

    return 0;
}



Measured memory_bytes: 4472
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class A {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      vector<int> a(4);
      rep(i, 4) cin >> a[i];
      sort(all(a));
      cout << abs(a[3]+a[0]-a[1]-a[2]) << endl;
    }
};

signed main() {
  A solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 3220
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 insertion_sort(target_array: &mut Vec<i32>, n: i32, g: i32) -> i32 {
    let mut cnt = 0;

    for i in 0..n {
        let v = target_array[i as usize];
        let mut j = i - g;

        while j >= 0 && target_array[j as usize] > v {
            target_array[(j + g) as usize] = target_array[j as usize];
            j = j - g;
            cnt += 1;
        }

        target_array[(j + g) as usize] = v
    }

    cnt
}

fn shell_sort(target_array: &mut Vec<i32>, n: i32) {
    let mut cnt = 0;

    let mut g: Vec<i32> = vec![];

    if n == 1 {
        g.push(1)
    } else {
        let mut h = 1;
        while h < n {
            g.push(h);
            h = 3 * h + 1;
        }
        g.reverse()
    }
    let m = g.len();

    for i in 0..m {
        let new_cnt = insertion_sort(target_array, n, g[i as usize]);
        cnt += new_cnt;
    }

    println!("{}", m);
    for index in 0..m {
        if index != m - 1 {
            print!("{} ", g[index as usize]);
        } else {
            println!("{}", g[index as usize]);
        }
    }
    println!("{}", cnt);
}

fn main() {
    let n: i32 = read();

    let mut target_array: Vec<i32> = (0..n).map(|_| read::<i32>()).collect();

    shell_sort(&mut target_array, n);

    for index in 0..n {
        println!("{}", target_array[index as usize]);
    }
}



Measured memory_bytes: 9124
S=input()
prev=int(S[:2])
aft=int(S[2:])

if prev <= 12 and prev >= 1:
    if aft == 0:
        print("MMYY")
    elif aft <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif prev > 12:
    if aft == 0:
        print("NA")
    elif aft <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if aft >= 1 and aft <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 3060
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int n,m,a,b,c,d[100005] = {};
string s,t;

int main(){
    
    cin >> a >> b;

    if(a + b == 15)P("+");
    else if(a * b == 15)P("*");
    else P("x");
    
	return  0;
}

Measured memory_bytes: 768
#include <stdio.h>

int main(void){
    
    int num1,num2,answer =0;
    
    // 数値の取得（空白区切りで2個入力されると信じている。
    scanf("%d%d", &num1, &num2);
    
    // 最大公約数の算出
    while(answer == 0){
        if (num2>=num1)
        {
            num2=num2%num1;
            if(num2==0)
            {
                answer = num1;
            }
        }
        else
        {
            num1=num1%num2;
            if(num1==0)
            {
                answer = num2;
            }
        }
    }
    
    // 回答の表示
    printf("%d\n",answer);
    
    return 0;
}



Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

inline ll inv(int x, int m) {
    ll a = 0, b = 1, tmp = m;
    while (x != 0) {
        ll t = m / x;
        m -= t * x;
        swap(x, m);
        a -= t * b;
        swap(a, b);
    }
    a %= tmp;
    if (a < 0) a += tmp;
    return a;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int p;
    cin >> p;
    vector<int> a(p);
    rep(i, 0, p) cin >> a[i];
    vector<vector<int>> t(p, vector<int>(p));
    vector<int> iv(p);
    rep(i, 0, p) {
        t[i][0] = 1;
        rep(j, 1, p) {
            t[i][j] = t[i][j - 1] * i % p;
        }
    }
    debug(t);
    t[0][p - 1] = p - 1;
    rep(i, 1, p) iv[i] = inv(i, p) * (p - 1) % p;
    debug(iv);
    vector<int> ans(p);
    if (a[0] == 1) ans[0]++, ans[p - 1] += p - 1;
    rep(i, 1, p) {
        t[i][0] = 0;
        rep(j, 1, p) {
            t[i][j] = iv[t[i][j]];
            if (a[i]) ans[j] += t[i][j];
        }
    }
    debug(t);
    for (int x : ans) cout << x % p << ' ';
    cout << endl;
    return 0;
}

Measured memory_bytes: 35584
#include <stdio.h>
int main(){
    int n,i;
    long long ans,luca[87];
    luca[0]=2;
    luca[1]=1;
    scanf("%d",&n);
    for(i=2;i<=86;i++){
        luca[i]=luca[i-1]+luca[i-2];
    }
    printf("%lld",luca[n]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
	while (b != 0)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

int n;
vector <int > a, p, s;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	a.resize(n);
	p.resize(n);
	s.resize(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	p[0] = a[0];
	for (int i = 1; i < n; i++)
		p[i] = gcd(p[i - 1], a[i]);
	s[n - 1] = a[n - 1];
	for (int i = n - 2; i >= 0; i--)
		s[i] = gcd(s[i + 1], a[i]);
	int ans = 0;
	for (int i = 0; i < n; i++)
		ans = max(ans, (i == 0 ? s[i + 1] : i == n - 1 ? p[i - 1] : gcd(p[i - 1], s[i + 1])));
	cout << ans;
	cin >> n;
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
    for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

int dp[2005];
int ne[2005];
int t[2005][4];
vector<P> v1;

int main(){
    int n,m;
    int i,j,k;
    int a,b,c;
    int p,q;
    cin>>n;
    for(i=0;i<2005;i++){
        dp[i]=-INF;
    }
    for(i=0;i<n;i++){
        for(j=0;j<4;j++){
            cin>>t[i][j];//r/a/w/t
        }
        v1.push_back(make_pair(t[i][0]+t[i][3],i));
    }
    sort(v1.rbegin(),v1.rend());
    for(i=0;i<n;i++){
        p=v1[i].second;

        for(j=0;j<2005;j++){
            ne[j]=-INF;
        }
        for(j=t[p][0];j<2005;j++){
            if(dp[j]==-INF)continue;
            k=min(j-t[p][0],t[p][3]);
            ne[k]=max(ne[k],dp[j]+t[p][1]);
        }
        ne[t[p][3]]=max(ne[t[p][3]],t[p][1]);
        for(j=2004;j>=0;j--){
            dp[j]=max(dp[j],ne[j]);
            if(j<t[p][0] || ne[j]==-INF)continue;
            k=j-t[p][0];
            ne[k]=max(ne[k],ne[j]+t[p][2]);
        }
    }
    int s=0;
    for(i=1;i<2005;i++){
        s=max(s,dp[i]);
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3188
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;

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

    static class CKThSubstring {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int k = in.nextInt();

            TreeSet<String> strings = new TreeSet<>();
            for (int i = 0; i < s.length(); i++) {
                for (int j = i + 1; j <= i + k && j <= s.length(); j++) {
                    strings.add(s.substring(i, j));
                }
            }

            Iterator<String> it = strings.iterator();
            for (int i = 0; i < k - 1; i++) {
                it.next();
            }

            out.println(it.next());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23508
N=int(input())
n=str(N)
k=len(n)

if k==1:
    print(N)
elif k==2:
    print(9)
elif k==3:
    print((N//100-1)*100+N%100+10)
elif k==4:
    print(909)
elif k==5:
    print((N//10000-1)*10000+N%10000+910)
else:
    print(90909)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>

const long long MOD = (long long) 1e9 + 7;

int main() {
  int N, M, K;
  std::cin >> N >> M >> K;
  bool ans = false;
  for (int n = 0; n <= N; ++n) {
    for (int m = 0; m <= M; ++m) {
      ans |= n * M + m * N - 2 * n * m == K;
    }
  }
  std::cout << (ans ? "Yes" : "No") << std::endl;
  return 0;
}


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

int main() {
 int n;
    cin >> n;
    
    if(n>=30) {
     cout << "Yes";}
     else {
     cout << "No";
     }
    

    
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 1000; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j])%mod;
//       }
//     }
//   }
//   return 0;
// }


// int factorial(int n){
//   if(n == 0) return 1;
//   return n*factorial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   pascal_triangle();
//   return memo[n][k];
// }

int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}







//二項係数(mod剰余)----------------------------

// const int MAX = 3000010;
// const int M = 1000000007;

// vector<ll> fac(MAX); //n!(mod M)
// //a,bの範囲的にこれだけ配列を用意していけば十分
// vector<ll> ifac(MAX); //k!^{M-2} (mod M)

// ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
//     ll ans = 1;
//     while(n != 0){
//         if(n&1) ans = ans*x % M;
//         x = x*x % M;
//         n = n >> 1;
//     }
//     return ans;
// }

// ll COMinit(){
//   //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
//   fac[0] = 1;
//   ifac[0] = 1;
//   for(ll i = 0; i<MAX; i++){
//     fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
//     ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
//   }
//   return 0;
// }

// ll COM(ll a, ll b){ //aCbをmod計算
//   if(a == 0 && b == 0)return 1;
//   if(a < b || a < 0)return 0;
//   ll tmp = ifac[a-b]* ifac[b] % M;
//   return tmp * fac[a] % M;
// }

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

bool b[10000000];
int cnfa[1000000];

int main(){
  float H,A;
  cin >> H >> A;
  cout << ceil(H/A) << endl;
  
  
  return 0;
}




Measured memory_bytes: 256
s = input()
d = {}
flag = 1
for i in s:
    if i in d:
        d[i] += 1
    else:
        d.setdefault(i, 1)
    
for j in d.values():
    if j % 2 != 0:
        flag = 0
if flag == 0:
    print("No")
else:
    print("Yes")

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

int main(){
    int n, h, m, s;
    cin >> n;
    h = n / 3600;
    n = n - (h * 3600);
    m = n / 60;
    s = n - (m * 60);
    cout << h << ":" << m << ":" << s << endl;
    return 0;
}

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

public class Hello{
    public static void Main(){
        var s = Console.ReadLine();
        var t = Console.ReadLine();
        
        var ret = "";
        if(s.Length + 1 == t.Length && t.Substring(0, s.Length) == s){
            ret = "Yes";
        } else{
            ret = "No";
        }
        
        System.Console.WriteLine(ret);
    }
}


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

using namespace std;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

int main(){

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

    //freopen("input.txt", "r", stdin);

    string a;

    cin >> a;

    int best = 1e9, moves, prev;

    for(int i = 0; i < 26; ++i){
        string b = a;
        moves = 0;
        prev = -1;

        for(int j = 0; j < a.size(); ++j){
            if(a[j] - 97 == i){
                if(prev == -1)
                    moves = j;
                prev = j;
            }
            moves = max(moves, j - prev);
        }

        best = min(best, moves);
        //cout << i << " " << moves << endl;

    }

    cout << best;

    return 0;
}


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

int search_bit(int a[], int from, int b[], int n) {
  for (int i = from; i < n; i++) {
    if (b[i] == a[from]) return i;
  }
  return -1;
}

void move(int a[], int from, int to) {
  int temp = a[to];
  for (int i = from + 1; i <= to; i++) {
    a[i] = a[i - 1];
  }
  a[from] = temp;
}

void display(int a[], int n) {
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}

int operate(int init[], int run[], int n) {
  int count = 0;
  for (int i = 0; i < n; i++) {
    //display(run, n);
    if (init[i] == run[i]) continue;
    int match = search_bit(init, i, run, n);
    count += match - i;
    move(run, i, match);
  }
  //display(run, n);
  return count;
}

int count_bit(int a[], int n) {
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i]) count++;
  }
  return count;
}

int main() {
  int n, m;
  cin >> n >> m;
  int b[n], p[m];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }
  int run0[n], run1[n];
  int pos = 0;
  int bit = 0;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < p[i]; j++) {
      run0[pos++] = bit;
    }
    bit = 1 - bit;
  }
  for (int i = 0; i < n; i++) {
    run1[i] = (run0[i]) ? 0 : 1;
  }
  int count0 = -1, count1 = -1;
  int res[n];
  if (count_bit(b, n) == count_bit(run0, n)) {
    count0 = operate(b, run0, n);
  }
  if (count_bit(b, n) == count_bit(run1, n)) {
    count1 = operate(b, run1, n);
  }
  if (count0 == -1) {
    cout << count1 << endl;
  } else if (count1 == -1) {
    cout << count0 << endl;
  } else {
    cout << min(count1, count0) << endl;
  }
  return 0;
}



Measured memory_bytes: 3116
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk)
{
	var input = chunk.toString();
	var kazu = input.split(" ");
	var men = kazu[0] * kazu[1];
	var syu = kazu [0] * 2 + kazu[1] * 2;
	console.log(men+" "+syu);
});

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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for(auto&& i : a){
        cin >> i;
    }
    for(auto&& i : b){
        cin >> i;
    }
    for(auto&& i : c){
        cin >> i;
    }
    sort(begin(a), end(a));
    sort(begin(b), end(b));
    sort(begin(c), end(c));
    long long ans = 0;
    for(auto&& i : b){
        long long selectA = lower_bound(begin(a), end(a), i) - begin(a);
        long long selectC = end(c) - upper_bound(begin(c), end(c), i);
        ans += selectA * selectC;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
from collections import deque

n, m = map(int, input().split())
graph = [deque([]) for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
for i in graph[1]:
    if n in graph[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


Measured memory_bytes: 148664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

constexpr ll MM = 160000;
bool used[400][400];
ll H, W, bcn, wcn;
array<ll, 4> dh = {0, 0, 1, -1}, dw = {1, -1, 0, 0};
vc<string> S;

void dfs(ll h, ll w){
    char tc = (S[h][w] == '#' ? '.' : '#');
    used[h][w] = true;
    if (S[h][w] == '#') bcn++;
    else wcn++;

    rep(i, 4){
        ll th = h + dh[i], tw = w + dw[i];
        if (th < 0 or th >= H or tw < 0 or tw >= W) continue;
        if (used[th][tw] or S[th][tw]!=tc) continue;
        dfs(th, tw);
    }
}

int main() {
    init();
    cin >> H >> W;
    S.resize(H);
    rep(i, H) cin >> S[i];

    ll ans = 0;
    rep(i, H) rep(j, W){
        if(!used[i][j]){
            bcn = 0, wcn = 0;
            dfs(i, j);
            ans += bcn * wcn;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 13844
module WeightedGraph
  (Vertex : sig
    type t
    val compare : t -> t -> int
  end)
  (Weight : sig
    type t
    val compare : t -> t -> int
  end) :
sig
  val prim :
    (* 隣接リスト *)
    (Vertex.t -> (Vertex.t * Weight.t) list) ->
    (* 始点 *)
    Vertex.t ->
    (* 最小全域木に含まれる辺のリスト *)
    (Vertex.t * Vertex.t * Weight.t) list
end =
struct
  module VSet = Set.Make (Vertex)
  module WMap = Map.Make (Weight)

  let prim es =
    (*
     * プリム法のメインループ
     * es : 隣接リスト
     * vs : 訪れた頂点の集合
     * q : 訪れた頂点から伸びる辺が重み順に入ったヒープ
     * acc : 最小全域木に使うのが確定した辺を入れるやつ
     *)
    let rec prim acc vs q =
      match WMap.min_binding q with
      | exception Not_found -> acc
      | (w, []) -> prim acc vs (WMap.remove w q)
      | (w, (u, v) :: rest) ->
          ( if VSet.mem v vs
            (* vは既に訪れていた *)
            then prim acc vs
            (* vはまだ訪れていなかった *)
            else prim_aux ((u, v, w) :: acc) vs v ) (WMap.add w rest q)
    (* vを訪れ，vから伸びる辺をキューに追加してループを続行する *)
    and prim_aux acc vs v q =
      prim acc (VSet.add v vs) @@
      List.fold_right (fun (u, w) q ->
        WMap.add w ((v, u) :: try WMap.find w q with Not_found -> []) q) (es v) q in
    fun s -> prim_aux [] VSet.empty s WMap.empty
end

module Int = struct
  type t = int
  let compare = compare
end

module G = WeightedGraph (Int) (Int)

let () = Scanf.scanf "%d\n" (fun n ->
  let xys = Array.to_list @@ Array.init n (fun i -> Scanf.scanf "%d %d\n" (fun x y -> x, y, i)) in
  let es = Array.make n [] in
  begin match List.sort (fun (x, _, _) (x', _, _) -> compare x x') xys with
  | [] -> ()
  | (x, y, i) :: rest ->
      ignore @@ List.fold_left (fun (x, y, i) (x', y', j) ->
        es.(i) <- (j, min (abs (x - x')) (abs (y - y'))) :: es.(i);
        es.(j) <- (i, min (abs (x - x')) (abs (y - y'))) :: es.(j);
        (x', y', j)) (x, y, i) rest
  end;
  begin match List.sort (fun (_, y, _) (_, y', _) -> compare y y') xys with
  | [] -> ()
  | (x, y, i) :: rest ->
      ignore @@ List.fold_left (fun (x, y, i) (x', y', j) ->
        es.(i) <- (j, min (abs (x - x')) (abs (y - y'))) :: es.(i);
        es.(j) <- (i, min (abs (x - x')) (abs (y - y'))) :: es.(j);
        (x', y', j)) (x, y, i) rest
  end;
  G.prim (Array.get es) 0
  |> List.map (fun (_, _, w) -> w)
  |> List.fold_left ( + ) 0
  |> Printf.printf "%d\n")


Measured memory_bytes: 75264
x,y,a,b,c = map(int, input().split())

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort()
q.sort()
r.sort()

ans = p[-x:]+q[-y:]
ans.sort()

for i in range(min(len(ans), len(r))):
    R = r.pop()
    if ans[i]<=R:
        ans[i]=R
    else:
        break
print(sum(ans))


Measured memory_bytes: 106664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
typedef long long ll;
using namespace std;

int main(void){
  string s;
  bool c=0;
  cin>>s;
  if(s[0]==s[1]){
    if(s[2]==s[3]&&s[0]!=s[2]){
      c=1;
    }
  }
  else if(s[0]==s[2]){
    if(s[1]==s[3]&&s[0]!=s[1]){
      c=1;
    }
  }
  else if(s[0]==s[3]){
    if(s[1]==s[2]&&s[0]!=s[1]){
      c=1;
    }
  }

  if(c){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }

	return 0;
}


Measured memory_bytes: 256
use proconio::input;

#[allow(unused_variables)]
fn main() {
    input! {
      h: f64, w: f64
    };

    let ans: f64;

    if h == 1f64 || w == 1f64 {
        ans = 1f64
    } else {
        ans = (h * w / 2f64).ceil()
    }

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


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

int main() {
	int n;
	cin >> n;
	int xx = 10;
	bool ok = false;
	for ( int i = 0; i < 4; ++i ) {
		int x = n%10;
		n /= 10;
		if(x == xx)ok = true;
		xx = x;
	}
	if(ok)cout << "Bad" << endl;
	else cout << "Good" << endl; 
	return 0;
}

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

main()
{

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

    long long i,j,k=0,l,m,n,p,t;
   while(cin>>m>>n){
        l=0;
    for(i=0;i<=m;i++){
        k=(i*4)+((m-i)*2);
   if(k==n)l++;
   k=(i*2)+((m-i)*4);
   if(k==n)l++;
    }
    if(l>0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
   }
    return 0;

}


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

using pii = pair<int, int>;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<vector<int>> A(2, vector<int>(N));
    vector<vector<int>> sum(2, vector<int>(N + 1));
    for(int i = 0; i < 2; ++i) {
        for(int j = 0; j < N; ++j) {
            cin >> A[i][j];
            sum[i][j + 1] = sum[i][j] + A[i][j];
        }
    }

    int ans = 0;
    for(int i = 1; i <= N; ++i) {
        ans = max(ans, sum[0][i] + sum[1][N] - sum[1][i - 1]);
    }
    cout << ans << endl;
}


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

int main()
{
    
    
    while(1)
    {int n,x=0;
        int num=0;
        cin>>n>>x;
        if(n==0&&x==0)break;
        for(int i=1;i<=n-2; i++)
        {
            for(int s=i+1; s<=n-1; s++)
            {
                for(int t=s+1; t<=n; t++)
                {
                    if(i+s+t==x)
                    {
                        num++;
                    }
                }
            }
        }
        cout<<num<<endl;
    }
    
    return 0;
}

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

int main(){
    int n;
    int A[100];
    int w,minj;
    int cou =0;
    
    cin >> n;
    for (int i =0;i<n;i++) cin >> A[i];
    
    for(int i = 0; i<n-1; i++){
        minj =i;
        for (int j =i; j<n; j++){
            if (A[j]<A[minj]) minj = j;
        }    
        w = A[i];
        A[i] = A[minj];
        A[minj] = w;
       
        if (i != minj) cou ++;
    }
    
    cout << A[0];
    for(int i =1; i<n; i++){
        cout << " "  << A[i];
    }cout << endl;
    
    cout << cou << endl;
    
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

bool bfs(const Graph &G,int st,int go){
    vector<bool> check(G.size());
    check[st] = true;
    queue<int> q;
    q.push(st);
    while(q.size()){
        int t = q.front();
        q.pop();
        if(t==go){
            return true;
        }

        for(auto v : G[t]){
            if(t==st && v==go) continue;
            if(!check[v]){
                check[v] = true;
                q.push(v);
            }
        }
    }
    return false;
}

int main(){
    int n,m;
    cin >> n >> m;
    Graph G(n+1);
    vector<P> pai;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        pai.push_back(make_pair(a,b));  
    }
    int ans = 0;
    rep(i,pai.size()){
        if(!bfs(G,pai[i].first,pai[i].second)) ans++;
    }
    cout << ans << endl;
}

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

int main(){
  int d,n;
  cin >> d >> n;
  if(d == 0){
    if(n == 100){
      cout << n + 1 << endl;
    }else{
    cout << n << endl;
    }
  }else if(d == 1){
      if(n == 100){
        cout << 100 * (n+1) << endl;
      }else{
    cout << 100 * n << endl;
      }
  }else{
    if(n == 100){
      cout << 10000 * (n+1) << endl;
    }else{
    cout << 10000 * n << endl;
    }
  } 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
ll A;
  ll B;
  cin >>A>>B;
  ll count=0;
  repl(i,A,B+1) {
    int a=i/10000;
    int b=i/1000-a*10;
    int c=i/100-a*100-b*10;
    int d=i/10-a*1000-b*100-c*10;
    int e=i-a*10000-b*1000-c*100-d*10;
    if((a==e)&& (b==d)) {
      count++;
    }
  }
    cout << count<< endl;
  }
    
      
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;


// UnionFind
//abc157_d で解説しているので参照する
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
vector<int> d;
UnionFind(int n=0): d(n,-1) {}
int find(int x) {
  if (d[x] < 0) return x;
  return d[x] = find(d[x]);
}
bool unite(int x, int y) {
  x = find(x); y = find(y);
  if (x == y) return false;
  if (d[x] > d[y]) swap(x,y);
  d[x] += d[y];
  d[y] = x;
  return true;
}
bool same(int x, int y) { return find(x) == find(y);}
int size(int x) { return -d[find(x)];}
};

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

  vector<int> a(m);
  vector<int> b(m);


  REP(i,m){
    int ax, bx;
    cin >> ax >> bx;
    --ax; --bx;
    a[i] = ax;
    b[i] = bx;
  }

  int ans = 0;

  REP(i,m){
    UnionFind uf(n);
    REP(j,m){
      if(j == i) continue;
      uf.unite(a[j],b[j]);
    }
    if(!uf.same(a[i],b[i])) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <cmath>
#include <vector>
using namespace std;
const int INF=0x7fffffff;

long long n,x,a,b,h[1000010],ans=INF;

bool check(long long mid){
    long long cnt=mid;
    for (int i=1;i<=n;++i){
        long long s=h[i]-mid*b;
        if (s>0){
            cnt-=(s/(a-b)+(s%(a-b)==0?0:1));
            if (cnt<0)
                return false;
        }
    }
    return true;
}

int main(){
    cin>>n>>a>>b;
    for (int i=1;i<=n;++i) cin>>h[i];
    long long l=0,r=INF,mid;
    while(l<=r){
        mid=(l+r)>>1;
        if (check(mid)){
            ans=mid;r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() { cin >> n >> k;
    a = n % k;
    cout << min(a, k - a) << endl;
}

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

using namespace std;

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

signed main() {
    int N;
    int A[220000];
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    double x=0;
    for(int i=0;i<N;i++)x+=1.0/A[i];
    cout << fixed << setprecision(20);
    cout<<1.0/x<<endl;
}


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

int main(){
  int N, count = 3;
  cin >> N;
  for(int i = 0; i < N; i++){
    char S;
    cin >> S;
    if(S == 'Y'){
      count += 1;
      break;
    }
  }
  if(count == 3){
    cout << "Three" << endl;
  }
  else{
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 3612
import math

N = int(input())

fact_n = math.factorial(N)

towns = []

for i in range(N):
    a, b = map(int, input().split())
    towns.append((a, b))

ans = 0


for i in range(N):
    for j in range(N-i-1):
        town_a = towns[i]
        town_b = towns[j+i+1]
        dist = math.sqrt((town_a[0] - town_b[0])**2 + (town_a[1] - town_b[1])**2)
        ans += 2 * math.factorial(N-1) * dist

ans = ans / fact_n


print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int a, b, c, d;
int main(void){
    cin >> a >> b >> c >> d;
    cout << max(0, min(b, d)-max(a, c) ) << endl;
    return 0;
}

Measured memory_bytes: 3608
/*
    WRITER:kakitamasziru/OxOmisosiru
*/
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1001001000;
const int MOD = 1000000007;
typedef pair<long,long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int point[514][514];
int rui[514][514];

int main() {
    int N,M,Q;cin >> N >> M >> Q;
    for(int i = 0;i<514;i++){
        for(int j = 0;j<514;j++) {
            point[i][j] = 0,rui[i][j] = 0;
        }
    }

    for(int i = 0;i<M;i++){
        int left,right;
        cin >> left >> right;
        point[left][right]++;
    }
    //query.first:left,query.second:right
    vector<P> query(Q);
    for(int i = 0;i<Q;i++){
        cin >> query.at(i).first >> query.at(i).second;
    }
    //累積和の計算
    for(int i = 1;i<=N;i++){
        for(int j = 1;j<=N;j++){
            rui[i][j] += rui[i][j-1] + rui[i-1][j] - rui[i-1][j-1] + point[i][j];
        }
    }

    //出力
    for(int i = 0;i<Q;i++){
        query.at(i).first--;
        int left = query.at(i).first;
        int right = query.at(i).second;
        int ans = rui[right][right] - rui[left][right] - rui[right][left] + rui[left][left];
        cout << ans << endl;
    }
}

Measured memory_bytes: 4608
package main

import (
	"fmt"
)

func main() {

	var a, b, c, count int

	fmt.Scanf("%d %d %d", &a, &b, &c)

	for i := 1; i <= c; i++ {
		if i%a == 0 {
			count += b
		}
	}
	fmt.Printf("%d", count)
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long v1 = 0;
    long v2 = Long.MAX_VALUE;
    long w1 = (-1) * Long.MAX_VALUE;
    long w2 = Long.MAX_VALUE;
    for(int i = 0; i < n; i++) {
      long x = sc.nextLong();
      long y = sc.nextLong();
      long v = x + y;
      long w = x - y;
      v1 = Math.max(v1, v);
      v2 = Math.min(v2, v);
      w1 = Math.max(w1, w);
      w2 = Math.min(w2, w);
    }
    long ans = Math.max(v1 - v2, w1 - w2);
    System.out.println(ans);
  }
}

Measured memory_bytes: 59568
t = input().split( )
n = int(t[0])
k = int(t[1])

mod = int(1e9+7)

x = int((k-1)*k*(2*k-1)/6)
y = int((n+1)*(n+2)*(2*n+3)/6)
z = int((n+1)*(n+k+1)*(n-k+2)/2)
w = int(n-k+2)

print(int((x-y+z+w)%mod))

Measured memory_bytes: 9136
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file  
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less  
using namespace         std;
#define                 int long long
#define                 double long double
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<'\n'
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second
#define N 1014159
#define  vi vector<int>
#define  v  vector
#define die exit(0)
#define alln(arr) arr+1 , arr+1+n
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> oset;

int n, m, k, arr[N];

void solve()
{
    string s;
    cin >> s;
    bool ok = 0;
    for (auto i : s)if (i == '7')ok = 1;
    if (ok)cout << "Yes";
    else cout << "No";
}


signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin>>t;
    forn(i, 1, t)
    {
        solve();
        nl;
    }



    return 0;

}

//       clang++ c.cpp ; ./a.out < a.txt ;


Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));
            
            String line;
            
            while((line = stdReader.readLine()) != null) {
                String[] input = line.split(" ", 0);
                int h = Integer.parseInt(input[0]);
                int w = Integer.parseInt(input[1]);
                
                if(h == 0 && w == 0) {
                    break;
                }
                for(int i = 0; i < h; i++) {
                    for(int j = 0; j < w; j++) {
                        System.out.print("#");
                    }
                    System.out.println();
                }
                System.out.println();
            }
            stdReader.close();
        } catch(Exception e) {
            e.getStackTrace();
            System.exit(-1);
        }
    }
}

Measured memory_bytes: 31680