akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>(ll)m; i--)
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "
#define cout(n) cout<<fixed<<setprecision(n)
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((b-a)/2+1>c){
    FOR(i,a,a+c){
      cout<<i<<endl;
    }
    FOR(i,b-c+1,b+1){
      cout<<i<<endl;
    }
  }
  else{
    FOR(i,a,b+1){
      cout<<i<<endl;
    }
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        if (r > 0 && r < 10000){
            // 面積
            double area = r * r * Math.PI;
            double circumference = 2 * r * Math.PI;
            System.out.printf("%.6f %.6f", area, circumference);
        }
    }
}


Measured memory_bytes: 28144
#include<iostream>
#include<cstring>
using namespace std;
int a[305][305];
int f[305];
int count[305];
int main(){
	int n,m;
	int i,j,k;
	int b,c,d;
	int s=1000;
	cin>>n>>m;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cin>>a[i][j];
			a[i][j]--;
		}
	}
	memset(f,0,sizeof(f));
	memset(count,0,sizeof(count));
	for(i=0;i<n;i++){
		count[a[i][f[i]]]++;
	}
	for(i=0;i<m;i++){
		for(d=0,j=0;j<m;j++){
			if(count[d]<count[j])d=j;
		}
		if(s>count[d])s=count[d];
		count[d]=-1;
		for(j=0;j<n;j++){
			if(count[a[j][f[j]]]!=-1)continue;
			while(count[a[j][f[j]]]==-1){
				f[j]++;
				if(f[j]==m)break;
			}
			count[a[j][f[j]]]++;
		}
	}
	cout<<s<<endl;
	return 0;
}
	
	


Measured memory_bytes: 640
alpha = {"a":"b", "b":"c", "c":"d", "d":"e", "e":"f", "f":"g", "g":"h", "h":"i", "i":"j", "j":"k", "k":"l", "l":"m", "m":"n", "n":"o", "o":"p", "p":"q", "q":"r", "r":"s", "s":"t", "t":"u", "u":"v", "v":"w", "w":"x", "x":"y", "y":"z"}
print(alpha[str(input())])

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(void)
{
  char s[200002];
  fgets(s,sizeof(s),stdin);
  int i=0, size=strlen(s), a,z;
  while(i<size){
    if(s[i]=='A'){
      a=i;
      break;
    }
    ++i;
  }
  while(i<size){
    if(s[i]=='Z'){
      z=i;
    }
    ++i;
  }
  printf("%d\n", z-a+1);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

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


void solve(){
    ll a, b;
    string s;
    cin >> a >> b >> s;
    if(s[a] != '-') ANS("No");

    rep(i, a) if(s[i] < '0' || s[i] > '9') ANS("No");
    for(ll i = a+1; i < s.size(); i++)if(s[i] < '0' || s[i] > '9') ANS("No");
    ANS("Yes")
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


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

int solve(char n,string upper,string under,string ans){
    while(upper.find("X")!=string::npos) upper.replace(upper.find("X"),1,&n);
    while(under.find("X")!=string::npos) under.replace(under.find("X"),1,&n);
    while(ans.find("X")!=string::npos) ans.replace(ans.find("X"),1,&n);
    for(int i=upper.size()-1,j=under.size()-1;i>=0;i--,j--){
        if(j>=0) upper[i] += under[j]-'0';
        if(upper[i] > '9'){
            upper[i] -= 10;
            if(i == 0) upper = "1" + upper;
            else upper[i-1]++;
        }
    }
    return (upper == ans)? 1 : 2;
}

int main(){
    string line,s1,s2,s3;
    while(cin >> line){
        bool judge = false;
        s1 = line.substr(0,line.find('+'));
        s2 = line.substr(line.find('+')+1,line.find('=')-(line.find('+')+1));
        s3 = line.substr(line.find('=')+1);
        if(s1.size() < s2.size()) swap(s1,s2);
        for(int i=0;i<10;i++){
            char ss = i +'0';
            if(solve(ss,s1,s2,s3) == 1){
                cout << i << endl;
                judge = true;
                break;
            }
        }
        if(!judge) cout << "NA" << endl;
    }
}

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

#define endl '\n'
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
#define ALL(v) v.begin(), v.end()
#define ALLR(v) v.rbegin(), v.rend()
#define deb cout<<"HOLA\n";
#define UNIQUE(v) (v).resize(unique(ALL(v))-(v).begin())
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define bs(v,f) binary_search(ALL(v),f)
#define lb(v,f) lower_bound(ALL(v),f)
#define ub(v,f) upper_bound(ALL(v),f)
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

void solve(){
	int n,m,n1,m1;
	cin>>m>>n>>m1>>n1;
	while(m>0 and m1>0){
		m1-=n;
		if(m1<1){cout<<"Yes";return ;}
		m-=n1;
		if(m<1)break;
	}
	cout<<"No";
}
int main(){
	/*int t;
	cin>>t;
	while(t--)*/
		solve();
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000



int main(){
	
	long long N,A,B;
	cin>>N>>A>>B;
	
	long long ans = 0;
	
	ans += N/(A+B)*A;
	
	N %= A+B;
	
	ans += min(N,A);
	
	cout<<ans<<endl;
	
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)

typedef long long ll;

using namespace std;



/*
class TheKingsArmyDiv2
{
public:
	int getNumber(vector <string> state)
	{

	}
};
*/




int main()
{
	int a;
	
	scanf("%d", &a);
	
	for (; a>0; a--)
	{
		double a1, a2, b1, b2, c1, c2, x1, y1, x2, y2, x3, y3;
		double x, y, r;
		
		scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
		a1 = 2 * (x2-x1), b1 = 2 * (y2-y1);
		c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		a2 = 2*(x3-x1), b2 = 2*(y3-y1);
		c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
		x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
		y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
		r = hypot(x - x1, y - y1);
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
	}
	
	return 0;
}

Measured memory_bytes: 1260
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

typedef struct point{
    double x,y;
}P;

void koch(int ,P ,P );

int main(void)
{
    P a,b;
    int n;
    cin>>n;
    a.x=0;a.y=0;
    b.x=100;b.y=0;
    printf("%.8lf %.8lf\n",a.x,a.y);
    koch(n,a,b);
    printf("%.8lf %.8lf\n",b.x,b.y);
    return 0;
}

void koch(int n,P a,P b)
{
    if(n==0)return ;
    P s,t,u;
    double th=M_PI*60.0/180.0;
    s.x=(2.0*a.x+1.0*b.x)/3.0;
    s.y=(2.0*a.y+1.0*b.y)/3.0;
    t.x=(1.0*a.x+2.0*b.x)/3.0;
    t.y=(1.0*a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;
    
    koch(n-1,a,s);
    printf("%.8lf %.8lf\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%.8lf %.8lf\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%.8lf %.8lf\n",t.x,t.y);
    koch(n-1,t,b);
}



Measured memory_bytes: 3212
import math
n,d=map(int,raw_input().split())
l=[]
for i in xrange (n):
  a=map(int,raw_input().split())
  l.append(a)
ans=0
for i in xrange (n-1):
  for j in xrange (i+1,n):
    temp=0
    for k in xrange (d):
      temp+=(l[i][k]-l[j][k])**2
    temp=math.sqrt(temp)
    if temp%1==0:
      ans+=1
print ans

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i,n) cin >> l[i];

  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i+1; j < n; j++) 
      for (int k = j+1; k < n; k++) {
        if (l[i]+l[j] <= l[k] || l[i]+l[k] <= l[j] || l[j]+l[k] <= l[i]) continue;
        if (l[i]==l[j] || l[i]==l[k] || l[j]==l[k]) continue;
        ans++;
      }

  cout << ans << endl;

  return 0;
}

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

int main(){
    string S;
    cin >> S;
    vector<bool> aru(26,false);
    for(char ch: S){
        aru.at((int)ch - (int)'a') = true;
    }
    rep(i,27){
        if(i == 26){
            cout << "None" << endl; 
            break;
        }

        if(aru.at(i) == false){
            cout << (char)(i + (int)'a') << endl;
            break;
        }
    }
}   

Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <queue>
#include <sstream>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), a + n
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)

