akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n;
	string s;
	int r = 0, b = 0;
	cin >> n >> s;

	for (char c: s) {
		if (c == 'R')r++;
		else b++;
	}
	cout << (r > b ? "Yes" : "No") << endl;



	return 0;
}

Measured memory_bytes: 256
from collections import deque

N = deque(input())
Q = int(input())
Qs = []
for _ in range(Q):
    Qs.append(list(map(str, input().split())) ) 
k=0
for q in Qs:
    if q[0] == '1':
        k+=1
    else:
        if k%2 ==0:
            if q[1]=='1':
                N.appendleft(q[2])
            else:
                N.append(q[2])
        else:
            if q[1]=='2':
                N.appendleft(q[2])
            else:
                N.append(q[2])
if k%2==1:
    ans=''
    for x in reversed(N):
        ans += x
else:
    ans=''
    for x in N:
        ans += x

print(ans)


Measured memory_bytes: 42964
n, m = map(int, input().split())

eva = [[0, 0] for _ in range(n)]

ac = 0
penalty = 0

for i in range(m):
    q, s = input().split()
    if eva[int(q) - 1][1] == 0:
        if s == "WA":
            eva[int(q) - 1][0] += 1
        else:
            eva[int(q) - 1][1] += 1
            ac += 1
            penalty += eva[int(q) - 1][0]
    else:
        pass

print(ac, penalty)

Measured memory_bytes: 13172
#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<list>
#include<climits>
#define endl '\n'
#define ll long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define mod 1000000007
#define mod1 998244353
#define PI acos(-1)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        cout<<k;
    }
    else if(a+b>=k)
    {
        cout<<a;
    }
    else
    {
        int r = k-a-b;
        cout<<a-r;
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
 
#define int long long int
#define ff first
#define ss second
#define pb push_back
 
int bexp(int a, int b, int mod)
{
    int res = 1;
    if (mod <= 0)
        return 0;
 
    while (b)
    {
        if (b & 1) res = (res * a) % mod;
 
        a = (a * a) % mod; 
        b >>= 1;
    }
    return res;
}
 
#define N 300010
#define MOD 1000000007
 
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss * (a.ff - a.ff / 2) > b.ss * (b.ff - b.ff / 2);
    }
};

vector<vector<pair<int, int>>> g;
int up[N][30];
int mi[N][30];
int in[N], out[N];
int tim = 0;
int dep[N];

void dfs(int v, int p, int de, int wei)
{
    up[v][0] = p;
    mi[v][0] = wei;
    in[v] = tim++;
    dep[v] = de;

    for (int i = 1; i < 30; ++i)
    {
        up[v][i] = up[up[v][i - 1]][i - 1];
        mi[v][i] = min(mi[up[v][i - 1]][i - 1], mi[v][i - 1]);
        // cout << mi[v][i] << ":: ";
    }

    for (auto k : g[v])
    {
        if (k.ff != p)
        {
            dfs(k.ff, v, de + 1, k.ss);
        }
    }

    out[v] = tim++;
}

int is_ances(int u, int v)
{
    return in[u] <= in[v] && out[u] >= out[v];
}

