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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

const int maxn = 2e5 + 5;

const ll mod = 1e9 + 7;

ll mul(ll a, ll b){
	return a*b%mod;
}

ll fac[maxn], invFac[maxn];
ll ans[maxn];

ll modPow(ll a, ll b){
	if(b == 0){return 1;}
	else{
		if(b % 2 == 1){return a*modPow(a, b-1) % mod;}
		else{
			ll temp = modPow(a,b/2);
			return temp*temp%mod;
		}
	}
}

void sub(ll &a, ll b){
	a -= b;
	if(a < 0){a += mod;}
}

void preprocess() {
	fac[0] = invFac[0] = 1;
	for(int i=1;i<maxn;i++){
		fac[i] = mul(fac[i-1], i);
		invFac[i] = modPow(fac[i], mod-2);
	}
}

bool cmp(ii a, ii b){
	if(a.first == b.first){return a.second < b.second;}
	return a.first < b.first;
}

ll findWays(ii a, ii b){
	if(a.second > b.second){return 0;}
	int selisihX = b.first - a.first;
	int selisihY = b.second - a.second;
	return mul(fac[selisihY + selisihX], mul(invFac[selisihX], invFac[selisihY]));
}

int main(){
	int h,w,n,i,j;
	preprocess();
	scanf("%d %d %d",&h,&w,&n);
	vector<ii> p(n);
	for(i=0;i<n;i++){
		scanf("%d %d",&p[i].first,&p[i].second);
	}
	p.pb(ii(h,w));
	sort(p.begin(), p.end(), cmp);
	
	for(i=0;i<n+1;i++){
		ans[i] = findWays(ii(1,1), p[i]);
	}

	for(i=0;i<n+1;i++){
		for(j=i+1;j<n+1;j++){
			sub(ans[j], mul(ans[i], findWays(p[i], p[j])));
		}
	}
	printf("%lld\n",ans[p.size() - 1]);
	return 0;
};

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define vc vector<int>
#define um unordered_map<int,int>
#define ll long long 
#define rep(i,a,b) for(__typeof(a) i=a; i<b; i++)
#define si(a) a.size()
#define all(a) a.begin(),a.end()
#define ss(a) a.second
#define ff(a) a.first
#define M 1000000
#define pb push_back
#define repit(i,a) for(auto i=a.begin(); i!=a.end(); i++)
#define take(arr,n) for(int i=0;i<n;i++)cin>>arr[i]
#define out(arr,n) for(int i=0;i<n;i++)cout<<arr[i]<<' '
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define reprev(i,b,a) for(__typeof(b) i=b; i>=a; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define doublearray vector<vector<int>>
using namespace std;
ll max(ll a, ll b){ return a>b?a:b; }
ll min(ll a, ll b){ return a<b?a:b; }
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}
ll ans(ll a){
    return a<0?a+MOD:a;
}
int main(){
  int n; cin>>n;
   cout<<(n>=30?"Yes":"No")<<endl;
          return 0;
          }





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

#define swap(type,a,b) {type t; t=a; a=b; b=t;}
#define forN(i,n) for(int i=0;i<n;i++)
#define forS(i,start,n) for(int i=start;i<n;i++)
#define ll long long
#define pb(t,d,n) {t p;int i;forN(i,n){cin>>p;d.push_back(p);}}
#define DOUBLE fixed << setprecision(15)

using namespace std;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

int main(){
    int m,n,cnt=0;
    string s;

    cin>>n;
    int jpy=0;
    double btc=0.;
    const double rate=3.8e5;
    forN(i,n){
        string x,u;
        cin>>x>>u;
        if(u=="JPY"){
            int tmp;
            istringstream(x)>>tmp;
            jpy+=tmp;
        }else{
            btc+=stod(x);
        }
    }
    cout<<DOUBLE<<(double)jpy+btc*rate<<endl;
}

Measured memory_bytes: 3688
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Chars, Bytes};
#[allow(unused_imports)]
use num::integer::gcd;
#[allow(unused_imports)]
use std::mem::swap;

#[allow(dead_code)]
type Pi = (i32, i32);
#[allow(dead_code)]
fn pri<T: std::fmt::Display>(x: T) {println!("{}", x);}