using namespace std;

typedef long long ll;

const double EPS = 1e-10;
const double PI = acos(-1.0);

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int n;
	scanf("%d", &n);
	vector<int> b(n - 1);
	for(auto&& e : b) {
		scanf("%d", &e);
	}

	vector<int> a(n);
	REP(i, n) {
		if(i == 0) {
			a[i] = b[i];
			continue;
		}

		if(i == n - 1) {
			a[i] = b[i - 1];
			continue;
		}

		a[i] = min(b[i - 1], b[i]);
	}

	int result = accumulate(ALL(a), 0);

	printf("%d\n", result);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
 
int main(){
    char ch;
    int num,list[30]={0};
    //for (int ga=0;ga<15;ga++){
        while(scanf("%c",&ch) != EOF ){
        //while(std::cin>>ch){
        //scanf("%c",&ch);
        if(isupper(ch)){
        	ch=tolower(ch);
        }
        num=ch-'a';
        list[num]=list[num]+1;
    }
    for (int gb=0;gb<=('Z'-'A');gb++){
        char tesa='a'+gb;
        std::cout << tesa<< " : " << list[gb] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3156
use std::cmp::{max, min};
use std::error::Error;
use std::io;

pub fn main() {
    if let Err(_e) = run() {
        panic!("failed.");
    }
}

fn run() -> Result<(), Box<dyn Error>> {
    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let n: i32 = input.trim().parse()?;
    input.clear();
    let mut ranges = vec![];
    let mut l_sort = vec![];
    let mut r_sort = vec![];
    for i in 0..n {
        io::stdin().read_line(&mut input)?;
        let a_b: Vec<i64> = input
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<i64>().unwrap())
            .collect();
        ranges.push(a_b.clone());
        l_sort.push(a_b[0]);
        r_sort.push(a_b[1]);
        input.clear();
    }
    l_sort.sort_by(|e1, e2| e1.cmp(&e2));
    r_sort.sort_by(|e1, e2| e1.cmp(&e2));

    if n % 2 == 1 {
        let l = l_sort[n as usize / 2];
        let r = r_sort[n as usize / 2];
        println!("{}", r - l + 1);
    } else {
        let l = l_sort[n as usize / 2] + l_sort[n as usize / 2 - 1];
        let r = r_sort[n as usize / 2] + r_sort[n as usize / 2 - 1];
        println!("{}", r - l + 1);
    }

    Ok(())
}


Measured memory_bytes: 16720
def m(s):
  return True if 1 <= int(s) <= 12 else False

s = input()
f = int(s[:2])
l = int(s[2:])

if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA")



Measured memory_bytes: 9176
#include<iostream>
#include<fstream>
#include<cstdio>
using namespace std;
int K;
int main()
{
	int num=0;
	scanf("%d",&K);
	for(int i=1;i<=1000000;i++){
		num=num*10+7;
		num=num%K;
		if(num==0){printf("%d\n",i);return 0;}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 3832
#include<iostream>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
int road[300][300];

long long warshall(int n){
    long long ans;
    vector<pii> a;
    for(int k=0;k<n;k++)
        for(int i=0;i<n;i++)
            for(int j=0;j<n;j++)
            {
                if(road[i][j]>road[i][k]+road[k][j]){
                    return -1;
                }
                else if(road[i][j]==road[i][k]+road[k][j]&&i!=k&&k!=j)
                    a.push_back(make_pair(i,j));
            }
    ans = 0;
    for(size_t i =0;i<a.size();i++)
        road[a[i].first][a[i].second] = 0;

    /*for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            cout<<road[i][j]<<" ";
        cout<<endl;
    }*/
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++)
            ans += road[i][j];

    return ans;
}


int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            cin>>road[i][j];
    }
    cout<<warshall(n)<<endl;
}