int lca(int u, int v)
{
    if (is_ances(u, v))
        return u;
    if (is_ances(v, u))
        return v;

    for(int i = 29; i >= 0; --i)
        if(!is_ances(up[u][i], v))
            u = up[u][i];
    
    return up[u][0];
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    string s, t;

    cin >> s >> t;

    int n = s.size();
    int n1 = t.size();
    int ans = INT_MAX;
    for (int i = 0; i < n - n1 + 1; ++i)
    {
        int cnt = 0;
        for (int j = 0; j < n1; ++j)
            if (s[i + j] != t[j])
                    cnt++;
        ans = min(ans, cnt);
    }

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

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;

const double PI = 3.14159265;
typedef struct {
	double x, y;
}point;

void koch(int d, point &p1, point &p2)
{
	if (d == 0)
		return;
	point s, u, t;
	s.x = (2 * p1.x + p2.x) / 3;
	s.y = (2 * p1.y + p2.y) / 3;
	t.x = (p1.x + 2 * p2.x) / 3;
	t.y = (p1.y + 2 * p2.y) / 3;
	u.x = (t.x - s.x) * cos(60 * PI / 180.0) - (t.y - s.y) * sin(60 * PI / 180.0) + s.x;
	u.y = (t.x - s.x) * sin(60 * PI / 180.0) + (t.y - s.y) * cos(60 * PI / 180.0) + s.y;
	koch(d - 1, p1, s);
	printf("%.8lf %.8lf\n", s.x, s.y);
	koch(d - 1, s, u);
	printf("%.8lf %.8lf\n", u.x, u.y);
	koch(d - 1, u, t);
	printf("%.8lf %.8lf\n", t.x, t.y);
	koch(d - 1, t, p2);
}
int main(void)
{
	int n;
	cin >> n;
	point p1 = { 0,0 }, p2 = { 100,0 };
	printf("%.8lf %.8lf\n", p1.x, p1.y);
	koch(n, p1, p2);
	printf("%.8lf %.8lf\n", p2.x, p2.y);
	return 0;
}


Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<math.h>
#include<iomanip>

using namespace std;
#define rep(i,n) for(int i = 0 ; i < n ; ++i)
using ld = long double;

int main(){
    int n;
    cin>>n;
    vector<ld> x(n), r(n);
    rep(i,n)cin>>x[i]>>r[i];
    ld ok=0, ng = 1e6;
    rep(_,100){
        ld mid = (ok+ng)/2;
        ld left = -1e9, right = 1e9;
        rep(i,n){
            if(r[i]<mid)left=right+1;
            ld dist = sqrt(r[i]*r[i]-mid*mid);
            left = max(left,x[i]-dist);
            right = min(right,x[i]+dist);
        }
        if(left<=right)ok=mid;
        else ng=mid;
    }
    cout<<fixed<<setprecision(10)<<ok<<endl;
}


Measured memory_bytes: 5984
fn main() {
    let mode = "c";
    if mode == "a" {
        a::solve();
    } else if mode == "b" {
        b::solve();
    } else if mode == "c" {
        c::solve();
    }
}
mod c {
    use std;
    use std::io::Read;

    pub fn solve() {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        let mut text = buf.split_whitespace();
        let n = text.next().unwrap().parse().unwrap();
        let data = text.into_iter().map(|x| x.parse().unwrap()).collect();

        let res = match calc(n, data) {
            true => "Yes",
            false => "No",
        };

        println!("{}", res);
    }
    fn calc(n: usize, mut h: Vec<i32>) -> bool {
        for i in (0..(n - 1)).rev() {
            match h[i] > h[i + 1] {
                false => {}
                true => {
                    h[i] -= 1;
                    if h[i] > h[i + 1] {
                        return false;
                    }
                }
            }
        }

        true
    }

    #[cfg(test)]
    mod tests {
        use super::*;

        #[test]
        fn test1() {
            assert_eq!(true, calc(5, vec![1, 2, 1, 1, 3]));
        }
        #[test]
        fn test2() {
            assert_eq!(false, calc(4, vec![1, 3, 2, 1]));
        }
        #[test]
        fn test3() {
            assert_eq!(true, calc(4, vec![1, 2, 3, 4, 5]));
        }
        #[test]
        fn test4() {
            assert_eq!(true, calc(1, vec![1000000000]));
        }
    }
}
mod b {
    use std;
    use std::io::Read;

    pub fn solve() {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        let n = buf.split_whitespace().next().unwrap().parse().unwrap();
        let res = calc(n);
        println!("{}", res);
    }

    fn calc(num: i32) -> i32 {
        let mut base = 10;
        let mut res = 0;
        loop {
            if num >= base {
                res += base - base / 10;
                base *= 100;
            } else {
                break;
            }
        }

        let amari = match num - (base / 10) >= 0 {
            true => num - (base / 10) + 1,
            false => 0,
        };

        res + amari
    }
}

mod a {
    use std;
    use std::io::Read;

    pub fn solve() {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        let mut text = buf.split_whitespace();
        let a = text.next().unwrap().parse().unwrap();
        let b = text.next().unwrap().parse().unwrap();
        let c = text.next().unwrap().parse().unwrap();

        let res = calc(a, b, c);
        println!("{}", res);
    }

    fn calc(a: i32, b: i32, c: i32) -> i32 {
        let used = std::cmp::min(a - b, c);
        c - used
    }

    #[cfg(test)]
    mod tests {
        #[test]
        fn test1() {}
    }

}


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

int prime[10000005] = {1, 1};
int print[10000005] = {-1, -1, 2};

int main()
{
    long long i, j;

    for (i = 2; i < 10000005ll; i++) {
        if (prime[i] == 1) continue;
        for (j = 2; i * j < 10000005ll; j++) {
            prime[i * j] = 1;
        }
    }
    for (i = 13; i < 10000005; i++) {
        if (prime[i - 8] == 0 && prime[i- 6] == 0 && prime[i - 2] == 0 && prime[i] == 0) {
            print[i] = i;
        } else {
            print[i] = print[i - 1];
        }
    }

    int n;
    cin >> n;
    while (n != 0) {
        printf("%d\n", print[n]);

        cin >> n;
    }

    return 0;
}



Measured memory_bytes: 81256
#include<iostream>
#include<string>
using namespace std;
int main(){
     int H,W;
     cin>>H>>W;
     while(H!=0&&W!=0){
		 
		 for(int i=1;i<=H;i++){
			 for(int j=1;j<=W;j++){
				 cout<<"#";
		 	}
		 cout<<endl;
		}
		cout<<endl;
		cin >> H >> W;
	}	
	return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  string L;
  cin >> L;
  int n = L.size();
  vector<vector<ll>> dp(n+1,vector<ll>(2,0));
  dp[0][0] = 1;
  for(int i=1;i<=n;i++){
    int d = L.at(i-1) - '0';
    if(d == 0){
      dp[i][0] = dp[i-1][0];
      dp[i][1] = (3*dp[i-1][1])%MOD;
    }else{
      dp[i][0] = (2*dp[i-1][0])%MOD;
      dp[i][1] = (3*dp[i-1][1] + dp[i-1][0])%MOD;
    }
  }
  cout << (dp[n][1]+dp[n][0])%MOD << endl;
  return 0;
}



Measured memory_bytes: 5760
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl;
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

bool Check(char c) {
	return c != ' ' && c != ',' && c != '.';
}

int main() {
	string s; getline(cin, s);
	VS ans;

	int i = 0;
	while (i < sz(s)) {
		string sub;
		if (Check(s[i])) {
			while (i < sz(s) && Check(s[i])) {
				sub += s[i];
				i++;
			}
		}
		else {
			i++;
		}
		if (sz(sub) >= 3 && sz(sub) <= 6)ans.pb(sub);
	}

	rep(i, sz(ans)) {
		cout << ans[i];
		printf(i == sz(ans) - 1 ? "\n" : " ");
	}
}


Measured memory_bytes: 3220
// Problem : A - We Love Golf
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;

#define ff first
#define fs second
#define lb lower_bound
#define ub upper_bound

#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector< vi >
#define vpii vector< pii >
#define vb vector<bool>
#define si set<int>
#define mii map<int, int>
#define mci map<char, int>
#define md 1000000007
#define pb push_back
#define eb emplace_back
#define fio ios_base::sync_with_stdio (false); cin.tie (NULL);  cout.tie (NULL);
#define qw1(x) cerr<<#x<<": "<<x<<" "<<endl
#define qw2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define qw3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define qw4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl


#define f(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define rl(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define all(x) x.begin(),x.end()
#define endl '\n'
void printv(vector<int>  v){ for(int i=0;i<v.size();i++) cout<<v[i]<<' '; cout<<endl;   }
int bem(int m , int n, int mod) { int res=1; while(n){
	     			        if(n%2!=0) { res*=m; res%=mod; }
	    			        m*=m;   m%=mod;   n/=2;
			                          }
				return res;	}
int be(int a, int b) { int res=1; 	while(b){
				if(b%2!=0) res*=a;
				a*=a; b/=2;
				}
			return res;	}
void sieve(int n, vb &prime){
    prime[0]=false;     prime[1]=false;
    for(int i=2;i*i<=n;i++){
         if(prime[i]==true){
              for(int j=i*i;j<=n;j+=i)    prime[j]=false;
             	  }
    	 }
	}

void solve()
  {
int k, a, b; cin>>k>>a>>b;
int d=b-a;
int r=a%k;
if(r!=0) r=k-r;
if(r<=d) cout<<"OK\n";
else cout<<"NG\n";

  }

int32_t main ()
{
//fio
int t=1; 
//cin>>t; 
while(t--){
	solve();
}
 
}








Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
#define int long long
 
signed main(){
    int n,a,b;
    cin>>n>>a>>b;
    if(a>b||(n==1&&a!=b))cout<<0<<endl;
    else{
    int min=a*(n-1)+b;
    int max=b*(n-1)+a;
    cout<<max-min+1<<endl;
    }
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int n;
	cin >> n;
	V<int> wa(n), sa(n);
	REP(i, n) {
		int num = i + 1, a;
		cin >> a;
		wa[i] = num + a;
		sa[i] = num - a;
	}

	upsort(sa);
	LL ans = 0;
	RBF(w, wa) {
		auto lo = lower_bound(ALL(sa), w);
		auto up = upper_bound(ALL(sa), w);
		ans += distance(lo, up);
	}

	col(ans);
	return 0;
}


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

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	for (int i = 0; i < 1000; ++i)
	{
		c -= b;
		if (c <= 0)
		{
			cout << "Yes" << endl;
			return 0;
		}
		
		a -= d;
		if (a <= 0)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}


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

using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
#define re return
#define mp make_pair
#define se second
#define sz(a) (int)a.size()
typedef long long ll;

const ll mod = 1e9 + 7;
ll n;
string s, ans;
void solve() {
	for (int i = 1; i + 1 < n; i++) {
		int k = 0;
		if (s[i] == 'x') k = 1;
		if (ans[i] == 'W') k = 1 - k;
		if (k == 0)
			ans += ans[i - 1];
		else {
			if (ans[i - 1] == 'S')
				ans += 'W';
			else
				ans += 'S';
		}
	}
	//cout << ans<< "\n";
	int k = 0;
	if (s[n - 1] == 'x')
		k = 1;
	if (ans[n - 1] == 'W')
		k = 1 - k;
	if ((k && ans[0] == ans[n - 2]) || (k == 0 && ans[0] != ans[n - 2]))
		re;
	k = 0;
	if (s[0] == 'x') k = 1;
	if (ans[0] == 'W')
		k = 1 - k;
	if ((k && ans[1] == ans[n - 1]) || (k == 0 && ans[1] != ans[n - 1]))
		re;
	cout << ans << "\n";
	exit(0);
}

int main() {
	iostream::sync_with_stdio(0);
	//freopen("a.in", "r", stdin);
	cin >> n >> s;
	ans = "SS";
	solve();
	ans = "SW";
	solve();
	ans = "WS";
	solve();
	ans = "WW";
	solve();
	cout << "-1\n";
}	

Measured memory_bytes: 720
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll n,a,b; cin >> n >> a >> b;
  //nCk
  vector<vector<ll>> com(n+1, vector<ll>(n+1,0));
  REP(i,n+1){
    com[i][0] = 1;
    com[i][i] = 1;
  }
  FOR(i,1,n+1) FOR(j,1,n) com[i][j] = com[i-1][j-1] + com[i-1][j]; 

  double avg = 0.0;
  ll ans = 0;
  map<ll,ll> cnt;
  REP(i,n){
    ll v; cin >> v;
    cnt[v]++;
  }
  auto it = cnt.rbegin();
  ll maxi = it->first;
  ll num = it->second;
  ll used = 0;
  if(num >= a){
    b = min(num,b);
    avg = maxi;
    FOR(i,a,b+1) ans += com[num][i]; 
  }else{
    while(1){
      ll val = it->first;
      num = it->second;
      if(used + num >= a){
        avg += 1.0 * val * (a-used);
        avg /= 1.0 * a;
        ans = com[num][a-used];
        break;
      }
      avg += 1.0 * val * num;  
      used += num;
      it++;
    }
  }
  cout << fixed << setprecision(10);
  cout << avg << endl << ans << endl;
}



