akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){
    ll n,m;
    cin>>n>>m;
    cout<<n*m<<endl;
    
    
    return 0;
}



Measured memory_bytes: 3104
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    n: i64,
    a: i64,
    b: i64,
    c: i64,
    d: i64,
  }
  let mut ans = false;
  for pos in 0 .. n {
    let neg = n - 1 - pos;
    let min = a + c * pos - d * neg;
    let max = a + d * pos - c * neg;
    if min <= b && b <= max {
      ans = true;
      break;
    }
  }

  println!("{}", if ans { "YES" } else { "NO" });
}


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

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

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

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



void solve(){
  ll h,w,ch,cw,dh,dw;
  cin >>h >> w >> ch >> cw >> dh >> dw;
  ch--;
  cw--;
  dh--;
  dw--;
  
  vs s(h);
  rep(i,0,h) cin >> s[i];
  
  queue<P> q,r;
  
q.push(P(ch,cw));

 vvll d(h,vll(w,-1));
 d[ch][cw]=0;
while(q.size()){
 P p=q.front();
 q.pop();
 ll x=p.fi,y=p.se;
 r.push(P(x,y));
rep(i,0,4){
 ll ix=x+dx[i];
 ll iy=y+dy[i]; 
 if(ix>=h||ix<0||iy>=w||iy<0) continue;
 if(s[ix][iy]=='#') continue;
 if(d[ix][iy]!=-1) continue;
  d[ix][iy]=d[x][y]; 
 q.push(P(ix,iy));
}
 if(q.empty()){ 
   while(r.size()){
      P p=r.front();
      r.pop();
     ll x=p.fi,y=p.se;
   rep(i,-2,3){
    rep(j,-2,3){
     ll ix=x+i;
     ll iy=y+j; 
   if(ix>=h||ix<0||iy>=w||iy<0) continue; 
   if(s[ix][iy]=='#') continue;   
   if(d[ix][iy]!=-1) continue;
   d[ix][iy]=d[x][y]+1;  
     q.push(P(ix,iy)); 
   }
   }
     
   }
   
 }
  
}
  
  
  
  cout <<d[dh][dw] << endl;
  
  
  
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

bitset<55560> prime;

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    int n;
    cin >> n;

    cout << 2;

    for(int i = 2; i <= 55555 && n > 1; ++i){
        if(prime[i]) continue;
        if((i - 1) % 10 == 0){
            cout << " " << i;
            --n;
        }
        for(int j = i * i; j <= 55555; j += i)
            prime[j] = 1;
    }

    return 0;
}


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

int main() {
  int H,N = 0;cin >> H >> N;
  int A[N] = {0};
  int sum = 0;
  for(int i = 0 ;i < N;i++){
    cin >> A[i];
    sum = sum + A[i];
  }
  if(sum >= H){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n, w, i, j, wt;
    cin >> n >> w;
    long long dp[w+1] = {0}, v;
    for(i = 0; i < n; ++i) {
        cin >> wt >> v;
        for(j = w; j >= wt; --j) 
			dp[j] = max(dp[j], dp[j-wt] + v);
    }
    cout << dp[w];
    return 0;
}

Measured memory_bytes: 4412
w, h, n = gets.chomp.split.map(&:to_i)

l = [0,0]
r = [w,h]

n.times do |i|
  x, y, a = gets.chomp.split.map(&:to_i)
  case a
  when 1 then
    l[0] = x if l[0] < x
  when 2 then
    r[0] = x if x < r[0]
  when 3 then
    l[1] = y if l[1] < y
  when 4 then
    r[1] = y if y < r[1]
  end
end
if l[0] >= r[0] || l[1] >= r[1]
  puts 0
else
  puts (r[0] - l[0]) * (r[1] - l[1])
end

Measured memory_bytes: 1788
macro_rules! input {
    ( $( $var:ident : $t:tt ),* ) => {
        use std::io::{stdin, Read};
        let mut bytes = stdin().bytes();
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        $(let $var = read_value!(next, $t);)*
    };

    ( $( $var:ident : $t:tt ),+ ,) => {
        input!{ $($var : $t),* }
    };
}

macro_rules! read_value {
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
        a: [u32; n]
    };

    let mut a = a.iter().enumerate().map(|(i, x)| (x, i + 1)).collect::<Vec<_>>();
    a.sort();
    a.iter().map(|&(&_, i)| {
        println!("{}", i);
    }).collect::<Vec<_>>();
}