Measured memory_bytes: 35428
#include<bits/stdc++.h>
using namespace std;
#define N 100
int n, a[N];

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    for(int i = 1; i < n; i++) a[n] -= a[i];
    cout << ((a[n] < 0) ? "Yes" : "No") << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    vector<vector<int>> cnt(n, vector<int>(30, 0));
    for (int i = 0; i < n; i++) {
        cin >> s[i];
        //cout << s[i] << " ";
    }
    //cout << endl;

    for (int i = 0; i < n; i++) {
        string t = s[i];
        for (int j = 0; j < t.size(); j++) {
            cnt[i][t[j] - 'a']++;
            //cout << t[j] - 'a' << " ";
        }
        //cout << endl;
    }

    vector<int> mn(30, 0);
    for (int i = 0; i < 26; i++) {
        int a = 1e9;
        for (int j = 0; j < n; j++) {
            a = min(a, cnt[j][i]);
        }
        mn[i] = a;
    }

    /*
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 26; j++) {
            cout << cnt[i][j] << " ";
        }
        cout << endl;
    }
    */

    string ans = "";
    string abc = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < 26; i++) {
        if (mn[i] == 0) continue;
        while (mn[i] > 0) {
            ans += abc[i];
            mn[i]--;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int a[99999];
int main()
{
    int i,n,k;
cin >> n;
int ans = -n;
    for(i=0;i<n;i++){
    cin>>a[i];
       ans += a[i];
    }
   cout << ans;
}

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

#define M_PI       3.14159265358979323846   // pi

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

#define rep(a,n) for(int a = 0;a < n;a++)

const ll mod = 1000000007;

ll mpow(ll x, ll n) {
	ll ans = 1; x %= mod;
	while (n != 0) {
		if (n & 1) ans = ans * x % mod;
		x = x * x % mod;
		n = n >> 1;
	}
	return ans;
}

ll inv_mod(ll a) { return mpow(a, mod - 2); }

//階乗とその逆元を求めて計算に利用するクラス
class Factorial {
private:
	vector<ll> fac;
	vector<ll> ifac;
public:

	Factorial(ll N) {
		fac.push_back(1);
		for (int i = 0; i < N; i++) fac.push_back(fac[i] * (i + 1) % mod);
		ifac.resize(N + 1);
		ifac[N] = inv_mod(fac[N]);
		for (int i = 0; i < N; i++) ifac[N - 1 - i] = (ifac[N - i] * (N - i)) % mod;
	}

	ll fact(ll a) { return fac[a]; }
	ll ifact(ll a) { return ifac[a]; }

	ll cmb(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		ll tmp = ifact(a - b) * ifact(b) % mod;
		return tmp * fac[a] % mod;
	}
	ll per(ll a, ll b) {
		if (a == 0 && b == 0) return 1;
		if (a < b || a < 0 || b < 0) return 0;
		return fac[a] * ifac[a - b] % mod;
	}
};
int main(void)
{
	ll x,y;
	cin >> x >> y;
	ll xy = x + y;
	if (xy % 3 != 0) {
		cout << 0 << endl;
		return 0;
	}
	ll n = xy / 3;
	if (x < n || y < n) {
		cout << 0 << endl;
		return 0;
	}
	ll dx = x - n;
	ll dy = y - n;
	ll dxy = dx + dy;

	Factorial f(dxy);
	ll ans = f.cmb(dxy, dx);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 12776
#include <bits/stdc++.h>
#include <boost/math/constants/constants.hpp>
using namespace std;
typedef long long ll;
long double e = boost::math::constants::e<long double>();
long double pi = boost::math::constants::pi<long double>();
// 条件を見落としていませんか？
int main () {
    int X;
    cin >> X;
    int a = X/500, b = X%500;
    b /= 5;
    cout << a*1000 + b*5 << endl;
}

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

using namespace std;
using LL = long long;
using P = pair<int,int>;
const LL mod=998244353;

LL dp[3010][3010];

int main(){
	int N, S;
	cin >> N >> S;
	vector<int> A(N);
	rep(i,N) cin >> A[i];
	dp[0][0]=1;
	rep(i,N){
		rep(j,S+1){
			(dp[i+1][j]+=dp[i][j]*2)%=mod;
			if(j>=A[i]) (dp[i+1][j]+=dp[i][j-A[i]])%=mod;
		}
	}
	cout << dp[N][S] << endl;

	return 0;
}

Measured memory_bytes: 74140
#include <bits/stdc++.h>
using namespace std;
template <typename T>void read(T &x){
	x = 0; int f(1); char c = getchar();
	for(;!isdigit(c);c = getchar()) if(c == '-') f = -1;
	for(;isdigit(c);c = getchar()) x = x*10+c-'0';
	x *= f;
}
long long x;
int main(){
	cin >> x;
	int ans = 0;
	long long now = 100;
	while(now < x)	++ans,now = floor(now*1.01);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3780
/*
ID: espr1t
TASK: 
KEYWORDS: 
*/

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
FILE* in = stdin; FILE* out = stdout;

const int MAX = 101;
const int MOD = 1000000007;

int h, w, k;
int dyn[MAX][MAX];

int recurse(int row, int col) {
    if (row == h)
        return col == k - 1;
    int& ans = dyn[row][col];
    if (ans != -1)
        return ans;
    
    ans = 0;
    for (int nmask = 0; nmask < (1 << (w - 1)); nmask++) {
        bool valid = true;
        for (int i = 1; i < w - 1; i++) {
            if ((nmask & (1 << (i - 1))) && (nmask & (1 << i))) {
                valid = false;
                break;
            }
        }
        if (!valid)
            continue;
        
        int ncol = col;
        if (col + 1 < w && (nmask & (1 << col)))
            ncol = col + 1;
        if (col - 1 >= 0 && (nmask & (1 << (col - 1))))
            ncol = col - 1;
        ans += recurse(row + 1, ncol);
        if (ans >= MOD) ans -= MOD;
    }
    
    return ans;
}

int main(void) {
	// in = fopen("D.in", "rt");
	
	fscanf(in, "%d %d %d", &h, &w, &k);
	
	memset(dyn, -1, sizeof(dyn));
	fprintf(out, "%d\n", recurse(0, 0));
	
	return 0;
}

Measured memory_bytes: 256
s=list(input())
b=True
for x in range(len(s)):
    if (x+1)%2==1:
       if s[x] not in ["R","U","D"]:b=False
    else:
       if s[x] not in ["L","U","D"]:b=False
if b:print("Yes")
else:print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MODD 1000000007
using namespace std;
long long mul(long long a, long long b)
{
	return ((a % MODD) * (b % MODD)) % MODD;
}

long long add(long long a, long long b)
{
	return ((a % MODD) + (b % MODD)) % MODD;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	long long k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long cnt = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (a[i] > a[j]) {
				cnt++;
			}
		}
	}
	long long cnt1 = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i] > a[j]) {
				cnt1++;
			}
		}
	}
	long long ans = add(mul(k, cnt), mul(cnt1, k * (k - 1) / 2 % MODD));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include<bits/stdc++.h>