Measured memory_bytes: 256
import java.util.*; 
import java.io.*;

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

        char S[] = next().toCharArray();
        char T[] = next().toCharArray();

        int ans = 0;

        for (int i=0; i<S.length; i++) {
            if(S[i]!=T[i]){
                ans ++;
            }
        }

       
        System.out.println(ans);
 
        
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}


Measured memory_bytes: 37748
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<string,int>> vpsi;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////

char c;
cin >> c;c++;
fin(c);

//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <functional>
#include <cmath>
#include <cstdint>
#include <mutex>
#include <thread>
#include <bitset>

using namespace std;

int main()
{
	int n;
	int a;
	int flag = 1;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a;
		if (a % 2 == 0)
		{
			if (a % 3 == 0 || a % 5 == 0)
			{

			}
			else
			{
				flag = 0;
			}
		}
	}

	if (flag)
		cout << "APPROVED" << endl;
	else
		cout << "DENIED" << endl;

	return 0;
}


Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    ab = []
    ba = []
    for i in range(3):
        if a[i]-b[i] < 0:
            ab.append((a[i],b[i]))
        elif a[i]-b[i] > 0:
            ba.append((a[i],b[i]))

    dp = [0]*(n+1)
    if len(ab) > 0:
        for i in range(n+1):
            dp[i] = i
            for x,y in ab:
                if i >= x:
                    dp[i] = max(dp[i],dp[i-x]+y)
    p = max(n,dp[n])

    dp2 = [0]*(p+1)

    if len(ba) > 0:
        for i in range(p+1):
            dp2[i] = i
            for y,x in ba:
                if i >= x:
                    dp2[i] = max(dp2[i],dp2[i-x]+y)
    print(max(p,dp2[-1]))
