akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

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

int w, h;
int grand[55][55];
string s[55];
bool flag[55][55];

void dfs(int y, int x){
  if(s[y][x] != '.' || !flag[y][x]) return;
  flag[y][x] = false;
  for(int k=0; k<4; k++){
    if(!CH(x + dx[k],0,w) || !CH(y + dy[k],0,h)) continue;
    if(s[y + dy[k]][x + dx[k]] != '.') continue;
    if(grand[y + dy[k]][x + dx[k]] != 3) grand[y + dy[k]][x + dx[k]] = grand[y][x];
  }
  for(int k=0; k<4; k++){
    if(!CH(x + dx[k],0,w) || !CH(y + dy[k],0,h)) continue;
    if(s[y + dy[k]][x + dx[k]] != '.') continue;
    dfs(y + dy[k], x + dx[k]);
  }
}

int main() {

  while(1){
    cin>>w>>h;
    if(w==0 && h==0) break;
    for(int i=0; i<h; i++){
      cin>>s[i];
    }
    memset(grand, 0, sizeof(grand));

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(s[i][j] == '.'){
          for(int k = 0; k<4; k++){
            if(!CH(j + dx[k],0,w) || !CH(i + dy[k],0,h)) continue;
            int posx = j + dx[k], posy = i + dy[k];
            while(1){
              if(!CH(posx,0,w) || !CH(posy,0,h)){
                break;
              }else if(s[posy][posx] == 'W'){
                int tx = posx - dx[k], ty = posy - dy[k];
                while(1){
                  if(grand[ty][tx] == 0 || grand[ty][tx] == 1) grand[ty][tx] = 1;
                  else grand[ty][tx] = 3;
                  if(tx == j && ty == i ) break;
                  tx -= dx[k];
                  ty -= dy[k];
                }
                break;
              }else if(s[posy][posx] == 'B'){
                int tx = posx - dx[k], ty = posy - dy[k];
                while(1){
                  if(grand[ty][tx] == 0 || grand[ty][tx] == 2) grand[ty][tx] = 2;
                  else grand[ty][tx] = 3;
                  if(tx == j && ty == i ) break;
                  tx -= dx[k];
                  ty -= dy[k];
                }
                break;
              }
              posx += dx[k];
              posy += dy[k];
            }
          }
        }
      }
    }

    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        memset(flag, true, sizeof(flag));
        dfs(i, j);
      }
    }

    int wcnt=0, bcnt=0;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(grand[i][j] == 1) wcnt++;
        if(grand[i][j] == 2) bcnt++;
      }
    }

    cout<<bcnt<<" "<<wcnt<<endl;

  }
  return 0;
}

Measured memory_bytes: 3384
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	
	
//	cout<<"jmd";
ll a,b,c;
    cin>>a>>b>>c;
    ll ans= max(c-a+b, 0LL);
    cout<<ans;
    return 0;
}