using namespace std;
	int n;
	int bingo[3][3];
	bool a[105];
	int bingob[3][3];
	bool ans;
	int main(){
		IOS
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++){
				cin>>bingo[i][j];
				a[bingo[i][j]]=1;
			}
		cin>>n;
		for(int w=1;w<=n;w++){
			int t;
			cin>>t;
			for(int i=0;i<3;i++)
				for(int j=0;j<3;j++){
					if(t==bingo[i][j])
						bingob[i][j]=w;
				}
		}
		for(int i=0;i<3;i++)
			if(bingob[i][0]&&bingob[i][1]&&bingob[i][2])
				ans=1;
		for(int i=0;i<3;i++)
			if(bingob[0][i]&&bingob[1][i]&&bingob[2][i])
				ans=1;
		if(bingob[0][0]&&bingob[1][1]&&bingob[2][2])
			ans=1;
		if(bingob[0][2]&&bingob[1][1]&&bingob[2][0])
			ans=1;
		if(ans)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	} 

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        int N = Integer.parseInt(st.nextToken());
        int M = Integer.parseInt(st.nextToken());

        String[][] input_multiArray = new String[M][N];

        for(int i = 0; i < M; i++) {
            input_multiArray[i] = br.readLine().split(" ");
        }

        String[] p_array = br.readLine().split(" ");

        int ans = 0;

        for(int i = 0; i < (1<<N); i++) {

            boolean ableFlag = false;

            for(int j = 0; j < M; j++) {

                int onNum = 0;

                for(int k = 1; k <= Integer.parseInt(input_multiArray[j][0]); k++) {
                    if((i>>Integer.parseInt(input_multiArray[j][k])-1 & 1) == 1) {
                        onNum++;
                    }
                }

                if(onNum % 2 == Integer.parseInt(p_array[j])) {
                    ableFlag = true;
                } else {
                    ableFlag = false;
                    break;
                }
            }

            if(ableFlag) ans++;

        }

        pw.print(ans);
        br.close();
        pw.close();
    }
}