// Modint
const MOD: u32 = 1000000007;
#[derive(Clone, Copy)]
struct Mint(u32);
impl std::ops::Add for Mint {
    type Output = Mint;
    fn add(self, x: Mint) -> Mint {
        let res = self.0 + x.0;
        Mint(if res >= MOD {res-MOD} else {res})
    }
}
impl std::ops::AddAssign for Mint {
    fn add_assign(&mut self, x: Mint) {
        *self = *self + x;
    }
}
impl std::ops::Sub for Mint {
    type Output = Mint;
    fn sub(self, x: Mint) -> Mint {
        let res = self.0 + MOD - x.0;
        Mint(if res >= MOD {res-MOD} else {res})
    }
}
impl std::ops::SubAssign for Mint {
    fn sub_assign(&mut self, x: Mint) {
        *self = *self - x;
    }
}
impl std::ops::Mul for Mint {
    type Output = Mint;
    fn mul(self, x: Mint) -> Mint {Mint((self.0 as u64 * x.0 as u64 % MOD as u64) as u32)}
}
impl std::ops::MulAssign for Mint {
    fn mul_assign(&mut self, x: Mint) {
        *self = *self * x;
    }
}
impl std::ops::Div for Mint {
    type Output = Mint;
    fn div(self, x: Mint) -> Mint {
        let mut a = x.0 as i64; //solves au + mv = 1 and u = a^-1
        let mut m = MOD as i64; let mut u = 1i64; let mut v = 0i64;
        let mut buf: i64;
        while m != 0 {
            let t = a / m;
            a -= t * m; buf = a; a = m; m = buf;
            u -= t * v; buf = u; u = v; v = buf;
        }
        u %= m;
        if u < 0 {u += m;}
        self * Mint(u as u32)
    }
}
impl std::ops::DivAssign for Mint {
    fn div_assign(&mut self, x: Mint) {
        *self = *self / x;
    }
}
impl std::fmt::Display for Mint {
    fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
impl Mint {
    pub fn pow(self, mut n: u32) -> Mint {
        let mut res = Mint(1); let mut r = self;
        while n > 0 {
            if n & 1 == 1 {res *= r;}
            r *= r;
            n >>= 1;
        }
        res
    }
    #[allow(dead_code)]
    pub fn inv(self) -> Mint {
        assert!(self.0 > 0);
        self.pow(MOD - 2)
    }
}

#[fastout]
fn main() {
    input!{
        n: u32, k: u32,
    }
    let mut v: Vec<Mint> = Vec::new(); for _ in 0..k+1 {v.push(Mint(0));}
    for i in (1..k+1).rev() {
        v[i as usize] += Mint(k/i).pow(n);
        let mut j = i * 2;
        while j <= k {
            let x = v[j as usize];
            v[i as usize] -= x;
            j += i;
        }
    }
    let mut ans = Mint(0);
    for i in 1..k+1 {
        ans += v[i as usize] * Mint(i);
    }
    pri(ans);
}

Measured memory_bytes: 2512
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

//int main()
//{
//	string n;
//	int k;
//	cin >> n >> k;
//	//vector<int> h(n);
//	int ans = 0;
//	for (int i = 1; i <= (n); ++i) {
//		//h[i-1] = i;
//		string numstr = to_string(i);
//		int total_count = numstr.length();
//		int zero_count = count(numstr.begin(), numstr.end(), '0');
//		if (total_count - zero_count == k) {
//			ans++;
//		}
//	}
//	//rep(i, n) h[i]=i;
//	//sort(h.begin(), h.end());
//	//k = min(n, k);
//	/*ll ans = 0;
//	rep(i, k) {
//		h.pop_back();
//	}
//	rep(i, h.size()) ans += h[i];*/
//	cout << ans << endl;
//	return 0;
//

//int main()
//{
//	ll n;
//	int k;
//	cin >> n >> k;
//	//vector<int> h(n);
//	ll ans = 0;
//	
//	for (ll i = 1; i <= (n); ++i) {
//		ll temp = i;
//		int count = 0;
//		
//		while (temp > 0) {
//			ll num = temp % 10;
//			if (num != 0) {
//				count++;
//			}
//			temp /= 10;
//			if (count > k) {
//				if (num != 0) {
//					i += 8;
//				}
//				break;
//			}
//		}
//		if (count == k) {
//			ans++;
//		}
//	}
//	//rep(i, n) h[i]=i;
//	//sort(h.begin(), h.end());
//	//k = min(n, k);
//	/*ll ans = 0;
//	rep(i, k) {
//		h.pop_back();
//	}
//	rep(i, h.size()) ans += h[i];*/
//	cout << ans << endl;
//	return 0;
//}

int main()
{
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (s == u) {
		a--;
	}
	if (t == u) {
		b--;
	}
	cout << a << endl;
	cout << b << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	int a=0,b=getchar();
	while(!isdigit(b))b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a;
}
int n,ans,a[3][3],b[15],c[3][3];
int main(){
	for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
			a[i][j]=read();
	n=read();
	for(int i=0;i<n;i++){
		b[i]=read();
		for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)
				if(a[j][k]==b[i])
					c[j][k]=1;
	}
	for(int i=0;i<3;i++){
		if(c[i][0] and c[i][1] and c[i][2])ans=1;
		if(c[0][i] and c[1][i] and c[2][i])ans=1;
	}
	if(c[0][0] and c[1][1] and c[2][2])ans=1;
	if(c[2][0] and c[1][1] and c[0][2])ans=1;
	if(ans)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<long long, long long> P;
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define int long long
int ifPrime(int n){
    if(n==1)return false;
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
signed main(signed argc, char* argv[]) {
    int n,k,r,s,p;
    string t;
    cin>>n>>k>>r>>s>>p>>t;
    int ans=0;
    rep(i,n){
        if(i-k>=0&&t[i]==t[i-k]){
            t[i]=' ';
            continue;
        }
        if(t[i]=='r')ans+=p;
        if(t[i]=='s')ans+=r;
        if(t[i]=='p')ans+=s;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
n = gets.to_i
dams = gets.split.map(&:to_i)

acc = 0
dams.reverse.each_with_index {|d, i| acc += (-1) ** i * d}

rain = Array.new(n, 0)
rain[0] = acc

(1...n).each {|i| rain[i] = 2 * (dams[i - 1] - rain[i - 1] / 2)}

puts rain.join(" ")

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

public class Main {
	
	public static void ask(String number){
		System.out.println("? "+number);
	}
	public static void ask(long number){
		System.out.println("? "+number);
	}
	public static void answer(String number){
		System.out.println("! "+number);
	}
	public static void answer(long number){
		System.out.println("! "+number);
	}
	
	//10^k
	public static long dec(int k){
		long a =1;
		for(int i=0;i<k;i++)a*=10;
		return a;
	}
	
    public static void main(String[] args) {
    	/*
    	1,10,100,...10^10について質問.
		Noが出れば桁数が分かる(10^kでnoならk桁)
		n=(k桁)+"0" と Nについて n>Nであるから,
		"Yes" <=> "n">"N" <=> (k桁)>=N
		BinarySearchできそう
	
		全部YesならN==10^k
		2?   Y -> 1
		20?  Y -> 10
		...
    	*/
    	
        Scanner sc = new Scanner(System.in);
        
        int digit = -1;
        for(int i=0;i<=10;i++){
        	ask(dec(i));
        	if(sc.nextLine().equals("N")){
        		digit = i;
        		break;
        	}
        }
        
        if(digit == -1){
        	for(int i=0;i<=10;i++){
        		ask(2*dec(i));
        		if(sc.nextLine().equals("Y")){
        			answer(dec(i));
        			System.exit(0);
        		}
        	}
        }
        else{
        	long min = dec(digit-1);
        	long max = dec(digit)-1;
        	while(min<max){
        		long next = (min+max)/2;
        		ask(next*10);
        		if(sc.nextLine().equals("Y")){
        			max = next;
        		}else{
        			min = next+1;
        		}
        	}
        	answer(min);
        	System.exit(0);
        }
    }
}

Measured memory_bytes: 24100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

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

    int a,b;
    cin >> a >> b;
    int mn = max(-1000000,b-a+1);
    int mx = min( 1000000,b+a-1);
    rep(i,mn,mx) {
        cout << i << " ";
    }cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define f(n) for(ll i=0;i<n;i++)
#define r(n) for(ll j=0;j<n;j++)
#define all(v) (v).begin(),(v).end()
#define ff first
#define ss second
#define pi 3.14159265359
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
typedef long double ld;
ll ESP=1e18;
ll INF=1e9+7;

int main()
{
 hs;
 ll n,m;
 cin>>n>>m;
 ll a[m];
 ll sum=0;
 f(m)
 {
  cin>>a[i];
  sum+=a[i];
 }
 if(sum<=n)
    cout<<n-sum;
 else
    cout<<"-1";
 cout<<"\n";
 return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
  string s; ll k;
  cin >> s >> k;
  map<string, bool> b;
  vector<string> c;
  // 文字数1-kまでやれば十分(a,aa,aaa,aaaa,aaaaa)、ただしsの方が短い可能性がある
  rep(i,0,s.size()){
    rep(j,0,min(k, (ll)s.size()-i)){
      auto t = s.substr(i,j+1);
      if(!b[t]) c.push_back(t);
      b[t] = true;
    }
  }
  sort(c.begin(), c.end());
  cout << c[k-1] << endl;
  return 0; 
}

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

#define ntest 0

using namespace std;
string s,t;
void solve() {
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int res = n;
    for (int i = 0; i < n - m + 1; ++i) {
        int tmp = 0;
        for (int j = 0; j < m; ++j) {
            tmp += (s[i+j] != t[j]);
        }
        res = min(res, tmp);
    }
    cout << res << '\n';
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    if(ntest){
        int t;
        cin >> t;
        while(t--) solve();
    } else {
        solve();
    }

}




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

int main() {
  int x, y;
  cin>>x>>y;

  if (abs(y) == abs(x)) {
    cout<<1<<endl;
    return 0;
  }
  if (y > x && (x >= 0 || 0 >= y)) {
    cout<<y-x<<endl;
    return 0;
  }
  // x < 0 && y > 0
  if (y > x) {
    int cnt1 = y - x;
    int cnt2 = abs(y + x) + 1;
    cout<<min(cnt1, cnt2)<<endl;
    return 0;
  }
  // x > y
  if (y >= 0) {
    int cnt1 = x + y + 1;
    int cnt2 = x - y + 2;
    cout<<min(cnt1, cnt2)<<endl;
  } else if (0 >= x) {
    int cnt1 = -x - y + 1;
    int cnt2 = abs(y-x) + 2;
    cout<<min(cnt1, cnt2)<<endl;
  }
  // x > 0 && y < 0
  else {
    cout<<abs(x+y)+1<<endl;
  }
}

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

using namespace std;


string to_string(string s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef ABHI
  #define line_debug(x) cerr << "[" << __LINE__ << "]: " << #x << "->" << to_string(x) << '\n';
  #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
  #define line_debug(x) 42
  #define debug(...) 42
#endif


const long long MOD = (long long) (1e9 + 7);

inline long long add(long long a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}

inline long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}

inline long long mul(long long a) {
  return a;
}

template<typename... T>
inline long long mul(long long a, T... b) {
  return (long long) ((long long) a * mul(b...) % MOD);
}

inline long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline long long inv(long long a) {
  a %= MOD;
  if (a < 0) a += MOD;
  long long b = MOD, u = 0, v = 1;
  while (a) {
    long long t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += MOD;
  return u;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  cin >> H >> W;
  vector<string> ar(H);
  for(string &x : ar) {
    cin >> x;
  }
  vector<vector<long long>> dp(H, vector<long long>(W, 0));
  dp[0][0] = (ar[0][0] != '#');
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      if(ar[i][j] != '#') {
        if(i + 1 < H) if(ar[i + 1][j] != '#') {
          dp[i + 1][j] = add(dp[i + 1][j], dp[i][j]);
        }
        if(j + 1 < W) if(ar[i][j + 1] != '#') {
          dp[i][j + 1] = add(dp[i][j + 1], dp[i][j]);
        }
      }
    } 
  }
  debug(dp);
  cout << dp[H - 1][W - 1] << '\n';
  return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;
 
int a[15][15];
 
int main(){
    int n,m,x;
    cin>>n>>m>>x;
    vector<int> c(n);
 
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
 
    int ans=INF;
    rep(bit,1<<n){
        vector<int> sc(m,0);
        int tmp=0;
        rep(i,n){
            if(bit & 1<<i){
                tmp+=c[i];
                rep(j,m) sc[j]+=a[i][j];
            }
        }
        bool ok=true;
        rep(i,m){
            if(sc[i]<x) ok=false;
        }
        if(ok) ans=min(ans,tmp);
    }
 
    if(ans==INF) ans=-1;
    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1LL << 60
int main(){
	int N; string S;
	cin >> N;
	cin >> S;
	vector<int> d(N);
	for (int i = 0; i < N; i++) {
		int tmp = 0;
		for (int j = 0; j <= i; j++) {
			if (S[j] == '(')tmp++;
			else if(S[j] == ')')tmp--;
		}
		d[i] = tmp;
	}
	d.push_back(0);
	if (N == 1)cout << "()" << endl;
	else {
		int x = *min_element(d.begin(), d.end());
		for (int i = 0; i < (x*-1); i++) {
			S = "(" + S;
		}
		for (int i = 0; i < (d[N - 1] - x); i++) {
			S = S + ")";
		}
		cout << S << endl;
	}

	return 0;
}

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

int main() {
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    int right, left, top, bottom;
    right = x + r;
    left = x - r;
    top = y + r;
    bottom = y - r;
    
    if (right <= w && 0 <= left && top <= h && 0 <= bottom)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    
    return 0;
}


Measured memory_bytes: 3084
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll inf = 1e18;
ll mod=1e9+7;
//LLONG_MIN

/*
*/

ll n,m,c,ans=0,b[110],a[100][100];

int main(void){
	cin>>n>>m>>c;
	rep(i,m)cin>>b[i];
	rep(i,n)rep(j,m)cin>>a[i][j];
	rep(i,n){
		ll sum=0;
		rep(j,m)sum+=a[i][j]*b[j];
		sum+=c;
		if(sum>0)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI=2147483647;
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  ll n; cin >>n;
  ll a,b; cin >>a >>b;
  ll res = n / (a+b) * a;
  ll sub = n - (n / (a+b) * (a+b));
  res += min(sub, a);
  cout <<res <<endl;
}

Measured memory_bytes: 256
a=[[10*[0]for _ in range(3)]for _ in range(4)]
for _ in range(int(input())):
 b,f,r,v=map(int,input().split())
 a[b-1][f-1][r-1]+=v
for i in range(4):
 for j in range(3):
  print('',*a[i][j])
 if i!=3:print('#'*20)

Measured memory_bytes: 5624
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
using namespace std;
typedef long long ll;

int main() {
    int n; cin >> n;
    ll prev = 0;
    bool flag = true;
    for (int i = 0; i < n; i++) {
        ll h; cin >> h;
        if (h > prev) {
            h--;
            prev = h;
        } else if ( h == prev) {
            prev = h;
        } else {
            flag = false;
        }
    }
    cout << (flag ? "Yes" : "No") << endl;
}


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

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

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

using ll =  long long;
using pint =  pair<int,int>;

#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i))
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(x,v) for(const auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義 #define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//lambda: [&](int x, int y){return x<y;}

signed main(void){
  int k,s;cin>>k>>s;
  int ans=0;
  rep(x,k+1){
    rep(y,k+1){
      int z=s-x-y;
      if(0<=z&&z<=k)ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import math
n,k = map(int,input().split())
a_input = list(map(int,input().split()))

#数列の最小値は１であり、一回の操作で最大k-1個を増やすことができる
ans=(n-1)//(k-1)+min(1,(n-1)%(k-1))
print(ans)


Measured memory_bytes: 20472
# from pprint import pprint
# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

now_high = a[0]
fumidai = 0

for _a in a:
    if now_high > _a:
        fumidai += now_high - _a
    else:
        now_high = _a

print(fumidai)


Measured memory_bytes: 32212
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
int rec[50][100005];
signed main() {
  int N, C;

  cin >> N >> C;

  rep(i, N) {
    int s, t, c;
    cin >> s >> t >> c;
    s--;
    c--;
    rec[c][s]++;
    rec[c][t]--;
  }

  rep(i, C) rep(j, 100005) rec[i][j + 1] += rec[i][j];
  // rep(i, C) {
  //   rep(j, 20) cout << rec[i][j] << ' ';
  //   cout << endl;
  // }
  rep(i, C) rep(j, 100005) if (rec[i][j]) rec[i][j] = 1;

  int ans = 0;
  rep(i, 100005) {
    rep(j, C) rec[j + 1][i] += rec[j][i];
    cmax(ans, rec[C][i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 24832
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	string s;
	cin>>s;
	if(s.length()<26){
		map<char,bool> m;
		fori(s.length()){
			m[s[i]]=true;
		}
		for(char c='a';c<='z';++c){
			auto itr=m.find(c);
			if(itr==m.end()){
				cout<<s<<c;
				return 0;
			}
		}
		return 0;
	}else{
		if(s=="zyxwvutsrqponmlkjihgfedcba"){
			cout<<-1;
			return 0;
		}
		string t=s;
		next_permutation(t.begin(),t.end());
		fori(26){
			if(s[i]==t[i])
				cout<<t[i];
			else{
				cout<<t[i];return 0;
			}
		}
	}
}

Measured memory_bytes: 3592
#https://atcoder.jp/contests/abc067/submissions/1562911
#コピペコード
N = int(input())
ab = [[] for i in range(N+1)]
for i in range(N-1):              #隣接リスト作成
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)
 
def calc_dist(K):
    # dist[i]:頂点Kから頂点iまでの距離
    dist = [-1 for i in range(N+1)]
    dist[K] = 0
 
    # 深さ優先探索（スタック）
    from collections import deque
    stack = deque()
    stack.append(K)
 
    while stack:
        v = stack.pop()
        for nxt in ab[v]:            #隣接リストから値をとっていく
            if dist[nxt] == -1:
                dist[nxt] = dist[v] + 1
                stack.append(nxt)
 
    return dist
 
dist1 = calc_dist(1)
distN = calc_dist(N)
 
Fennec = 0
Snuke = 0
for v in range(1,N+1):
    if dist1[v] <= distN[v]:     #vまで行くのにどちらが早いか
        Fennec += 1
    else:
        Snuke += 1
 
if Fennec > Snuke:
    print('Fennec')
else:
    print('Snuke')

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

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

int V[4];
ld n,dp[301][301][301];
ld f(int a,int b,int c){
  if(dp[a][b][c]>=0)return dp[a][b][c];
  ld res=0,z=n-a-b-c;
  if(a)res+=a*f(a-1,b,c);
  if(b)res+=b*f(a+1,b-1,c);
  if(c)res+=c*f(a,b+1,c-1);
  res*=1/(n-z);
  res+=(a+b+c)*n/((n-z)*(n-z));
  return dp[a][b][c]=res;
}

signed main(){
  cin>>n;
  REP(i,n-0.1){int x;cin>>x;V[x]++;}
  REP(i,301)REP(j,301)REP(k,301)dp[i][j][k]=-1;
  dp[0][0][0]=0;
  cout<<fixed<<setprecision(12)<<f(V[1],V[2],V[3])<<endl;
}


Measured memory_bytes: 426368
#include <iostream>
#include <array>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;


int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || a + c == b || c + b == a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1'000'000'007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

int n, m;
int a[51], b[51];
int dp[51][51][101][2][3];

int f(int i, int j, int s, int t, int p, int A, int B) {
	if (dp[i][j][s][t][p] != INF)return dp[i][j][s][t][p];
	int ret;
	if (t == 0) {
		int x;
		if (i + 1 <= n) {
			if (a[i] != -1)
				x = f(i + 1, j, s + 1, t ^ 1, 0, A + a[i], B);
			else
				x = f(i + 1, j, s + 1, t ^ 1, 0, A, 0);
		}
		else
			x = -INF;
		int y;
		if (p <= 1)
			y = f(i, j, 0, t ^ 1, p + 1 + (i + j + s + t + p == 0), 0, 0) + A - B;
		else
			y = 0;
		ret = max(x, y);
	}
	else {
		int x;
		if (j + 1 <= m) {
			if (b[j] != -1)
				x = f(i, j + 1, s + 1, t ^ 1, 0, A, B + b[j]);
			else
				x = f(i, j + 1, s + 1, t ^ 1, 0, 0, B);
		}
		else
			x = INF;
		int y;
		if (p <= 1)
			y = f(i, j, 0, t ^ 1, p + 1, 0, 0) + A - B;
		else
			y = 0;
		ret = min(x, y);
	}
	dump(i, j, s, t, p, ret);
	return dp[i][j][s][t][p] = ret;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	memset(dp, 0x3f, sizeof(dp));
	cin >> n >> m;
	rep(i, 0, n) {
		cin >> a[i];
	}
	rep(i, 0, m) {
		cin >> b[i];
	}
	cout << f(0, 0, 0, 0, 0, 0, 0) << endl;
	return 0;
}


Measured memory_bytes: 15480
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<((n+1)/2)<<endl;

  return 0;
}


Measured memory_bytes: 256
from collections import deque

deque_a = deque(input())
deque_b = deque(input())
deque_c = deque(input())

pick = deque_a.popleft()

while True:
    if pick == 'a':
        if len(deque_a) <= 0:
            output = 'A'
            break
        else :
            pick = deque_a.popleft()
            
    elif pick == 'b':
        if len(deque_b) <= 0:
            output = 'B'
            break
        else :
            pick = deque_b.popleft()
    else :
        if len(deque_c) <= 0:
            output = 'C'
            break
        else :
            pick = deque_c.popleft()
    
print(output)

Measured memory_bytes: 3316
S = input()
if "keyence"in S:
	print("YES")
	exit()
for i in range(8):
	#print(S[0:i] + S[i+len(S)-7:len(S)])
	if S[0:i] + S[i+len(S)-7:len(S)] == "keyence":	
		print("YES")
		exit()
print("NO")

Measured memory_bytes: 2940
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int n,m,l,r;
	bool flag = true;
	std::cin >> n >> m;
	if(n%2){
		l = 1; r = (n-1);
		while(m){
			std::cout << l << " " << r << std::endl;
			++l; --r; --m;
		}
	}else{
		l = 1; r = n;
		while(m){
			std::cout << l << " " << r << std::endl;
			++l; --r; --m;
			if(flag && r-l<=n/2){
				flag = false;
				--r;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;

const int N = 300000;

typedef long long lli;

struct data{
  lli b, c, num, ans;
};

bool compB(const data &a, const data &b){
  return a.b < b.b;
}

bool compN(const data &a, const data &b){
  return a.num < b.num;
}
  data d[N];

int main(void){
  lli n, m;
  lli A[N]; 
  scanf("%lld", &n);
  lli i=0;
  for(i=0; i<n; i++){
    scanf("%lld", &A[i]);
  }

  scanf("%lld", &m);
  for(i=0; i<m; i++){
    scanf("%lld", &d[i].b);
  }
  for(i=0; i<m; i++){
    scanf("%lld", &d[i].c);
    d[i].num=i;
  }
  int j;
  j=0;
  lli sum = 0;
  
//sort(A), sort(d)
  sort(A, A+n);
  sort(d, d+m, compB);
  i = j = 0;
  while(j<m){
    if(A[i] <= d[j].b && i < n){
      sum += A[i];
      i++;
    }
    else{
      d[j].ans = sum;
      j++;
    } 
  }

  sort(d, d+m, compN);
  
  for(i=0; i<m; i++){
    //cout << d[i].ans << endl;
    if(d[i].c <= d[i].ans){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }

  return 0;
}

Measured memory_bytes: 12904
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

int pip[200050];

struct edge
{
	int nxt,v;
}e[400050];

int head[200050],ecnt;

void adde(int u,int v)
{
	e[++ ecnt].v = v;
	e[ecnt].nxt = head[u];
	head[u] = ecnt;
}

void dfs(int pos,int lst)
{
	for(int i = head[pos];i;i = e[i].nxt)
	{
		int v = e[i].v;
		if(v != lst)
			dfs(v,pos);
	}
	if(!pip[pos])
	{
		if(pip[lst])
		{
			printf("First\n");
			exit(0);
		}
		pip[lst] = 1;
		pip[pos] = 1;
	}
}

int main()
{
	int n; scanf("%d",&n);
	for(int i = 1;i < n; ++ i)
	{
		int u,v; scanf("%d%d",&u,&v);
		adde(u,v),adde(v,u);
	}
	pip[0] = 1;
	dfs(1,0);
	printf("Second\n");
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<P>a(n);
  rep(i,0,n)cin>>a[i].fi>>a[i].se;
  vector<P>b(n);
  rep(i,0,n){
    b[i].fi=a[i].fi+a[i].se;
    b[i].se=a[i].fi-a[i].se;
  }
  sort(ALL(b));
  ll mx=-INF;;
  rep(i,0,n){
    if(mx<=b[i].se){
      mx=b[i].fi;
      res++;
    }
  }
  cout<<res<<endl;
  return 0;
}

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

int main(){
  int p,q,r,a,b,c;

  cin >> p >> q >> r;

  a = p + q;
  b = q + r;
  c = r + p;

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


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int h = in.nextInt();
            int w = in.nextInt();

            String[] strs = new String[h];

            in.nextLine();
            for (int i = 0; i < strs.length; ++i) {
                strs[i] = in.nextLine();
            }


            String border = "";
            for (int j = 0; j < w + 2; ++j) {
                border += "#";
            }

            out.println(border);

            for (int i = 0; i < h; ++i) {
                out.println("#" + strs[i] + "#");
            }

            out.println(border);


        }

    }
}



Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main(){

  int N;
  int nummax = 0;
  cin >> N;
  vector<string> S(N);
  vector<int> num(N,0);
  for(int i=0;i<N;i++)
  {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  for(int i=1;i<N;i++)
  {
    if(S.at(i-1) == S.at(i))
       num.at(i) = num.at(i-1) + 1;
  }
  
  for(int i=1;i<N;i++)
  {
    if(nummax <= num.at(i))
    {
      nummax = num.at(i);
    }
  }
;
  
  for(int i=0;i<N;i++)
  {
    if(nummax==num.at(i))
    {
      cout << S.at(i) << endl;
    }
  }
  
}


Measured memory_bytes: 15104
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a2.reverse()

asum1 = []
asum2 = []
tmp1 = 0
tmp2 = 0
for i in range(n):
    tmp1 += a1[i]
    asum1.append(tmp1)
    tmp2 += a2[i]
    asum2.append(tmp2)

asum2.reverse()
asum = [x + y for (x, y) in zip(asum1, asum2)]

print(max(asum))

Measured memory_bytes: 62080
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#include <atcoder/all>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using namespace atcoder;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const int INF = 1e9;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll MOD3 = 1e6;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<long double,long double> point;
typedef complex<long double> Point;
const ll MAX = 1e9;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n),b(m);
    cins(all(a));
    cins(all(b));
    auto c = convolution(a,b);
    array_output(all(c));
}


Measured memory_bytes: 45140
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <limits>
#include <algorithm>
#include <string>

using namespace std;
 
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
 
typedef long long ll;

int main() {
    string str;
    cin >> str;
    ll N = str.length();
    ll N_ = str.length()-1;
//     reverse(str.begin(), str.end());
    ll ans=0;
    for(int i=0;i < (1<<N_);i++){
        string pat="";
        for(int j = 0;j < N_; j++){
            if(( i >> j ) & 1){
                pat += "+";
            } else {
                pat += "x";
            }
        }
        string str2;
        ll k=0,j=0;
        while(k < N || j < N_){
            if((k+j) % 2 == 0){
                str2 += str[k];
                k++;
            } else {
                if(pat[j] == '+'){
//                     cout << i << ":" << str2 <<endl;
                    ll n;
                    sscanf(str2.c_str(), "%lld", &n);
                    ans += n;
                    str2 = "";
                }
                j++;
            }
        }
//         cout << i << ":" << str2 <<endl;
        ll n;
        sscanf(str2.c_str(), "%lld", &n);
        ans += n;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007

lli q;
string str;
int st=0;
// st==0 normal and st==1 reverse

int main()
{
    cin>>str;
    cin>>q;
    string res;
    for(int i=0;i<q;i++)
    {
        int t;
        cin>>t;
        if(t==1)
        {
            st=!st;
        }
        else
        {
            int f;
            char c;
            cin>>f>>c;
            if(f==1)
            {
                if(st==0)
                {
                    str.insert( str.begin(),c);
                }
                else
                {
                    str.insert(str.end(),c);
                }
            }
            else
            {
                if(st==1)
                {
                    str.insert(str.begin(),c);
                }
                else
                {
                    str.insert(str.end(),c);
                }
            }
        }
    }

    if(st==1)
    {
        reverse(str.begin(),str.end());
    }
    cout<<str<<"\n";
    return 0;
}


Measured memory_bytes: 900
/*
* Complete Binaly Tree
* output 1)node_number, 2)parent_number, 3)depth, 4)kind_of_node, 5)child_list
*/

/* inclution */
#include <stdio.h>

/* definition */
#define HEAP_SIZE_MAX 500000
#define VALUE_MAX 2000000000
#define VALUE_MIN -2000000000

/* Prototype */
int parent(int);
int left(int);
int right(int);
void maxHeapify(int);
void swap(int, int);


/* Global Variables */
int n, A[HEAP_SIZE_MAX+1];

/* ??????????????´?????§????§?????????? */
void maxHeapify(int i) {
  int l, r, largest;
  l = left(i);
  r = right(i);
  // ????????????????????????????????§???????????§????????????????????¶
  if(l<=n && A[l]>A[i]) { //?????????????????°???
    largest = l;
  }else {
    largest = i;
  }
  if(r<=n && A[r]>A[largest]) { //?¬????????????°??????????????¨?????????
    largest = r;
  }
  if(largest != i){ // i ???????????????????????§????????´???
    swap(i, largest);
    maxHeapify(largest); // ?????°??????????????????
  }
}

void swap(int i, int largest) {
  int tmp;  //A[i] ??¨ A[largest] ?????????;
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
}

/* node operation */
int parent(int i){
  return i/2;
}
int left(int i){
  return 2 * i;
}
int right(int i){
  return 2 * i + 1;
}

/* main */
int main(){
  int i;
  
  /* input the number of A[] */
  scanf("%d",&n);
  
  /* input array */
  for(i=1;i<=n;i++) {
    scanf("%d", &A[i]);
  }

  for(i=n/2;i>=1;i--){ // O(logn)
    maxHeapify(i);
  }

  /* print */
  for(i=1;i<=n;i++) {
    printf(" %d", A[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 2552
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int main(){
    double x1,x2,y1,y2;
    cin >>x1 >>y1 >>x2 >>y2;
    
    printf("%lf\n",sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)));
    
    return 0;
}


Measured memory_bytes: 3196
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define F first
# define S second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define end(x) prev(x.end());
# define all(x) x.begin(), x.end()
# define rall(x) x.rbegin(), x.rend()
# define pqueue priority_queue
# define mset multiset
# define umap unordered_map
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)
# define lr(i,l,r) for(int i=l;(l>r?i>=r:i<=r);(l>r?--i:++i))

using namespace std;

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

const int MOD = 1e9+7;
const int N = 2e5+5;

void solve(){
	string s;
	cin>>s;
	ll sum=0;
	rep(i,sz(s)){
		sum+=(int)(s[i]-'0');
	}
	if(sum%9==0)cout<<"Yes";
	else cout<<"No";
}

int main(){
	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)
		solve();
	return 0;
}

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


int main(){
  int N;
  cin >> N;
  vector<tuple<string,int,int>> a(N);//名前、得点、本来の順番、ページ数
  for(int i=0;i<N;i++){
	string name;
    int p;
    cin >> name >> p;
    get<0>(a.at(i)) = name;
    get<1>(a.at(i)) = p*(-1);
    get<2>(a.at(i)) = i+1;
  }
  sort(a.begin(),a.end());

  for(auto x:a){
    cout << get<2>(x) << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << "\n"
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define chmax(a,b) if(a<b)a=b;
#define chmin(a,b) if(b<a)a=b;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int MAX = 1400;
vv(int, dp, MAX, MAX, 0);
vv(int, G, MAX, MAX, 0);
int getLargestSquare(int H, int W) {
	int maxWidth = 0;
	rep(i, 0, H) {
		rep(j, 0, W) {
			dp[i][j] = (G[i][j] + 1) % 2;
			maxWidth |= dp[i][j];
		}
	}
	rep(i, 1, H) {
		rep(j, 1, W) {
			if(G[i][j]) dp[i][j] = 0;
			else {
				dp[i][j] = min({dp[i - 1][j - 1], dp[i - 1][j], dp[i][j - 1]}) + 1;
				chmax(maxWidth, dp[i][j]);
			}
		}
	}
	return maxWidth * maxWidth;
}
int main() {
	int H, W; cin >> H >> W;
	rep(i, 0, H) rep(j, 0, W) cin >> G[i][j];
	P(getLargestSquare(H, W));
	return 0;
}

Measured memory_bytes: 18396
import math
n = int(input())
f = []
digit_num = []

n_rt = int(math.sqrt(n))
for i in range(1,n_rt+1):
    if n % i == 0:
        f.append((i,int(n/i)))

for i in range(len(f)):
    digit_num.append(max(len(str(f[i][0])),len(str(f[i][1]))))

print(min(digit_num))

Measured memory_bytes: 3188
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long 
using namespace std;

const int maxn = 510000;

int n,L;
struct node{double x,y;}a[maxn<<1]; int head,tail;

double multi(node x,node y,node z)
{
	x.x-=z.x; x.y-=z.y;
	y.x-=z.x; y.y-=z.y;
	return x.x*y.y-x.y*y.x;
}

int main()
{
	scanf("%d%d",&n,&L); n--;
	a[head=maxn]=(node){0.0,0.0};
	ll x,y;
	tail=head+1; scanf("%lld%lld",&y,&x);
	printf("%lf\n",(double)y); a[tail].y=(double)x*y; a[tail].x=x;
	
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&y,&x); y*=x;
		node now=(node){a[head].x-(double)x,a[head].y-(double)y};
		while(head+1<=tail&&a[tail-1].x-now.x>=L) tail--;
		if(head!=tail)
		{
			double pt=(a[tail].y-a[tail-1].y)/(a[tail].x-a[tail-1].x);
			if(a[tail].x-now.x>L)
			{
				a[tail].y=a[tail-1].y+(L-(a[tail-1].x-now.x))*pt;
				a[tail].x=now.x+L;
			}
		}
		while(head+1<=tail&&multi(a[head],a[head+1],now)>=0) head++;
		a[--head]=now;
		double kk=a[tail].y-now.y;
		printf("%lf\n",kk/(double)L);
	}
	
	return 0;
}


Measured memory_bytes: 16640
import bisect
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.append(float("INF"))
b.append(float("INF"))
la = [a[0]]
lb = [b[0]]
for i in range(1,n):
    la.append(la[-1]+a[i])
for i in range(1,m):
    lb.append(lb[-1]+b[i])
ans = 0
for i in range(n):
    if la[i] > k:
        break
    x = k-la[i]

    count = i+1
    ind = bisect.bisect_right(lb,x)
    count += ind
    ans = max(ans,count)
for i in range(m):
    if lb[i] > k:
        break
    x = k-lb[i]

    count = i+1
    ind = bisect.bisect_right(la,x)
    count += ind
    ans = max(ans,count)
print(ans)


Measured memory_bytes: 47340