akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner stdin = new Scanner(System.in);

		int inN = stdin.nextInt();
		int inA = stdin.nextInt();

		String result = "No";
		if ((inN % 500) <= inA) {
			result = "Yes";
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 20564
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int main(){
  int h,n;
  cin >> h >> n;
  int s=0;
  rep(i,n){
    int a;
    cin >> a;
    s +=a;
  }
  cout << (s>=h?"Yes":"No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s;
    while(cin >> s)
    {
        int len = s.size();
        int i;
        for(i = 0;i < len - 1;i++)
        {
            if(s[i] == s[i + 1])
            {
                cout << i + 1 << " " << i + 2 << endl;
                break;
            }
            else if(i < len - 2 && s[i] == s[i + 2])
            {
                cout << i + 1 << " " << i + 3 << endl;
                break;
            }
        }
        if(i == len - 1)
        cout << -1 << " " << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 512
//03
#include<iostream>

using namespace std;

int p[100],q[100],r[100],b[100];

int gcd(int a,int b){
  return b?gcd(b,a%b):a;
}

int dfs(int s){
  if(s==0)return 1;
  int x=dfs(r[s])*p[s],y=dfs(b[s])*q[s];
  int z=x/gcd(x,y)*y;
  return z/p[s]+z/q[s];
}

int main(){
  for(int n;cin>>n,n;){
    int fs=n*(n+1)/2;
    for(int i=1;i<=n;i++){
      cin>>p[i]>>q[i]>>r[i]>>b[i];
      fs-=r[i]+b[i];
    }
    cout<<dfs(fs)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#define M 1000000007
int a[100000];

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

    int x = -1, y = -1, z = -1;
    long long ans = 1;

    for(int i = 0; i < n; i++) {
        int p = a[i] - 1;
        if (x == p && y == p && z == p) {
            ans = (ans * 3) % M;
            x = a[i];
        } else if(x == p && y == p) {
            ans = (ans * 2) % M;
            x = a[i];
        } else if(y == p && z == p) {
            ans = (ans * 2) % M;
            y = a[i];
        } 
        else if(x == p) x = a[i];
        else if(y == p) y = a[i];
        else if(z == p) z = a[i];
        else {
            puts("0");
            return 0;
        }
    } 

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 512
use std::io::stdin;

fn main() {
    let mut s = String::new();
    let mut total = 0;
    stdin().read_line(&mut s).ok();
    let n: usize = s.trim().parse().unwrap();
    s.clear();

    stdin().read_line(&mut s).ok();
    let v = s
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect::<Vec<usize>>();
    let mut a: Vec<i64> = vec![0; 1000000];
    for i in 0..n {
        let t: usize = v[i];
        a[t] += 1;
    }

    for i in 0..n+1 {
        total += comb(a[i]);
    }

    for i in 0..n {
        let t = comb(a[v[i]]) - comb(a[v[i]] - 1);
        println!("{}", total - t);
    }
}

fn comb(n: i64) -> i64 {
    (n - 1) * n / 2
}


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

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
        cerr << (*i) << " ";
    }
    cerr << "\n";
}
const int MAXN = 120000;

ll a[3 * MAXN];
ll lf[3 * MAXN];
multiset<ll> ss;
ll ans = -1e16;
int n;

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n * 3; ++i)
        scanf("%lld", a + i);
    ll sum = 0;
    for (int i = 0; i < 3 * n; ++i) {
        ss.insert(a[i]);
        sum += a[i];
        while (ss.size() > n) {
            sum -= *ss.begin();
            ss.erase(ss.begin());
        }
        lf[i] = sum;
    }
    ss.clear();
    sum = 0;
    for (int i = 3 * n - 1; i >= 0; --i) {
        ss.insert(-a[i]);
        sum += a[i];
        while (ss.size() > n) {
            sum += *ss.begin();
            ss.erase(ss.begin());
        }
        if (i >= n && ss.size() >= n) {
            ans = max(ans, lf[i - 1] - sum);
        }
    }
    cout << ans << "\n";
    return 0;
}




Measured memory_bytes: 10112
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;

using namespace std;

const long long MOD = 998244353;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	vector<int> a = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;
	cout << a[k - 1];

	return 0;
}


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

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 200020;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
 #define LOOP 10000000



int main() {

  ll N;
  cin >> N;
  vector<ll> P(N);
  ll count = 0, _min = MAX;

  REP(i, N){
    cin >> P[i];
  }

  REP(i, N){
    if( _min > P[i]){
      count++;
      _min = P[i];
    }
  }

  cout << count << endl;

  return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 1792
#include <math.h>
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX / 2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using psi = pair<string, int>;

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

  int N; cin >> N;
  vl D(N); REP(i,N) cin >> D[i];

  ll sum = 0;
  REP(i,N-1) {
    FOR(j,i+1,N) {
      sum += D[i] * D[j];
    }
  }

  ll ans = sum;
  cout << ans << endl;

  return 0;
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	int n;
	cin >> n;
	int one = 0;
	int two = 0;
	int four = 0;
	rep(i, n) {
		ll a;
		cin >> a;
		if (a % 4 == 0) {
			four++;
		} else if (a % 2 == 0) {
			two++;
		} else {
			one++;
		}
	}
	if (four >= one) {
		cout << "Yes" << endl;
	} else if (four + 1 == one && two == 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	
	return 0;
}

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

const long double PI = acos(-1);
constexpr long double EPS = 1e-15;
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;

//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
  int a,p;
  cin >> a >> p;
  p += a * 3;
  cout << p / 2 << endl;
}

int main(int argc, char *argv[]){
  int case_num = 1;
  // while (1) if (solve()) break;
  if (argc > 1 && stoi(argv[1])) cin >> case_num;
  REP(case_no, case_num) {
    cerr << endl << "case " << case_no + 1 << endl;
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int n,y;
	cin >> n >> y;
	
	for(int i=0; i<=n; i++){
		for(int j=0; j<=n; j++){
			int k = n - (i+j);
			if(k < 0) continue;
			if(y == 10000*i + 5000*j + 1000*k){
				printf("%d %d %d\n",i,j,k);
				return 0;
			} 
		}
	}
	
	printf("-1 -1 -1\n");
	
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n,m;
    cin>>n>>m;

    vector<vi> sw(m);
    vi p(m);
    REP(i,m){
        int k;
        cin>>k;
        REP(j,k){
            int s;
            cin>>s;
            s--;
            sw[i].emplace_back(s);
        }
    }
    REP(i,m) cin>>p[i];

    ll ans = 0;
    REP(i, 1<<n){
        vector<bool> on(m,false);

        REP(j,m){
            int tmp=0;
            REP(k,sw[j].size()){
                if( (i>>sw[j][k]) & 1 ) tmp++;
            }
 
            if( (tmp%2) == p[j] )
                on[j]=true;
        }

        bool flg=true;
        REP(j,m){
            if(!on[j]) flg = false;
        }

        if(flg) ans++;
    }

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const int MAX=1e3+10;
const int MOD=1e9+7;

int N,M;
char B[MAX][MAX];
void input(){
    cin>>N>>M;
    rep(i,N)rep(j,M)cin>>B[i][j];
}

int dp[MAX][MAX];
void solve(){
    rep(i,N)rep(j,M)if(B[i][j]=='.'){
      	if(i==0 && j==0)dp[i][j]=1;
      	else if(j==0)dp[i][j]=dp[i-1][j];
      	else if(i==0)dp[i][j]=dp[i][j-1];
        else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
    }
}


void output(){ 
    cout<<dp[N-1][M-1]<<endl;
}

int main(){
    input();
    solve();
    output();
}

Measured memory_bytes: 5248
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
void Garden() {
	int A, B;
	cin >> A >> B;
	cout << (A * B) - (A + B - 1) << "\n";
}

int main() {
	Garden();
	return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;

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

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

	ll cnt =0;

	ll twocnt =0;
	rep(i,n){
		ll tmp; cin>>tmp;
		if(tmp %4 ==0)cnt++;
		if(tmp %2 ==0 && tmp% 4 !=0)twocnt++;
	}
	if(twocnt ==n){
		writeln("Yes");
		return 0;
	}
	int c =0;
	if(twocnt >=2){
		c = -twocnt+1;
	}

	if(n-cnt +c<= cnt+1 && cnt !=0 ){
		writeln("Yes");
	}else {
		writeln("No");
	}




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
//26

int a[1000][1000], f[1000], dp[1000];
vector<int> G[1000];
signed main(){
	int n, m;
	scanf("%lld%lld", &n, &m);
	rep(i,n)a[i][i] = 1;
	rep(i,m){
		int x, y;
		scanf("%lld%lld", &x, &y);x--;y--;
		a[x][y] = a[y][x] = 1;
	}
	rep(i,n)rep(j,n)if(a[i][j] == 0)G[i].pb(j);
	
	int flag = 0;
	queue<P> q;
	vector<P> S;
	fill(f, f+1000, -1);
	rep(i,n){
		if(f[i] >= 0)continue;
		int color[2] = {0};
		q.push(P(i, 0));
		while(!q.empty()){
			P p = q.front();q.pop();
			int v = p.fi, c = p.se;
			if(f[v] >= 0){
				if(f[v] != c){flag = 1;break;}
				else continue;
			}
			f[v] = c;color[c]++;
			for(int to: G[v]){
				q.push(P(to, !c));
			}
		}
		S.push_back(P(color[0], color[1]));
	}
	if(flag == 1){printf("-1\n");return 0;}
	
	int size = S.size();
	dp[0] = 1;
	rep(i,size){
		drep(j,999,0){
			if(S[i].fi and S[i].se)dp[j] = 0;
			int x = j-S[i].fi, y = j-S[i].se;
			if(x >= 0 and dp[x])chmax(dp[j], dp[x]);
			if(y >= 0 and dp[y])chmax(dp[j], dp[y]);
		}
	}
	
	int ans = INF;
	rep(i,998)if(dp[i]){
		int x = i, y = n-i;
		chmin(ans, (x-1)*x/2+(y-1)*y/2);
	}
	printf("%lld\n", ans);
	return 0;
}





Measured memory_bytes: 18960
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 998244353;
const ll INF = 1000000000000000;
ll N, T, A[3010], B[3010], dp[3010], ans, tim[3010], score[3010];
vector<P> vec;

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

ll pow_ll(ll x, ll y)
{
	if (y == 0) return 1;
	return x * pow_ll(x, y - 1);
}

ll div(ll x)
{
	return pow(x, mod - 2);
}



int main(void)
{
	cin >> N >> T;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i] >> B[i];
		vec.push_back(P(B[i], A[i]));
	}
	
	sort(vec.begin(), vec.end());

	for (int i = N - 1; i >= 0; i--)
	{
		tim[i] = tim[i + 1] + vec[i].second;
		score[i] = score[i + 1] + vec[i].first;
	}

	if (tim[1] <= T - 1)
	{
		ans = score[0];
	}

	for (int i = 1; i < N; i++)
	{
		for (int j = T - 1; j > 0; j--)
		{
			if (j < vec[i - 1].second) break;
			dp[j] = max(dp[j - vec[i - 1].second] + vec[i - 1].first, dp[j]);
		}

		if (tim[i + 1] < T)
		{
			ll S = 0;
			for (int j = 0; j < T - tim[i + 1]; j++)
			{
				S = max(S, dp[j]);
			}
			
			ans = max(ans, score[i + 1] + S + vec[i].first);
		}
	}

	cout << ans << endl;

	int xxx;
	cin >> xxx;
}


Measured memory_bytes: 512
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}

int main() {
  int n,m; cin >> n >> m;
  int ans = 1;
  for(int a=1; a*a <= m ;a++){
    if(m % a != 0) continue;
    int b = m/a;
    if((long)a * n <= m) ans = max(ans,a);
    if((long)b * n <= m) ans = max(ans,b);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const long long INF = 1e13;
#define fi first
#define sec second 
#define MOD 1000000007
#define pb push_back
#define endl "\n"
#define test cout<<"debuged\n";
#define si 1000000
#define pi pair<ll,ll>

ll pre[405]={0};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<ll> v(n+5);
    for(ll i=1;i<=n;i++)
        {
            cin>>v[i];
            pre[i]=pre[i-1]+v[i];
        }
    ll dp[n+5][n+5];
    for(ll i=n;i>=1;i--)
        for(ll j=i;j<=n;j++)
        {   
            dp[i][j]=INF;
            if(i==j)
            {
                dp[i][j]=0;
                continue;
            }
            for(ll k=i;k<j;k++)
            {
                dp[i][j]=min(dp[i][j],(dp[i][k]+dp[k+1][j]+(pre[k]-pre[i-1])+(pre[j]-pre[k])));
            }
        }
        cout<<dp[1][n];
}

















Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c,d,e,g=0;cin>>a>>b>>c>>d>>e;
  int f=10;
  if(a%10==0)g+=a; 
  else{
    g+=a/10*10+10;
    f=min(f,a%10);
  }
    if(b%10==0)g+=b; 
  else{
    g+=b/10*10+10;
    f=min(f,b%10);
  }
    if(c%10==0)g+=c; 
  else{
    g+=c/10*10+10;
    f=min(f,c%10);
  }
    if(d%10==0)g+=d; 
  else{
    g+=d/10*10+10;
    f=min(f,d%10);
  }  
  if(e%10==0)g+=e; 
  else{
    g+=e/10*10+10;
    f=min(f,e%10);
  }
  if(f==10)cout<<g;
  else cout<<g-10+f;
}

Measured memory_bytes: 256
arr = [[[0 for i1 in range(10)] for i2 in range(3)] for i3 in range(4)]

count=input()
for l in range(int(count)):
    b,f,r,v=input().split()
    arr[int(b)-1][int(f)-1][int(r)-1]+=int(v)

first_b = arr[0]
second_b = arr[1]
third_b = arr[2]
fourth_b= arr[3]

for m in range(3):
    for n in range(10):
        print(" "+str(first_b[m][n]),end="")
    print()
print("#"*20)
for m in range(3):
    for n in range(10):
        print(" "+str(second_b[m][n]),end="")
    print()
print("#"*20)
for m in range(3):
    for n in range(10):
        print(" "+str(third_b[m][n]),end="")
    print()
print("#"*20)
for m in range(3):
    for n in range(10):
        print(" "+str(fourth_b[m][n]),end="")
    print()

Measured memory_bytes: 7808
# -*- coding: utf-8 -*-
import numpy as np
import math

N = input()

MinDigit = 10000000001
for i in range(int(math.sqrt(N))+1):
    quotient = 1.0*N/(i+1)
    if(quotient.is_integer() == True):
        #print(i+1,quotient)
        #print(len(str(i+1)),len(str(int(quotient))))
        #print(max(len(str(i+1)),len(str(int(quotient)))))
        if(MinDigit>max(len(str(i+1)),len(str(int(quotient))))):
            MinDigit = max(len(str(i+1)),len(str(int(quotient))))

print(MinDigit)

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

using namespace std;

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int main() {
  int N;
  cin >> N;
  set<char> S;
  for (int i = 0; i < N; i++) {
    char C;
    cin >> C;
    S.insert(C);
  }
  if (S.size() == 3)
    cout << "Three" << endl;
  else
    cout << "Four" << endl;
}

Measured memory_bytes: 256
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rep1(i, n) for(ll i = 1; i < (n); ++i)
#define rep4(i, start, end, step) for (ll i = (start); i < (end); i += (step))

#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
int StrLen(char *s) { for(int ptr = 0;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
int StrDel(char *s, int n) { int l = StrLen(s); s[l - n + 1] = '\0'; return l - n; }

int NumDigits(long long l){ char s[30]; sprintf(s, "%lld", l); return strlen(s); }

int is1stAns = 1;
#ifdef __cplusplus
template <class T> 
void print(T t) { if (is1stAns) cout << t, is1stAns = 0; else cout << " " << t; }
#else
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }
#endif

#ifndef __cplusplus
ll min(ll a, ll b){ if (a < b) return a; else return b; }
ll max(ll a, ll b){ if (a > b) return a; else return b; }
#endif
/*
#ifdef __cplusplus
void chmin(ll& a, ll b) { if (a > b) a = b;}
#else
void chmin(ll *a, ll b) { if (*a > b) *a = b; }
#endif
*/
#define chmin(a, b) func_chmin(&(a), (b))
void func_chmin(ll *a, ll b) { if (*a > b) *a = b; }
#define chmax(a, b) func_chmax(&(a), (b))
void func_chmax(ll *a, ll b) { if (*a < b) *a = b; }

#define newchar(n) (char *)malloc(sizeof(char) * (n))
#define newint(n) (int *)malloc(sizeof(int) * (n))
#define newll(n) (ll *)malloc(sizeof(ll) * (n))

#define inll(x) ll x; scanf("%lld", &x)
#define putll(x) printf("%lld\n", (x))

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    inll(N); inll(K);
    ll *h = newll(N + 9); rep(i, N) scanf("%lld", &h[i]);
    ll *dp = newll(N + 9); rep(i, N + 9) dp[i] = INF;
    
    dp[0] = 0;
    rep(i, N - 1){
        rep1(j, K + 1){
            if (i + j >= N) break;
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    putll(dp[N - 1]);
    
    free(dp);
    free(h);
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;

int main () {

	string S,T;
	cin >> S >> T;

	set < char > used1[26], used2[26];

	REP(i,S.size()) {
		if (used1[S[i] - 'a'].find(T[i]) == used1[S[i] - 'a'].end()) {
			if (used1[S[i] - 'a'].size() != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
		used1[S[i] - 'a'].insert(T[i]);
	}

	REP(i,T.size()) {
		if (used2[T[i] - 'a'].find(S[i]) == used2[T[i] - 'a'].end()) {
			if (used2[T[i] - 'a'].size() != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
		used2[T[i] - 'a'].insert(S[i]);
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

int main()
{
    int N, M;
    cin>>N>>M;
    vector<int> A(N);
    for (int &a: A)
        cin>>a;
    vector<int> B(M);
    for (int &b: B)
        cin>>b;

    if (set<int>(A.begin(), A.end()).size() < N ||
        set<int>(B.begin(), B.end()).size() < M)
    {
        cout<<0<<endl;
        return 0;
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int pa = N;
    int pb = M;
    long long ans = 1;

    for (int x=N*M; x>0; x--)
    {
        while (0<pa && x<=A[pa-1])
            pa--;
        while (0<pb && x<=B[pb-1])
            pb--;
        //  x<=A[pa], x<=B[pb]

        long long t;
        if (A[pa]==x && B[pb]==x)
            t = 1;
        else if (A[pa]==x)
            t = M-pb;
        else if (B[pb]==x)
            t = N-pa;
        else
            t = max(0, (N-pa)*(M-pb)-(N*M-x));
        ans *= t;
        ans %= 1000000007;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;
double pi = 3.141592653589793;

int main(){
    int A,B,H,M; cin>>A>>B>>H>>M;

    double ans=A*A+B*B,theta,ht,mt;
    ht=360/12*H+1/2.*M;
    mt=6*M;
    theta=pi/180*abs(ht-mt);
    ans-=2*A*B*cos(theta);
    ans=sqrt(ans);

    cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 4192
N = int(input())
s = [0]*N
p = {}
ans = 0
for i in range(N):
    s[i] = "".join(sorted(input()))
    if s[i] in p:
        ans += p[s[i]]
        p[s[i]] += 1
    else:
        p[s[i]] = 1

print(ans)

Measured memory_bytes: 18732
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
双方向リスト
*/

struct node {
    struct node* next;
    struct node* prev;
    int val;
};
typedef struct node node_t;

node_t* make_new_node(int val) {
    node_t* p = (node_t*)calloc(sizeof(node_t), 1);
    p->val = val;
    p->next = p;
    p->prev = p;
    return p;
}
// 前に挿入
void insert_prev(node_t* cur, node_t* p) {
    cur->prev->next = p;
    p->next = cur;
    p->prev = cur->prev;
    cur->prev = p;
}
// 後に挿入
void insert_next(node_t* cur, node_t* p) {
    p->next = cur->next;
    cur->next->prev = p;
    cur->next = p;
    p->prev = cur;
}
// 削除
void delete_this(node_t* cur) {
    node_t* tmp = cur->next;
    cur->prev->next = tmp;
    cur->next->prev = cur->prev;
}

typedef struct {
    node_t* head;
} list_t;

list_t* make_new_list() {
    list_t* list = (list_t*)calloc(sizeof(list_t), 1);
    node_t* head = make_new_node(0);
    list->head = head;
    return list;
}

void print_list(list_t* list) {
    char sep[2] = {};
    node_t* n = list->head->next;
    while (n != list->head) {
        printf("%s%d", sep, n->val);
        sep[0] = ' ';
        n = n->next;
    }
    putchar('\n');
}

void insert(list_t* list, int val) {
    node_t* n = make_new_node(val);
    insert_next(list->head, n);
}
void deleteFirst(list_t* list) {
    node_t* n = list->head->next;
    if (n == list->head) {
        return;
    }
    delete_this(list->head->next);
}
void deleteLast(list_t* list) {
    node_t* n = list->head->prev;
    if (n == list->head) {
        return;
    }
    delete_this(list->head->prev);
}
void delete (list_t* list, int val) {
    node_t* n = list->head->next;
    if (n == list->head) {
        return;
    }
    while (n != list->head) {
        if (n->val == val) {
            delete_this(n);
            break;
        }
        n = n->next;
    }
}

int main(int argc, char const* argv[]) {
    int n;
    char buf[1024];
    fgets(buf, sizeof(buf), stdin);
    sscanf(buf, "%d", &n);
    list_t* list = make_new_list();

    char cmd[32];
    int op;
    for (int i = 0; i < n; i++) {
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, "%s %d", cmd, &op);
        if (!strcmp("insert", cmd)) {
            insert(list, op);
        } else if (!strcmp("delete", cmd)) {
            delete (list, op);
        } else if (!strcmp("deleteFirst", cmd)) {
            deleteFirst(list);
        } else if (!strcmp("deleteLast", cmd)) {
            deleteLast(list);
        }
    }
    print_list(list);
}



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

int digits(int i){
    int ret=1;
    while((i=i/10)!=0) ret++;
    return ret;
}
int main(){
    long long n; int answer = 10000;
    cin>>n;
    for(int i=1; i<=int(sqrtl(n)); i++){
        if(n % i == 0){
            answer = min(answer, max(digits(i), digits(n/i)));
        }
    }
    cout<<answer;
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

// Problem Specific Parameter:

int main(void){
	int n, k;
	cin >> n >> k;
	vector<int> p(n + 1, 0);

	rep(i, 1, n + 1) {
		cin >> p[i];
		p[i] += p[i - 1];
	}

	R ans = 0.0;

	rep(i, k, n + 1) chmax(ans, 1.0L * (p[i] - p[i - k] + k) / 2.0);
	cout.precision(20);
	cout << fixed << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int cnt[12][12] = {}; 
	for(int i = 1; i <= N; i++){
		int a, b; 
		b = i % 10; 
		int tmp = i; 
		while(tmp >= 10){
			tmp /= 10; 
		}
		a = tmp; 
		cnt[a][b] ++; 
	} 
	int ans = 0; 
	for(int i = 1; i <= N; i++){
		int a, b; 
		b = i % 10; 
		int tmp = i; 
		while(tmp >= 10){
			tmp /= 10; 
		}
		a = tmp; 
		ans += cnt[b][a]; 
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <iomanip>

typedef long long ll;
typedef long double ld;

using namespace std;
using Graph = vector<vector<ll>>;

#define rep(i, N) for (ll i = 0; i < (ll)(N); ++i)
#define ALL(a) (a).begin(),(a).end()

const ll inf = 1e18+7;
const ll mod = 1e9+7;

ll GetDigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

int main(){
    ll N,ans=1;
    cin >> N;
    vector<ll> H(N,0);
    rep(i,N) cin >> H[i];
    ll ma=H[0];
    for(ll i=1;i<N;i++){
        ma = max(ma,H[i]);
        if(ma<=H[i]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
typedef pair<int,int> P;
int n,k;
P a[1000];
int i,j,l,m;
long long int dp[1000][4][4],cnt=0;
int flg1=0,flg2=0;
void func();
int main(void){
	scanf("%d %d",&n,&k);
	for(i=1;i<=k;i++){
		scanf("%d %d",&a[i].first,&a[i].second);
	}
	sort(a,a+k+1);
	for(i=1;i<=n+1;i++){
		for(j=1;j<=3;j++){
			for(l=1;l<=3;l++){
				dp[i][j][l]=0;
			}
		}
	}
	for(i=3;i<=n+1;i++){
		for(m=1;m<=k;m++){
			if(a[m].first==i-2){//もしi-2日目に設定があったら
				for(j=1;j<=3;j++){
					for(l=1;l<=3;l++){
						if(l!=a[m].second){
							dp[i][j][l]=-1;
						}
					}
				}
			}
			if(a[m].first==i-1){
				for(l=1;l<=3;l++){
					for(j=1;j<=3;j++){
						if(j!=a[m].second){
							dp[i][j][l]=-1;
						}
					}
				}
			}
		}
	}
	for(j=1;j<=3;j++){
		for(l=1;l<=3;l++){
			if(dp[3][j][l]!=-1){
				dp[3][j][l]=1;
			}
		}
	}
	for(i=3;i<=n+1;i++){
		for(j=1;j<=3;j++){
			for(l=1;l<=3;l++){
				if(dp[i][j][l]>-1){
					for(m=1;m<=3;m++){
						if(dp[i+1][m][j]>-1){
							if(m==j && j==l);
							else {
								dp[i+1][m][j]+=dp[i][j][l];
								dp[i+1][m][j]%=10000;
							}
						}
					}
				}
			}
		}
	}
	
	/*for(i=3;i<=n+1;i++){
		for(j=1;j<=3;j++){
			for(l=1;l<=3;l++){
				printf("%lld ",dp[i][j][l]);
			}
			printf("\n");
		}
		printf("\n");
	}*/
	long long int cnt=0;
	for(j=1;j<=3;j++){
		for(l=1;l<=3;l++){
			if(dp[n+1][j][l]>-1){
				cnt+=dp[n+1][j][l];
				cnt%=10000;
			}
		}
	}
	printf("%lld\n",cnt);
	return 0;
}

Measured memory_bytes: 1052
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
    ll K;
    string S;
    cin >> K >> S;
    ll len = S.length();
    mint ans = mint(0);
    combination comb = combination(K + len + 2);
    for(ll k = 0; k <= K; ++k) {
        mint base1 = mint(25);
        mint base2 = mint(26);
        mint mlen = mint(len);
        ans += comb.operator()(len + k - 1, k) * base1.pow(k) * base2.pow(K-k);
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 35564
MOD=10**9+7
n=int(input())
dp=[]
for i in range(n+1):
  dp.append([])
  for j in range(4):
    dp[-1].append([])
    for k in range(4):
      dp[-1][-1].append([])
      for l in range(4):
        dp[-1][-1][-1].append(0)
for i in range(4):
  for j in range(4):
    for k in range(4):
      dp[3][i][j][k]=1
dp[3][0][1][2]=0
dp[3][0][2][1]=0
dp[3][1][0][2]=0
for i in range(3,n):
  for j in range(4):
    for k in range(4):
      for l in range(4):
        dp[i+1][k][l][0]=(dp[i+1][k][l][0]+dp[i][j][k][l])%MOD
        dp[i+1][k][l][1]=(dp[i][j][k][l]+dp[i+1][k][l][1])%MOD
        dp[i+1][k][l][3]=(dp[i][j][k][l]+dp[i+1][k][l][3])%MOD
        if not((j==0 and k==1) or (j==0 and l==1)):
          dp[i+1][k][l][2]=(dp[i+1][k][l][2]+dp[i][j][k][l])%MOD
  dp[i+1][0][1][2]=0
  dp[i+1][0][2][1]=0
  dp[i+1][1][0][2]=0
ans=0
for i in range(4):
  for j in range(4):
    for k in range(4):
      ans=(ans+dp[n][i][j][k])%MOD
print(ans)

Measured memory_bytes: 74724
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	int n, k, i;
	cin >> n >> k;
	int arr[n];
	fo(i, 0, n)
	cin >> arr[i];
	
	fo(i, k, n) {
		if(arr[i] > arr[i - k]) cout << "Yes\n";
		else cout << "No\n";
	}
}


Measured memory_bytes: 4476
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const S = readToken();
      const K = cast(int)(S.length);
      const A = S.count('o');
      const ans = (A + (15 - K) >= 8);
      writeln(ans ? "YES" : "NO");
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define MAXN 500003
typedef long long ll;
inline ll mod(ll x,ll n)
{
    if(x<n)
    {
        return x;
    }
    return x-n;
}
using namespace std;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}



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

vector<ll>v;
 ll sum=0,act=0,k,n,q,f;
cin>>n;
ll arr[n];
ll dp[n+1];
forr(i,0,n){cin>>arr[i];
dp[i]=1e9;}

dp[0]=0;
dp[1]=abs(arr[1]-arr[0]);
forr(i,2,n)
{
    ll x=1e9,y=1e9;
    x=dp[i-1]+abs(arr[i]-arr[i-1]);
    if(i-2>=0)y=dp[i-2]+abs(arr[i-2]-arr[i]);
    dp[i]=min(x,y);
}
cout<<dp[n-1]<<endl;

return 0;
}


Measured memory_bytes: 5120
program bingo
  implicit none
  integer :: a(3,3), n, b, i, j, k
  logical :: x
  read(*,*) a
  read(*,*) n
  do i = 1, n
    read(*,*) b
    do j = 1, 3
      do k = 1, 3
        if (a(j,k) == b) a(j,k) = -1
      end do
    end do
  end do
  x = x .or. (a(1,1) < 0 .and. a(2,2) < 0 .and. a(3,3) < 0) .or. (a(3,1) < 0 .and. a(2,2) < 0 .and. a(1,3) < 0)
  do i = 1, 3
    x = x .or. all(a(i,:) < 0) .or. all(a(:,i) < 0)
  end do
  write(*,'(a)') trim(merge("Yes","No ",x))
end program bingo

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, C: int, B: "List[int]", A: "List[List[int]]"):
    ans = 0
    for a in A:
        if sum(aa*bb for aa, bb in zip(a, B)) + C > 0:
            ans += 1
    return ans


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    B = [int(next(tokens)) for _ in range(M)]  # type: "List[int]"
    A = [[int(next(tokens)) for _ in range(M)] for _ in range(N)]  # type: "List[List[int]]"
    print(solve(N, M, C, B, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

const int MAXV = 100005;
const int BLACK = 1;    // odd
const int WHITE = 0;    // even

vector<vector<P>> to(MAXV);
vector<int> col(MAXV);
void dfs(int v, int p, int len) {
  col[v] = p < 0 ? WHITE : (col[p] + len) % 2;
  for(P u : to[v]) {
    if(col[u.first] == BLACK || col[u.first] == WHITE)
      continue;
    dfs(u.first, v, u.second);
  }
}

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

  col.resize(n);
  rep(i, n) col[i] = -1;

  rep(i, n - 1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    to[u].push_back(make_pair(v, w));
    to[v].push_back(make_pair(u, w));
  }
  dfs(0, -1, 0);
  rep(i, n) printf("%d\n", col[i]);
  return 0;
}

Measured memory_bytes: 7680
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n, q;
    string s;
    cin >> n >> q >> s;

    vector <int> sm(n, 0);
    for (int i = 1; i < n; i++) {
        sm[i] = sm[i-1];
        if (s[i-1] == 'A' && s[i] == 'C') {
            sm[i]++;
        }
    }

    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        l--; r--;
        cout << sm[r] - sm[l] << '\n';
    }

    return 0;
}

Measured memory_bytes: 1472
def main():
    n = int(input())
    h = list(map(int, input().split()))

    for i in range(1, n):
        if h[i-1] < h[i]:
            h[i] -= 1
        elif h[i-1] == h[i]:
            pass
        else:
            print('No')
            return
    print('Yes')


main()


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

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

int main(){
  string s, t;
  cin >> s >> t;
  ll a,b;
  cin >> a >> b;
  string u;
  cin >> u;
  if(u==s){
    a--;
  }else{
    b--;
  }

  cout << a << " " << b << endl;

  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int field[6][6] = {0},a,x = 1,y = 0,t = 1;
  for(int i=0; i<5; i++){
    for(int j=0; j<4; j++){
      scanf("%1d",&a);
      field[j+1][i]+=(a<<2);
      field[j+1][i+1]+=(a<<0);
    }
    if(i<4){
      for(int j=0; j<5; j++){
	scanf("%1d",&a);
	field[j][i+1]+=(a<<1);
	field[j+1][i+1]+=(a<<3);
      }
    }
  }
  for(;;){
    if(t == 0){
      if(field[x][y]&2){
	cout <<"U";
	if(field[x][y]&1){t = 3;}
	else{y--;}
      }
      else{x++;t = 1;}
    }
    else if(t == 1){
      if(field[x][y]&4){
	cout <<"R";
	if(field[x][y]&2){t = 0;}
	else{x++;}
      }
      else{y++;t = 2;}
    }
    else if(t == 2){
      if(field[x][y]&8){
	cout <<"D";
	if(field[x][y]&4){t = 1;}
	else{y++;}
      }
      else{x--;t = 3;}
    }
    else if(t == 3){
      if(field[x][y]&1){
	cout <<"L";
	if(field[x][y]&8){t = 2;}
	else{x--;}
      }
      else{y--;t = 0;}
    }
    if(!x && !y){break;}
  }
  cout <<endl;
  return 0;
}

Measured memory_bytes: 1204
#include<bits/stdc++.h>
#define mo 998244353
using namespace std;
int n,m,i,j,k,x,y,book[20005],zhan[20005],flag,f[2005][2005];
int top,nex[20005],to[20005],fir[20005];
int lj(int u,int v){
	top++;
	nex[top]=fir[u];
	fir[u]=top;
	to[top]=v;
}
long long read(){
	long long xx=0,flagg=1;
	char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')
		ch=getchar();
	if(ch=='-'){
		flagg=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		xx=xx*10+ch-'0';
		ch=getchar();
	}
	return xx*flagg;
}
void pus(long long xx,int flagg){
	if(xx>=10)
		pus(xx/10,0);
	putchar(xx%10+'0');
	if(flagg==1)
		putchar(' ');
	if(flagg==2)
		putchar('\n');
	return;
}
void ss(int v){
	if(flag!=0)
		return;
	if(book[v]!=0){
		flag=book[v];
		return;
	}
	top++;
	book[v]=top;
	zhan[top]=v;
	for(int top1=fir[v];top1;top1=nex[top1])
		ss(to[top1]);
	if(flag!=0)
		return;
	book[v]=0;
	zhan[top]=0;
	top--;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();m=read();
	for(i=1;i<=m;i++){
		x=read();y=read();
		f[x][y]=1;
		lj(x,y);
	}
	for(i=1;i<=n;i++)
		if(flag==0)
			ss(i);
	if(flag==0){
		printf("-1\n");
		return 0;
	}
	for(i=1;i<=top-flag+1;i++)
		zhan[i]=zhan[i+flag-1];
	top=top-flag+1;
	for(i=1;i<=n;i++)
		book[i]=0;
	for(i=1;i<=top;i++)
		book[zhan[i]]=i;
	while(1){
		flag=0;
		for(i=1;i<=top;i++){
			for(j=1;j<=top;j++)
				if(i+1!=j&&(i!=top||j!=1)){
					if(f[zhan[i]][zhan[j]]==1){
						flag=1;
						if(j<i){
							for(k=1;k<=i-j+1;k++)
								zhan[k]=zhan[j+k-1];
							top=i-j+1;
						}
						else{
							for(k=1;;k++){
								zhan[i+k]=zhan[j+k-1];
								if(j+k-1==top){
									top=i+k;
									break;
								}
							}
						}
					}
					if(flag==1)
						break;
				}
			if(flag==1)
				break;
		}
		if(flag==0)
			break;
	}
	pus(top,2);
	for(i=1;i<=top;i++)
		pus(zhan[i],2);
	return 0;
}

Measured memory_bytes: 7552
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
ks = []

for _ in range(M):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    T = 0
    
    for ci in c:
        T += 1<<(ci-1)
    
    ks.append((a, T))

dp = [10**18]*(1<<N)
dp[0] = 0

for S in range(1<<N):
    for a, T in ks:
        dp[S|T] = min(dp[S|T], dp[S]+a)

if dp[-1]==10**18:
    print(-1)
else:
    print(dp[-1])

Measured memory_bytes: 74248