Measured memory_bytes: 33328
# from urllib.parse import urljoin

def testcase_ends():
    n, m = map(int, input().split())
    if (n, m) == (0, 0):
        return 1

    htmls = set(input() for i in range(n))
    files = set('/')
    for html in htmls:
        sp = html.split('/')
        for i in range(2, len(sp)):
            files.add('/'.join(sp[:i]) + '/')

        files.add(html)

    def find(url):
        has_ts = url.endswith('/')
        url = url.rstrip('/')
        sp = url.split('/')[1:]
        u = ['']
        for i, c in enumerate(sp, 1):
            if c == '..':
                if len(u) == 0: return None  # ???
                u.pop()
            elif c == '.':
                pass
            else:
                u.append(c)

            if ('/'.join(u) + '/') not in files:
                if i < len(sp):
                    return None
        else:
            u = '/'.join(u)

        if u.endswith('/') and (u+'index.html') in files:
            return u+'index.html'

        if (u+'/index.html') in files:
            return u+'/index.html'

        if u in files and not has_ts:
            return u

        return None

    for i in range(m):
        p1 = input()
        p2 = input()

        p1 = find(p1)
        p2 = find(p2)

        if p1 is None or p2 is None:
            print('not found')
        elif p1 == p2:
            print('yes')
        else:
            print('no')

def main():
    while not testcase_ends():
        pass

if __name__ == '__main__':
    main()



Measured memory_bytes: 5620
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int N = 2e5 + 7;

LL a[N], num[N], ans[N], f[N];

int main(){
	int n, q;
	scanf("%d%d", &n, &q);
	int cnt = 1; a[1] = n; LL x;
	for (int i = 1; i <= q; i++){
		scanf("%lld", &x);
		//x = (LL)1e18 - (LL)q + (LL)i;
		while (cnt >= 1 && x <= a[cnt]) cnt--;
		a[++cnt] = x;
	}
	//for (int i = 1; i <= cnt; i++) printf("%lld^*^\n", a[i]);
	num[cnt] = 1;
	for (int i = cnt; i >= 2; i--){
		LL x = a[i], y = num[i];
		//printf("%lld\n", x);
		while (true){
			//printf("%lld\n", x);
			int t = lower_bound(a + 1, a + i, x) - a;
			//printf("%d^*^\n", t);
			if (t != i && a[t] == x){
				num[t] += y;
				break;
			}
			t--;
			if (t == 0) { f[x] += y; break ; } 
			num[t] += y * (x / a[t]);
			x %= a[t];
			if (x == 0) break;
		}
		//return 0;
	}
	for (int i = a[1]; i >= 1; i--) f[i] += f[i + 1];
	for (int i = 1; i <= a[1]; i++) ans[i] = f[i] + num[1];
	for (int i = 1; i <= n; i++) printf("%lld\n", ans[i]);
	return 0;
}

Measured memory_bytes: 7040
use std::io;
use std::cmp;


/// https://beta.atcoder.jp/contests/abc070/tasks/abc070_b
fn main() {
    let (a, b, c, d) = {
        let i = read::<isize>();
        (i[0], i[1], i[2], i[3])
    };
    println!("{}", cmp::max(0, cmp::min(b, d) - cmp::max(a, c)));
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

ll gcd(ll a, ll b){
    if(a < b) swap(a, b);

    while(b != 0){
        int t = a;
        a = b;
        b = t%b;
    }

    return a;
}

int main(){
    int N; cin >> N;
    vector<int> a(N+2, 0);
    for(int i=1; i<=N; i++) cin >> a[i];
    vector<int> cum(N+2, 0), cum2(N+2, 0);

    cum[1] = a[1];
    cum2[N] = a[N];
    for(int i=2; i<=N; i++) cum[i] = gcd(a[i], cum[i-1]);
    for(int i=N-1; i>=1; i--) cum2[i] = gcd(a[i], cum2[i+1]);

    int ans = 0;
    for(int i=1; i<=N; i++){
        int tmp = gcd(cum[i-1], cum2[i+1]);
        ans = max(ans, tmp);
    }

    cout << ans << endl;

}

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


int main()
{
	int m,n;
	cin>>m>>n;
	if(m!=1 && n!=1)
	{
		cout<<1;
	}
	else if(m!=2 && n!=2)
	{
		cout<<2;
	}
	else
		cout<<3;
}


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

int main(){
    int  x, n;
    cin>>x>>n;
    int ans = 1;
    int c1= 0;
    for(int i=0;i<x;i++){
        int rr;cin>>rr;
        if(c1+rr <= n){ans++;c1+=rr;}
        else {c1+=rr;}
    }
    cout<<ans<<endl;
	return 0 ;
}


Measured memory_bytes: 256
#B
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0] * (n + 1)
d[0]=0
count = 0
for i in range(n):
    d[i + 1] = d[i] + l[i]