Measured memory_bytes: 6908
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final char[] input = sc.next().toCharArray();
		
		for(int i = 0; i < input.length - 1; i++){
			if(input[i] == input[i + 1]){
				System.out.println((i + 1) + " " + (i + 2));
				return;
			}
		}
		for(int i = 0; i < input.length - 2; i++){
			if(input[i] == input[i + 2]){
				System.out.println((i + 1) + " " + (i + 3));
				return;
			}
		}
		
		System.out.println("-1 -1");
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}	
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 10836
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = 1; i < (ll)(n); i++)
#define P pair<ll, ll>
typedef long long ll;
const ll mod = 1e9+7;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//繰り返し自乗法によるmod累乗計算
//a = 底、　n = 指数
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//nCa 
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}

int main(){
  int h, w;
  cin >> h >> w;
  char mp[55][55];
  rep(i,h)rep(j,w) cin >> mp[i][j];
  int a[55][55] = {};

  rep(i,h){
    rep(j,w){
      if(mp[i][j] == '.'){
        for(int di = i-1; di <= i+1; di++){
          for(int dj = j-1; dj <= j+1; dj++){
            if(di < 0 || dj < 0 || di >= h || dj >= w) continue;
            if(mp[di][dj] == '#') a[i][j]++;
          }
        }
      }
      else{
        a[i][j] = -1;
      }
    }
  }

  rep(i,h){
    rep(j,w){
      if(a[i][j] == -1) cout << '#';
      else cout << a[i][j];
    }
    cout << endl;
  }
}






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

int main(){
  int n,dp[4010]={1};
  for(int i=0;i<4;i++)
    for(int j=4000;j>=0;j--)
      for(int k=1;k<=1000;k++)
	if(j+k<=4000)dp[j+k]+=dp[j];

  while(cin>>n)cout << dp[n]<<endl;
  return 0;
}

Measured memory_bytes: 1184
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
s = 0
t = 0
for i in range(n):
  ai = a[i]
  s = (s+ai)%mod
  t = (t+ai**2)%mod
s = (s*s)%mod
x = (s -t)%mod
if x%2 == 0:
  print(x//2)
else:
  print((x+mod)//2)
  
             

Measured memory_bytes: 94216
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int a,b;cin>>a>>b;
	int k=ceil(a*1.0/b);
	cout<<k<<endl;
}

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

}

Measured memory_bytes: 256
<?php
function check($m, $f, $r) {

  if ($m == -1 or $f == -1) return "F";

  $s = $m + $f;
  if ($s >= 80) return "A";
  if ($s >= 65) return "B";
  if ($s >= 50) return "C";
  if ($s >= 30) {
    if ($r >= 50) return "C";
    return "D";
  }
  return "F";
}

$input = trim(fgets(STDIN));
List($m, $f, $r) = explode(" ", $input);

while (($m != -1) or ($f != -1) or ($r != -1)) {
  $p = check($m, $f, $r);
  echo $p . PHP_EOL;

  $input = trim(fgets(STDIN));
  List($m, $f, $r) = explode(" ", $input);
}

Measured memory_bytes: 15232
n=input()
p=2019
t=1
y=0
c=[0]*p
for x in map(int,n[::-1]):
  y+=t*x
  y%=p
  c[y]+=1
  t*=10
  t%=p
