akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
  IOS();
  ll n,h,w;
  cin >> n >> h >> w;
  cout << max(0LL,(n-h+1)*(n-w+1)) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

    bool ans = true;
    int len = s.length();
    for(int i = 0; i < len; i++){
        for(int j = i + 1; j < len; j++){
            if(s[i] == s[j]){
                ans = false;
                break;
            }
        }
    }

    cout << (ans ? "yes" : "no") << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(input()) for _ in range(n)]


max_a = max(a)

max_a_count = 0
for i in range(n):
    if a[i] == max_a:
        max_a_count += 1

if max_a_count > 1:
    for i in range(n):
        print(max_a)
elif max_a_count == 1:
    b = sorted(range(len(a)), key=a.__getitem__)
    for i in range(n):
        if a[i] != max_a:
            print(max_a)
        else:
            print(a[b[-2]])


Measured memory_bytes: 22948
A,B,H,M = map(int,input().split())
minutes = H*60 + M
angle_pm_h = 360 / (12 * 60)
angle_pm_m = 360 / 60
angle_h = angle_pm_h * minutes
angle_m = angle_pm_m * M % 360
angle = angle_h - angle_m
import math
ans = math.sqrt(A*A + B*B - 2 * A * B * math.cos(math.radians(angle)))
print(ans)


Measured memory_bytes: 9432
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  if (s[n-1] == 's'){
    for (int i = 0; i < n; i++)
      cout << s[i];
    cout << "es" << endl;
  }
  else {
    cout << s << "s" << endl;
  }
  return 0;
}

Measured memory_bytes: 3648
from collections import Counter
n = int(input())
s = input()

cnt = Counter(s)
W = cnt['W']
E = cnt['E']
#print(E,W)

l = [[0, 0] for i in range(n + 1)]

dict = {'E':0, 'W':1}
for i in range(n):
    temp1, temp2 = l[i]
    l[i + 1] = [temp1, temp2]
    l[i + 1][dict[s[i]]] += 1
#print(l)
count = 10 ** 7
for i in range(n):
    e, w = l[i + 1]
    temp = E - e + w if s[i] != 'W' else E - e + w - 1
    if count > temp:count = temp
    #print(temp, count)
print(count)

Measured memory_bytes: 43852
# 入力
A=int(input())
B=int(input())
C=int(input())
X=int(input())

cnt=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i+100*j+50*k==X:
        cnt+=1

# 出力
print(cnt)

Measured memory_bytes: 3060
def main():
    N = int(input())

    ans = 0
    if len(str(N)) % 2 == 0:
        for i in range(len(str(N))):
            if i % 2 == 0:
                ans += 9*(10**i)
    else:
        for i in range(len(str(N))+1):
            if i % 2 == 0:
                ans += 9*(10**i)
        ans = ans - (10**len(str(N)) - N) + 1
        
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
}

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

int n;
vector<int> X[15], Y[15];