if __name__ == '__main__':
    main()

Measured memory_bytes: 228764
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

struct Edge {
    int a;
    int b;
    Edge(){}
    Edge(int a, int b) {
        this-> a = a;
        this-> b = b;
    }
};

bool isBridge(int from, int to, vector<Edge> edges, int num) {
    set<int> s;
    queue<int> q;
    s.insert(from);
    q.push(from);
    while(!q.empty()) {
        int front = q.front();
        q.pop();
        if(front == to)
            return false;
        for(int i = 0; i < edges.size(); i++) {
            if(i == num)
                continue;
            if(edges[i].a == front) {
                if(s.find(edges[i].b) == s.end()) {
                    s.insert(edges[i].b);
                    q.push(edges[i].b);
                }
            }
            if(edges[i].b == front) {
                if(s.find(edges[i].a) == s.end()) {
                    s.insert(edges[i].a);
                    q.push(edges[i].a);
                }
            }
        }
    }
    return true;
}

int main() {
    int n,m; cin >> n >> m;
    vector<Edge> edges(m);
    int a,b;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        edges[i] = Edge(a,b);
    }
    int num = 0;
    bool isFinish = false;
    for(int i = 0; i < m; i++){
        isFinish = false;
        for(int from = 1; from < n; from++){
            for(int to = from + 1; to <=n; to++) {
                if(isBridge(from,to,edges,i)){
                    num++;
                    isFinish = true;
                    break;
                }
            }
            if(isFinish)
                break;
        }
    }
    cout << num << endl;
}



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

using namespace std;