print(sum(i*(i-1)//2 for i in c)+c[0])


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

using namespace std;

int main() {
	int N;
	cin>>N;
	vector<int> l(N);
	for (int i = 0;i < N;++i) {
		cin>>l[i];
	}

	sort(l.begin(), l.end());
	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[k] > l[i] + l[j]) break;
				if (l[i] < l[j] + l[k] && l[j] < l[i] + l[k] && l[k] < l[i] + l[j]) ++ans;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
	int x[6];
	for (int i = 1; i <= 5; i++) {
		cin >> x[i];
	}
	int ans = -1;
	for (int i = 1; i <= 5; i++) {
		if (x[i] == 0) {
			ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    string s;
    cin >> s;
    
    string t;
    int x = 0;
    vector<int> cnt;
    REP(i, size(s)){
        if(s[i] == 'x'){
            x++;
        }else{
            t += s[i];
            cnt.push_back(x);
            x = 0;
        }
    }
    cnt.push_back(x);

    string u = t;
    reverse(all(u));

    if(t != u){
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;

    REP(i, size(cnt)/2){
        ans += abs(cnt[i] - cnt[size(cnt) - 1 - i]);
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 1148
#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>

using namespace std;

#define ll long long int
#define ti4 tuple<int,int,int,int>
#define pii pair<ll,ll>

static const int MOD = 1e9 + 7;

int main()
{
    int n,k, x,y;
    cin >> n >> k >> x >> y;
    
    if(n <= k)
    {
        cout << x * n << endl;
        return 0;
    }
    int sum = x * k;
    sum += (n-k) * y;
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 764
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll x,y;
        cin>>x>>y;
        ll a,b,c;
        cin>>a>>b>>c;
        priority_queue<pair<ll,ll>>pq;
        ll ans[c+2];
            ans[0]=0;
        for(int i=1;i<=a;i++)
        {
            ll h;
            cin>>h;
            pq.push({h,1});
        }
        for(int i=1;i<=b;i++)
        {
            ll h;
            cin>>h;
            pq.push({h,2});
        }
        for(int i=1;i<=c;i++)
        {
            ll h;
            cin>>h;
            ans[i]=h;
        }
        sort(ans+1,ans+1+c);
        
        ll sum=0;
        ll op=0,oq=0;
        ll final=0;
        ll cnt=0;
        ans[c+1]=0;
        for(int i=c;i>=1;i--)
            ans[i]+=ans[i+1];
        while(!pq.empty())
        {
           // cout<<pq.top().F<<" ";
            if(pq.top().S==1)
            {
                op++;
                if(op<=x)
                    sum+=pq.top().F,cnt++;
            }
            else
            {
                oq++;
                if(oq<=y)
                    sum+=pq.top().F,cnt++;
            }
            //cout<<op<<oq<<sum<<" ";
            if(x+y-cnt<=c)
            {
                final=max(final,sum+ans[c-x-y+cnt+1]);
            }
            pq.pop();
            //cout<<final<<" ";
        }
        cout<<final;



    }
    return 0;
}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll; // 10^19



int main(void){
    int n;
    cin >> n;
    vector <ll> x(100000);
    REP(i,n)
        cin >> x[i];
    REP(i,n){
		if(x[i]==0){
			cout<<0;
			return 0;
		}
	}
    ll t=1;
	REP(i,n){
		if(1000000000000000000/t<x[i]){
			cout<<-1;
			return 0;
		}
		t*=x[i];
	}
	cout<<t;
    return 0;
}

Measured memory_bytes: 3984
#include <cstdio>
#define MOD 1000000007
typedef long long ll;
inline ll quick_pow(ll a, int n)
{
	ll res = 1; 
	while (n)
	{
		if (n & 1)
			res = res * a % MOD; 
		a = a * a % MOD;
		n >>= 1; 
	}
	return res; 
}
ll fact[4005], inv[4005]; 
inline ll C(int n, int m)
{
	if (n < m || m < 0)
		return 0; 
	return fact[n] * inv[m] % MOD * inv[n - m] % MOD; 
}
int main()
{
	// freopen("CF17-QB-E.in", "r", stdin); 
	fact[0] = inv[0] = 1; 
	for (int i = 1; i <= 4000; i++)
	{
		fact[i] = fact[i - 1] * i % MOD; 
		inv[i] = quick_pow(fact[i], MOD - 2); 
	}
	int a, b; 
	scanf("%d%d", &a, &b); 
	ll ans = a + 1; 
	for (int i = 1; i <= b; i++)
	{
		for (int j = 1; j <= b - i; j++)
			(ans += C(b - 1, i - 1) * C(b - i - 1, j - 1) % MOD * C(a - (b - i) - (b - i - j) + 2, 2)) %= MOD; 
	}
	printf("%lld\n", ans);
	return 0; 
}


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

using namespace std;

int main(){
    int N;
    cin >> N;
    int a,b,c;
    a = N%10;
    b = N/10%10;
    c = N/100%10;
    if(a==7 || b==7 || c==7){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define maxn 100010
#define LL long long
#define inf 0x3f3f3f3f

int n,m,k;
int a[maxn];
string s;
int root;

int main(){
//	freopen("test.txt","r",stdin);
	cin>>s;
	n=s.length();
	for(int i=1;i<=n;i++) a[i]=(s[i-1]=='1');
	for(int i=1;i<=n;i++)
		if(a[i]!=a[n-i]){
			puts("-1");
			return 0;
		}
	if(a[1]==0||a[n-1]==0||a[n]==1){
		puts("-1");
		return 0;
	}
	root=1;
	for(int i=1;i<n;i++){
		printf("%d %d\n",root,i+1);
		if(a[i]==1){
			root=i+1;
		}else{
			
		}
	}
	
    return 0;
}

Measured memory_bytes: 2048
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;

int main() {
    int N;
    cin >> N;
    if (N >= 1000) {
        cout << "ABD" << endl;
    } else {
        cout << "ABC" << endl;
    }
}


Measured memory_bytes: 256
#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;

#define ll long long
#define eb emplace_back
#define nl '\n'
#define deb(x) cerr << #x" = " << x << nl
#define in() ( { int a ; scanf("%d", &a); a; } )
template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 3e5 + 9;
const int mod = 1e9 + 7;
const ll inf = 1e18;

ll yo(vector<ll> a, vector<ll> b, ll x)
{
    if(x < 0) reverse(a.begin(), a.end());
    int r = (int)b.size() - 1;
    ll ans = 0;
    for(int l = 0; l < a.size(); l++){
        while(r >=0 && a[l] * b[r] > x) r--;
        ans += r + 1;
    }
    return ans;
}
ll yo1(vector<ll> a, ll x)
{
    ll p = a.size();
    ll ans = yo(a, a, x) ;
    for(int i = 0; i < (int)a.size(); i++) ans -= a[i] * a[i] <= x;
    return ans / 2;
}
int a[N];
int32_t main()
{
    ios_base::sync_with_stdio(0);
    //vector<ll> a = {0, 0, 0, 0 ,0, 2, 3, 4, 5}, b = {1, 2, 3 };
    //cout << yo1(a, 500000000000) << nl;
    int n; cin >> n;
    ll k; cin >> k;
    vector<ll> pos, neg, nn;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] >= 0) pos.eb(a[i]);
        else neg.eb(-a[i]), nn.eb(a[i]);
    }
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());
    sort(nn.begin(), nn.end());
    ll l = - inf, r = inf, ans;
    while(l <= r){
        ll mid = (l + r) / 2;
        //deb(mid);
        ll cnt = 0;
        if(mid >= 0){
            cnt = yo1(pos, mid) + yo1(neg, mid) + (ll)pos.size() * (ll)neg.size();
        }
        else{
            cnt = yo(pos, nn, mid);
        }
        //deb(cnt);
        if(cnt >= k){
            ans = mid; r = mid - 1;
        }
        else l = mid + 1;
    }
    cout << ans << nl;
    return 0;
}


Measured memory_bytes: 8548
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <set>
#include <string.h>
#include <functional>

using namespace std;


int main()
{
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a<40)
        a=40;
    if(b<40)
        b=40;
    if(c<40)
        c=40;
    if(d<40)
        d=40;
    if(e<40)
        e=40;
    cout<<(a+b+c+d+e)/5<<endl;
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main(){
  long long N,K;cin>>N>>K;
  if(K%2!=0){
    long long count=0;
    long num=K;
    while(num<=N){
      count++; num+=K;
    }
    cout<<count*count*count<<endl;
    return 0;
  }
  else{
    long long count=0;
    long long num=K;
    long long ans=0;
    while(num<=N){
      count++;num+=K;
    }
    ans+=count*count*count;
    num=K/2;
    count=0;
    while(num<=N){
      count++;num+=K;
    }
    ans+=count*count*count;
    cout<<ans<<endl;
    return 0;
  }
}


Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
li = [input() for _ in range(h)]
for i in range(h):
    li[i] = '#' + li[i] + '#'
d = deque(li)
d.appendleft('#'*(w+2))
d.append('#'*(w+2))
for s in d:
    print(s)

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a >= 13) {
    cout << b << '\n';
  } else {
    if (a <= 5) {
      cout << 0 << '\n';
    } else {
      cout << b / 2 << '\n';
    }
  }
  return 0;
}

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

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

int main()
{
    int A, B;
    cin >> A >> B;
    cout << ((A * B * (A + B)) % 3 == 0 ? "Possible" : "Impossible") << endl;
}

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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

typedef long long ll;
typedef pair<int,int> pii;

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5 + 9, M = 2e3 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


int main(){
    init();

    string s;   cin >> s;
    int i = 0;
    while(s[i] != 'A')i++;
    int j = s.size() - 1;
    while(s[j] != 'Z')j--;

    cout << j - i + 1;
}


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


int main() {
    int N;cin>>N;
    vector<char>S(N);
    vector<int>E(N);
    vector<int>W(N);
    int mn =1000000;
    rep(i,N){
        cin>>S[i];
        if(i==0){
            if(S[0]=='E')E[0]=1;
            else W[0]=1;
        }
        else if(S[i]=='E'){
            E[i]=E[i-1]+1;
            W[i]=W[i-1];
            
        }
        else{
            W[i]=W[i-1]+1;
            E[i]=E[i-1];
        }
    }
        
        rep(i,N){
            if(i==0){
                mn =min(mn,E[N-1]-E[0]);
            }
            else if(i!=0 && i!=N-1){
            int a=E[N-1]-E[i];
            int b=W[i-1];
            mn=min(mn,a+b);
            }
            else mn=min(mn,W[N-2]);
        }

cout<<mn<<endl;
}


Measured memory_bytes: 2944
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	long N=sc.nextInt();
    	long A=sc.nextInt();
    	long B=sc.nextInt();

    	if(A>B || (N==1 && A!=B)) {
    		System.out.println("0");
    		return;
    	}

    	long lowbound=(N-1)*A+B;
    	long upeerbound=A+(N-1)*B;

    	long result=upeerbound-lowbound+1;

    	System.out.println(result);
    }


}



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

    class Program
    {
        static void Main()
        {
            var inputList = System.Console.ReadLine().Split(' ').Select((x) => int.Parse(x)).ToList();
            var x = inputList[0];
            var y = inputList[1];


            int kame;
            int turu;
            int kame_turu = x;
            int asi = y;

            //亀の合計
            kame = (asi - kame_turu * 2) / 2;
            if (kame > kame_turu)
            {
                Output("No");
                return;
            }
            //鶴の数
            turu = kame_turu - kame;
            if (turu > kame_turu)
            {
                Output("No");
                return;
            }

            if (turu + kame != kame_turu)
            {
                Output("No");
                return;
            }
            if (turu * 2 + kame * 4 != asi)
            {
                Output("No");
                return;
            }

            Output("Yes");

        }
        private static void Output(string str)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Console.WriteLine(str);

            Console.Out.Flush();
        }
    }

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