Measured memory_bytes: 256
/*input
3 81
33 105 57 
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
#define pb push_back 
ll gcd(ll a,ll b)
{
	if(a==0)
		return b;
	else
		return gcd(b%a,a);
}

int main() {
	ll n,x;
	cin>>n>>x;
	ll a[n+1];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	a[n]=x;
	sort(a,a+n+1);
	ll mn1=a[n]-a[0];
	ll g =  (a[1]-a[0]);
	for(int i=1;i<=n;i++)
	{
		
	g=gcd(a[i]-a[i-1],g);
		
	}
	cout<<g;
return 0;
} 

Measured memory_bytes: 1024
//abc174_c.cpp
//Sat Sep 12 10:35:04 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (k%2==0){
		cout << -1 << endl;
		return 0;
	}

	ll tmp = 7;
	ll ans = 1;
	while(1){
		if (tmp%k!=0){
			tmp = tmp%k;
			tmp = tmp*10+7;
			ans++;
		}else {
			cout << ans << endl;
			return 0;
		}
		if (ans >= 1e7){
			cout << -1 << endl;
			return 0;
		}
	}

}

Measured memory_bytes: 3604
import java.io.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int h=Integer.parseInt(st.nextToken());
int w=Integer.parseInt(st.nextToken());
int[] wf=new int[w];
for(int i=0;i<h;i++){
boolean flag=false;
char[] map=br.readLine().toCharArray();
for(int j=0;j<w;j++){
if(map[j]=='c'){
wf[j]=0;
flag=true;
}
else{
if(!flag) wf[j]=-1;
else wf[j]=wf[j-1]+1;
}
if(j==w-1) out.println(wf[j]);
else out.print(wf[j]+" ");
}
}
out.flush();
}
}
}

Measured memory_bytes: 24956
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll n, a, b;
vector<ll> v;

ll check(ll p){
  vector<ll> v1 = v;
  rep(i,0,v1.sz){
    v1[i] -= b*p;
  }
  rep(i,0,v1.sz){
    if(v1[i]>0){
      ll d = v1[i]/(a-b);
      if(v1[i]%(a-b)!=0)d++;
      p-=d;
    }  
  }
  if(p>=0)return 1;
  return 0;
}

int main() {
  cin >> n >> a >> b;
  rep(i, 0, n) {
    ll a;
    cin >> a;
    v.pb(a);
  }
  long long low = 0;
  long long high = 1000000010LL;

  while (low < high) {
    long long mid = (high + low) >> 1;

    if (check(mid) == 1) {
      high = mid;
    }
    else {
      low = mid + 1;
    }
  }
  cout << low << endl;
  return 0;
}


Measured memory_bytes: 1908
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>

using namespace std;

#define fo(i,n) for(int i=0; i<(int)n; i++)
#define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define pii pair<int,int>

struct point{
	double x,y,z;
	point(double x=0, double y=0,double z=0):x(x),y(y),z(z){}
};

point operator-(const point &a, const point &b) {
	return point(a.x-b.x, a.y-b.y, a.z-b.z);
}

point operator+(const point &a, const point &b) {
	return point(a.x+b.x, a.y+b.y, a.z+b.z);
}

point operator*(const point &a, const double &t) {
	return point(t*a.x, t*a.y, t*a.z);
}

double dot(const point &a, const point &b) {
	return a.x*b.x + a.y*b.y + a.z*b.z;
}

bool intersect(point a, point b, point c, double r) {
	point u = b-a; 
	point p0 = a-c;
	
	double A = dot(u,u);
	double B = 2*dot(u,p0);
	double C = dot(p0,p0) - r*r;
	
	double delta = B*B - 4*A*C;
	
	if (delta<0) return false;
	
	double t1 = (double)(-B + sqrt((double)delta)) / (2.0*A);
	double t2 = (double)(-B - sqrt((double)delta)) / (2.0*A);
	
	point p1 = a + u*t1;
	point p2 = a + u*t2;
	
	//cout<<dot(p1-a,b-a)<<" "<<dot(p2-a,b-a)<<endl;
	
	if (dot(p1-a,b-a) > 1.0e-6 && dot(p1-b,a-b) > 1.0e-6) return true;
	if (dot(p2-a,b-a) > 1.0e-6 && dot(p2-b,a-b) > 1.0e-6) return true;
	
	return false;
}

int N,M,R;
point ballc[2010];
int ballr[2010];
point light[20];
int intensity[20];
point target;

double totalIntensity(int i) {
	point u = (light[i]-target);
	double m = dot(u,u);
	return (double)intensity[i]/m;
}

double ans;
bool bad[2010][20];

int main() {

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

	while (cin>>N>>M>>R && N) {
		for (int i=0; i<N; i++) {
			int x,y,z,r;
			scanf("%d%d%d%d",&x,&y,&z,&r);
			ballc[i] = point(x,y,z);
			ballr[i] = r;
		}
		for (int i=0; i<M; i++) {
			int x,y,z,r;
			scanf("%d%d%d%d",&x,&y,&z,&r);
			light[i] = point(x,y,z);
			intensity[i] = r;
		}
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		target = point(x,y,z);
		
		ans = 0.0;
		
		//cout<<intersect(target,light[1],ballc[7],ballr[7])<<endl;; break;
		
		for (int i=0; i<N; i++) {
			for (int j=0; j<M; j++) {
				bad[i][j] = intersect(target,light[j],ballc[i],ballr[i]);
			}
		}
		
		for (int i=0; i<(1<<M); i++) {
			int tot = 0;
			for (int j=0; j<N; j++) {
				for (int k=0; k<M; k++) if (i&(1<<k)) {
					if (bad[j][k]) {
						tot++;
						break;
					}
				}
			}
			double tmp = 0.0;
			if (tot>R) continue;
			for (int k=0; k<M; k++) if (i&(1<<k)) tmp += totalIntensity(k);
			ans = max(ans,tmp);
		}
		
		printf("%.12lf\n",ans);
	}
	
    return 0;

}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

// 階乗, 逆元テーブル(mod)
const int nMax = 200005;
ll fact[nMax], fact_inv[nMax], inv[nMax];
ll calc_fact() {
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < nMax; i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}

// 組合せ, 二項係数
ll mod_comb(ll n, ll r) {
    if (r < 0 || n < r) return 0;
    return ((fact[n] * fact_inv[r]) % MOD) * fact_inv[n - r] % MOD;
}

int main() {
    int N, M, K;
    cin >> N >> M >> K;

    calc_fact();

    ll sumx = 0, sumy = 0;
    ll comb = mod_comb(N * M - 2, K - 2);

    REP(i, N) sumx = (sumx + i * (N - i) % MOD) % MOD;
    sumx = sumx * M * M % MOD;
    REP(j, M) sumy = (sumy + j * (M - j) % MOD) % MOD;
    sumy = sumy * N * N % MOD;

    ll ans = comb * (sumx + sumy) % MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
def comb(n, k, mod):
    if k == 0:
        return 1
    else:
        x, y = 1, 1
        for i in range(k):
            x = x * (n - i) % mod
            y = y * (k - i) % mod
        c = x * pow(y, mod - 2, mod) % mod
        return c


x, y = map(int, input().split())
mod = 10 ** 9 + 7
n = (x + y) // 3
if not((x + y) % 3 == 0 and n <= x <= 2 * n):
    ans = 0
else:
    k = min(x - n, 2 * n - x)
    ans = comb(n, k, mod)
print(ans)

Measured memory_bytes: 3064
fn input1<T: std::str::FromStr> () -> Result<T, T::Err> {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();
    n.trim().parse()
}

fn pow3 (a: usize) -> usize {
    vec![a; 3].into_iter().fold(1, |a, s| a * s)
}

fn main() {
    let n: usize = input1().unwrap();

    println!("{}", pow3(n));
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main(void){
 int a, b, c;
 cin >> a;
 cin >> b;
 cin >> c;

if (a <= b&&a <= c){
    if(b <=c){
        cout << a;
        cout << " ";
        cout << b;
        cout << " ";
        cout << c;
    }else{
    cout << a;
    cout << " ";
    cout << c;
    cout << " ";
    cout << b;
    }

}else if (b <= a&&b <= c){
    if(a <= c){
        cout << b;
        cout << " ";
        cout << a;
        cout << " ";
        cout << c;
    }else{
    cout << b;
    cout << " ";
    cout << c;
    cout << " ";
    cout << a;
    }

}else if (c <= a&&c <= b){
    if(a <= b){
        cout << c;
        cout << " ";
        cout << a;
        cout << " ";
        cout << b;
    }else{
    cout << c;
    cout << " ";
    cout << b;
    cout << " ";
    cout << a;
    }
}

 cout << endl;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> H;
    vector<vector<int>> path;
    for (int i = 0; i < N; i++){
        int h;
        cin >> h;
        H.push_back(h);
    }
    for(int i = 0; i < N; i++){
        vector<int> v;
        path.push_back(v);
    }
    for (int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        a -= 1;
        b -= 1;
        path.at(a).push_back(b);
        path.at(b).push_back(a);
    }
    int res = 0;
    for (int i = 0; i < N; i++){
        int add = 1;
        for(int p : path.at(i)){
            if (H.at(p) >= H.at(i)) add = 0; 
        }
        res += add;
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 8828
#include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}
int main(void){
  int a[3],i,c=1;
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  qsort(a,3,sizeof(int),compare_int);
  if(a[0]+a[1]==a[2])
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

Measured memory_bytes: 128
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 06/20/20 20:14:02
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename T, T MOD>
class modular {
 private:
  T val_;

 public:
  constexpr modular() : val_(0) {}
  constexpr modular(T v) : val_(v%MOD) {}
  constexpr modular& operator=(T v) { val_ = v%MOD; return *this; }

  constexpr T val() const { return val_; }
  constexpr modular operator+(modular x) const { return (val() + x.val())%MOD; }
  constexpr modular operator+=(modular x) { return *this = *this + x; }
  constexpr modular operator++() { return *this += 1; }
  constexpr modular operator++(int) { modular c = *this; ++(*this); return c; }
  constexpr modular operator-(modular x) const { return (val() + MOD - x.val())%MOD; }
  constexpr modular operator-=(modular x) { return *this = *this - x; }
  constexpr modular operator--() { return *this -= 1; }
  constexpr modular operator--(int) { modular c = *this; --(*this); return c; }
  constexpr modular operator*(modular x) const { return (val() * x.val())%MOD; }
  constexpr modular operator*=(modular x) { return *this = *this * x; }
  friend constexpr modular pow(modular x, T p) {
    modular t = 1;
    modular u = x;
    while (p) {
      if (p & 1)
        t *= u;
      u *= u;
      p >>= 1;
    }
    return t;
  }
  constexpr modular operator/(modular x) const { return *this * pow(modular{x}, MOD-2); }
  constexpr modular operator/=(modular x) { return *this = *this / x; }

  constexpr bool operator==(modular x) const { return val() == x.val(); }
  constexpr bool operator!=(modular x) const { return val() != x.val(); }
  constexpr bool operator<(modular x) const { return val() < x.val(); };
  constexpr bool operator<=(modular x) const { return val() <= x.val(); };
  constexpr bool operator>(modular x) const { return val() > x.val(); };
  constexpr bool operator>=(modular x) const { return val() >= x.val(); };

  friend std::ostream& operator<<(std::ostream& os, const modular& x) {
    return os << x.val();
  }
  friend std::istream& operator>>(std::istream& is, modular& x) {
    return is >> x.val_;
  }

};

using mint = modular<ll, 998244353>;

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

  int a,b,c,d; cin>>a>>b>>c>>d;
  int h = c-a;
  int w = d-b;
  vector<vector<mint>> dp(h+1, vector<mint>(w+1));
  dp[0][0] = 1;
  for (int i = 0; i <= h; i++) {
    for (int j = 0; j <= w; j++) {
      if (i>0)
        dp[i][j] += dp[i-1][j] * (j+b);
      if (j>0)
        dp[i][j] += dp[i][j-1] * (i+a);
      if (i>0 and j>0)
        dp[i][j] -= dp[i-1][j-1] * (i+a-1)*(j+b-1);
    }
  }
  cout << dp[h][w] << endl;

  return 0;
}


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

using namespace std;

int main()
{
    int a,b,c;
    while(cin>>a>>b>>c)
    {
        if((a!=b&&a!=c&&b!=c)||(a==b&&b==c))
            printf("No\n");
        else
            printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int *a =new int[n];
    int min=10000000000;
    int min2=10000000000;
    for (int i=0;i<n;i++){
    	cin>>a[i];
        if(min>a[i]){
            min2=min;
        	min=a[i];
        }else if(min2>a[i]){
        	min2=a[i];
        }
    }
  int r=1;
    for(int i=min2;i>=2;i--){
        int g=0;
    	for(int j=0;j<n;j++){
        	if(a[j]%i==0){
            	g+=1;
            }
        }
        if(g>=n-1){
        	r=i;
            break;
        }
    }
    cout << r << endl;
}

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

using namespace std;

#define MAX_N  101
#define MAX_W   100001
int N, W;
vector<vector<long long> >  Lookup(MAX_N,vector<long long> (MAX_W,-1));
vector<int> wei(MAX_N);
vector<long long> val(MAX_N);

long long Knapsack(int c,int  n){
	if (Lookup[n][c] == -1){
	if(c==0|| n==0)return 0;
	//else
	//if(Lookup[n][c]!=-1) return 	Lookup[n][c];
	else
	if(c-wei[n]>=0)
		return Lookup[n][c] = max(Knapsack(c-wei[n],n-1)+val[n],Knapsack(c,n-1));
	else return Knapsack(c,n-1);
	}
	return Lookup[n][c];
}
void fillDp(){
	for(int i =0;i<MAX_N;i++){
		for (int j=0;j<MAX_W;j++)
			Lookup[i][j]=-1;
	}	
}

int main(int argc, char** argv) 
{
	cin>>N>>W;
	for (int i =1;i<=N;i++){
		cin>>wei[i]>>val[i];
	}
	//fillDp();
	cout<<Knapsack(W,N)<<endl;

	return 0;
}


Measured memory_bytes: 80256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
typedef long long ll;

int keta(long long a)
{
    int digit = 0;
    while (a > 0)
    {
        a /= 10;
        digit++;
    }
    return digit;
}

int main(void)
{
    long long n;
    cin >> n;
    long long limit = sqrt(n) + 10;

    int ans = 1001001001;
    rep(i, 1, limit)
    {
        if (n % i == 0)
        {
            long long b = n / i;
            int tmp = max(keta(i), keta(b));
            ans = min(tmp, ans);
        }
    }
    cout << ans << endl;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

constexpr ll mod = 1000000007;

ll gcd(ll a, ll b) { while (b) a %= b, swap(a, b); return abs(a); }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    ll n, m;
    cin >> n >> m;
    vector<ll> vs(n);
    vector<ll> vs2(n);
    rep(i, n) {
        cin >> vs[i];
        vs2[i] = vs[i] / 2;
    }
    ll mult = 1;
    rep(i, n) {
        mult = lcm(mult, vs2[i]);
    }
    ll ok = true;
    rep(i, n) {
        auto div = mult / vs2[i];
        if (div % 2 == 0) {
            ok = false;
            break;
        }
    }
    if (ok) {
        cout << (m / mult + 1) / 2 << endl;
        return 0;
    }
    cout << 0 << endl;
    return 0;
}



Measured memory_bytes: 4844
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int p[256] = {};
    for (int i = 0; i < n; i++) {
        char s;
        cin >> s;
        p[s] = 1;
    }

    cout << (p['P'] + p['W'] + p['G'] + p['Y'] == 3 ? "Three" : "Four") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=100005;
int n,c,k;
int t[MAX];
int main()
{
    while(~scanf("%d%d%d",&n,&c,&k))
    {
        for(int i=0;i<n;i++)
            scanf("%d",t+i);
        sort(t,t+n);

        int ans=0,cnt=1,first=t[0];
        for(int i=1;i<n;i++)
        {
            if(t[i]-first>k||cnt>=c)
            {
                cnt=0;
                first=t[i];
                ans++;
            }

            cnt++;
        }

        if(cnt) ans++;

        printf("%d\n",ans);

    }

    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int n, a, b, check = 0, pro = 0;

int main()
{
    cin >> n;
    int d1[n+1], d2[n+1];
    for(int i = 0; i < n; i++)
    {
        cin >> d1[i] >> d2[i];
        if(d1[i] == d2[i]) check++;
        if(check == 3) pro++;
        if(d1[i] != d2[i]) check = 0;
    }
    if(pro != 0) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
 
int main(void) 
{
    int N;
    cin >> N;
    string str = to_string(N);
    string ans = "No";
    for (int i = 0; i < str.size(); i++) {
        if (str[i] == '7') {
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3696
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll A, B; cin >> A >> B;
    char C; cin >> C;
    int D; cin >> D;
    B *= 100; B += D;
    ll X = A*B; X /= 100;
    cout << X << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] l = new int[n];
        int counter = 0;
        for (int i = 0; i < l.length; i++) {
            l[i] = sc.nextInt();
        }
        for (int i = 0; i < l.length - 2; i++) {
            for (int j = i + 1; j < l.length - 1; j++) {
                for (int j2 = j + 1; j2 < l.length; j2++) {
                    if (l[i] != l[j] && l[j] != l[j2] && l[j2] != l[i]
                    &&  l[i] + l[j] > l[j2]
                    &&  l[j] + l[j2] > l[i]
                    &&  l[j2] + l[i] > l[j]) {
                        counter++;
                    }
                }
            }
        }
        System.out.println(counter);
        sc.close();
    }
}

Measured memory_bytes: 36872
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

#define im() imag()
#define re() real()

typedef complex<double> P;
typedef vector<P> Poly;

bool comp_x(const P &a, const P &b) {
    return a.re() < b.re();
}

bool comp_y(const P &a, const P &b) {
    return a.im() < b.im();
}

double close_pair(vector<P> &a, int l, int r) {
    if (r - l <= 1) return 1e20;
    int mid = (l + r) / 2;
    double X = a[mid].re();
    double d = min(close_pair(a, l, mid), close_pair(a, mid, r));
    inplace_merge(a.begin() + l, a.begin() + mid, a.begin() + r, comp_y);

    vector<P> b;
    for (int i = l; i < r; i++) {
        if (abs(a[i].re() - X) >= d) continue;
        for (int j = b.size() - 1; j >= 0; j--) {
            if ((a[i] - b[j]).im() >= d) break;
            d = min(d, abs(a[i] - b[j]));
        }
        b.push_back(a[i]);
    }
    return d;
}

int main() {

    int N;
    cin >> N;

    Poly p(N);

    for (int i = 0; i < N; i++) {
        double x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    sort(p.begin(), p.end(), comp_x);
    double ans = close_pair(p, 0, N);
    cout << fixed << setprecision(20) << ans << endl;
}














































Measured memory_bytes: 7672
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=1000;
  for(int j=0;j<s.size()-2;j++){
    int k=100*(int)(s.at(j)-'0')+10*(int)(s.at(j+1)-'0')+(int)(s.at(j+2)-'0');
    ans=min(ans,abs(753-k));
  }
  cout<<ans;
}


Measured memory_bytes: 256
#include <float.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}
int compr(const void *a, const void *b){return *(int*)b-*(int*)a;}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

inline int max2(const int a, const int b){return a>b?a:b;}
inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}

int f(int r, int l){
	return min2(l, r-l);
}

int p[100000];
int q[100000];
int r[100000];
int main(void){
	int x=nextpint()-1;
	int y=nextpint()-1;
	int z=0;
	int a=nextpint();
	int b=nextpint();
	int c=nextpint();
	for(int i=0; i<a; i++){ p[i]=nextpint(); }
	for(int i=0; i<b; i++){ q[i]=nextpint(); }
	for(int i=0; i<c; i++){ r[i]=nextpint(); }
	qsort(p, a, sizeof(int), compr);
	qsort(q, b, sizeof(int), compr);
	qsort(r, c, sizeof(int), compr);
	while(z<c){
		if(x>=0 && y>=0 && p[x]<r[z] && q[y]<r[z]){
			if(p[x]<q[y]){
				x--;
			}else{
				y--;
			}
		}else if(x>=0 && p[x]<r[z]){
			x--;
		}else if(y>=0 && q[y]<r[z]){
			y--;
		}else{
			break;
		}
		z++;
	}
	long ans=0;
	for(int i=0; i<=x; i++){ ans+=p[i]; }
	for(int i=0; i<=y; i++){ ans+=q[i]; }
	for(int i=0; i<z; i++){ ans+=r[i]; }
	printf("%ld\n", ans);
}


Measured memory_bytes: 1788
import numpy as np
n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    t = arr & 1
    c1 = np.count_nonzero((arr & 1))
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1

print(s % mod)

Measured memory_bytes: 48852
from collections import deque
H,W = map(int,input().split())
lst1 = [list(list(input())) for i in range(H)]

def dfs(maze,visited, sh, sw):
    a = 0
    stack = deque([[sh, sw]])
    visited[sh][sw] = 1
    while stack:
        h, w = stack.popleft()
        #print(visited)
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]): #4近傍について探索
            new_h, new_w = h+j, w+k
            if new_h < 0 or new_h >= H or \
               new_w < 0 or new_w >= W: #リスト外でないならelif条件へ
                continue
            elif maze[new_h][new_w] != "#" and \
                visited[new_h][new_w] == 0: #行ったことがないかつ、壁でないなら
                visited[new_h][new_w] = visited[h][w]+1
                stack.append([new_h, new_w])
    a = 0
    for s in range(H):
        for x in range(W):
            a = max(a,visited[s][x])
    return a

ans = 0

for i in range(H):
    for q in range(W):
        visited = [[0]*W for _ in range(H)]
        if lst1[i][q] == ".":
            ans = max(ans,dfs(lst1,visited,i,q))
print(ans-1)



Measured memory_bytes: 46060
n,m = gets.split.map(&:to_i)
edges = Array.new(n+1).map{[]}
p = Array.new(n,0)
used = Array.new(n,true)
ans = true

m.times {
  a,b = gets.split.map{|i|i.to_i-1}
  edges[a] << b
  edges[b] << a
}

used[0] = false
q = [0]
while q.any?
  f = q.shift
  edges[f].each { |i|
    if used[i]
      used[i] = false
      p[i] = 1-p[f]
      q.push(i)
    elsif p[i] == p[f]
      ans = false
    end
  }
end

if ans
  c = p.count(0)
  puts c*(n-c)-m
else
  puts (n*(n-1))/2-m
end

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long a, b, ans = 0;
  cin >> n >> a >> b;
  vector<long long> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  long long pn = vec[0];
  for (int i = 1; i < n; i++) {
    if ((vec[i]-pn)*a > b) {
      ans += b;
    }
    else {
      ans += (vec[i]-pn)*a;
    }
    pn = vec[i];
  }
  cout << ans << '\n';
}


Measured memory_bytes: 1024
K = int(input())
counter = 0
level = 1
theList = []
PreLevelStart,PreLevelEnd = 0,0
while counter < K:
    levelStart = counter
    if level == 1:
        for i in range(1,10,1):
            theList.append(i)
            counter += 1
    else:
        for i in range(PreLevelStart,PreLevelEnd):
            if theList[i]%10 == 0:
                theList.append(theList[i]*10)
                counter+=1
                theList.append(theList[i]*10+1)
                counter+=1
            elif theList[i]%10 == 9:
                theList.append(theList[i]*10+8)
                counter+=1
                theList.append(theList[i]*10+9)
                counter+=1
            else:
                theList.append(theList[i]*10+theList[i]%10-1)
                counter+=1
                theList.append(theList[i]*10+theList[i]%10)
                counter+=1
                theList.append(theList[i]*10+theList[i]%10+1)
                counter+=1
    PreLevelStart = levelStart
    PreLevelEnd = counter
    level = level+1
print(theList[K-1])


Measured memory_bytes: 11676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (int)(n); i>=0; --i)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int ans = 0;
    ans += (k-a>=0)?a:k;
    k = max(0, k-a-b);
    ans -= (k-c>=0)?c:k;

    cout << ans << endl;
}

Measured memory_bytes: 3636
N = input()
A = input()
B =[i for i in A]
SUM = [0]*(len(B))
for i in range(len(B)):
    count=0
    C = B[:i]
    D = set(B[i:])
    for t in D:
        if C.count(t)>0:
            count+=1
            SUM[i] = count
print(max(SUM))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<int>>;
using P = pair<int,int>;
//int dy[4] = {-1,0,1,0};
//int dx[4] = {0,-1,0,1};


int main()
{
    int H,W,D;
    cin >> H >> W >> D;
    
    int size = H*W;
    
    vector<int> I(size),J(size);
    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            int t;
            cin >> t;
            t--;
            I[t] = i;
            J[t] = j;
        }
    }
    
    vector<int> data(size);
    
    for(int i=0;i<size;i++)
    {
        if(i-D<0)
        {
            data[i] = 0;
            continue;
        }
        data[i] = abs(I[i] - I[i-D]) + abs(J[i] - J[i-D])  + data[i-D];
    }
    
    int Q;
    cin >> Q;
    vector<long long> ans(Q);
    for(int i=0;i<Q;i++)
    {
        int l,r;
        cin >> l >> r;
        
        l--;
        r--;
        
        cout << data[r] - data[l] << endl;
        
    }
    return 0;
}


/*
int main()
{
    int N;
    cin >> N;
    
 
 int ans;
 cout << ans << endl;
    return 0;
}
*/

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
long t;
long j;
int main(){
    long n;
    cin>>n;
    for(int i=1;i<=1000;i++){
        if(i*(i+1)/2 == n){
            cout<<"Yes"<<endl;
            cout<<i+1<<endl;
            t=i;
            break;
        }
        if(n < i*(i+1)/2){
            cout<<"No";
            return 0;
        }
    }
    int a[t+1][t];
    long last;
    for(int i=0;i<t+1;i++){
        if(i==0){
            for(j=0;j<t;j++){
                a[i][j]=j+1;
            }
            last=a[0][t-1];
        }
        else{
            j=0;
            while(j<i){
                    a[i][j]=a[j][i-1];
                    j++;
            }
            int offset=1;
            while(j<t){
                a[i][j]=last+offset;
                j++;
                offset++;
            }
            last=a[i][t-1];
        }
    }
    for(int i=0;i<t+1;i++){
        cout<<t<<" ";
        for(j=0;j<t;j++){
            cout<<a[i][j]<<" ";
        }
        cout<<endl;
    }
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>

#define BUF_SIZE 500

int* fget_array(int *arr, int size, char *line) {
  char *tmpbuf = line;
  int i;
  for(i = 0; i < size; i++) {
    char *tmp = strtok(tmpbuf, " ");
    arr[i] = strtol(tmp, NULL, 10);
    tmpbuf = NULL;
  }
  return arr;
}

struct list {
  struct list *next;
  int dst;
  int cost;
};

struct pair {
  int node;
  int cost;
};

struct list *create_graph(int size) {
  struct list *graph = malloc(sizeof(struct list)*size);
  int i;
  for(i = 0; i < size; i++) {
    graph[i].next = &graph[i];
  }
  return graph;
}

void insert(struct list *graph, int src, int dst, int cost) {
  struct list *head = &graph[src];
  struct list *elem = malloc(sizeof(struct list));
  elem->next = head->next;
  head->next = elem;
  elem->dst = dst;
  elem->cost = cost;
}

#define HEAP_SIZE 100
   
struct pair heap[HEAP_SIZE];
int pos = 1;

int is_empty(void) {
  return pos == 1;
}

void swap(struct pair *pa, struct pair *pb) {
  struct pair tmp = *pa;
  *pa = *pb;
  *pb = tmp;
}

// create min_heap
void enqueue(int node, int cost) {
  int idx = pos;
  struct pair p;
  p.node = node; p.cost = cost;
  heap[pos++] = p;
  int parent;
  while((parent = idx/2)) {
    if(heap[parent].cost > heap[idx].cost) {
      swap(&heap[parent], &heap[idx]);
      idx = parent;
    } else { break; }
  }
}

struct pair fetch_min(void) {
  struct pair res = heap[1];
  struct pair last = heap[--pos];
  int idx = 1;
  heap[idx] = last;
  // fix
  while(1) {
    int left = idx * 2;
    int right = idx * 2 + 1;
    int smallest = idx;
    if(left < pos && heap[smallest].cost > heap[left].cost) {
      smallest = left;
    }
    if(right < pos && heap[smallest].cost > heap[right].cost) {
      smallest = right;
    }

    if(smallest != idx) {
      swap(&heap[smallest], &heap[idx]);
      idx = smallest;
    } else { break; }
  }
  return res;
}

int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  int num;
  sscanf(line, "%d", &num);

  struct list *graph = create_graph(num);

  int i, j;
  for(i = 0; i < num; i++) {
    if(!fgets(line, BUF_SIZE, fp)) return 0;
    char *tmpbuf = line;
    for(j = 0; j < num; j++) {
      char *tmp = strtok(tmpbuf, " ");
      int n = strtol(tmp, NULL, 10);
      if(n!=-1) insert(graph, i, j, n);
      tmpbuf = NULL;
    }
  }

  char checked[100] = {0};
  enqueue(0, 0);
  int sum = 0;
  while(!is_empty()) {
    struct pair p = fetch_min();
    if(checked[p.node]) continue;
    checked[p.node] = 1;
    sum += p.cost;
    // searched in checked set.
    int min = INT_MAX;
    int min_node = -1;
    for(i = 0; i < num; i++) {
      if(!checked[i]) continue;
      struct list *head = &graph[i];
      struct list *tmp;
      for(tmp = head->next; tmp != head; tmp = tmp->next) {
        if(checked[tmp->dst]) continue;
        if(min > tmp->cost) {
          min_node = tmp->dst;
          min = tmp->cost;
        }
      }
    }
    if(min_node != -1) enqueue(min_node, min);
  }
  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 2036
m=998244353
M=1<<20
f=[0]*M
g=[0]*M
h=[0]*M
f[0]=g[0]=f[1]=g[1]=h[1]=1
for i in range(2,M):
	f[i]=f[i-1]*i%m
	h[i]=m-h[m%i]*(m//i)%m
	g[i]=g[i-1]*h[i]%m
A,B=map(int,input().split())
if A<B:A,B=B,A
a=0
b=1
for j in range(1,B+1):
	a+=b*f[A+B-j]*g[B-j]*g[A]
	b=b*2%m
print((a*f[A]*f[B]*g[A+B]+A)%m)

Measured memory_bytes: 65004
#include<math.h>
#include<time.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
int isprime(int x)
{
	int i;
	if(x==2)
		return 1;
	if(x<2 || x%2==0)
		return 0;
	for(i=3;i<=sqrt(x);i+=2)
		if(x%i==0)
			return 0;
	return 1;
}
int main()
{
	int t,n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&t);
		if(isprime(t))
			sum++;
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long a, b, x; cin >> a >> b >> x;
	a += (x - (a%x))%x;
	b -= b%x;
	if(a > b) cout << 0 << endl;
	else cout << b/x - a/x + 1 << endl;
	return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner();
			int n = cin.Int();
			long k = cin.Long();
			long[] a = cin.ArrayLong(n);
			long[] f = cin.ArrayLong(n);

			Array.Sort(a);
			Array.Sort(f);
			Array.Reverse(f);

			long max = 0;
			for (int i = 0; i < n; i++) {
				max = Math.Max(max, a[i] * f[i]);
			}

			long left = -1;
			long right = max;

			while (right - left > 1) {
				long mid = (right + left) / 2;

				bool ok = true;
				long kk = k;
				for (int i = 0; i < n; i++) {
					long diff = a[i] * f[i] - mid;
					if (diff <= 0) {
						continue;
					}

					long num = diff / f[i];
					if (diff % f[i] != 0) {
						num++;
					}

					kk -= num;
					if (kk < 0) {
						ok = false;
						break;
					}
				}

				if (ok) {
					right = mid;
				} else {
					left = mid;
				}
			}

			long ans = right;

			Console.WriteLine(ans);
		}
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;

		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 43228
#include <vector>
#include <cstdio>
using namespace std;
typedef pair<int,int> section;
section read(){
	int x,y,z,w;
	scanf("%02d:%02d-%02d:%02d",&x,&y,&z,&w);
	return make_pair(x*60+y,z*60+w);
}
void read_merge(vector<section>&s){
	int N;
	for(scanf("%d",&N);N--;)s.push_back(read());
}
int main(){
	int r=0,i;
	vector<section> ti,teacher,student;
	read_merge(ti);
	for(scanf("%d",&r);r--;)read_merge(teacher);
	for(scanf("%d",&r);r;--r)read_merge(student);
	for(int i=0;i<ti.size();i++){
		int a=0,b=0;
		for(int j=0;j<teacher.size();j++)a+=teacher[j].first<=ti[i].first&&ti[i].second<=teacher[j].second;
		for(int j=0;j<student.size();j++)b+=student[j].first<=ti[i].first&&ti[i].second<=student[j].second;
		r+=min(a,b);
	}
	printf("%d\n",r);
}

Measured memory_bytes: 1268
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using System.Text.RegularExpressions;

    class Program
    {
        static void Main()
        {
            string s = Console.ReadLine();
            string y = s.Replace("?", "D");

            Console.WriteLine(y);
        }

    }

Measured memory_bytes: 20948
/*
 ********************************************************************************
 *  Author: ThoseBygones
 *  Version: V1.0
 *  Date: 2018-07-11
 *  Subject: ACM-ICPC
 *  Language: C/C++11
 *  OJ: AOJ
 *  Algorithm:
 ********************************************************************************
 *  Algo-Description:
 ********************************************************************************
 */

//#include <bits/stdc++.h>  //For CodeForces only

//#pragma comment(linker,"/STACK:102400000,102400000")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <string>
#include <sstream>
#include <set>
#include <stack>
#include <queue>
using namespace std;
template<class T> inline T sqr(T x)
{
    return x * x;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<PII, int> PIII;
typedef pair<LL, LL> PLL;
typedef pair<LL, int> PLI;
typedef pair<LD, LD> PDD;
#define MP make_pair
#define PB push_back
#define sz(x) ((int)(x).size())
#define clr(ar,val) memset(ar, val, sizeof(ar))
#define istr stringstream
#define FOR(i,n) for(int i=0;i<(n);++i)
#define forIt(mp,it) for(__typeof(mp.begin()) it = mp.begin();it!=mp.end();it++)
const double EPS = 1e-6;
const int INF = 0x3fffffff;
const LL LINF = INF * 1ll * INF;
const double PI = acos(-1.0);

#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define lowbit(u) (u&(-u))
#define MAXN 105
#define MAXM 10005

int v[MAXN],w[MAXN];
int dp[MAXM];

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; i++)
        scanf("%d%d",&v[i],&w[i]);
    for(int i=1; i<=n; i++)
    {
        for(int j=w[i]; j<=m; j++)
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
    }
    printf("%d\n",dp[m]);
    return 0;
}



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

