akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] str = reader.readLine().split(" ");
		int[] ab = new int[str.length];
		for (int i = 0; i < str.length; i++) {
			ab[i] = Integer.parseInt(str[i]);
		}

		int ans = 0;
		int count = 0;   //////////////
		//		for (int r = 0; r <= ab[3]/ab[0]; r++) {
		//			for (int g = 0; g <= (ab[3] - ab[0] * r)/ab[1]; g++) {
		//				for (int b= 0; b <= (ab[3] - ab[0] * r - ab[1] * g)/ab[2]; b++) {
		//					count++; //////////////////
		//					if (ab[0] * r + ab[1] * g + ab[2] * b == ab[3]) {
		//						ans++;
		//					}
		//				}
		//			}
		//		}

//		outer:
//		for (int r = 0; r <= ab[3]/ab[0]; r++) {
//			boolean flag2 = false;
//				if (ab[0] * r == ab[3]) {
//					ans++;
//					break outer;
//				}
//			for (int g = 0; g <= (ab[3] - ab[0] * r)/ab[1]; g++) {
//				if (ab[0] * r + ab[1] * g == ab[3]) {
//					ans++;
//					flag2 = true;
//					
//				}
//				if (!flag2) {
//					for (int b= 0; b <= (ab[3] - ab[0] * r - ab[1] * g)/ab[2]; b++) {
//						count++; //////////////////
//						if (ab[0] * r + ab[1] * g + ab[2] * b == ab[3]) {
//							ans++;
//						}
//					}
//				}
//			}
//		}
		
		//割った余り
		//for 文の最後を工夫
		//outerを2つ
		//for 文をそもそも2回に減らす
		for (int r = 0; r <= ab[3]/ab[0]; r++) {
			for (int g = 0; g <= (ab[3] - ab[0] * r)/ab[1]; g++) {
				if ((ab[3] - ab[0] * r - ab[1] * g) % ab[2] == 0) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21204
#![allow(warnings)]
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let (N, K) = {
    let tmp: Vec<u64> = read_vec();
    (tmp[0], tmp[1])
  };

  let mut h: Vec<u64> = read_vec();

  h.sort_by(|a, b| a.cmp(b));

  for i in 0..K { h.pop(); }

  println!("{}", h.iter().sum::<u64>());
}

Measured memory_bytes: 13560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

    int n, m;
    int a[100005];
    priority_queue<int> que;
    cin >> n >> m;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        que.push(a[i]);
        
    }
    
    for(int i = 0; i < m; i++) {
        int tmp = que.top();
        tmp /= 2;
        que.pop();
        que.push(tmp);
    }

    ll sum = 0;
    while(!que.empty()) {
        sum += que.top();
        que.pop();
    }

    cout << sum << endl;

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 1148
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include <functional>
#include <queue>
#include <regex>
#include<time.h>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;

#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 Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。


for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}


*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}
*/

/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/

/*実行開始からの経過時間を表すよ。
while (clock() < 1900000) { ; }
*/

/*まだ使えないテクニックのメモだよ。
for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ
*/

/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/

int a[105], b[105];