int main() {
    int n;
    cin >> n;
    long long a[n];
    long long s;
    long long mod(1e9 + 7);
    long long ans(0);
    for (int i = 0; i < n; ++i) {
            cin >> a[i];
        s += a[i];
        s %= mod;
    }
    for (int i = 0; i < n; ++i) {
        s -= a[i];
        s += mod;
        s %= mod;
        ans += s * a[i] % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
};

Measured memory_bytes: 5160
#include <stdio.h>

int main(){
	int n, p, i, t, c=0;

	t = scanf("%d", &n);
	for(i=0; i<n; i++){
		t = scanf("%d", &p);
		if(p == i+1){
			i++;
			c++;
			t = scanf("%d", &p);
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
fun main(args:Array<String>?): Unit {
    val (n, m) = readLine()!!.trim().split(' ').map(String::toInt)
    val pictures = Array(n){
        val (s, v) = readLine()!!.trim().split(' ').map(String::toInt)
        Picture(s, v)
    }.sortedArrayDescending()
    val frames = IntArray(m){ readLine()!!.trim().toInt() }.sortedArrayDescending()
    var i = 0
    var count = 0
    for (frame in frames) {
        while(i < n && pictures[i].size > frame){
            ++i
        }
        if (i in pictures.indices) {
            ++count
            ++i
        }
    }
    println(count)
}
data class Picture(val size: Int, val value: Int): Comparable<Picture> {
    override fun compareTo(other: Picture): Int {
        return if (value == other.value) size.compareTo(other.size) else value.compareTo(other.value)
    }
}


Measured memory_bytes: 86416
#include <stdio.h>
#include <string.h>

int main(){
	char i[26], j[26], k[26];
	scanf("%s %s %s", &i, &j, &k);
	int a=strlen(i), b=strlen(j);
	if(i[a-1]==j[0] && j[b-1]==k[0]){
		 printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1636
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
void chmin(int &a, int b) { if (a > b) a = b; }
const int INF = 1LL<<29;
const int MAX = 202;

// 入力
int N;
string S;

// 前処理結果
int nG, nR, nY;
int num[MAX][3][3];

int calc_diff(int r, int g, int y, int color) {
    int sum = 0;
    if (color == 0) {
        sum = nR - (r+1) + min(num[r][0][1], nG-g) + min(num[r][0][2], nY-y);
    }
    else if (color == 1) {
        sum = nG - (g+1) + min(num[g][1][0], nR-r) + min(num[g][1][2], nY-y);
    }
    else {
        sum = nY - (y+1) + min(num[y][2][0], nR-r) + min(num[y][2][1], nG-g);
    }
    int res = abs((N-1-sum) - (r+g+y));
    return res;
}

int dp[MAX][MAX][MAX][3];
int solve() {
    // -1 の場合
    N = (int)S.size();
    nR = 0, nG = 0, nY = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'R') ++nR;
        else if (S[i] == 'G') ++nG;
        else ++nY;
    }
    if (nR > (N+1)/2 || nG > (N+1)/2 || nY > (N+1)/2) return -1;
    
    // 前処理
    int num_r = 0, num_g = 0, num_y = 0;
    for (int i = N-1; i >= 0; --i) {
        if (S[i] == 'R') {
            int r_ind = nR - 1 - num_r;
            num[r_ind][0][0] = num_r;
            num[r_ind][0][1] = num_g;
            num[r_ind][0][2] = num_y;
            ++num_r;
        }
        else if (S[i] == 'G') {
            int g_ind = nG - 1 - num_g;
            num[g_ind][1][0] = num_r;
            num[g_ind][1][1] = num_g;
            num[g_ind][1][2] = num_y;
            ++num_g;
        }
        else {
            int y_ind = nY - 1 - num_y;
            num[y_ind][2][0] = num_r;
            num[y_ind][2][1] = num_g;
            num[y_ind][2][2] = num_y;
            ++num_y;
        }
    }
    
    // DP 初期化
    for (int i = 0; i < MAX; ++i)
        for (int j = 0; j < MAX; ++j)
            for (int k = 0; k < MAX; ++k)
                for (int l = 0; l < 3; ++l)
                    dp[i][j][k][l] = INF;
        
    // DP 初期条件
    dp[1][0][0][0] = calc_diff(0, 0, 0, 0);
    dp[0][1][0][1] = calc_diff(0, 0, 0, 1);
    dp[0][0][1][2] = calc_diff(0, 0, 0, 2);
        
    // DP
    for (int r = 0; r <= nR; ++r) {
        for (int g = 0; g <= nG; ++g) {
            for (int y = 0; y <= nY; ++y) {
                if (r < nR) {
                    chmin(dp[r+1][g][y][0], dp[r][g][y][1] + calc_diff(r, g, y, 0));
                    chmin(dp[r+1][g][y][0], dp[r][g][y][2] + calc_diff(r, g, y, 0));
                }
                if (g < nG) {
                    chmin(dp[r][g+1][y][1], dp[r][g][y][0] + calc_diff(r, g, y, 1));
                    chmin(dp[r][g+1][y][1], dp[r][g][y][2] + calc_diff(r, g, y, 1));
                }
                if (y < nY) {
                    chmin(dp[r][g][y+1][2], dp[r][g][y][0] + calc_diff(r, g, y, 2));
                    chmin(dp[r][g][y+1][2], dp[r][g][y][1] + calc_diff(r, g, y, 2));
                }
            }
        }
    }
    
    // 答え
    int res = INF;
    for (int i = 0; i < 3; ++i) chmin(res, dp[nR][nG][nY][i]);
    if (res < INF) return res;
    else return -1;
}
        
int main() {
    cin >> N >> S;
    cout << solve() << endl;
}


Measured memory_bytes: 99796
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	int a;
    string s;
    cin>>a>>s;
    if(a>=3200)OUT(s);
    else OUT("red");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  string n;
  int s;
  
  cin >> n;
  s=0;
  if(n[0]=='1') s +=1;
  if(n[1]=='1') s +=1;
  if(n[2]=='1') s +=1;
  cout << s;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

const int INF=1e18;

int dist(int a,int b,int c){
    return abs(b-a)+abs(c-b);
}

signed main()
{
    int A,B,Q; 
    cin>>A>>B>>Q;
    vint s(A+2),t(B+2);
    REP(i,A) cin>>s[i+1];
    REP(i,B) cin>>t[i+1];

    s[0]=-INF; s[A+1]=INF;
    t[0]=-INF; t[B+1]=INF;

    while(Q--){
        int x; cin>>x;
        vint idxs(2),idxt(2);
        idxs[0]=lower_bound(ALL(s),x)-s.begin();
        idxs[1]=upper_bound(ALL(s),x)-s.begin()-1;
        idxt[0]=lower_bound(ALL(t),x)-t.begin();
        idxt[1]=upper_bound(ALL(t),x)-t.begin()-1;

        int ans=INF;
        REP(i,2) REP(j,2){
            ans=min(ans,dist(x,s[idxs[i]],t[idxt[j]]));
            ans=min(ans,dist(x,t[idxt[j]],s[idxs[i]]));
        }
        cout<<ans<<endl;
    }

}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

LL power(LL x, LL n, LL m) {
  LL res = 1;
  if (n > 0) {
    res = power(x, n/2, m);
    if (n % 2 == 0) res = (res * res) % m;
    else res = (((res * res) % m) * x) % m;
  }
  return res;
}

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

  cout << power(m, n, 1000000007) << endl;
}



Measured memory_bytes: 3060
#include <iostream>

using namespace std;

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

  string week_[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

  int i = 0;

  while(S != week_[i]){
    i++;
    if(i == 8){
      cout << "error" << endl;
      break;
    }
  }
    
  cout << 7-i << endl; 
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

int main()
{
	
	std::string n;
	int k;

	std::cin >> n >> k;

	long long dp[102][2][5] = {};
	dp[0][0][0] = 1;

	const int L = n.length();

	for (int i = 0; i < L; ++i)
	{
		const int D = n[i] - '0';

		for (int j = 0; j < 2; ++j)
		{
			for (int nonzero = 0; nonzero < (k + 1); ++nonzero)
			{
				for (int d = 0; d <= (j ? 9 : D); ++d)
				{
					dp[i + 1][j || d != D][(d == 0 ? nonzero : nonzero + 1)] += dp[i][j][nonzero];
				}
			}
		}
	}

	std::cout << (dp[L][0][k] + dp[L][1][k]) << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


int main(){
	string s;
	cin >> s;
	int n=(int)s.size();
	int ans=0;
	FOR(i,n){
		if(s[i]!=s[n-i-1])ans++;
	}
	cout << ans/2 << endl;
}

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

ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod,n/2);
  else return x * Pow(x,n-1) % mod;
}

int main(){
  ll n;
  cin >> n;
  ll ans = (Pow(10,n) - Pow(9,n)*2 + Pow(8,n)) % mod;
  if(ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}


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

main(){
  int n,i,j,ans=1;
  string s;
  cin >> n >> s;
  
  for(i=0;i<n-1;i++){
    if(s[i]!=s[i+1]) ans ++;
  }   
    
  cout << ans << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void) {
	int n[4];
	int one = 0, nine = 0, seven = 0,four = 0;
	for (int i = 0; i < 4; ++i) {
	    scanf("%d",&n[i]);
		if (n[i] == 1){
			one++;
		}else if(n[i] == 9){
			nine++;
		}else if(n[i] == 7){
			seven++;
		}else if(n[i] == 4){
			four++;
		}
	}
	if (one == 1&&nine == 1&&seven == 1&&four==1){
		printf("YES\n");
	}else printf("NO\n");
	return 0;
}


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

int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int count=0;
  for(int i=0;i<=a;++i){
    for(int j=0;j<=b;++j){
      for(int k=0;k<=c;++k){
        int sum=500*i+100*j+50*k;
        if(sum==x)count++;
      }
    }//for 100
  }//for 500
  cout<<count<<endl;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long a = 0;
		long b = 0;
		
		a += N / (A + B) * A;
		b += N / (A + B) * B;
		N %= (A + B);
		var la = Math.Min(N, A);
		var lb = N - la;
		a += la;
		b += lb;
		Console.WriteLine("{0}", a);
		
	}
	long N,A,B;
	public Sol(){
		var d = rla();
		N = d[0]; A = d[1]; B = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
  char s[6];
  cin >> s;
  for(int i=0;i<5;i++){
    if(s[i]=='A'&&s[i+1]=='C'){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}


Measured memory_bytes: 256
def calcBoundCount(rangex, lstL):
    d = 0
    for i in range(0, len(lstL)):
        d = d + lstL[i]
        if rangex < d:
            return i + 1
    return len(lstL) + 1
 
N, X = map(int, input().split())
lstL = list(map(int, input().split()))
 
count = calcBoundCount(X, lstL)
print((count if count <= N+1 else N+1))

Measured memory_bytes: 3060
S = gets.strip
MOD = 2019

dp = Array.new(2019) { 0 }
dp[0] += 1
sum = 0
tens = 1
S.reverse.each_char do |s|
  msd = s.to_i
  msd *= tens
  sum += msd
  sum %= MOD
  dp[sum] += 1
  tens *= 10
  tens %= 2019
end

res = 0
dp.each do |d|
  res += d * (d-1) / 2
end

puts(res)


Measured memory_bytes: 14756
import sys
x=[]
n=input()
for i in range(3,n+1):
    if i%3==0:
        x.append(i)
    else:
        j=i
        while j!=0:
            if j%10==3:
                x.append(i)
                break
            j=j/10

X=iter(x)
for i in X:
    sys.stdout.write(' ')
    sys.stdout.write('%d'%i)
print('')

Measured memory_bytes: 6592
using System;
using System.Linq;

namespace ABC147A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

            Console.WriteLine(input.Sum() >= 22 ? "bust" : "win");
        }
    }
}

Measured memory_bytes: 13396
import sys
read = sys.stdin.read

H, W, *S = read().split()
H, W = int(H), int(W)
ABC = [chr(i) for i in range(65, 65 + 26)]

for i, s in enumerate(S):
    if s == 'snuke':
        print(ABC[i % W] + str(i // W + 1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,ans;
void find(int x)
{
	for(int i=1;i*i<=x;i++)
	if(x%i==0)
	{
		if(i!=1)
		ans++;
		if(i*i!=x)
		ans++;
	}
}
int pd(int x,int y)
{
	if(y==1)
	return 0;
	while(x%y==0)
	x/=y;
	if(x%y==1)
	return 1;
	return 0;
}
signed main()
{
	scanf("%lld",&n);
	find(n-1);
	for(int i=1;i*i<=n;i++)
	if(n%i==0)
	{
		ans+=pd(n,i);
		if(i*i!=n)
		ans+=pd(n,n/i);
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    for(int i=0; i<N; ++i) {
        for(int j=0; j<D; ++j) cin >> X[i][j];
    }

    int res = 0;
    for(int i=0; i<N; ++i) {
        for(int j=i+1; j<N; ++j) {
            int tmp = 0;
            for(int k=0; k<D; ++k) {
                tmp += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
            }
            if(ceil(sqrt(tmp)) == sqrt(tmp)) ++res; 
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
int num1[MAX];
int num2[MAX];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n;
    cin>>n;
    int x;
    int maxodd=0,maxeven=0;
    int odd,even;
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&x);
        if(i%2)
        {
            num1[x]++;
            if(maxodd<num1[x])
            {
                maxodd=num1[x];
                odd=x;
            }
        }
        else
        {
            num2[x]++;
            if(maxeven<num2[x])
            {
                maxeven=num2[x];
                even=x;
            }
        }
    }
    sort(num1,num1+MAX,cmp);
    sort(num2,num2+MAX,cmp);
    int res=n;
    if(even==odd)
    {
        int rr=0;
        rr=max(num1[0]+num2[1],num1[1]+num2[0]);
        res-=rr;
    }
    else
    {
        res-=maxodd;
        res-=maxeven;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;int n,m,l,x,i,a[1<<18];main(){cin>>n>>m;n*=2;while(cin>>a[i])i++;sort(a,a+n);for(i--;i>l;i--){while(a[i]+a[l]<m&&l<i-1)l++;if(a[i]+a[l]>=m){a[i]-=m;l++;}}sort(a,a+n);for(i=0;i<n/2;i++)x=max(x,a[i]+a[n-i-1]);cout<<x;}

Measured memory_bytes: 4344
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))

#if 1
//No.2
int main()
{
	INT A, B, C, K;
	cin >> A >> B >> C >> K;

	INT total = 0;
	INT card = 0;

	card = (A > K) ? K : A;
	total = card * 1;

	if (K - card > 0) {
		card += (B > K - card) ? K - card : B;
	}
	if (K - card > 0) {
		int tmp = K - card;
		card += tmp;
		total -= tmp;
	}

	cout << total;
	return 0;
}
#endif

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
// ----------------------R00TDADA------------------------------
#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada ios_base::sync_with_stdio(false)
#define int long long
#define M 1000000007
#define MAX 100005
int A[MAX], tree[4 * MAX];
int power(int x, int p)
{
    if (p == 0)
        return 1;
    int y = power(x, p / 2);
    y *= y;
    y %= M;
    if (p % 2 == 0)
        return y;
    y *= x;
    y %= M;
    return y;
}
void build(int node, int start, int end)
{
    if (start == end)
        //Leaf node will have a single element
        tree[node] = start;
    else
    {
        int mid = (start + end) / 2;
        //Recurse on the left child
        build(2 * node, start, mid);
        //Recurse on the right child
        build(2 * node + 1, mid + 1, end);
        // Internal node will have the sum of both of its children
        tree[node] = tree[2 * node] + tree[2 * node + 1];
    }
}
void update(int node, int start, int end, int idx, int val)
{
    if (start == end)
    {
        //Leaf Node
        A[idx] = val;
        tree[node] += val;
    }
    else
    {
        int mid = (start - end) / 2 + end;
        if (start <= idx && idx <= mid)
        {
            // If idx is in the left child, recurse on the left child
            update(2 * node, start, mid, idx, val);
        }
        else
        {
            // if idx is in the right child, recurse on the right child
            update(2 * node + 1, mid + 1, end, idx, val);
        }
        // Internal node will have the sum of both of its children
        tree[node] = tree[2 * node] + tree[2 * node + 1];
    }
}
int query(int node, int start, int end, int l, int r)
{
    if (r < start || l > end)
    {
        // range represented by a node is completely outside the given range
        return 0;
    }
    if (l <= start && end <= r)
    {
        // range represented by a node is completely inside the given range
        return tree[node];
    }
    // range represented by a node is partially inside and partially outside the given range
    int mid = (start + end) / 2;
    int p1 = query(2 * node, start, mid, l, r);
    int p2 = query(2 * node + 1, mid + 1, end, l, r);
    return p1 + p2;
}
void Baap_ko_mat_sikha()
{
    int a, b;
    cin >> a >> b;
    int m[4] = {0};
    rep(i, 1, 4)
    {
        if (a == i)
            m[i] = 1;
        if (b == i)
            m[i] = 1;
    }
    rep(i, 1, 4)
    {
        if (m[i] == 0)
        {
            cout << i << endl;
            break;
        }
    }
}

signed main()
{

    rootdada;
    int t;
    t = 1;
    while (t--)
    {
        Baap_ko_mat_sikha();
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, q, a[100005] = {}, l, r;
    string s;
    cin >> n >> q >> s;
    for (int i = 1; i < n; i++) if (s[i - 1] == 'A' && s[i] == 'C') a[i] = 1;
    for (int i = 1; i <= n; i++) a[i] += a[i - 1];
    while (q--) cin >> l >> r, cout << a[r - 1] - a[l - 1] << '\n';
}


Measured memory_bytes: 1616