for i in d:
    if i <= x:
        count+=1
print(count)

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

using namespace std;

int main()
{
	string s;
	int i;
	int al[26] ={0};

	cin >> s;

	for(i = 0; i < s.length(); i++) {
		al[s[i] -'a'] ++;
	}

	for(i = 0; i < 26; i ++) {
		if(al[i] == 0) {
			cout << (char)(i + 'a') << endl;
			return 0;
		}
	}

	cout << "None" << endl;
	return 0;

}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
 
int main() { 
    int a[5], k;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    for(int i = 0; i < 5; ++i) {
        for(int j = i+1; j < 5; ++j) {
            if(abs(a[i] - a[j]) > k) {
                cout << ":(" << '\n';
                return 0;
            }
        }
    }
    cout << "Yay!" << '\n';
}


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

int main() {
    int n, a_, sum = 0;
    cin >> n;
    int a[n+2] = {};
    a[0] = 0; a[n+1] = 0;
    for(int i = 1; i < n+1; ++i) {
        cin >> a[i];
        sum += abs(a[i-1]-a[i]);
    }
    sum += abs(a[n]);
    for(int i = 1; i < n+1; ++i) {
        
        cout << sum - abs(a[i-1]-a[i]) - abs(a[i]-a[i+1]) + abs(a[i-1]-a[i+1]) << "\n";
    }
    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int k,x;
  cin >> k >> x;
  if(k * 500 >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.math;

  int n; rd(n);
  int cur=0, x=0, y=0;
  while(n--){
    int t, nx, ny; rd(t, nx, ny);
    auto d=(nx-x).abs+(ny-y).abs;
    if(d>(t-cur)){writeln("No"); return;}
    auto r=(t-cur)-d;
    if(r&1){writeln("No"); return;}
    cur=t; x=nx; y=ny;
  }

  writeln("Yes");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}


Measured memory_bytes: 1276
#include <iostream>
#include <algorithm>
#include <climits>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    
    int max_Num = INT_MIN;
    int min_Num = INT_MAX;
    long long sum = 0;
    
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        max_Num = max(max_Num, a);
        min_Num = min(min_Num, a);
        sum += a;
    }
    
    cout << min_Num << " " << max_Num << " " << sum << endl;
    
    
    
}



Measured memory_bytes: 3132
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		cout<<(a-1)*(b-1)<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
from collections import deque

N, Q = map(int, input().split())
V = [0] * N
E = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)
for _ in range(Q):
    p, x = map(int, input().split())
    V[p-1] += x

stack = deque()
stack.append(0)
checked = [False] * N

while stack:
    v = stack.popleft()
    checked[v] = True
    for e in E[v]:
        if checked[e]:
            continue
        V[e] += V[v]
        stack.append(e)
        checked[e] = True

print(*V)



Measured memory_bytes: 56084
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=2e3+4;

vector<pair<int,int>> v;

int n;

//dp[i][j] tells the best answer if we have processed till i-1 elements(and currently
//are at the ith element) and used the first j-1 places from the left to place some
//of the elements which we have taken now.

ll dp[N][N];

ll solve(int cur,int left)
{
	if(cur>n)
	return 0;

	if(dp[cur][left]!=-1)
	return dp[cur][left];

	//for each item, I have two options either place it in the leftmost available
	//place or the rightmost available place

	int right=left+(n-cur);

	ll &ans=dp[cur][left];

	ans=0;

	ll place_left,place_right;

	//place it in the leftmost available option
	place_left = 1LL*v[cur-1].F*abs(v[cur-1].S-left) + solve(cur+1,left+1);

	//place it in the rightmost available option
	place_right = 1LL*v[cur-1].F*abs(v[cur-1].S-right) + solve(cur+1,left);

	ans=max(place_right,place_left);

	return ans;
}

int main()
{
	memset(dp,-1,sizeof(dp));

	scn(n);

	rep(i,1,n+1)
	{
		int val;

		scn(val); v.emplace_back(val,i);
	}

	//you will definetely try to give the largest element the most possible movement.
	sort(v.rbegin(),v.rend());

	ll ans=solve(1,1);

	lpri(ans);

    return 0;
}