int main(){
    int K, X;
    cin >> K >> X;

    for (int i = X-K+1; i < X+K; i++){
        cout << i << " ";
    }

    return 0;
}


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

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

  int sum = 0;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;

    sum += a;
  }

  if(sum >= h){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if(a==1) a += 13;
  if(b==1) b += 13;
  
  if(a==b){
    cout << "Draw" << endl;
  }
  
  else if(a>b){
    cout << "Alice" << endl;
  }
  
  else cout << "Bob" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int N=100005;
int w,h,k;
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
long long solve(int w,int h)
{
	long long res=0;
	for(int d=0;d<h;d++)
		for(int a=1;a<w;a++)
		{
			int R=2*k-a*d+gcd(d,w)-2;
			if(R<0) break;
			int b=min(h-1-d,R/w);
			int tmp=b;
			b++;
			if(b+d<h&&1LL*w*b-gcd(w-a,b+d)-gcd(a,b)<=R) tmp++;
			if(d==0) res+=tmp;
			else res+=tmp*2;
		}
	return res*2;
}
int main()
{
	scanf("%d%d%d",&w,&h,&k);
	printf("%lld",solve(w,h)+solve(h,w));
	return 0;
}

Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
long long a=0;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout.setf(ios_base::fixed,ios_base::floatfield);
    int n,m;
    cin>>n>>m;
    cout<<max({n+m,n-m,n*m})<<'\n';
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
long h[100005], f[100005];
int main()
{
	int n;
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		cin >> h[i];
	}
	f[1] = 0;
	f[2] = abs(h[1] - h[2]);
	for(int i=3;i<=n;i++)
	{
		f[i] = min(f[i-1] + abs(h[i] - h[i-1]), f[i-2] + abs(h[i] - h[i-2]));
	}
	cout << f[n];
	return 0;
} 

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;
int combination(int n, int r)
{
	if (r == 0 || r == n)
		return (1);
	else if (r == 1)
		return (n);
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

int main(void) {

	long  N=0,A=0,B=0;
	
	cin >> N;

	if (N >= 1000) {
		N -= 999;
		cout << "ABD" << endl;
	}
	else {
		cout << "ABC" << endl;
	}
	
	

	

	return 0;

}


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

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;

int main() {
  int n;
  cin >> n;
  
  vector<pair<string, int>> restaurants(n);
  vector<int> indices(n);
  for (int i = 0; i < n; ++i) {
    cin >> restaurants[i].first >> restaurants[i].second;
    restaurants[i].second *= -1;
    indices[i] = i;
  }
  
  sort(indices.begin(), indices.end(), [&](int i, int j) {
    return restaurants[i] < restaurants[j]; 
  });
  for (int idx : indices) {
    cout << idx + 1 << "\n";
  }
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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;}

void YES(bool b) {cout << (b?"YES\n":"NO\n");}
void Yes(bool b) {cout << (b?"Yes\n":"No\n");}
void yes(bool b) {cout << (b?"yes\n":"no\n");}
void Yay(bool b) {cout << (b?"Yay!\n":":(\n");}

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,ans=0;
	map<ll,ll> m;
	cin >> n;
	vll a(n);
	rep(i,n) cin >>a[i];
	sort(all(a));
	rep(i,n){
		m[a[i]]++;
		if((a[i]!=a[i+1] || i==n-1) && m[a[i]]%2==1) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    if (abs(c-a) <= d) {
        cout << "Yes" << endl;
    }
    else if (abs(a-b) <= d && abs(b-c) <= d) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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


using namespace std;


int main(void) {
    int X, N;
    cin >> X >> N;
    vector<bool> exists(102, false);
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        exists[p] = true;
    }

    int diff = 101;
    int ans = X;
    for (int i = 0; i <= 101; i++) {
        if (exists[i])
            continue;
        if (abs(X - i) < diff) {
            diff = abs(X - i);
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_M = 10005;
const int MAX_N = 5005;

int p[MAX_M];
int sump[MAX_M];
int c[MAX_N];
int e[MAX_N];
int dp[MAX_N][MAX_M];
int m,n;

int main()
{
	scanf("%d%d",&m,&n);
	rep(i,m){
		scanf("%d",&p[i]);
	}
	rep(i,n){
		scanf("%d%d",&c[i],&e[i]);
	}
	sort(p,p+m,greater<int>());
	sump[0] = p[0];
	for(int i=1;i<m;i++){
		sump[i] += sump[i-1] + p[i];
	}
	rep(i,n+1){
		rep(j,m+1){
			dp[i][j] = INF;
		}
	}
	dp[0][0] = 0;
	rep(i,n+1){
		rep(j,m+1){
			dp[i+1][j] = min(dp[i][j],dp[i][max(j-c[i],0)]+e[i]);
		}
	}
	int ans = 0;
	rep(i,m){
		ans = max(ans,sump[i] - dp[n][i+1]);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 22964
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
    std.typecons, std.math, std.container, std.format, std.numeric;

void main(string[] args)
{
    long n;
    readf("%d\n", &n);

    long ans = 0;
    long before = 0;
    long a;
    foreach (i; 0 .. n)
    {
        readf("%d\n", &a);
        long b = a + before;
        ans += b / 2;
        before = (a == 0) ? 0 : b % 2;
    }

    writeln(ans);
}


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

using namespace std;

int a;
int b;
int res;

int main() {
	scanf("%d%d", &a, &b);
	for(int i = a; i <= b; i++) {
		if(i % 10 == i / 10000 && i / 1000 % 10 == i % 100 / 10)
			res++;
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n;
    scanf("%d",&n);
    int h[n];
    for(int i=0;i<n;i++){
        scanf("%d",h+i);
    }
    int ans=0;
    int z;
    for(int i=0;i<n;i++){
        z=1;
        for(int j=0;j<i;j++){
            if(h[j]>h[i])z=0;
        }
        ans+=z;
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;





int main()
{
    ll n;
    cin >> n;
    vector<int>t(n);
    
    vector<int>r;
    for (int i = 0; i < n; i++) {
        cin >> t[i];
        
    }
    int p = 1;
    r.push_back(t[0]);
    for (int i = 1; i < n; i++) {
       
        if (t[i] > r[p-1]) {
            r.push_back(t[i]);
            p++; 
        }
        else {
            
            auto x = lower_bound(r.begin(), r.begin()+p, t[i]);
            
            r[x - r.begin()] = t[i];

        }
    }
    cout << p << endl;
   

    return 0;

}


Measured memory_bytes: 3852
#include <stdio.h>
int main(void)
{
  int n,m;
  int a,b;
  int num[100]={0};
  int i;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++){
    scanf("%d %d",&a,&b);
    num[a-1]+=1;
    num[b-1]+=1;
  }
  for(i=0;i<n;i++){
    printf("%d\n",num[i]);
  }
  return 0;
}

Measured memory_bytes: 128
N = int(input())
LRs = [tuple(map(int, input().split())) for _ in range(N)]


# [L1, R1]は最小のRを、[L2, R2]は最大のLを含む。L1を減らす形で走査。
R1 = min(map(lambda t: t[1], LRs))
L2 = max(map(lambda t: t[0], LRs))
LRs.sort(key=lambda t: (-t[0], t[1])) # Lについて降順、L同じならRについて昇順

ans = 0
R2 = 1001001001
for i in range(1, N):
    R2 = min(R2, LRs[i-1][1])
    L1 = LRs[i][0]  # LRsはLについて降順ソート済みより
    ans = max(ans, max(0, R2 - L2 + 1) + max(0, R1 - L1 + 1))


# 加えて、コンテスト1つだけ行うときを場合分け
LRs.sort(key = lambda t: t[0] - t[1])
one_problem_contest = LRs[0][1] - LRs[0][0] + 1
L_max = max(map(lambda t: t[0], LRs[1:]))
R_min = min(map(lambda t: t[1], LRs[1:]))
ans = max(ans, one_problem_contest + max(R_min - L_max + 1, 0))

print(ans)


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

ll nc2(int tmp){
  return (ll)tmp * (tmp - 1) / 2;
}

int main(){
  int N;
  cin >> N;
  map<int, int> check;
  vector<int> Ai(N);
  int A;
  rep(i, N){
    cin >> A;
    Ai.at(i) = A;
    check[A]++;
  }
  ll cases = 0;
  for(auto itr : check){
    if(itr.second > 1){
      int tmp = itr.second;
      cases += nc2(tmp);
    }
  }
  ll ans;
	rep(i, N){
    ans = cases;
	    ans -= nc2(check[Ai.at(i) ]);
	    ans += nc2(check[Ai.at(i) ] - 1);
    cout << ans << endl;
  }
  
}

Measured memory_bytes: 8320
n,m=map(int,input().split())
M,F=10**9+7,[1]
for i in range(m): F+=[-~i*F[i]%M]
c=lambda n,r: F[n]*pow(F[r]*F[n-r],M-2,M)
p=lambda n,r: F[n]*pow(F[n-r],M-2,M)
print(sum((-1)**k*c(n,k)*p(m,k)*p(m-k,n-k)**2 for k in range(n+1))%M)

Measured memory_bytes: 104884
#![allow(non_snake_case)]
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n:usize = sc.read();
    let k:i64 = sc.read();
    let mut a:Vec<i64> = sc.vec(n);
    let mut f:Vec<i64> = sc.vec(n);
    a.sort();
    f.sort();

    let mut l: i64 = 0;
    let mut r: i64 = 1000000000001;
    while r - l >= 2{
        let m = (l+r)/2;
        let mut t: i64 = 0;
        for i in 0..n{
            if a[i]*f[n-1-i] <= m{
                continue
            }
            t += (a[i]*f[n-1-i]-m+f[n-1-i]-1)/f[n-1-i];
        }
//        println!("{} {} {} {}", t,l, m,r );
        if t <= k{
            r = m
        }else{
            l = m
        }
    }
    if l == 0 {
        println!("{}", l);
    }else{
        println!("{}", l+1);
    }
    
    
    
    
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}




Measured memory_bytes: 10492
#include<cstdio>
#include<cmath>
using namespace std;

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

// note: theta[rad]
void rotate( double &x, double &y, const double &theta ){
	double nx, ny;
	nx = x*cos(theta) - y*sin(theta);
	ny = x*sin(theta) + y*cos(theta);
	x = nx;
	y = ny;
}

int main(){
	double p[2][2], q[2];
	while( scanf("%lf,%lf,%lf,%lf,%lf,%lf",&p[0][0],&p[0][1],&p[1][0],&p[1][1],&q[0],&q[1]) == 6 ){
		double bias[2] = { p[0][0], p[0][1] };
		p[0][0] -= bias[0];		p[0][1] -= bias[1];
		p[1][0] -= bias[0];		p[1][1] -= bias[1];
		q[0] -= bias[0];		q[1] -= bias[1];
		double theta = atan2(p[1][1]-p[0][1],p[1][0]-p[0][0]);
		rotate( q[0], q[1], -theta );
		double r[2] = { q[0], -q[1] };
		rotate( r[0], r[1], theta );
		r[0] += bias[0];		r[1] += bias[1];
		printf("%lf %lf\n", r[0],r[1]);
	}
	return 0;
}

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

int main(){
    int H,W;
    while (1){
        cin >> H >> W ;
        if (H == 0 && W == 0){
            break;
        } 
        for (int i = 0; i < H; i++){
            if (i == 0 || i == H-1){
                for (int j = 0; j < W; j++){
                    cout << "#";
                }
                cout << endl;
            } else {
                for (int j = 0; j < W; j++){
                    if (j == 0 || j == W-1){
                        cout << "#";
                    } else {
                        cout << ".";
                    }
                }
                cout << endl;
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>

typedef long long ll;

ll pw(ll x,ll n){
    ll ans = 1;
    while(n){
        if(n&1) ans*=x;
        x*=x;
        n>>=1;
    }
    return ans;
}

int main(){
    int K;
    scanf("%d",&K);
    ll ans = 0;
    ll v[K];
    for(int i = K-1;i>=0;i--){
        v[i] = pw(K/(i+1),3LL);
        for(int j = 2*(i+1);j <= K;j+=(i+1)) v[i] -= v[j-1];
    }
    for(int i = 0;i<K;i++) ans+=(v[i]*(i+1LL));
    printf("%lld\n",ans);
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int n;
    cin >> n;
    int co=0;
    int c=0;
    for(int i=0;i<n;i++){
        string str;
        cin >> str;
        str+=str;
        for(int j=0;j<10;j++){
            string a;
            a.assign(str,j,(int)s.size());
            if(a==s) co++;
        }
        if(co!=0) c++;
        co=0;
    }
    cout << c <<endl;
    return 0;
}



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

using namespace std;
const int N = 2e3 + 3, MOD = 1e9 + 7;
int n, m, a[N], b[N], mem[N][N][3];
int go(int i, int j, int state) {
	if (i == n || j == m)
		return 0;
	int &ret = mem[i][j][state];
	if (~ret)
		return ret;
	ret = 0;
	if (state == 0) {
		ret = (go(i + 1, j, 0) + go(i, j, 1)) % MOD;
	} else if (state == 1) {
		ret = (go(i, j + 1, 1) + go(i, j, 2)) % MOD;
	} else if (a[i] == b[j]) {
		ret = (ret + go(i + 1, j + 1, 0) + 1) % MOD;
	}
	return ret;
}
int main() {
#ifndef ONLINE_JUDGE
//	freopen("input.in", "r", stdin);
#endif
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	for (int i = 0; i < m; ++i)
		scanf("%d", b + i);
	memset(mem, -1, sizeof mem);
	printf("%d\n", (go(0, 0, 0) + 1) % MOD);
	return 0;
}


Measured memory_bytes: 47488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{	
	ll a,b,n,t;
	cin>>a>>b>>n;
	t=min(b-1,n);
	cout<<floor(a*t/b)-a*floor(t/b)<<endl;
	return 0;
}

Measured memory_bytes: 3784
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,K=MAP()

print(N-K+1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using V = vector<int>;
using VV = vector<V>;
using P = pair<int, int>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
inline int fLog2(int x) { return 31-__builtin_clz(x); } // floor(log2(x))


template<typename T>
struct RMQ {
  vector<T> v; VV st;
  int op(int a, int b) { return (v[a] == v[b]) ? min(a, b) : ((v[a] < v[b]) ? a : b); }
  void init(const vector<T> &_v) {
    v = _v;
    int n = v.size();
    st = {V(n)}; iota(all(st[0]), 0);
    for (int j=0; n>>(j+1); ++j) {
      int m = n-(1<<(j+1))+1;
      st.push_back(V(m));
      rep(i, m) st[j+1][i] = op(st[j][i], st[j][i+(1<<j)]);
    }
  }
  int index(int l, int r) { int d = fLog2(r-l); return op(st[d][l], st[d][r-(1<<d)]); }
  T query(int l, int r) { return v[index(l, r)]; }
};


template<typename T>
struct LCA {
  struct edge {
    int v, c; T w;
    edge(int v, int c, T w) : v(v), c(c), w(w) {}
  };
  vector<vector<edge>> G;
  V tl, tour, dep;
  vector<T> distr;
  RMQ<int> R;
  int r;

  vector<vector<T>> distrc;
  vector<vector<T>> cntc;
  vector<vector<T>> ttc;
  int tt = 0;

  LCA(int n) : G(n), tl(n), tour(2*n), dep(2*n), distr(n), distrc(n, V(1)), cntc(n, V(1)), ttc(n) {}
  void add_edge(int u, int v, int c, int w) {
    G[u].emplace_back(v, c, w);
    G[v].emplace_back(u, c, w);
  }
  void dfs(int &t, int u, int p=-1, int d=0) {
    tour[t] = u; dep[t] = d;
    tl[u] = t++;
    for (auto &[v, c, w] : G[u]) if (v != p) {
      distr[v] = distr[u] + w;
      distrc[c].push_back(w);
      cntc[c].push_back(1);
      ttc[c].push_back(tt++);
      dfs(t, v, u, d+1);
      distrc[c].push_back(-w);
      cntc[c].push_back(-1);
      ttc[c].push_back(tt++);
    }
    tour[t] = p; dep[t] = d-1;
    ++t;
  }
  void init(int _r=0) {
    r = _r; int t = 0; dfs(t, r); R.init(dep);
    for (auto &v : distrc) rep(i, v.size()-1) v[i+1] += v[i];
    for (auto &v : cntc) rep(i, v.size()-1) v[i+1] += v[i];
  }
  int lca(int u, int v) { return tour[R.index(min(tl[u], tl[v]), max(tl[u], tl[v]))]; }
  int dist(int u, int v) { return distr[u] + distr[v] - 2*distr[lca(u, v)]; }
  int dist2(int x, int y, int u) {
    int res = 0;
    int &i = tl[u];
    int ii = lower_bound(all(ttc[x]), i) - ttc[x].begin();
    res += distr[u];
    res -= distrc[x][ii];
    res += cntc[x][ii] * y;
    return res;
  }
  int query(int x, int y, int u, int v) {
    int a = lca(u, v);
    int res = 0;
    res += dist2(x, y, u);
    res += dist2(x, y, v);
    res -= 2*dist2(x, y, a);
    return res;
  }
};


int main() {
  int n, q; cin >> n >> q;
  LCA<int> G(n);

  rep(i, n-1) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    --a, --b;
    G.add_edge(a, b, c, d);
  }
  
  G.init();

  rep(_, q) {
    int x, y, u, v; cin >> x >> y >> u >> v;
    --u, --v;
    cout << G.query(x, y, u, v) << '\n';
  }

  return 0;
}


Measured memory_bytes: 50660
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)

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

    bool flag = false;
    rep(i, 0, n / 4 + 1) {
        rep(j, 0, n / 7 + 1) {
            if (4 * i + 7 * j == n) {
                flag = true;
            }
        }
    }
    cout << (flag ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    string str;
    cin >> n;
    int maxnum = 0;
    map<string, int> mp;
    for (int i = 0; i < n; i++)
    {
        cin >> str;
        mp[str]++;
        maxnum = max(maxnum, mp[str]);
    }
    for (auto &&i : mp)
    {
        if (i.second == maxnum)
        {
            cout << i.first << "\n";
        }
    }
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
int k,now,i;

signed main(){
	scanf("%d",&k);
	if(k%2==0 || k%5==0){
		printf("-1\n");
		return 0;
	}
	while(i<100000000){
		i++;
		now=(now*10+7)%k;
		if(now==0){
			printf("%d\n",i);
			return 0;
		}
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main(){
  int count=0;
  string s1,s2="CODEFESTIVAL2016";
  cin >> s1;
  r(i,s1.length()){
    if(s1.at(i)!=s2.at(i))count++;
  }
  cout << count<<endl;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int n;
	while(cin >> n)
		cout << 1 + (n + 1) * n / 2 << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int N,Z,W;
  cin>>N>>Z>>W;
  int a[N];
  for(int i=0;i<N;i++) cin>>a[i];
  if(N==1) cout<<abs(a[0]-W)<<endl;
  else cout<<max(abs(a[N-1]-W), abs(a[N-2]-a[N-1]))<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int r,d,x;
  scanf("%d %d %d",&r,&d,&x);
  for(int i = 0; i < 10; ++i){
    x = r*x - d;
    printf("%d",x);
    if(i < 9) printf("\n");
  }
  return 0;
}

Measured memory_bytes: 128
n=int(input())
ab=[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append([a+b,a,b])
ab.sort(reverse=True)
#print(ab)

taka=0
aoki=0

for i in range(1,n+1):
    if i%2!=0:
        taka+=ab[i-1][1]
    else:
        aoki+=ab[i-1][2]
ans=taka-aoki
print(ans)

Measured memory_bytes: 29156