int main() {
	int n; cin >> n;
	int w[100];

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

	int ans = INF;

	for (int i = 0; i < n; i++) {
		int a = 0;
		for (int j = i; j >= 0; j--) {
			a += w[j];
		}
		int b = 0;
		for (int k = i+1; k < n; k++) {
			b += w[k];
		}

		ans = min(ans, abs(a - b));

	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool isprime(int num)
{
	for(int i=2; i*i<=num; i++){
		if(num%i==0)
		 return false;
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int num;
	cin>>num;
	for(int i=num; ; i++){
		if(isprime(i)){
		 cout<<i;
		 return 0;
	    }
		 
	}
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
const int nmax=40,abmax=10,inf=1e9;
int n,ma,mb;
int a[nmax],b[nmax],c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];

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

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

  for(int i=0;i<=n;i++){
    for(int j=0;j<=nmax*abmax;j++){
      for(int k=0;k<=nmax*abmax;k++)
        dp[i][j][k]=inf;
    }
  }

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

  for(int i=0;i<n;i++){
    for(int j=0;j<=nmax*abmax;j++){
      for(int k=0;k<=nmax*abmax;k++){
        if(dp[i][j][k]==inf) continue;
        dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
        dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
      }
    }
  }
  int ans=inf;

  for(int i=1;i<=nmax*abmax;i++){
    for(int j=1;j<=nmax*abmax;j++){
      if(i*mb==j*ma) ans = min(ans,dp[n][i][j]);
    }
  }

  if(ans==inf) ans = -1;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 25984
while True:
    h, w = map(int, input().split())
    if h == 0 or w == 0:
        exit()
    for y in range(h):
        if y == 0:
            print('#' * w)
            continue
        elif y == h - 1:
            print('#' * w)
            break
        for x in range(w):
            if x == 0:
                print('#', end='')
            elif x == w - 1:
                print('#')
            else:
                print('.', end='')
    print()


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

int main() {
  int n, d;
  cin >> n >> d;
  int x[11][11];
  rep(i, n) rep(j, d) cin >> x[i][j];
  int ans = 0;
  rep(i, n) for (int j = i + 1; j < n; j++) {
    ll dist = 0;
    rep(k, d) dist += abs(x[i][k] - x[j][k]) * abs(x[i][k] - x[j][k]);
    double dbl = sqrt(dist);
    if (int(dbl) == dbl) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
const long double pi= 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        int n,m,i,x,y,z;
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        double ma=c*30.0+d/(2.0);
        double sa=d*6.0;
        double aa;
        if(ma<sa)
             aa=ma-sa;
        else
        {
            aa=sa-ma;
        }
        aa=aa*pi/180.000;
        double ang= cos(aa);
        double ans = a*a+b*b-2*a*b*ang;
        ans=1.0000*sqrt(ans);
        cout<<fixed<<setprecision(18)<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 4212
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    vector<int> mxs{399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 999999};

    auto index = [&](int x) {
        for (int i = 0; i < mxs.size(); ++i) {
            if (x <= mxs[i]) {
                return i;
            }
        }
        return -1;
    };

    int m = mxs.size();
    int n;
    cin >> n;
    vector<int> cnts(m, 0);
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        ++cnts[index(x)];
    }

    int mn = 0, mx = 0;
    if (cnts.back() == 0) {
         for (auto x : cnts) {
            if (x > 0)  {
                ++mn;
            }
         }
         mx = mn;
    } else if (cnts.back() == n) {
        mn = 1;
        // mx = min(m - 1, n);
        mx = n;
    } else {
        for (int i = 0; i < m - 1; ++i) {
            if (cnts[i] > 0) {
                ++mn;
            }
        }
        // mx = min(mn + cnts.back(), m - 1);
        mx = mn + cnts.back();
    }

    cout << mn << " " << mx << '\n';


    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define inc(l,i,r) for (int i=l;i<=r;i++)
#define dec(r,i,l) for (int i=r;i>=l;i--)
#define For(G) inc(0,i,(int)G.size()-1)
#define pb push_back
#define In inline
#define fi first
#define se second
#define mp make_pair
#define It iterator
#define ___ putchar(10);
#define cnt(x) __builtin_popcount(x)
#define show(x) cout << #x << " = " << x << endl;
#define mid ((l+r) >> 1)
#define N 100100
#define P 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

//inline int qpow(int a,int x) { int r = 1;  for (;x;x>>=1, a=1ll*a*a%P) if (x & 1) r = 1ll * r * a % P;  return r; }

int n, f[30];
char s[N];

int main() {
	scanf("%d%s",&n,s);
	inc(0,i,25) f[i] = 1;
	inc(0,i,n-1) ++f[s[i] - 'a'];
	ll ans = 1;
	inc(0,i,25) ans = ans * f[i] % P;
	ans = (ans + P - 1) % P;
	printf("%lld\n",ans);
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		int monthTerm = Integer.parseInt(input());

		int principal = 100000;

		while (monthTerm != 0) {
			principal += principal * 0.05;
			int fraction = principal % 1000;
			if (fraction != 0) {
				principal += 1000 - fraction;
			}
			monthTerm--;
		}

		System.out.println(principal);

	}

	private static String input() {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String input = null;
		try {
			input = br.readLine();
		} catch (IOException e) {
			System.out.println("読み込みに失敗しました");
			e.printStackTrace();
		}
		return input;
	}


}

Measured memory_bytes: 16852
import collections
n = int(input())
a = list(map(int, input().split()))
b = collections.deque()

for i in range(n):
    if i % 2 == 0:
        b.appendleft(a[i])
    else:
        b.append(a[i])
if n % 2 == 0:
    b.reverse()
print(*b)


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

bool isPrime(int x) {
  if(x == 0 || x == 1) return false;
  for(int i = 2; i*i <= x; ++i) {
    if(x % i == 0) return false;
  }
  return true;
}

int main() {
  for(int N, P; cin >> N >> P && (~N|~P);) {
    vector<int> v;
    for(int x = N+1; v.size() < P; ++x) {
      if(isPrime(x)) v.push_back(x);
    }
    vector<int> u;
    for(int i = 0; i < v.size(); ++i) {
      for(int j = i; j < v.size(); ++j) {
        u.push_back(v[i] + v[j]);
      }
    }
    sort(u.begin(), u.end());
    cout << u[P-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	bool ok=1;
	for(int i=0;i<n;i++){
		if(a[i]%2==0){
			if(a[i]%3!=0&&a[i]%5!=0)ok=0;
		}
	}
	if(ok){
		cout << "APPROVED" << endl;
	}
	else{
		cout << "DENIED" << endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;//list用
using System.Text;//StringBuilder用
using System.Collections;
using System.Linq;
class Program
{
    static List<int> s=new List<int>();
      static List<int> t=new List<int>();
    static decimal result;
  static int N,K,M;
static string a;
    static void Main()
    {
Read2();
      for(int i=0;i<a.Length;i++){if(a[i]=='x'){result++;}}
      
   if(result<8){Console.WriteLine("YES");}else{Console.WriteLine("NO");}

      
    }

    static void Read1()
    {
        string tmp = Console.ReadLine();
        N = int.Parse(tmp);
    }

    static void Read2()
    {
      a=Console.ReadLine();
}
}

Measured memory_bytes: 11348
use std::fmt::{Debug, Display};
use std::io::{self, Read};
use std::str::{self, FromStr};


fn solve(n: String) -> String {
    let l = n.as_bytes()[0];
    let r = n.as_bytes()[2];
    if l == r {
        format!("Yes")
    } else {
        format!("No")
    }
}


fn main() {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock().bytes());
    println!("{}", solve(sc.next()));
}


struct Scanner<R: Read> {
    buf: Vec<u8>,
    bytes: io::Bytes<R>,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(bytes: io::Bytes<R>) -> Self {
        Scanner {
            buf: Vec::with_capacity(256),
            bytes: bytes,
        }
    }

    fn next<T: FromStr>(&mut self) -> T
    where
        <T as FromStr>::Err: Debug,
    {
        self.buf.clear();
        for c in self.bytes
            .by_ref()
            .map(|c| c.unwrap())
            .skip_while(|&c| c == ' ' as u8 || c == '\n' as u8)
            .take_while(|&c| !(c == ' ' as u8 || c == '\n' as u8))
        {
            self.buf.push(c);
        }
        str::from_utf8(&self.buf).unwrap().parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<A: FromStr, B: FromStr>(&mut self, n: usize) -> Vec<(A, B)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<A: FromStr, B: FromStr, C: FromStr>(&mut self, n: usize) -> Vec<(A, B, C)>
    where
        <A as FromStr>::Err: Debug,
        <B as FromStr>::Err: Debug,
        <C as FromStr>::Err: Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        <T as FromStr>::Err: Debug,
    {
        (0..n).map(|_| self.vec(m)).collect()
    }
}


#[allow(dead_code)]
fn print_foreach<T: Display>(answer: &[T]) {
    for x in answer {
        println!("{}", x);
    }
}


#[allow(dead_code)]
fn print_yn(answer: bool, yes: &str, no: &str) {
    println!("{}", if answer { yes } else { no });
}


#[allow(dead_code)]
fn print_or<T: Display>(answer: &Option<T>, or: &T) {
    match *answer {
        Some(ref x) => println!("{}", x),
        None => println!("{}", or),
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>
using ll = long long;
int main() {
	int N, T, prev = 0, t;
	ll sum = 0;
	scanf("%d %d", &N, &T);
	for (int i = 0; i < N; i++) {
		scanf("%d", &t);
		sum += std::min(T, t - prev);
		prev = t;
	}
	sum += T;
	printf("%lld\n", sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e18;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    ll N, M;
    cin >> N >> M;
    ll A[N];
    rep(i, N) cin >> A[i];
    sort(A, A+N, greater<ll>());
    ll l = 2, r = 2e5;
    while(l < r){
        ll n = (l+r+1)/2, pos = 0, cnt = 0;
        rep3(i, N-1, 0){
            while(pos < N && A[i] + A[pos] >= n) pos++;
            cnt += pos;
        }
        if(cnt < M) r = n-1;
        else l = n;
    }
    ll pos = 0, cnt = 0, ans = 0;
    ll sum[N];
    sum[0] = 0;
    rep2(i, 1, N) sum[i] = sum[i-1]+A[i-1];
    rep3(i, N-1, 0){
        while(pos < N && A[i] + A[pos] >= l) pos++;
        cnt += pos;
        ans += A[i]*pos+sum[pos];
    }
    ans -= l*(cnt-M);
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<map>
#include<cstdio>
#include<fstream>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)

#define mp make_pair
#define P pair<int,int>
#define ll __int64
int n,k;
int t[111111];
int cnt[111111];
int dp[111111];
int kouho[111111];

int main(){

	while(cin>>n>>k,n||k){
	rep(i,110000)t[i]=cnt[i]=dp[i]=kouho[i]=0;
	rep(i,k)cin>>t[i];
	rep(i,k)cnt[t[i]]=1;
	
	int now=0,pos=0;

	for(int i=1;i<=n;i++){

		if(cnt[i]==1){
			now++;
			dp[i]=now;
		}

		else if(cnt[i]==0){
			now=0;
			kouho[pos++]=i;
		}
	}
	
	for(int i=n-1;i>=0;i--){
		if(dp[i]==0)now=0;

		if(now!=0)dp[i]=now;
		else if(dp[i]!=0){
			now=dp[i];
		}

	}
	int ans=0;

	if(cnt[0]==0){
		rep(i,n)ans=max(ans,dp[i]);
	}
	else{
		int x;
		for(int i=0;i<pos;i++){
			x=kouho[i];
			
			ans=max(ans,dp[x-1]+dp[x+1]+1);
		}
		//cout<<endl;
	}
	//rep(i,n+1)cout<<dp[i]<<" ";cout<<endl;
	cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
int n, m;
char mat[21][21];
bool in_range(int i, int j)
{
	if(i >=0 && j>=0 && i<n && j<m)
		return true;
	return false;
}
int bfs(int startX, int startY)
{
	queue<pair<int,int> > q;
	queue<int> step;
	q.push(make_pair(startX,startY));
	step.push(0);
	bool vis[n][m];
	memset(vis,false,sizeof(vis));
	vis[startX][startY] = true;
	int dx[4] = {1,0,-1,0};
	int dy[4] = {0,1,0,-1};
	int max_step = -1;
	while(!q.empty()){
		pair<int,int> at = q.front(); q.pop();
		int steps_taken = step.front(); step.pop();
		max_step = max(max_step,steps_taken);
		for(int dir = 0; dir<4;dir++)
		{
			int x = at.first + dx[dir], y = at.second + dy[dir];
			if(in_range(x,y) == true && mat[x][y]=='.' && vis[x][y]==false)
			{
				q.push(make_pair(x,y));
				vis[x][y] = true;
				step.push(steps_taken+1);
			}
		}
	}
	return max_step;
}
int main()
{
	cin>>n>>m;
	for(int i = 0;i<n;i++)
		for(int j =0;j<m;j++)
			cin>>mat[i][j];
			
	int best = -1;
	for(int i=0;i<n;i++){
		for(int j =0;j<m;j++){
			if(mat[i][j]!='.')
				continue;
			else
			{
				int rez = bfs(i,j);
				best = max(best,rez);
			}		
		}
	}
	cout<<best<<endl;
	return 0;
}

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

int main() {
  while (true) {
    int n,x; cin >> n >> x;
    if (n == 0 && x == 0) break;
    int count =0;
    for (int i =1; i<=n; i++) {
      for (int j =i+1; j<=n; j++) {
        if(x - i - j > j && x - i - j <= n) count++;
      }
    }
    cout << count << endl;
  }
}



Measured memory_bytes: 3048
#define _USE_MA_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

int f(int a){
    int ans=0;
    rep(i,42){
        int s=(a+1)/(1ll<<(i+1));
        int t=s*(1ll<<i);
        int u=(a+1)%(1ll<<(i+1));
        int v=u-(1ll<<i);
        if(a<(1ll<<i)||!u||v<0)v=0;
        // cout<<i<<" "<<s<<" "<<t<<" "<<u<<" "<<v<<endl;
        ans|=((t+v)%2)<<i;
    }
    // cout<<ans<<endl;
    return ans;
}

void run(){
    int a,b;
    cin>>a>>b;
    cout<<(f(a-1)^f(b))<<endl;;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  long long zero=0;
  cin >> a >> b >> c;
  long long ans=max(zero,a-c);
  long long amari=max(zero,c-a);
  long long ans2=max(zero,b-amari);
  cout << ans << " " << ans2;
  return(0);
}

Measured memory_bytes: 256
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
//const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;
ll a[4], n, m, x, y, N;
ll b[4];
int main(){
	IOS;
	cin >> n >> m >> N;
	cin >> x >> y;
	str s1, s2;
	cin >> s1 >> s2;
	b[0] = y;
	b[1] = m - y + 1;
	b[2] = x;
	b[3] = n - x + 1;
//	for (int i = 0; i < 4; i++){
//		cout << b[i] << '\n';
 //	}
 	//cout << "JOON\n";
	for (int i = 0; i < s1.size(); i++){
		if (s1[i] == 'L'){
			a[0] ++;
		}
		//cout << s1[i] << '\n';
		else if (s1[i] == 'R') a[1] ++;
		else if (s1[i] == 'U') a[2] ++;
		else if (s1[i] == 'D') a[3] ++;
		//cout << s1[i] << '\n';
		for (int j = 0; j < 4; j++){
			if (a[j] >= b[j]) kill("NO");
		}if (s2[i] == 'R'){
			a[0] --;
		}
		if (s2[i] == 'L') a[1] --;
		if (s2[i] == 'D') a[2] --;
		if (s2[i] == 'U') a[3] --;
		a[0] = max(a[0], -b[1] + 1);
		a[1] = max(a[1], -b[0] + 1);
		a[2] = max(a[2], -b[3] + 1);
		a[3] = max(a[3], -b[2] + 1);
		
		//cout << a[1] << '\n';
 	//	cout << "JOON\n";
		
	}

	cout << "YES";
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




Measured memory_bytes: 920
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<bitset>
using namespace std;
int n,a;
long long sum(0);
bitset<4000010>s;
int main()
{
	cin>>n;
	s.reset();
	s[0]=1;
	for(int i=1;i<=n;++i)
	{
		cin>>a;
		s|=s<<a;
		sum+=a;
	}
	int i;
	for(i=(sum+1)/2;;++i)
	 if(s[i]==1)break;
	cout<<i;
	return 0;
}

Measured memory_bytes: 1792
S = gets.chomp.chars
ans = 0
(0...(1 << (S.length - 1))).each do |i|
  ops = sprintf("%0#{S.length-1}b", i).chars.map{|c| c == '1' ? '+' : ''} + ['']
  prog = S.zip(ops).flatten.join
  ans += eval(prog)
end
p ans


Measured memory_bytes: 1916
n=int(input())
s=input()
r,g,b=[],[],[]
for i in range(n):
    if s[i]=="R":
        r.append(i)
    elif s[i]=="G":
        g.append(i)
    else:
        b.append(i)
b=set(b)
lb=len(b)
ans=0
for i in r:
    for j in g:
        x,y=min(i,j),max(i,j)
        ans_=lb
        if x-(y-x) in b:
            ans_-=1
        if y+(y-x) in b:
            ans_-=1
        if (x%2==y%2) and (y-x)//2+x in b:
            ans_-=1
        ans+=ans_
print(ans)


Measured memory_bytes: 9236
import sys

N = int(input())

if N // 100 == 7:
    print("Yes")
    sys.exit()
N = N % 100


if N // 10 == 7:
    print("Yes")
    sys.exit()

N = N % 10
if N == 7:
    print("Yes")
    sys.exit()

print("No")


Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {
	public static Scanner sc;
	
	public static void main(String[] args) {
		int a=0;
		int b=0;
		//System.out.println("Please input a and b below");
		sc = new Scanner(System.in);
		a=sc.nextInt();
		b=sc.nextInt();
		
		if(a<b) {
			System.out.println("a < b");
		}else if(a>b) {
			System.out.println("a > b");
		}else {
			System.out.println("a == b");
		}
		
	}
}



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

int main(){
    string S;
    cin >> S;
    int l = S.size();

    long long mod[2019] = {0};
    mod[0] ++;
    long long tmp = 0;
    long long n = 1;
    long long ans = 0;

    for(long long i = 0; i < l;i++){
        long long add = S[l - i - 1] - '0';
        tmp += add * n % 2019;
        mod[tmp % 2019] ++;
        n = n * 10 % 2019;
    };

    for (int i = 0;i < 2019;i++){
        ans += (mod[i] * (mod[i] - 1 ) / 2);
    };

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  rep(x, 100000) {
    if (x * 108 / 100 == n) {
      cout << x << endl;
      return;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 256
from math import sin,cos,sqrt,pi
a,b,C=map(float,raw_input().split(" "))
C*=pi/180

c=sqrt(a**2+b**2-2*a*b*cos(C))

L=a+b+c

S=0.5*a*b*sin(C)

h=2*S/a

print S
print L
print h

Measured memory_bytes: 6712
#include <bits/stdc++.h>
#include <math.h>
#include <sstream>
#include <deque>
#include <string>
#include<map>
#include <cctype>
#include <cstring>
#include <cstdio>
const int M = 1e9 + 7;
#define start  int t;cin>>t;while(t--)
#define ll long long int
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define pb(x) push_back(x)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

//insta  -------  __ansh7
//MSDIAN




int main()
{
   fastio
     string s;
  cin>>s;
  
  ll count1=0;

  if(count(s.begin(),s.end(),'R')==0)
  {
     cout<<"0"<<"\n";
  }

  else
  {
  
  for(ll i=0;i<s.length()-1;i++)

  {
    if(s[i]=='R' && s[i+1]=='R')
    {
       count1++;
    }

  }


  cout<<count1+1<<"\n";
  

  }

 
   
    return 0;


}

//sk mc

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int x;
	cin >> x;
	if (x < 1200)
		cout << "ABC" << endl;
	else
		cout << "ARC" << endl;
	return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#define INF 1000000000
void matrixChainMultiplication(int *);
int min(int,int);
int n;
int min(int a,int b){
    if(a>b){
        return b;
    }
    else{
        return a;
    }
}
void matrixChainOrder(int p[]){
    int i,j,k,l,q;
    int m[1000][1000];
    for(i=1;i<=n;i++){
        m[i][i]=0;
    }
    for(l=2;l<=n;l++){
        for (i=1;i<=n-l+1;i++){
            j=i+l-1;
            m[i][j]=INF;
            for(k=i;k<=j-1;k++){
            q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
            m[i][j]=min(m[i][j],q);
            }
        }
    }
    printf("%d\n",m[1][n]);
}   
int main(){
    int i;
    int A[1000];
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d %d",&A[i-1],&A[i]);
    }
    matrixChainOrder(A);
    return 0;
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    bool ok = false;
    rep(i,1,10){
        rep(j,1,10){
            if(i*j == n) ok = true;
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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



int main() {
	int n, a, b;
	cin >> n;
	cin >> a;
	cin >> b;
	if (n * a >= b) {
		cout << b;
	}
	else {
		cout << n*a;
	}
}










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

#define i64 long long int
#define ran 202202

int n, D, A;
pair<int, int> a[ran];
i64 d[ran];

int main() {
	scanf("%d%d%d", &n, &D, &A);
	D*=2;
	for(int i=0;i<n;i++) {
		int x, h;
		scanf("%d%d", &x, &h);
		a[i] = make_pair(x, (h-1)/A+1);
	}
	sort(a, a+n);
	
	i64 done = 0LL, ans = 0LL;
	int it = 0;
	for(int i=0;i<n;i++){
		while(a[i].first - a[it].first > D) {
			done -= d[it];
			it ++;
		}
		
		i64 det = max(0LL, 1LL*a[i].second-done);
		done += det;
		d[i] = det;
		ans += det;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3328
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use proconio::marker::{Bytes, Chars};
use std::collections::*;

fn main() {
    input! {
        n:usize,
        a:[usize;n+1],
    }
    let a = a.iter().map(|&x| x - 1).collect::<Vec<_>>();
    let mut count = vec![0; n];
    for &x in a.iter() {
        count[x] += 1;
    }
    let duplicate = (0..n).find(|&x| count[x] == 2).unwrap();
    let dupls = (0..(n + 1))
        .filter(|&x| a[x] == duplicate)
        .collect::<Vec<_>>();
    let modulo = 1e9 as i64 + 7;
    let comb = CombinationMod::new(n + 1, modulo);
    let n = n as i64;
    let first = dupls[0] as i64;
    let last = n - dupls[1] as i64;
    for i in 1..=(n + 1) {
        let a = if i <= n - 1 { comb.query(n - 1, i) } else { 0 };
        let b = if i - 1 <= n - 1 {
            comb.query(n - 1, i - 1)
        } else {
            0
        };
        let c = b;
        let e = if i - 1 <= first + last {
            comb.query(first + last, i - 1)
        } else {
            0
        };
        let d = (b + c + modulo - e) % modulo;
        let f = if i >= 2 { comb.query(n - 1, i - 2) } else { 0 };
        let ans = (a + d + f) % modulo;
        println!("{}", ans);
    }
}

struct CombinationMod {
    fac: Vec<i64>,
    inv: Vec<i64>,
    inv_fac: Vec<i64>,
    modulo: i64,
}
impl CombinationMod {
    pub fn new(size: usize, modulo: i64) -> CombinationMod {
        let mut fac = vec![1; size + 1];
        let mut inv = vec![1; size + 1];
        let mut inv_fac = vec![1; size + 1];
        for i in 2..=size {
            fac[i] = fac[i - 1] * i as i64 % modulo;
            inv[i] = modulo - inv[modulo as usize % i] * (modulo / i as i64) % modulo;
            inv_fac[i] = inv_fac[i - 1] * inv[i] % modulo;
        }
        CombinationMod {
            fac: fac,
            inv: inv,
            inv_fac: inv_fac,
            modulo: modulo,
        }
    }
    fn query(&self, n: i64, r: i64) -> i64 {
        self.fac[n as usize] * self.inv_fac[r as usize] % self.modulo
            * self.inv_fac[(n - r) as usize]
            % self.modulo
    }
    fn inverse(&self, n: i64) -> i64 {
        self.inv[n as usize]
    }
}

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

int main(){
    int n; cin >> n; 
    int e = 0;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a %2 == 0) e++;  
    }
    cout << pow(3,n) - pow(2,e) << endl;
    return 0;
}

Measured memory_bytes: 256
a(char *p){return((*p>'`')&&(*p<'{'));}
char b[82];
c(char *p,int d){return ((26+*p-*(p+1))%26==d);}
d(int s){char *p=b-1;while (*++p){if(a(p)){*p+=s;if((unsigned char)*p>'z')*p-=2\
6;else if(*p<'a')*p+=26;}}}
main(s){while(gets(b)){char *p=b-1;s=0;while(*++p){if((c(p,12))&&((c(p+1,3)&&!a\
(p+3))||(c(p+1,7)&&c(p+2,7)&&!a(p+4))||(c(p+1,25)&&c(p+2,16)&&!a(p+4)))){s='t'-\
*p;p+=3;break;}else for(;a(p);p++);}d(s);printf("%s\n",b);}}

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF             2e9
#define INF_LL          1LL<<60
#define ll              long long
#define Ceil(x, n)      (((((x))+((n)-1))/n))
#define CeilN(x, n)     (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)    ((x)-(x)%(n))
#define ALL(x)          (x).begin(),(x).end()

int main(){
    int n, m, d;
    cin >> n >> m >> d;
    int tmp;
    if(d == 0) tmp = 1;
    else tmp = 2;
    printf("%.10f\n", (double)(n-d)*tmp*(double)(m-1)/(double)n/(double)n);
    return 0;
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
}

// Driver Function
int main()
{
    ll compte = 1;
   // test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3532
#include<stdio.h>
int main()
{
    int a,b,c,d,turn = 0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    while(1)
    {
        turn++;
        if(turn%2!=0) //odd-taka attacks
            c = c-b;
        else //even - ako attacks
            a = a-d;
        if(a<=0 || c<=0)
            break;
    }
    if(a>=c)puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 1660
import sys

lines = sys.stdin.read().splitlines()
numbers = [int(v) for v in lines[1].split(" ")]
count = 0
while True:
  if all(v % 2 == 0 for v in numbers):
    count += 1
    numbers = [v / 2 for v in numbers]
  else:
    break
print(count)


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

int main(){
    string a, b, ans;
    cin >> a >> b;
    
    ans = "NO";
    
    if (a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) {
        ans = "YES";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define gcd __gcd
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
#define pr(n) printf("%d",n)
#define out(n) printf("%d\n",n)
#define llin(a) cin >> a
#define llpr(a) cout << a << " "
#define llout(a) cout << a << endl
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
#define DEBUG(x) cout << #x << " : " << x << endl;
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define all(vec) vec.begin(),vec.end()
#define asc(vec) sort(vec.begin(),vec.end())
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define M 1000000007
#define N 200005
typedef long long int ll;
int bit[N];
void update(int j,int x)
{
    for(;j<N;j+=j&(-j))
        bit[j]+=x;
}
int query(int j)
{
    int x=0;
    for(;j>0;j-=(j)&(-j))
        x+=bit[j];
    return x;
}
int main()
{
    int n,k,i,p,ans,f;
    in2(n,k);
    vi v(n);
    rep(i,n)
        in(v[i]),v[i]++;
    vi ar(n);
    ar[0]=1;
    lp(i,1,n)
    {
        if(v[i]>v[i-1])
            ar[i]=ar[i-1]+1;
        else
            ar[i]=1;
    }
    rep(i,k)
        update(v[i],1);
    p=0,ans=1;
    if(ar[k-1]==k)
        p=1;
    for(i=0;i<n-k;i++)
    {
        f=0;
        if(query(v[i])==1)
            f++;
        update(v[i],-1);
        update(v[i+k],1);
        if(query(v[i+k])==k)
            f++;
        if(f<2)
        {
            if(ar[i+k]<k)
                ans++;
            else if(p==0)
                ans++,p=1;
        }
    }
    out(ans);
}
// read the constraint properly (ll vs int)


Measured memory_bytes: 2688
#include <iostream>
#include <cmath>
typedef long long ll;
using namespace std;

int main(void) {
    ll N,K;
    cin>>N>>K;
    if (N >= K) {
       N = N % K;
    }
    while (true) {
        ll N_tmp = abs(N - K);
        if (N_tmp > N) {
            cout << N << endl;
            return 0;
        }
        N = N_tmp;
    }
    return 0;
}

Measured memory_bytes: 256
isOperator str = str=="+" || str=="-" || str=="*" || str=="/"

operatorCalc :: Int -> Int -> String -> Int
operatorCalc a b op | op=="+"   = a+b
                    | op=="-"   = a-b
                    | op=="*"   = a*b
                    | otherwise = 0


reversePolishNotation::[String]->[String]
reversePolishNotation (a:[])       = [a]
reversePolishNotation (a:b:[])     = [a,b]
reversePolishNotation (a:b:c:expr) = if ( isOperator c && not (isOperator b) && not (isOperator a))
                                        then reversePolishNotation( [show(operatorCalc (read a) (read b) c)] ++ expr)
                                        else if isOperator b
                                            then a:b:c:expr
                                            else reversePolishNotation( a:reversePolishNotation (b:c:expr))

main = do{
    getLine>>=putStrLn.head.reversePolishNotation.words;
}

Measured memory_bytes: 4072
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll f(ll n,ll k)
{
    return (1+(n-k)*k)%mod;
}
int main()
{
    ll n,k;
    cin>>n>>k;
    n++;
    ll res=0;
    for(int i=k;i<=n;i++)
    {
        res=(res+f(n,i))%mod;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 3632
import networkx as nx

def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

mod = 1000000007

n, k = map(int, input().split())
graph = nx.Graph()
graph.add_nodes_from(range(n))
for _ in range(n-1):
    a, b = map(lambda x : int(x) - 1, input().split())
    graph.add_edge(a, b)
if nx.degree(graph)[0] + 1 > k:
    print(0)
    quit()

fac, inv = factorial(k, mod)
ans = fac[k] * inv[k - nx.degree(graph)[0] - 1] % mod # nx.degree(graph)[0]:グラフの頂点0から出ている枝の数
for parent, child in nx.dfs_edges(graph, 0): # nx.dfs_edges(graph, 0):グラフの頂点0からDFS
    m = nx.degree(graph)[child]
    if m + 1 > k:
        print(0)
        quit()
    ans = ans * fac[k-2] % mod * inv[k-1-m] % mod
print(ans)


Measured memory_bytes: 163720
/*input
11 5 9

*/ 
#include <iostream>
#include <bits/stdc++.h>
#include <math.h> 
    
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define gc getchar_unlocked
#define fo(i,n) for(ll i=0;i<n;i++)
#define Fo(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define ms(a,x) memset(a, x, sizeof(a));
#define endl "\n"
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp); 
void ipgraph(int m);
//void dfs(int u, int par);
const int mod = 1000000007;
const int N = 1000000001;
const int MAX = 1e5+1;


int32_t main() {
    IOS;
	int a,b,n;cin>>a>>b>>n;
	if(b>n){
		int i = n;
		cout<<floor((a*i/b))-a*floor(i/b)<<endl;
	}
	else{
		int i = b-1;
		cout<<floor((a*i/b))-a*floor(i/b)<<endl;
	}
	// for(int i=1;i<=n;i++){
	// 	cout<<i<<" "<<floor((a*i/b))-a*floor(i/b)<<endl;
	// }
	return 0;
}






Measured memory_bytes: 3800
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n,res=0;
  cin>>n;
  string ans="Yes";
  while(n--){
    int a,b;
    cin>>a>>b;
    if(a==b){
      res++;
    }else{
      if(res==3){
        break;
      }else{
        res=0;
      }
    }
  }
    
    if(res<3){
 		ans="No";
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  int x = n % 10;
  cin >> x;
  
  if(x == 3){
    cout << "bon" << endl;
  }else if(x == 0 || x == 1 || x == 6 || x == 8){
    cout << "pon" << endl;
  }else{
    cout << "hon" << endl;
  }
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <algorithm>
#include<math.h>
using namespace std;
long long int a[1002]={};
int main(){
  int n;
  cin >> n;
  for(int i=2;i<=n;i++){
    int tmp=i;
    for(int j=2;j<=n;j++){
      if(tmp%j==0){
        while(tmp%j==0){
          a[j]++;
          tmp/=j;
        }
      }
      if(tmp==1) break;
    }
  }
  long long int sum=1;
  for(int i=2;i<=n;i++){
  if(a[i]!=0){
    sum=sum*(a[i]+1)%1000000007;
  }
  if(sum==0) break;
}
cout << sum<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }     //最小公倍数
using Graph = vector<vector<ll>>;
ll inf=300000000000000000;
const double PI = 3.14159265358979323846;
int main(){
  int a,b;
  cin >> a >> b;
  cout << a*b << endl;
}  


Measured memory_bytes: 3636