Measured memory_bytes: 35380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<=e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
void solve(){
    ll mxs = -inf, mxd = -inf,mnd = inf,mns = inf;
    ll n;
    cin >> n;
    fo(i, n){
        ll x, y;
        cin >> x >> y;
        mxs = max(mxs, x + y);
        mns = min(mns, x + y);
        mxd = max(mxd, x - y);
        mnd = min(mnd, x - y);
    }
    cout << max(abs(mxs - mns), abs(mnd - mxd)) << nl;
}
int main(){ 
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#ifndef LOCAL
struct ostdmy{template<class T>ostdmy&operator<<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
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(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(const T&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(const T&i:v)o<<i<<' ';return o;}
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    P a,b;
    cin>>a>>b;
    cout<<b.F+a.S-b.S<<endl;
    cout<<b.S-a.F+b.F<<endl;

    cout<<a.F-b.S+a.S<<endl;
    cout<<a.S+b.F-a.F<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());

      String s = sc.next();
      int lng = s.length();
      char[] c = new char[lng];
      for(int i=0;i<lng;i++){
        c[i] = s.charAt(i);
      }

      int[] kore = new int[n];
      int[] or01 = new int[n];
      int cnt = 0;
      for(int i=0;i<n-1;i++){
        if(c[i]==c[i+1]){
          kore[cnt]++;
        }
        else{
          if(c[i]=='0'){
            or01[cnt] = 0;
          }
          else{
            or01[cnt] = 1;
          }
          cnt++;
        }
      }
      for(int i=0;i<=cnt;i++){
        kore[i]++;
      }

//////main////////////////////////////////////
int range = 2*k+1;
int ans = 0;
int max = 0;
for(int i=-k;i<=lng-range;i++){

if(i<0){
//////////////////////////////////
for(int j=0;j<range+i;j++){
  max += kore[j];
}
//////////////////////////////////
}
else if(0<=i && i<=lng-range){
//////////////////////////////////
  if(or01[i]==1){
    for(int j=i;j<i+range;j++){
      max += kore[j];
    }
  }
//////////////////////////////////
}
else if(lng-range<i){
//////////////////////////////////
for(int j=i;j<lng;j++){
  max += kore[j];
}
//////////////////////////////////
}
  ans = Math.max(ans,max);
  max = 0;
}
if(cnt==0){
  ans=n;
}
System.out.println(ans);
//////////////////////////////////////////////

      /*for(int kores : kore){
        System.out.println(kores);
      }*/

    }
}


Measured memory_bytes: 26056
#include<stdio.h>

void trace(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if (i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

 void insertionSort(int A[],int N){
   int i,j,v;
 for(i=1;i<N;i++){
   v = A[i];
   j = i -1;

    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }


    
    A[j+1] = v;
    trace(A,N);
 }
  }


int main(){

  int N,i,j;
  int A[100];

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

  trace(A,N);
  insertionSort(A,N);

  

  return 0;
}



Measured memory_bytes: 2124
#include<stdio.h>
#include<string.h>
int main(void){
  int i,o;
  int n=0;
  char a[200001];
  char b[200001];
  scanf("%s",a);
  scanf("%s",b);
  i=strlen(a);
  for(o=0;o<=i;o++){
    if(a[o]!=b[o]){
      n++;
    }
  }
  printf("%d\n",n);
  return 0;
}

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

int n, t;
int a[200200];
long long sol;

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

for (int i=0; i < n; i++)	
	{
		cin >> a[i];
	}
	
for (int i=1; i < n; i++)	
	{
		if (a[i]-a[i-1]>t)
		sol+=t;
		else
		sol+=a[i]-a[i-1];
	}	
	
cout << sol+t;

return 0;	
	
	
}