using namespace std;

int num[100005];
int dp[100105];


int main() {
    int n,k;

    cin >> n >> k;

    for(int i=0; i<n; i++){
        int x;
        scanf("%d",&x);
        num[i] = x;
    }

    for(int i=0; i<100105; i++){
        dp[i] = INT_MAX;
    }

    dp[0] = 0;


    for(int i=0; i<n; i++){
        for(int j=1; j<=k; j++){
            dp[i+j] = min(dp[i+j],dp[i] + abs(num[i]-num[i+j]));

        }

    }

    /*for(int i=0; i<n; i++){
        cout << dp[i] << " ";
    }*/

    cout << dp[n-1];

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,k=1,ans;
signed main(){
	string s,t;
	cin>>s>>t;
	rep(i,s.size()){
		if(s[i]!=t[i])ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3844
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
char mp[25][25];
int boom[25][25];
int nx[]= {0,0,1,-1};
int ny[]= {1,-1,0,0};
vector<pair<int,int>>v;
int h,w;
struct node
{
    int x,y;
    int step;
};
int bfs(pair<int,int>a,pair<int,int>b)
{
    queue<node>q;
    node st;
    st.x=a.first,st.y=a.second,st.step=0;
    q.push(st);
    memset(boom,0,sizeof(boom));
    boom[a.first][a.second]=1;
    while(!q.empty())
    {
        node ft=q.front();
        for(int i=0; i<4; i++)
        {
            int tx=ft.x+nx[i];
            int ty=ft.y+ny[i];
            if(tx>=0&&tx<h&&ty>=0&&ty<w&&mp[tx][ty]=='.'&&boom[tx][ty]==0)
            {
                boom[tx][ty]=1;
                q.push({tx,ty,ft.step+1});
            }
            if(tx==b.first&&ty==b.second)
                return ft.step+1;
        }
        q.pop();
    }
}
int main()
{
    cin>>h>>w;
    for(int i=0; i<h; i++)
        for(int j=0; j<w; j++)
        {
            cin>>mp[i][j];
            if(mp[i][j]=='.')
                v.push_back({i,j});
        }
    int sum=0;
    for(int i=0; i<v.size(); i++)
        for(int j=i+1; j<v.size(); j++)
        {
            sum=max(sum,bfs(v[i],v[j]));
        }
    cout<<sum<<endl;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;

int a;

int dfs(ll n){ // 
	ll res = 0;
	if (n > a) return 0;

	string s = to_string(n);

	// 条件に合うかチェック
	bool check[4] = {0};
	for (int i = 0; i < s.size(); i++){
		if(s[i] == '3') check[0] = 1;
		else if(s[i] == '5') check[1] = 1;
		else if(s[i] == '7') check[2] = 1;
		else check[3] = 1;
	}
	if (check[0] && check[1] && check[2] && !check[3]){
		res++;
	}

	res += dfs(n*10 + 3);
	res += dfs(n*10 + 5);
	res += dfs(n*10 + 7);

	return res;
}

int main(){
	cin >> a;
	cout << dfs(0) << endl;

	return 0;
}

Measured memory_bytes: 256
function main(lines) {
  const S = lines[0];

  let ans = 0;
  if (S == 'RRR') ans = 3;
  else if (S.includes('RR')) ans = 2;
  else if (S.includes('R')) ans = 1;
  
  return ans;
}


const ans = main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
console.log( ans );

function splitN(s) {
  return s.split(' ').map(Number);
}


Measured memory_bytes: 29656