signed main(){
  
  cin>>n;
  
  for(int i=0;i<n;i++){
    
    int a;
    cin>>a;
    
    for(int j=0;j<a;j++){
      
      int x, y;
      cin>>x>>y;
      
      X[i].push_back(x-1);
      Y[i].push_back(y);
      
    }
    
  }
  
  int ans = 0;

  for(int i=0;i<(1<<n);i++){
    
    int cnt = __builtin_popcount(i);
    int flg = 1;
    
    for(int j=0;j<n;j++){
      
      if( !( i >> j & 1 ) ) continue;
      
      for(int k=0;k<X[j].size();k++){
	
	int x = X[j][k], y = Y[j][k];
	
	if( ( i >> x & 1 ) != y ) flg = 0;
	
      }
      
    }
    
    if( flg ) ans = max( ans, cnt );
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	
	int m[50] = {0};
	int f[50] = {0};
	int r[50] = {0};

	for(int i = 0; i < 50; i++){
		cin >> m[i] >> f[i] >> r[i];
		if((m[i] == -1 && f[i] == -1) && (r[i] == -1)) break;
	}

	for(int i = 0; i < sizeof(m); i++){
		if((m[i] == -1 && f[i] == -1) && (r[i] == -1)) break;
		if(m[i] == -1 || f[i] == -1){
			cout << "F" << endl;
		}else if((m[i] + f[i] >= 80)){
			cout << "A" << endl;
		}else if((m[i] + f[i] >= 65) && (m[i] + f[i] < 80)){
			cout << "B" << endl;
		}else if((m[i] + f[i] >= 50) && (m[i] + f[i] < 65)){
			cout << "C" << endl;
		}else if((m[i] + f[i] >= 30) && (m[i] + f[i] < 50)){
			if(r[i] >= 50){
				cout << "C" << endl;
			}else{
				cout << "D" << endl;
			}
		}else{
			cout << "F" << endl;
		}
	}
	return 0;

}


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

int main(){
    int a, b;
    std::cin >> a >> b;

    std::string s;
    std::cin >> s;

    bool flg = false;
    for(int i = 0; i < s.size(); ++i){
        // std::cout << "s.at(" << i << "): " << s.at(i) << std::endl;
        if(std::string::npos == s.find('-')){
            break;
        }else if('-' == s.at(i)){
            if(a != i){
                break;
            }
        }else if(s.at(i) < '0' || '9' < s.at(i)){
            break;
        }else if(s.size() - 1 == i){
            flg = true;
        }
    }

    if(flg){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
int x,y,z;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>x>>y>>z;
	x-=z;
	cout<<x/(y+z);
	re 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++) cin >> p[i];
    sort(p, p + n);
    for (int a = n; a >= 0; a--) {
        int idx = lower_bound(p, p + n, a) - p;
        if (a <= n - idx) {
            cout << a << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3164
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();

    vvl dp(n+1, vl(m+1));  // dp[i][j] : sのi文字目までとtのj文字目までのLCSの長さ
    rep(i, n) {
        rep(j, m) {
            if(s[i] == t[j]) {
                chmax(dp[i+1][j+1], dp[i][j] + 1);
            }
            else {
                chmax(dp[i+1][j+1], max(dp[i+1][j], dp[i][j+1]));
            }
        }
    }

    string ans = "";
    ll i = n-1, j = m-1;
    while(i >= 0 && j >= 0) {
        if(dp[i+1][j+1] == dp[i][j+1]) {
            i--;
        }
        else if(dp[i+1][j+1] == dp[i+1][j]) {
            j--;
        }
        else if(dp[i+1][j+1] == dp[i][j] + 1) {
            ans = s[i] + ans;
            i--;  j--;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 74164
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>

//#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

int main() {
  string s;
  cin >> s;
  bool flag = true;

  if((s.at(0)-'0') > 2) flag = false;
  if((s.at(1)-'0') > 0) flag = false;
  if((s.at(2)-'0') > 1) flag = false;
  if((s.at(3)-'0') > 9) flag = false;
  if((s.at(3)-'0') == 9){
    if((s.at(5)-'0') > 0) flag = false;
    if((s.at(6)-'0') > 4) flag = false;
  }

  if(flag){
      cout << "Heisei" << endl;
  } else {
      cout << "TBD" << endl;
  }


}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    
    static int gcd(int a, int b){
        if (b == 0){
            return a;
        }
        return gcd(b, a % b);
    }
    
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int n = gcd(a, b);
        System.out.println(n);
    }
}


Measured memory_bytes: 26324
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

#define MAX 1010

int main(){
  char buff[100];
  while(fgets(buff,sizeof(buff),stdin)){
    stack<double> st;
    for(char *p = buff; *p; p++) if(*p == '\n') *p = '\0';
    for(char *p = buff; *p; p++){
      if(*p == '+'){
	double op1,op2;
	op1 = st.top(); st.pop();
	op2 = st.top(); st.pop();
	st.push(op1 + op2);
      }else if(*p == '-' && (*(p+1) < '0' || *(p+1) > '9')){
	double op1,op2;
	op2 = st.top(); st.pop();
	op1 = st.top(); st.pop();
	st.push(op1 - op2);
      }else if(*p == '*'){
	double op1,op2;
	op1 = st.top(); st.pop();
	op2 = st.top(); st.pop();
	st.push(op1 * op2);
      }else if(*p == '/'){
	double op1,op2;
	op2 = st.top(); st.pop();
	op1 = st.top(); st.pop();
	st.push(op1 / op2);
      }else if(*p == ' '){
      }else{
	double op;
	sscanf(p, "%lf", &op);
	st.push(op);
	while((*p >= '0' && *p <='9') || (*p == '.') || (*p == '-')) p++;
      }
    }
    printf("%.6f\n",st.top());
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i,c,l,r,d;
 c=0;
 cin >> l >> r >> d;
 for(i=l;i<=r;i++)
 {
  if(i%d==0)
  c++;
 }
 cout << c;
 return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll A, B; cin >> A >> B;

  cout << (A <= 8 && B <= 8 ? "Yay!" : ":(") << endl;
  return 0;
}

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

using namespace std;

int main() {
  int n, tr;
  bool check = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> tr;
    if (tr % 2 == 0 && tr % 5 != 0 && tr % 3 != 0) {
      check = 0;
    }
  }
  if (check) {
    cout << "APPROVED\n";
  }
  else {
    cout << "DENIED\n";
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
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;
}

int main()
{
  double a, b;
  int h, m;
  cin >> a >> b >> h >> m;
  double deg = abs(360 * m / 60 - (360 * h / 12 + 0.5 * m));
  double ans = sqrt(a * a + b * b - 2 * a * b * cos(deg * M_PI / 180));
  cout << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 4100
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, x;
    cin >> n >> x;
    vi l(n);
    rep(i, n) cin >> l[i];
    int now = 0;
    int cnt = 1;
    rep(i, n) {
        now += l[i];
        if (now <= x) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

use rand::{thread_rng, Rng};
use std::cmp::Reverse;

fn calc(v: &Vec<Vec<isize>>, plan: &Vec<usize>, c: &Vec<isize>) -> isize {
    let mut last = vec![0; 26];
    let mut res = 0_isize;
    for (i, &x) in plan.iter().enumerate() {
        res += v[i][x];
        last[x] = i as isize + 1;
        for (j, &y) in last.iter().enumerate() {
            res -= c[j] * (i as isize + 1 - y);
        }
    }

    res
}

fn main() {
    input! {
        d:usize,
        c:[isize;26]
    }
    let mut plan = vec![0; d];
    let mut v = vec![];
    for p in 0..d {
        input! {
            buf:[isize;26]
        }
        let mut max = 0;
        let mut max_idx = 0;
        for i in 0..buf.len() {
            if max < buf[i] {
                max = buf[i];
                max_idx = i;
            }
        }
        plan[p] = max_idx;
        v.push(buf);
    }
    let mut rng = rand::thread_rng();
    let mut prev_score = calc(&v, &plan, &c);

    let mut k = 501;

    let mut cc = vec![];
    for i in 0..c.len() {
        cc.push((c[i], i));
    }

    cc.sort_by_key(|k| Reverse(*k));

    for q in 0..300_000 {
        if q % 100 == 0 {
            let idx = rng.gen_range(d / 3, d * 2 / 3);
            let from = plan[idx];
            plan[idx] = cc[rng.gen_range(0, 10)].1;
            let next_score = calc(&v, &plan, &c);
            if next_score > prev_score {
                prev_score = next_score;
            } else {
                plan[idx] = from;
            }
        } else {
            let idx = vec![rng.gen_range(0, d); k];
            let to = vec![rng.gen_range(0, 26); k];
            let mut from = vec![];
            for &i in &idx {
                from.push(plan[i]);
            }
            for i in 0..idx.len() {
                plan[idx[i]] = to[i];
            }
            let next_score = calc(&v, &plan, &c);
            if next_score > prev_score {
                prev_score = next_score;
            } else {
                for i in 0..idx.len() {
                    plan[idx[i]] = from[i];
                }
            }
            if k > 1 && q % 150 == 0 {
                k -= 2;
            }
        }
    }
    for i in plan {
        println!("{}", i + 1);
    }
}


Measured memory_bytes: 2988
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

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

void solve(){
  ll h,w,k;
  cin >> h >>w >> k;
  vs a(h);
  vvll d(h,vll(w,inf));
  queue<P> q;
  rep(i,0,h){
   cin >> a[i]; 
    rep(j,0,w) if(a[i][j]=='S'){
     d[i][j]=0;
     q.push(P(i,j));
    }
  }
  
  while(q.size()){
   P p=q.front();
    q.pop();
    rep(i,0,4){
     ll x=p.fi+dx[i],y=p.se+dy[i];
     if(x<0||y<0||x>=h||y>=w) continue;
     if(a[x][y]=='#') continue;
     if(d[x][y]!=inf) continue; 
     d[x][y]=d[p.fi][p.se]+1; 
     q.push(P(x,y)); 
    }
  }
    
 rep(i,0,h){
  rep(j,0,w){
   if(d[i][j]<=k){ 
    if(i==0||i==h-1||j==0||j==w-1){ 
     cout << 1 << endl;
     return; 
    }
   }
  }
 }
  
 ll ans=inf;
 rep(i,0,h){
  rep(j,0,w){ 
   if(d[i][j]<=k){ 
   chmin(ans,i);
   chmin(ans,h-1-i);  
   chmin(ans,j);
   chmin(ans,w-1-j);  
   }
  }
 }
  ans=(ans+k-1)/k+1;
  
 cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  


Measured memory_bytes: 6016
N, A, B = map(int, input().split())

def judge_sum(s, A, B):
    s = str(s)
    ans = 0
    for i in range(len(s)):
        ans += int(s[i])
    return A <= ans <= B

li = [i for i in range(1, N+1) if judge_sum(i, A, B)]

print(sum(li))

Measured memory_bytes: 9404
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ALDS1_7_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int[] preOrder = Console.ReadLine()
                                    .Split(' ')
                                    .Select(i => int.Parse(i))
                                    .ToArray();

            int[] inOrder = Console.ReadLine()
                                    .Split(' ')
                                    .Select(i => int.Parse(i))
                                    .ToArray();

            Node root = Node.FormTreeFromOrder(null, preOrder, inOrder);
            StringBuilder stringBuilder = new StringBuilder();
            root.BuildPostOrder(stringBuilder);
            Console.WriteLine(stringBuilder.ToString().Trim(' '));
        }
    }

    class Node
    {
        public int val;
        public Node parent = null;
        public Node left = null;
        public Node right = null;

        public static Node FormTreeFromOrder(Node parent, int[] preOrder, int[] inOrder)
        {
            Node node = new Node();
            node.parent = parent;
            node.val = preOrder[0];

            int[] inOrderLeft = inOrder.TakeWhile(i => i != node.val)
                                       .ToArray();

            int[] inOrderRight = inOrder.SkipWhile(i => i != node.val)
                                        .Skip(1)
                                        .ToArray();

            int[] preOrderLeft = preOrder.Skip(1)
                                         .Take(inOrderLeft.Length)
                                         .ToArray();

            int[] preOrderRight = preOrder.Skip(1)
                                          .Skip(inOrderLeft.Length)
                                          .ToArray();
            if (inOrderLeft.Length > 0)
            {
                node.left = Node.FormTreeFromOrder(node, preOrderLeft, inOrderLeft);
            }

            if (inOrderRight.Length > 0)
            {
                node.right = Node.FormTreeFromOrder(node, preOrderRight, inOrderRight);
            }

            return node;
        }

        public void BuildPostOrder(StringBuilder stringBuilder)
        {
            if (this.left != null)
            {
                this.left.BuildPostOrder(stringBuilder);
            }

            if (this.right != null)
            {
                this.right.BuildPostOrder(stringBuilder);
            }

            stringBuilder.Append(string.Format(" {0}", this.val));
        }
    }
}



Measured memory_bytes: 18540
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
void solve(){
    int n;
    cin>>n;
    int ans = 0;
    for(int a=1;a<=n;a++){
        for(int b=1;;b++){
            if(a*b >= n) break;
            ans++;
        }
    }
    cout<<ans<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}

Measured memory_bytes: 3664
from collections import deque
h, w = map(int, input().split())

maze = [list(input()) for _ in range(h)]
directions = [
    [0, 1],
    [0, -1],
    [1, 0],
    [-1, 0]
]

def bfs(start):

    visited = [[False] * w for _ in range(h)]
    que = deque([start + (0,)])

    max_cnt = -1
    while que:
        y, x, cnt = que.popleft()
        if 0 <= x < w and 0 <= y < h and maze[y][x] == '.' and not visited[y][x]:
            max_cnt = max(cnt, max_cnt)
            visited[y][x] = cnt + 1
            for dy, dx in directions:
                que.append((y + dy, x + dx, visited[y][x]))
    # print("\n".join([" ".join(map(str, v)) for v in visited]))
    return max_cnt

ans = 0
for sx in range(w):
    for sy in range(h):
        ans = max(ans, bfs((sy, sx)))
print(ans)


Measured memory_bytes: 46044
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int  ans=0,i=0,j=n-1;
	while(i<j)
	{
		while(i<j&&s[i]!='W')
		i++;
		while(i<j&&s[j]!='R')
		j--;
		if(i<j)
		ans++,i++,j--;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3700
N=int(input())
#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0 for j in range(3)] for i in range(100010)]

            
def chmax(a,b):
    if a>b:
        return a
    else:
        return b

for i in range(N):
    A,B,C=map(int,input().split())
    S[i+1][0]=A
    S[i+1][1]=B
    S[i+1][2]=C

DP=[[0 for j in range(3)] for i in range(100010)]

DP[0][0]=0
DP[0][1]=0
DP[0][2]=0
DP[1][0]=S[1][0]
DP[1][1]=S[1][1]
DP[1][2]=S[1][2]

if N==1:
    print(max(DP[1]))
    exit()

for k in range(2,N+1):
    for i in range(3):
        for j in range(3):
            if i!=j:
                DP[k][i]=chmax(DP[k-1][j]+S[k][i],DP[k][i])
                DP[k][j]=chmax(DP[k-1][i]+S[k][j],DP[k][j])
print(max(DP[N]))




Measured memory_bytes: 100904
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int ans = 0;
  char c;
  rep(i,4) {
    cin >> c;
    if(c=='+')ans++;
    else ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h> 
int main()
{   
	int a=0;   int b=0;   int c=0;   int d=0;   int e=0;   
	scanf("%d %d %d",&a,&b,&c);   
	for(d=a;d<b+1;d++)
	{     
		if(c%d==0)
		{      
			 e=e+1;     
		}   
	}  
	printf("%d\n",e);
	return 0; 
}

Measured memory_bytes: 596
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val today = sc.next
  val tomorrow = today match {
    case "Sunny" => "Cloudy"
    case "Cloudy" => "Rainy"
    case "Rainy" => "Sunny"
  }
  println(tomorrow)

}


Measured memory_bytes: 25548
#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<string,int>mp;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        mp[s]++;
    }
    cin>>n;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        mp[s]--;
    }
   int ans=0;
   for (auto itr=mp.begin();itr!=mp.end();itr++){
    ans=max(ans,itr->second);
   }
    cout<<ans<<endl;
    return 0;
}




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

int a[100], b[100], c[100], d[100];

int md(int x1, int y1, int x2, int y2) {
	return abs(x1-x2) + abs(y1-y2);
}

int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; i++) scanf("%d%d", &a[i], &b[i]);
	for (int i = 1; i <= M; i++) scanf("%d%d", &c[i], &d[i]);
	for (int i = 1; i <= N; i++) {
		int curmin = 1000000000;
		int curnode = M;
		for (int j = M; j >= 1; j--) {
			if (md(a[i], b[i], c[j], d[j]) <= curmin) {
				curnode = j;
				curmin = md(a[i], b[i], c[j], d[j]);
			}
		}
		printf("%d\n", curnode);
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <string>
#define REP(i, n) for (i = 0; i < (n); i++)
#define REP1(i, n) for (i = 1; i <= (n); i++)
using namespace std;

const int N = 10 +10;
const int OO = 1000000000;

char data[N];

int ans, n;

string a[N], b[N], s, t;

int min(int a, int b) {return a < b ? a : b;}

string red()
{
	scanf("%s", data);
	return data;
}

bool ri()
{
	int i;
	
	ans = OO;
	scanf("%d", &n);
	if (n == 0) return false;
	REP(i, n)
	{
		a[i] = red();
		b[i] = red();
	}
	s = red();
	t = red();
	return true;
}

string change(string v1, int k)
{
	int i;
	
	string res = "";
	
	while (v1.find(a[k]) != string::npos)
	{
		i = v1.find(a[k]);
		res += v1.substr(0, i);
		res += b[k];
		v1 = v1.substr(i + a[k].size(), v1.size());
	}
	return res + v1;
}

void dfs(int deep, string now)
{
	int i;
	
	string naw;
	
	if (deep >= ans) return;
	if (now.size() >= t.size())
	{
		if (now == t) ans = min(ans, deep);
		return;
	}
	REP(i, n)
	{
		naw = change(now, i);
		if (naw != now) dfs(deep + 1, naw);
	}
}

void print()
{
	if (ans == OO) ans = -1;
	printf("%d\n", ans);
}

int main()
{
	while (ri())
	{
		dfs(0, s);
		print();
	}
	return 0;
}

Measured memory_bytes: 1088
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include<iomanip>
#include<limits>
#include <utility>
typedef long long lint;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define INF 1e18

int ans2 = 0;
signed main()
{
	// 
	int r,D,x;
	cin >> r >> D >> x;

	int ans = x;

	for (int i = 0; i < 10; i++) {
		ans = r * ans - D;
		cout << ans << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int search(int A[],int n,int key){
  int i=0;
  A[n]=key;
  while(A[i]!=key)i++;
  return i!=n;
}

int main(){
  int i,n,A[10000+1],q,key,sum=0;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(A,n,key))sum++;
  }
  printf("%d\n",sum);

  return 0;
}

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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

double w,h,x,y;
double ans,num;

int main(){
    cin >> w >> h >> x >> y;

    double mem1,mem2;
    if(w/2.0 == x && h/2.0 == y)    num = 1;

    ans = w*h/2;
    cout << fixed;
    cout << setprecision(10) << ans << ' ' << setprecision(0) << num << endl;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
Q = int(input())
X = [input().split() for _ in range(Q)]


class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
        
    def sum(self, i):
        if i == 0:
            return 0
        
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
    
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


MAX = 5 * 10 ** 5 + 2
d = dict()

for c in range(ord("a"), ord("z") + 1):
    s = chr(c)
    d[s] = BIT(MAX)
    for i, v in enumerate(S):
        if v == s:
            d[s].add(i + 1, 1)


for t, i, c in X:
    if t == "1":
        i = int(i)
        
        if S[i - 1] != c:
            # Delete index
            d[S[i - 1]].add(i, -1)
            
            # Insert index
            d[c].add(i, 1)
            S[i - 1] = c
    else:
        l = int(i)
        r = int(c)
        
        res = 0
        for c in range(ord("a"), ord("z") + 1):
            s = chr(c)
            res += int(d[s].sum(r) - d[s].sum(l - 1) > 0)

        print(res)


Measured memory_bytes: 171036
(defun main ()
  (let ((s (read-line)))
    (loop for c across s
          for i from 1
          do (when (or (and (oddp i) (char= c #\L)) (and (evenp i) (char= c #\R)))
               (format t "No~%")
               (return-from main))))
  (format t "Yes~%"))
(main)

Measured memory_bytes: 14176
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define PB push_back
#define SP << " " <<

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VLL;

__attribute__((constructor))
void initial(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed <<setprecision(15);
}


int main(void){
	ll N, K;
    vector<double> p, X;
    cin >> N >> K;
    rep(i,N){
        double a;
        cin >> a;
        p.PB(a);
        X.PB((a+1)/2);
    }

    double ans = 0;
    double sum = 0;

    rep(i,K){
        sum += X[i];
    }
    ans = sum;

    for(int i = K; i<N; i++){
        sum = sum - X[i-K] + X[i];
        chmax(ans, sum);
        
    }

    cout << ans << endl;


    return 0;
}


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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);



int n;
double x,sum;
string u;

main() {
    cin >> n;
    rep(i,n) {
        cin >> x >> u;
        if (u == "JPY") sum += x;
        else sum += x*380000;
    }
    ct(sum)
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9 + 7;
const int INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
#define REP(i, n) for(int i = 0; i <= n; i++)
#define rrep(i,n) for(int i=n;i>0;i--)
#define RREP(i,n) for(int i=n;i>=0;i--)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    string str;cin>>str;
    string week[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    rep(i,7){
        if(week[i]==str){
            cout<<7-i<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n = 5;
	vector<int> vec(n, 0);
	for(int i = 0; i < n; ++i)cin>>vec[i];
	int t, r;
	r = 0;
	t = 0;
	for(int i = 0; i < n; ++i){
		if(vec[i] % 10 == 0){
			t += vec[i];
		}
		else{
			int x = (10 - (vec[i] % 10));
			r = max(r, x);
			t += vec[i] + x;
		}
	}
	cout<<t - r<<endl;
	return 0;
}


Measured memory_bytes: 256
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
s = ins()
seq = []
strk = 0
for i in range(n):
    if i==0 or s[i-1]==s[i]:
        strk += 1
    else:
        seq.append(strk)
        strk = 1
seq.append(strk)
if len(seq)<=2*k:
    print(n)
    exit()
seq.extend([0]*8)
#ddprint(seq)
if s[0]=='0':
    mx = sm = sum(seq[:2*k])
    sm += seq[2*k]+seq[2*k+1]-seq[0]
    mx = max(mx,sm)
    stt = 1
    end = 2*k+1
else:
    mx = sm = sum(seq[:2*k+1])
    stt = 0
    end = 2*k
while end<len(seq)-4:
    sm += seq[end+1]+seq[end+2]-seq[stt]-seq[stt+1]
    stt += 2
    end += 2
    mx = max(mx,sm)
print(mx)


Measured memory_bytes: 4596
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
l = [
    b - a, c - a, d - a, e - a, c - b, d - b, e - b, d - c, e - c, e - d
]

for i in l:
    if i > k:
        print(":(")
        break
else:
    print("Yay!")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;

//Aのn乗modM
//Aの逆元を取る場合、modpow(A, MOD-2, MOD)で求まる
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

//O(K)でnCkを求める
int comb( int N, int K ){
  int X = 1; //分子
  int Y = 1; //分母
  for( int i = N; i > N-K; i-- ){
    X = (X*i)%MOD;
  }
  for( int i = 1; i <= K; i++ ){
    Y = (Y*i)%MOD;
  }
  return X * modpow(Y, MOD-2, MOD)%MOD;
}

signed main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int ans = modpow(2, N, MOD);
  cout << (ans-1+MOD+MOD- comb(N, A) - comb(N, B))%MOD << endl;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
h = []
for i in range(n):
  hi = int(input())
  h.append(hi)
  
h.sort()

ans = 10**10

for i in range(n-k+1):
  if h[i+k-1] - h[i] < ans:
    ans = h[i+k-1] - h[i]
print(ans)

Measured memory_bytes: 7384
fn read<T: std::str::FromStr>() -> Vec<T> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf.split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect()
}

fn main() {
    let (n, x) = {
        let v: Vec<i64> = read();
        (v[0], v[1])
    };
    let mut a: Vec<i64> = read();
    let mut ans = 0;

    use std::cmp::{max, min};
    for i in 1..n as usize {
        ans += max(a[i - 1] + a[i] - x, 0);
        a[i] = min(a[i], max(x - a[i - 1], 0));
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    b = [0] * 9
    for i in range(n):
        if a[i]<=399:
            b[0] += 1
        elif a[i]<=799:
            b[1] += 1
        elif a[i]<=1199:
            b[2] += 1
        elif a[i]<=1599:
            b[3] += 1
        elif a[i]<=1999:
            b[4] += 1
        elif a[i]<=2399:
            b[5] += 1
        elif a[i]<=2799:
            b[6] += 1
        elif a[i]<=3199:
            b[7] += 1
        else:
            b[8] += 1
    
    cnt = 0
    for i in range(8):
        if b[i] >0:
            cnt+=1

    minc = cnt if cnt>0 else 1

    maxc = cnt + b[8]
    print(minc, maxc)

solve()


Measured memory_bytes: 3064
import sys
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
table = [0]*26
 
letters = "abcdefghijklmnopqrstuvwxyz"
input_str = sys.stdin.read()
 
for A in input_str:
    index = 0
    for B in letters:
        if A == B or A == B.upper():
            table[index] += 1
            break
        index += 1
 
for i in range(len(letters)):
    print("%s : %d"%(letters[i],table[i]))


Measured memory_bytes: 5572
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl M1, D1;
static sl M2, D2;

void solve(void) {
  if (M1 < M2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}

int main(void) {
  cin >> M1 >> D1;
  cin >> M2 >> D2;
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 10;
const int MOD = 1e9 + 7;
ll qpow(ll x, ll k) {
    ll r = 1;
    while(k) {
        if(k & 1) r = r * x % MOD;
        x = x * x % MOD;
        k >>= 1;
    }
    return r;
}

ll d[N];

ll chu(ll x, ll y) {
    return x * qpow(y, MOD-2) % MOD;
}

int main() {
    d[0] = 1;
    for(int i = 1; i < N; i++) {
        d[i] = d[i-1] * i % MOD;
    }
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= k; i++) {
        int need_b = i, need_r = i-1;
        int over_b = k-need_b, over_r = n-k-need_r;
        ll ans = 0;
        // printf("%d %d %d %d\n", need_b, over_b, need_r, over_r);
        if(over_b >= 0 && over_r >= 0) {
            ans = chu(chu(d[over_b + need_b-1], d[over_b]), d[need_b-1]);
            ans *= chu(chu(d[over_r + need_r + 1], d[need_r + 1]), d[over_r]);
            ans %= MOD;
        }
        cout << ans << '\n';
    }
    return 0;   
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;
using ll = long long;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	string s; cin >> s;

	cout << s[0];

	cout << s.size() - 2;

	cout << s[s.size() - 1];

	return 0;

}

Measured memory_bytes: 256
while True:
    a, b = map(int, input().split())
    if(a == 0 and b == 0):
        break
    for i in range(a):
        for j in range(b):
            if(0 < i < a-1 and 0 < j < b-1):
                print(".", end = "")
            else:
                print("#", end = "")
        print()
    print()


Measured memory_bytes: 7000
#include <iostream> 
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#define int long long
using namespace std;

int jousu(int, int);
int jousu(int x, int y) {
	int z = 1;
	for (int i = 0; i < y; i++) {
		z *= x;
	}
	return z;
}
int kurai(int x, int y) {
	int z = (x%jousu(10,y)) / jousu(10, y-1);
	return z;
}
int keta(int x) {
	int z = x;
	int w = 0;
	while (z != 0) {
		z /= 10;
		w++;
	}
	return w;
}
signed main() {
	int n, m, a, c=0;
	string b;
	cin >> n >> m;
	vector<int>vec(n+1,0);
	set<int>pro;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		if (b == "WA") {
			if (!pro.count(a))vec[a]++;
		}
		else {
			pro.insert(a);
		}
	}
	for (int i = 1; i <= n; i++) {
		if (pro.count(i))c += vec[i];
	}
	cout << pro.size() << " " << c << endl;
}

Measured memory_bytes: 5760
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N = int(readline())
    m = map(int,read().split())
    uv = list(zip(m,m))

    # もし全ての頂点が独立していたら(どの頂点同士もつながってないなら)、
    # f(L, R) = R - L + 1
    # となるので、これを全区間足し合わせると
    #        N   N           N   N         N 
    # ans =  Σ   Σ f(L, R) = Σ   Σ R-L+1 = Σ  {1 + 2 + ... + (N-L+1)}
    #       L=1 R=L         L=1 R=L       L=1
    # 
    #       N
    #     = Σ  (N-L+1)(N-L+2)/2
    #      L=1
    # 
    #     = N(N+1)/2 + (N-1)N/2 + (N-2)(N-1)/2 + ... + (1*2)/2
    # 
    #       N
    #     = Σ  i(i+1)/2 = N(N+1)(N+2)/6 (三角錐数)
    #      i=1
    # 

    # ans = N(N+1)(N+2)/6を最大値として、辺が繋がった分だけ引いていく
    ans = N * (N+1) * (N+2) // 6
    for u, v in uv:
        # uの番号が小さくなるようにする
        if v < u:
            swap = u
            u = v
            v = swap
        # uとvがつながったということは、
        #  N   N        
        #  Σ   Σ f(L, R)
        # L=1 R=L
        # 
        # のうち、L=1~u, R=v~N の範囲で、連結成分が1つ減ることになる
        # その分をansから減らす
        sub = u * (N - v + 1)
        # print(sub)
        ans -= sub

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 59244
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int i, number_of_jewelries, answer = 0;
    number_of_jewelries = Integer.parseInt(sc.next());
    int[] value = new int[number_of_jewelries];
    int[] cost = new int[number_of_jewelries];
    for(i = 0; i < number_of_jewelries; i++) {
      value[i] = Integer.parseInt(sc.next());
    }
    for(i = 0; i < number_of_jewelries; i++) {
      cost[i] = Integer.parseInt(sc.next());
    }
    for(i = 0; i < number_of_jewelries; i++) {
      if(value[i] - cost[i] > 0) answer += (value[i] - cost[i]);
    }
    System.out.println(answer);
  }
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s;
    cin >> s;
    
    int ans = 0;
    int num = 0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == 'R')
            num++;
        else
            num = 0;
        ans = max(ans, num);
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3616
from sys import stdin
import sys

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs



def main(inputs):
	s=inputs[0][0]
	if len(s)%2==1:
		print("No")
		sys.exit(0)
	
	ok=True
	for i in range(0, len(s), 2):
		sub=s[i:i+2]
		if sub!="hi":
			ok=False
	if ok:
		print("Yes")
	else:
		print("No")
		
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)
	

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int a[26];
	memset(a,0,sizeof(a));
	for(int i=0;i<s.size();i++)
	{
		a[s[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(a[i]%2)
		{
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if (A <= B && B <= C || B <= A && A <= C) {
    cout << A + B << endl;
  } else if (A <= C && C <= B || C <= A && A <= B) {
    cout << A + C << endl;
  } else if (B <= C && C <= A || C <= B && B <= A) {
    cout << B + C << endl;
  }
}


Measured memory_bytes: 256