Measured memory_bytes: 1024
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
#include <cctype>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
int main(){
  ll l,r,ans=2019,ch=1;
  cin>>l>>r;
  for(ll i=l;i<r;i++){
    ch=1;
    for(ll j=i+1;j<=r;j++){
      ans=min(ans,(i%2019*j%2019)%2019);
      if(ans==0) ch=0;
      if(ch==0) break;
    }
    if(ch==0) break;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define endl '\n'

typedef long long ll;
int main(){
string s;
cin >> s;
string t;
cin >> t;
for(int i = 0; i < s.size(); i++){
	if(s[i] != t[i]){
	 cout << "No";
	 return 0;
	}
}
if(s.size() == t.size() - 1)
  if(1 <= s.size() <= 10)
	cout << "Yes";
	return 0;
cout << "No";

}


Measured memory_bytes: 3584
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define endl "\n"
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(0)
using namespace std;                            
                                                
void yes() {cout << "YES" << endl;}                                               
void no() {cout << "NO" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const long long INF = 8e18 + 8;
const double EPS = 1e-9;
const long long MOD = 998244353;

void solve() {
    int n; cin >> n;
    vector<long long> a(n), b(n);
    long long ans = 0, ans2 = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    if (n == 1) {
        cout << a[0] / 2 << endl;
        return;
    }
    for (int i = 1; i < n; i++) {
        if (a[i] % 2 == a[i - 1] % 2) {
            ans += (a[i] + a[i - 1]) / 2;
            a[i] = 0;
        } else {
            if (a[i] != 0) {
                ans += (a[i] + a[i - 1]) / 2;
                a[i] = 1;
            }
        }
    }
    for (int i = n - 2; i >= 0; i--) {
        if (b[i] % 2 == b[i + 1] % 2) {
            ans2 += (b[i] + b[i + 1]) / 2;
            b[i] = 0;
        } else {
            if (b[i] != 0) {
                ans2 += (b[i] + b[i + 1]) / 2;
                b[i] = 1;
            }
        }
    }
    cout << max(ans, ans2) << endl;
}

int main() {
    jonathan; 
    livingston;
    bool tests = 0;
    int t = 1;
    if (tests) cin >> t;
    for (int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

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

int main() {
  int n,m,buf;
  cin>>n>>m;
  vector<int> ans(n,0);
  for (int i=0;i<2*m;i++) {
    cin>>buf;
    ans.at(buf-1) +=1;
  }
  for (int i=0;i<n;i++) cout<<ans.at(i)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=100011;
int n,a[N],r=0,l=0,ans=0;
int c[N*10],s[N<<1];
void add(int x)
{
	while(x<=N*2)
	  c[x]++,x+=x&(-x);
}
ll ask(int x)
{
	ll ans=0;
	while(x)
	{
		ans+=c[x];
		x-=x&(-x);
	}
	return ans;
}
//求中位数小于等于x的区间数至少为n*(n+1)/2/2+1的最小的x 
bool check(int x)
{
	for(int i=1;i<=2*N;i++) c[i]=0;
	s[0]=0;
	for(int i=1;i<=n;i++)
	  s[i]=s[i-1]+(a[i]<=x?1:-1);
	ll sum=0;
	for(int i=0;i<=n;i++)
    {
       sum+=ask(s[i]-1+N);
       add(s[i]+N);
	} 
	return sum>=(((ll)n*(n+1)/2/2+1));
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
  scanf("%d",&n);
  l=987654321;
  for(int i=1;i<=n;i++) scanf("%d",&a[i]),r=max(r,a[i]),l=min(l,a[i]);
  while(l+1<=r)
  {
	int mid=(l+r)>>1;
  	if(check(mid)) 
	  r=mid;
	else l=mid+1;
  }
  printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 1792
N=int(input())
h=list(map(int, input().split()))

min_cost = [0]*N
min_cost[0] = 0
min_cost[1] = abs(h[1]-h[0])
for idx in range(2, N):
    min_cost[idx] = min(min_cost[idx-1]+abs(h[idx]-h[idx-1]), \
                        min_cost[idx-2]+abs(h[idx]-h[idx-2]))
print(min_cost[-1])


Measured memory_bytes: 13928
#include <stdio.h>

int main(){
    int n,m,X,Y;
    scanf("%d %d %d %d",&n,&m,&X,&Y);
    int x[n],y[n];
    int xmax=-1e9;
    int ymin=1e9;
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
        if(xmax<x[i]) xmax=x[i];
    }   
    for(int i=0;i<m;i++){
        scanf("%d",&y[i]);
        if(ymin>y[i]) ymin=y[i];
        if(ymin<=xmax){printf("War\n");return 0;}
    }   
    if(X<ymin&&ymin<=Y){
        printf("No War\n");
    }else{
        printf("War\n");
    }   
    return 0;
}

Measured memory_bytes: 128
r, c = map(int, input().split())
# r:行数, c:列数
# matrics = [[0 for i in range(0, c+1)] for j in range(0, r+1)]
matrics = [[0 for i in range(0, c)] for j in range(0, r)]
# print(matrics)

for i in range(0, r):
	matrics[i] = list(map(int, input().split()))
# print(matrics)

for i in matrics:
	sum = 0
	for j in i:
		sum = sum + j
	i.append(sum)
# print(matrics)

vectors = [0 for i in range(0, c + 1)]
for i in range(0, len(matrics)):
	for j in range(0, len(matrics[i])):
		vectors[j] = vectors[j] + matrics[i][j]

# print(vectors)
matrics.append(vectors)

# print(matrics)

for i in range(0, len(matrics)):
	for j in range(0, len(matrics[i])):
		if j != len(matrics[i]) - 1:
			print('{0} '.format(matrics[i][j]), end='')
		else:
			print(matrics[i][j])



Measured memory_bytes: 6308
// F.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>

using namespace std;

typedef long long LL;

class BIT {
	std::vector<LL> bit;
	LL size;
public:
	BIT() { }
	BIT(LL sz) { init(sz); }
	void init(LL sz) {
		bit = std::vector<LL>((size = sz) + 1);
	}
	LL sum(LL i) {
		LL s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	void add(LL i, LL x) {
		while (i <= size) {
			bit[i] += x;
			i += i & -i;
		}
	}
};

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, d, a, x, h, ans = 0;
		cin >> n >> d >> a;
		if (n <= 0) return 0;
		set<LL> s;
		vector<pair<LL, LL>> v;
		for (LL i = 0; i < n; ++i) {
			cin >> x >> h;
			v.push_back({ x, h });
			s.insert(x);
			s.insert(x + 2 * d);
		}
		sort(v.begin(), v.end());
		BIT bit(s.size() + 1);
		map<LL, LL> m;
		LL seq = 0;
		for (LL x : s) {
			m[x] = ++seq;
		}
		for (LL i = 0; i < n; ++i) {
			LL need = (v[i].second - bit.sum(m[v[i].first]) + a - 1) / a;
			if (need > 0) {
				bit.add(m[v[i].first], need * a);
				bit.add(m[v[i].first + 2 * d] + 1, -need * a);
				ans += need;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 50284
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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 N,A,B;

int main(){
    cin>>N>>A>>B;
    out(min(A,B));
    out(max((A+B)-N,0));
}


Measured memory_bytes: 256