akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
//vector<vector<int>> vec(縦,vector<int>(横));

int main(){
  int A,B;
  cin>>A>>B;
  int i=0;
  while(1){
    if(floor(i*0.08)==A&&floor(i*0.1)==B){
      cout<<i<<endl;
      return 0;
    }
    if(i==1001){
      cout<<"-1"<<endl;
      return 0;
    }
    i++;
  }
  
}

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

int main()
{
    int n, result = 0; 
    cin >> n; 

    int arr[n]; 
    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i]; 
    }

    int temp; 

    for (int i = 0; i < n - 1; ++i)
    {
        for (int j = i + 1; j < n; ++j){
            temp = arr[i] * arr[j]; 
            result += temp; 
        }
    }
    
    cout << result << endl; 
    return 0; 
}

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


int n_1(int *c, int n)
{
	if (n == 0)
	{
		return 0;
	}

	int t = c[0];
	for (int i = 0; i < n; i++)
	{
		if (c[i] != t) return -1;
	}
	return t;
}

int n_2(int *s, int *c, int n)
{
	int t1 = -1, t2 = -1;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 1)
		{
			if (c[i] == 0)
			{
				return -1;
			}
			else if (t1 < 0)
			{
				t1 = c[i];
			}
			else if (t1 != c[i])
			{
				return -1;
			}
		}
		else if (s[i] == 2)
		{
			if (t2 < 0)
			{
				t2 = c[i];
			}
			else if (t2 != c[i])
			{
				return -1;
			}
		}
	}
	
	if (t1 < 0) t1 = 1;
	if (t2 < 0) t2 = 0;

	return t1 * 10 + t2;
}

int n_3(int* s, int* c, int n)
{
	int t1 = -1, t2 = -1, t3 = -1;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 1)
		{
			if (c[i] == 0)
			{
				return -1;
			}
			else if (t1 < 0)
			{
				t1 = c[i];
			}
			else if (t1 != c[i])
			{
				return -1;
			}
		}
		else if (s[i] == 2)
		{
			if (t2 < 0)
			{
				t2 = c[i];
			}
			else if (t2 != c[i])
			{
				return -1;
			}
		}
		else if (s[i] == 3)
		{
			if (t3 < 0)
			{
				t3 = c[i];
			}
			else if (t3 != c[i])
			{
				return -1;
			}
		}
	}

	if (t1 < 0) t1 = 1;
	if (t2 < 0) t2 = 0;
	if (t3 < 0) t3 = 0;

	return t1 * 100 + t2 * 10 + t3;
}

int main()
{
	int N, M;
	std::cin >> N >> M;

	int s[5], c[5];
	for (int i = 0; i < M; i++)
	{
		std::cin >> s[i] >> c[i];
	}

	int ans;
	if (N == 1)
	{
		ans = n_1(c, M);
	}
	else if (N == 2)
	{
		ans = n_2(s, c, M);
	}
	else if (N == 3)
	{
		ans = n_3(s, c, M);
	}

	std::cout << ans;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 266666;
int n,cnt[N];char S[N];
int main() {
	scanf("%s",S+1);n=strlen(S+1);
	rep(i,1,n)cnt[S[i]-'a']++;
	sort(cnt,cnt+3);
	if(cnt[2]-cnt[0]<=1)puts("YES");
	else puts("NO");
	return 0;
}


Measured memory_bytes: 384
import java.util.Scanner
object Main extends App {
  val sc = new Scanner(System.in)
  val ts = sc.next.map(_ - '0')
  println(Math.min(
    ts.indices.count(i => ts(i) == i % 2),
    ts.indices.count(i => ts(i) != i % 2)
  ))
  
}

Measured memory_bytes: 31584
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]){
    int d, n, m;
    vector<int> store;

    while (cin>>d, d){
        int ans = 0;
        cin>>n;
        cin>>m;

        store.push_back(0);
        for (int i = 0; i < n-1; i++){
            int s;
            cin>>s;
            store.push_back(s);
        }
        store.push_back(d);
        sort(begin(store), end(store));

        for (int i = 0; i < m; i++){
            int d;
            cin>>d;
            auto itl = lower_bound(begin(store), end(store), d);
            auto itu = itl - 1;
            ans += min(*itl - d, d - *itu);
        }

        cout<<ans<<endl;
        store.clear();
    }

    return 0;
}

Measured memory_bytes: 3456
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int R;
	cin >> R;
	if (R < 1200) {
		cout << "ABC" << endl;
	}
	else if (R < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

/***********************************************
    Dijkstra はここから O(V^2)
***********************************************/
struct edge{
  ll to, cost;
  edge(ll to, ll cost) : to(to), cost(cost){}
};
/// Dijkstra
///
/// - Parameter from  : 出発点
/// - Parameter to    : 目的点
/// - Parameter v_num : 頂点数
/// - Returns: dist from -> to
vector<ll> dijkstra(int from, int v_num, vector<vector<edge>> & graph){
  ll INF = (ll)1e15;
  vector<ll> d(v_num,INF);        // fromからの距離を格納する
  d[from] = 0;

  priority_queue<PLL,vector<PLL>,greater<PLL>> que;

  que.push(PLL(0,from));
  //頂点はv_num個あるので、v_num周する
  while(!que.empty()){ // もし調べ済みで到達可能な頂点がない場合はbreakする
    PLL  p = que.top();
    que.pop();
    ll node = p.second;
    if(d[node] < p.first) continue;
    for(auto e : graph[node]){
      if(d[e.to] > d[node] + e.cost){
        d[e.to] = d[node] + e.cost;
        que.push(PLL(d[e.to],e.to));
      }
    }
  }

  return d;
}

/***********************************************
    Dijkstra はここまで
***********************************************/
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;

  vector<vector<edge>> graph(n);
  rep(i,n){
    int idx,cnt;
    cin >> idx >> cnt;
    rep(j,cnt){
      ll x,cost;
      cin >> x >> cost;
      graph[idx].push_back(edge(x,cost));
    }
  }

  VLL d = dijkstra(0,n,graph);
  rep(i,n){
    cout << i << ' ' << d[i] << endl;
  }
  return 0;
}



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

#define ll          long long
#define ull         unsigned long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define Mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)      (a).rbegin(),(a).rend()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
//#define mod        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define INF         numeric_limits<ll>::max();
#define NINF        numeric_limits<ll>::min();
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))
const long double pi=3.14159265359;

inline ll add(ll a,ll b){
    if((a+b)>=mod)return (a+b)%mod;
    return a+b;
}

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




void solve(){
    int n;cin>>n;
    string s;cin>>s;
    set<int> r,g,b;
    rep(i,0,n){
        if(s[i]=='R')r.insert(i);
        if(s[i]=='G')g.insert(i);
        if(s[i]=='B')b.insert(i);
    }
    ll ans=r.size()*g.size()*b.size();
    for(auto u:r){
        for(auto v:g){
            if((u+v)%2==0 && b.find((u+v)/2)!=b.end())ans--;
        }
    }
    for(auto u:r){
        for(auto v:b){
            if((u+v)%2==0 && g.find((u+v)/2)!=g.end())ans--;
        }
    }
    for(auto u:b){
        for(auto v:g){
            if((u+v)%2==0 && r.find((u+v)/2)!=r.end())ans--;
        }
    }
    cout<<ans<<endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3844
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitsf(n) __builtin_popcount(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"
ll power(ll x, ll y); 

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll a, b, n;
    cin >> a >> b >> n;
    n = min(b-1, n);
    ll A = (a*n)/b - a*(n/b);
    cout << A;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

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

int main () {

    string n;
    cin >> n;

    for (int i = 0; i < n.size(); i++) {
        n[i] = ((n[i] == '1')? '9' : '1');
    }
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import statistics
input = sys.stdin.readline

n = int(input())
p = list(map(int, input().split()))
counter = 0
for i in range(1, n-1):
    lis = (p[i-1], p[i], p[i+1])
    mid = statistics.median(lis)
    if p[i] == mid:
        counter += 1

print(counter)

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef pair<ll, int> PILL;
typedef pair<ll, ll> PLL;

const int MAX_N = 1e5+5;
const int M = 1e6;
const ll INF = (ll)(1e18);
const int inf = 1e9;
const ll MOD = 1000000007LL;

void solve() {

}

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

    string s;
    cin >> s;

    for (int i=0; i<s.size(); i++) {
        int j = i+1;
        if (j%2 == 0 && s[i] == 'R') {
            cout << "No";
            return 0;
        }
        if (j%2 == 1 && s[i] == 'L') {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,x,t;
  scanf("%d %d %d\n",&n,&x,&t);
  int time;
  int a,d;
  if(n<x) time = t;
  if(n>=x){
    a = n/x;
    time = a*t;
    d = n%x;
    if(d!=0) time = time + t;
  }
  printf("%d\n",time);
  return 0;
}

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

import heapq
def dijkstra(s):
    # 始点sから各頂点への最短距離
    d = [float('inf')]*n
    d[s] = 0
    # 各頂点が訪問済みかどうか
    used = [False]*n
    used[s] = True
    # 仮の距離を記録するヒープ
    que = []
    for e in edge[s]:
        heapq.heappush(que, e)
    while que:
        minedge = heapq.heappop(que)
        if used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = True
        for e in edge[v]:
            if not used[e[1]]:
                heapq.heappush(que, [e[0] + d[v], e[1]])
    return d

################################
n = int(input()) #n:頂点数　w:辺の数
w = n - 1

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列
for i in range(w):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    z = 1
    edge[x].append([z,y])
    edge[y].append([z,x]) 

dis_from_f = dijkstra(0)
dis_from_s = dijkstra(n - 1)

cnt = 0
for i, j in zip(dis_from_f, dis_from_s):
    if i <= j:
        cnt += 1
if cnt > n - cnt:
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 104396
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;

int num[305][305];


int main()
{
	int h, w, d, q;
	map < int, pair<int,int> > mp;
	scanf("%d %d %d",&h, &w, &d);
	vector<int> pre(h * w + 5, 0);
	for(int i = 1; i <= h; i++)
	{
		for(int j = 1; j <= w; j++)
		{
			scanf("%d",&num[i][j]);
			mp[num[i][j]] = make_pair(i,j);
		}
	}
	for(int i = 1; i <= d; i++)
	{
		for(int j = 1; i + j * d <= h * w; j++)
		{
			int l = i + (j - 1) * d, r = i + j * d;
			int x = mp[l].first, y = mp[l].second;
			int z = mp[r].first, w = mp[r].second;
			pre[i + j * d] = pre[i + (j - 1) * d] + abs(z - x) + abs(w - y);
		}
	}
	scanf("%d",&q);
	for(int i = 1; i <= q; i++)
	{
		int l, r;
		cin >> l >> r;
		cout << pre[r] - pre[l] << endl;
	}
	return 0;
}

Measured memory_bytes: 7424
use std::collections::HashMap;
use whiteread::parse_line;

fn main() {
    let n: u32 = parse_line().unwrap();
    let ss: Vec<String> = (0..n).map(|_| parse_line().unwrap()).collect();

    let mut frequency: HashMap<&str, u32> = HashMap::new();
    for s in &ss {
        *frequency.entry(s).or_insert(0) += 1;
    }
    for t in vec!["AC", "WA", "TLE", "RE"] {
        println!("{} x {}", t, frequency.get(t).unwrap_or(&0));
    }
}


Measured memory_bytes: 7580
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    mind = float('inf')
    i = 1
    ans = []
    while i * i <= n:
        if n%i == 0:
            if i == n//i:
                ans.append(i)
                mind = min(mind,len(str(i)))
            else:
                ans.append(i)
                ans.append(n//i)
                maxd = max(len(str(i)),len(str(n//i)))
                mind = min(mind,maxd)
        i += 1
    print(mind)
if __name__ == '__main__':
  main()


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;


const int MAX_N = 1005;
const int MAX_V = MAX_N * (MAX_N - 1) / 2;
vector<int> to[MAX_V];

int id[MAX_N][MAX_N];
int toId(int i, int j) {
    if (i > j) swap(i, j);

    return id[i][j];
}

bool visited[MAX_V];
bool calculated[MAX_V];
int dp[MAX_V]; // vからの最長経路

int dfs(int v) {
    if (visited[v]) {
        if (!calculated[v]) return -1;
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for (int u : to[v]) {
        int res = dfs(u);
        if (res == -1) return -1;
        dp[v] = max(dp[v], res + 1);
    }
    calculated[v] = true;
    return dp[v];
}


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

    int n; cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i, n) {
        rep(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int V = 0;
    rep(i, n) rep(j, n) {
        if (i < j) {
            id[i][j] = V++;
        }
    }
    rep(i, n) {
        rep(j, n-1) {
            a[i][j] = toId(i, a[i][j]);
        }
        rep(j, n-2) {
            to[a[i][j+1]].pb(a[i][j]);
        }
    }
    int ans = 0;
    rep(i, V) {
        int res = dfs(i);
        if (res == -1) {
            puts("-1");
            return 0;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;
vector<int> a;
vector<int> b;
int n, x, m;
long long s;

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

	for (int i=1;i<=n;i++) {
		cin >> x;
		a.push_back(x);
	}

	sort(a.begin(), a.end());

	for (int i=0;i<n-1;i++) b.push_back(a[i+1] - a[i]);

	sort(b.begin(), b.end(), greater<int>());

	s = a[n-1] - a[0] + 1 - m;

	if (s <= 0 || m > n) {
		cout << 0;
	} else {
		for (int i=0;i<m-1;i++) {
				s -= b[i] - 1;
			}
		cout << s;
	}


}



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

int main() {
    vector<int> permu;
   int n = 0, k = 0;
   cin >> n >> k;
   for(int i = 0; i < n; i++)
   {
       int x = 0;
       cin >> x;
       permu.push_back(x);
   }
   int res = 0;
   res++;
   n-=k;
   k--;
   if(n > 0){
       if(n % k == 0)
        res += n / k;
       else
        res += (n / k) + 1;
   }
   
        cout << res << "\n";
    return 0;
}

Measured memory_bytes: 892
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm>
#include <vector>
#include <map>
#include <queue> 
using namespace std; 
inline int gi() { 
    register int data = 0, w = 1; 
    register char ch = 0;
    while (!isdigit(ch) && ch != '-') ch = getchar(); 
    if (ch == '-') w = -1, ch = getchar(); 
    while (isdigit(ch)) data = 10 * data + ch - '0', ch = getchar(); 
    return w * data; 
} 
const int INF = 1e9; 
const int MAX_N = 2e6 + 5; 
int N, M, cnt = 0; 
vector<pair<int, int> > G[MAX_N], E[MAX_N]; 
map<pair<int, int>, int> mp; 
void Add_Edge(int u, int v, int w) { 
	G[u].push_back(make_pair(v, w)); 
	G[v].push_back(make_pair(u, w)); 
} 
int dis[MAX_N]; 
int bfs() { 
	for (int i = 1; i <= cnt; i++) dis[i] = INF; 
	auto st = mp.upper_bound(make_pair(1, 0)); 
    auto ed = mp.upper_bound(make_pair(2, 0)); 
	static deque<int> que; 
	for (auto it = st; it != ed; ++it) dis[it->second] = 2, que.push_front(it->second); 
	while (!que.empty()) { 
		int x = que.front(); que.pop_front(); 
		for (auto e : G[x]) { 
			int v = e.first, w = e.second; 
			if (dis[x] + w < dis[v]) { 
				dis[v] = dis[x] + w; 
			    if (w) que.push_back(v); 
			    else que.push_front(v); 
			} 
		} 
	} 
	st = mp.upper_bound(make_pair(N, 0)); 
    ed = mp.upper_bound(make_pair(N + 1, 0)); 
	int ans = INF; 
	for (auto it = st; it != ed; ++it) ans = min(ans, dis[it->second]); 
	return ans == INF ? -1 : ans / 2; 
} 
int main () {
	N = gi(), M = gi();
	int mx = 0; 
	for (int i = 1; i <= M; i++) { 
		int u = gi(), v = gi(), c = gi(); 
		E[c].push_back(make_pair(u, v)), mx = max(mx, c); 
	} 
	for (int i = 1; i <= mx; i++) { 
		for (auto j : E[i]) { 
			int u = j.first, v = j.second; 
			if (mp.find(make_pair(u, i)) == mp.end()) mp[make_pair(u, i)] = ++cnt; 
			if (mp.find(make_pair(v, i)) == mp.end()) mp[make_pair(v, i)] = ++cnt; 
		} 
	} 
	for (int i = 1; i <= mx; i++) { 
		for (auto j : E[i]) { 
			int u = mp[make_pair(j.first, i)], v = mp[make_pair(j.second, i)];
			Add_Edge(u, v, 0); 
		} 
	} 
	for (int i = 1; i <= N; i++) { 
		auto st = mp.upper_bound(make_pair(i, 0)); 
		auto ed = mp.upper_bound(make_pair(i + 1, 0));
		if (st == ed) continue;
		++cnt; 
		for (auto it = st; it != ed; ++it) 
			Add_Edge(cnt, it->second, 1); 
	} 
	printf("%d\n", bfs()); 
    return 0; 
} 

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

int main(){
    int n, counter = 0;
    string s;
    cin >> n >> s;
    for(int i = 0; i < n; i++){ 
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C'){
            counter++;
        }
    }
    
cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.141592653897932384626
//freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
int main()
{
    long n,m,x,xx;
    cin>>n>>m>>x;
    long la=0,lb=0;
    for(long i=0;i<m;i++){
        scanf("%ld",&xx);
        if(xx>x)lb++;
        else la++;
    }
    cout<<min(la,lb)<<endl;

	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
arr = []
n.times { arr << gets.chomp.split(' ').map(&:to_i) }
distances = Hash.new(0)
(0...n).each do |i|
  (0...n).each do |j|
    next if i == j
    distances["{#{arr[i][0] - arr[j][0]}}&{#{arr[i][1] - arr[j][1]}}"] += 1
  end
end
max = distances.inject(0) { |acc, v| [acc, v[1]].max }
puts n - max

Measured memory_bytes: 2300
s=list(map(int,input().split()))
t=list(map(int,input().split()))
c=s[1]
d=0
a=sum(t[0:c])
b=0
for j in range(s[0]-s[1]+1):
  if j==0:
    b=sum(t[:c])
    continue
  else:
    a+=(t[j+c-1]-t[j-1])
    b=max(b,a)
b+=s[1]
print(b/2)

Measured memory_bytes: 25604
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    s = S()
    a = int(s[:2])
    b = int(s[2:])
    af = 1
    if a < 1 or a > 12:
        if b < 1 or b > 12:
            return 'NA'
        return 'YYMM'
    if b < 1 or b > 12:
        return 'MMYY'

    return 'AMBIGUOUS'


print(main())




Measured memory_bytes: 7748
import itertools
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())

# Twitterカンニング
# 二部グラフにする
# どの頂点対も一度以上別の頂点集合に属するようにする
ans = np.zeros((N, N), dtype=int)
level = 1
shift = 0
while True:
    groups = np.arange(N) >> shift & 1
    g0 = np.where(groups)[0]
    g1 = np.where(1 - groups)[0]
    if len(g0) == 0 or len(g1) == 0:
        break
    for i, j in itertools.product(g0, g1):
        ans[i, j] = level
    ans = np.maximum(ans, ans.T)
    shift += 1
    level += 1

for i in range(N - 1):
    print(*ans[i, i + 1:])


Measured memory_bytes: 16664
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  C *= 2;

  long long m = 1LL<<60;
  for (int c=0; c<=100000; c++) {
    int num_a = max(X-c, 0);
    int num_b = max(Y-c, 0);
    long long cost = 1LL*num_a*A + 1LL*num_b*B + 1LL*c*C;
    m = min(m, cost);
  }
  cout << m << "\n";
  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;

    string c;
    cin>>c;
    if(c=="MON")cout<<6;
    if(c=="TUE")cout<<5;
    if(c=="WED")cout<<4;
    if(c=="THU")cout<<3;
    if(c=="FRI")cout<<2;
    if(c=="SAT")cout<<1;
    if(c=="SUN")cout<<7;
    return 0;
}

Measured memory_bytes: 256
X,N=map(int,input().strip().split())
if N>=1:
    P=list(map(int,input().strip().split()))
else:
    P=[]

Y=X
while X in P and Y in P:
        X+=1
        Y-=1

if  Y not in P:
    print(Y)
else:
    print(X)

Measured memory_bytes: 9188
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
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; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion
void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    vec<ll> A(3);
    REP(i, 3){
        cin >> A[i];
        if(A[i]%2 == 0){
            cout << 0 << el; return;
        }
    }
    sort(ALL(A));
    cout << A[0]*A[1] << el;
}



Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


	public static void main(String[] args) throws IOException {
		BufferedReader bf = null;
		bf = new BufferedReader(new InputStreamReader(System.in));
		int n,i,ans,temp = 0;
		String str;
		str = bf.readLine();
		n = Integer.parseInt(str);
		str = bf.readLine();
		for(i = 0;i < n;++i) {
			if(str.charAt(i) == '.') {
				temp++;
			}
		}
		ans = temp;
		for(i = 0;i < n;++i) {
			if(str.charAt(i) == '.') {
				temp--;
			} else {
				temp++;
			}
			if(ans > temp) {
				ans = temp;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 26964
a, b = [int(x) for x in input().split()]

cnt = 0
for i in range(a, b + 1):
    fl = 0
    s = str(i)
    for j in range(len(s)//2):
        if not s[j] == s[len(s)-1-j]:
            fl = 1
            break
    if fl == 0:
            cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
using namespace std;


#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef pair<int, int> Edge;

vector<long long int> divi;


int main() {
	int n, m, c;
	int b[100];
	int y = 0;
	cin >> n >> m >> c;
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		int a = 0,A;
		for (int j = 0; j < m; j++) {
			cin >> A;
			a += A*b[j];
		}
		if (a + c > 0)y++;
	}

	cout << y << endl;
}


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

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

void header() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

ll a[maxn], b[maxn];

void solve() {
    ll n;
    cin >> n;
    ll res = 0, t;
    for (int i = 0; i <= n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        t = min(a[i], b[i]);
        res += t;
        b[i] -= t;
        if (b[i]) {
            t = min(a[i + 1], b[i]);
            res += t;
            a[i + 1] -= t;
        }
    }
    cout << res << endl;
}

int main() {
	header();
	solve();
	return 0;
}


Measured memory_bytes: 5120
n,k,*a,=map(int,open(0).read().split())
def f(li):
	b=[0]*(n+1)
	for i,x in enumerate(li):
		b[max(0,i-x)]+=1
		b[min(i+x+1,n)]-=1
	for i in range(n):
		b[i+1]+=b[i]
	return b[:-1]
for _ in range(k):
	a=f(a)
	if a==[n]*n:
		print(*a)
		exit()
print(*a)

Measured memory_bytes: 220468
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	log.SetFlags(log.Lshortfile)
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	m := 1
	cnt := 0
	for i := 0; i < n; i++ {
		if a[i] != m {
			cnt++
		} else {
			m++
		}
	}
	if cnt == n {
		fmt.Println("-1")
	} else {
		fmt.Println(cnt)
	}
}

const INF int = 1e7

func LongestIncrasingSubsequence(a []int, n int) int {
	dp := make([]int, n)
	for i := 0; i < n; i++ {
		dp[i] = INF
	}
	for i := 0; i < n; i++ {
		left := -1
		right := n - 1
		for right-left > 1 {
			mid := (left + right) / 2
			if dp[mid] >= a[i] {
				right = mid
			} else {
				left = mid
			}
		}
		dp[right] = a[i]
	}
	res := 0
	for i := 0; i < n; i++ {
		if dp[i] < INF {
			res = i
		}
	}
	return res + 1
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <time.h>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(c) (c).begin(), (c).end()
#define P pair<int, int>
#define chmin(x, y) x = min(x, y)

int main()
{
  ll n, x, m;
  cin >> n >> x >> m;
  vector<int> a;
  vector<int> id(m, -1);
  int cnt = 0;
  ll tot = 0;
  while (id[x] == -1)
  {
    a.push_back(x);
    id[x] = cnt;
    cnt++;
    tot += x;
    x = x * x % m;
  }
  if (n <= cnt)
  {
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
      ans += a[i];
    }
    cout << ans << endl;
    return 0;
  }
  ll ans = tot;
  ll s = 0; // 1ループの数値和
  for (int i = id[x]; i < cnt; i++)
  {
    s += a[i];
  }
  ll t = cnt - id[x];   // 1ループの長さ
  ll u = (n - cnt) / t; // ループの周回数
  ans += s * u;
  for (int i = id[x]; i < n - (u + 1) * t; i++)
  {
    ans += a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

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

    int cnt = 0;
    int l = 0, r = 0;
    rep(i, n){
        if(s[i] == '(') l++;
        else r++;
        
        if(r > l){
            cnt ++;
            l++;
        }
    }

    rep(i, cnt) cout << '(';
    cout << s;
    rep(i, l - r) cout << ')';
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
template <typename T> struct segtree {
    using Type = T;
    using DeltaType = T;
    const int size;
    vector<T> tree;
    const T zero;
    const function<T(T, T)> combine;
    segtree(int size, T zero, const function<T(T, T)>& combine)
    : size(size), tree(2 * (size + 1), zero), zero(zero), combine(combine) {}
    void update(int i, T x) {
        for(tree[i += size] = x; i >>= 1; )
            tree[i] = combine(tree[i << 1], tree[(i << 1) | 1]);
    }
    T query(int a, int b, bool inclusive) {
        assert(a <= b);
        T ans_l = zero, ans_r = zero;
        for(a += size, b += size + inclusive; a < b; a >>= 1, b >>= 1) {
            if(a & 1) ans_l = combine(ans_l, tree[a++]);
            if(b & 1) ans_r = combine(tree[--b], ans_r);
        }
        return combine(ans_l, ans_r);
    }
    T query(int i) { return query(i, i, true); }
    friend ostream& operator<<(ostream& os, segtree& t) {
        os << "[";
        for(int i = 0; i <= t.size; i++) {
            if(i != 0) os << ", ";
            os << t.query(i);
        }
        return os << "]";
    }
};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> h(n), a(n);
    cin >> h >> a;
    segtree<ll> opt(n, 0, [](ll x, ll y) { return max(x, y); });
    vector<int> I(n);
    iota(I.begin(), I.end(), 0);
    sort(I.begin(), I.end(), [&](int i, int j) { return h[i] < h[j]; });
    for(int i : I) {
        opt.update(i, opt.query(0, i, false) + a[i]);
    }
    cout << opt.query(0, n, false) << endl;
    return 0;
}


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

void solve() {
	int N, K; cin >> N >> K;
	vector<int> h(N);
	rep(i, N) scanf("%d", &h[i]);

	int res = 0;
	rep(i, N) {
		if (h[i] >= K) res++;
	}
	cout << res << endl;
}

int main(void) {
	solve();

	return 0;
}

Measured memory_bytes: 640
import sys
from collections import defaultdict

n, t = map(int, input().split())
knapsack = defaultdict(lambda: 0)
knapsack[0] = 0
tmp_ans = 0
cuisines = [tuple(map(int, line.split())) for line in sys.stdin]
cuisines.sort()
for a, b in cuisines:
    for time, satisfied in list(knapsack.items()):
        if time + a >= t:
            tmp_ans = max(tmp_ans, satisfied + b)
            continue
        knapsack[time + a] = max(knapsack[time + a], satisfied + b)

print(max(tmp_ans, max(knapsack.values())))


Measured memory_bytes: 51036
N,M = map(int,input().split())

line = [[] for _ in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    line[a-1].append(b-1)
    line[b-1].append(a-1)

check = [False] * N

def dfs(now):
    global cnt
    global ans
    if cnt == N:
        ans += 1
    else:
        for i in line[now]:
            if check[i] == False:
                check[i] = True
                cnt += 1
                dfs(i)
                check[i] = False
                cnt -= 1

check[0] = True
cnt = 1
ans = 0
dfs(0)
print(ans)

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

int main()
{
    double n,even=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i % 2 != 0){
            even++;
        }
    }
    double res = even/n;
    cout.setf(ios::fixed,ios::floatfield);
    cout.precision(10);
    cout<<res<<endl;

}



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

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const ll mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    while(cin >> n){
        int ans = 0;
        for(int i = 1 ; i <= n ; i *= 100){
            if(i*10<=n){
                ans += i * 10 - i;  
            }
            else{
                ans += n + 1 - i;
            }
        }
        cout << ans << endl;
    }
}

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

int main() {
	char S[20];
	string T;
	string p;
	string Q;
	double m;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> a >> b >> x;
	if (a <= x && a + b >= x) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
}

Measured memory_bytes: 256
M, D = map(int, input().split())

cnt = 0
for m in range(1, M+1):
    for d in range(1, D+1):
        if d >= 10:
            d10 = int(str(d)[0])
            d1 = int(str(d)[1])
            if d10 >= 2 and d1 >= 2:
                if d10 * d1 == m:
                    cnt += 1

print(cnt)

Measured memory_bytes: 3060
//problem_c.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

// -----------------------------------------

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

// -----------------------------------------

func solve() {
	n := getInt()
	x := getIntSlice(n)

	min := 100000000
	idx := 0

	for i := 1; i <= 100; i++ {
		sum := 0
		for j := 1; j <= n; j++ {
			sum += (i - x[j-1]) * (i - x[j-1])
		}

		if min > sum {
			min = sum
			idx = i
		}
	}

	println(idx)
	fmt.Fprintln(wr, min)

}

// -----------------------------------------

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 640
c=(0..M=18).map{[0]*19}
p`sed 1d`.split.sum{|a|a=(a.to_r*10**9).to_i
i=j=0
i+=1while a[i]<1&&i<M
(j+=1;a/=5)while a%5<1&&j<M
s=c[M-i..].sum{_1[M-j..].sum}
c[i][j]+=1;s}

Measured memory_bytes: 33636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

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

int main(){
  int N, M, t, s, d;
  while(scanf("%d%d", &N, &M) && N+M){
    vector<pii>v(M);
    rep(i, M){
      scanf("%d%d%d", &t, &s, &d);
      s--; d--;
      v[i] = make_pair(t, make_pair(s, d));
    }

    sort(v.begin(), v.end());
    vector<bool>f(N, 0);
    f[0] = 1;
    rep(i, M){
      int a = v[i].S.F; int b = v[i].S.S;
      if(f[a]) f[b] = 1;
    }
    int res = 0;
    rep(i, N) if(f[i]) res++;
    //    printf("%d %d %d\n", (int)f[0], (int)f[1], (int)f[2]);
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1428
/* Code by Saborit */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast") 
#define MX 100005
#define INF (1<<30)
#define EPS 1e-9
#define MOD 1000000007
#define mid (x+xend)/2
#define izq nod*2
#define der nod*2+1
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define all(X) (X).begin(), (X).end()
#define unique(X) (X).resize(unique(all(X)) - (X).begin())
#ifdef LOCAL
	#include "debug.h"
#endif
using namespace std;
using namespace __gnu_pbds;
typedef long long int64;
typedef unsigned long long unt64;

#define SQ(X) ((int64)(X)*(X))

struct pt{
	int x, y;
};

long double dist(pt a, pt b){
	return sqrt(SQ(a.x - b.x) + SQ(a.y - b.y));
}

int N, fact = 1;
pt A[MX];

int main(void){
    //~ freopen("a.in", "r", stdin);
    //~ freopen("a.out", "w", stdout);
    
    scanf("%d", &N);
    for(int i=1; i<=N; i++){
		scanf("%d%d", &A[i].x, &A[i].y);	
		fact *= i;
	}
	fact /= N;
	
	long double sum = 0;
	for(int i=1; i<=N; i++)
		for(int j=i+1; j<=N; j++)
			sum += dist(A[i], A[j]) * fact;
    
    fact *= N;
    
    printf("%.8LF\n", 2 * sum / fact);
    
   return 0;
}


Measured memory_bytes: 3852
#include<iostream>
using namespace std;
long long A[100010]={0},B[100010]={0};
int main(){
	int N;
	cin>>N;
	for(int i=0;i<=N;i++){
		cin>>A[i];
	}//怪兽 
	for(int i=0;i<N;i++){
		cin>>B[i];
	}//英雄 
	long long ans=0;
	int sen=0;
	for(int i=0;i<N;i++){
	    sen=B[i]-A[i];
		if(A[i]>B[i]){
			ans=ans+B[i];
		}else{
			ans=ans+A[i];
			if(sen>=A[i+1]){
				ans=ans+A[i+1];
				A[i+1]=0;
			}else{
				ans=ans+sen;
				A[i+1]=A[i+1]-sen; 
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
  int d,n,s=1;
  cin >> d >> n;
  for (int i = 0; i < d; i++){
    s *= 100;
  }
  if (n <= 99){
    cout << n*s << endl;
  }else{
    cout << 101*s << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

ts = [abs(t-0.006*h[i]-a) for i in range(n)]
min_ts=min(ts)
ret = [i for i in range(n) if ts[i]==min_ts][0]+1

print(ret)

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


int N;


void input() {
    cin >> N;
}


int main() {
    input();
    while (N % 111 != 0) N++;
    cout << N << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

typedef pair<int, int> pii;

int main()
{
	string T, P;
	cin >> T >> P;

	for (int i = 0; i != T.size(); i++)
	{
		if (T[i] == P[0])
		{
			bool same = true;
			for (int j = 1; j != P.size(); j++)
			{
				if (T[i + j] != P[j])
				{
					same = false;
					break;
				}
			}
			if (same)
			{
				cout << i << endl;
			}
		}
	}

	return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    ll wa = 0, ac = 0;
    int v[n + 1] = {}, ans[n + 1] = {};
    rep(i, m){
        int p;
        string s;
        cin >> p >> s;
        if (s == "WA" && ans[p] != 1){
            wa += 1;
            v[p] += 1;
        }
        else if (s == "AC" && ans[p] != 1){
            ac += 1;
            ans[p] = 1;
        }
        else continue;
    }

    rep (i, n){
        if (ans[i + 1]!=1 && v[i + 1] >= 1) wa -= v[i + 1];
    }
    cout << ac << " " << wa << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 9 ;
int a[N] , b[N] ,c[N] , mem[N][5];
int n;
int dp[N][5];
int solve(int day , int curr){          // top down
    if(day == n)
        return 0;
    int &ret = mem[day][curr];
    if(~ret)
        return ret ;
    if(curr == 0){
        ret = max(ret , a[day] + solve(day + 1 , 1)) ;
        ret = max(ret , a[day] + solve(day + 1 , 2)) ;
    }
    if(curr == 1){
        ret = max(ret , b[day] + solve(day + 1 , 0)) ;
        ret = max(ret , b[day] + solve(day + 1 , 2)) ;
    }
    if(curr == 2){
        ret = max(ret , c[day] + solve(day + 1 , 0)) ;
        ret = max(ret , c[day] + solve(day + 1 , 1)) ;
    }
    return ret ;

}
int main()
{

   // memset(mem ,-1 , sizeof mem);
    cin >> n ;
    for(int i = 0 ; i  <n ; ++i){
        cin >> a[i] >> b[i] >> c[i];
    }
    int ans = 0 ;
//    for(int i = 0 ; i < 3 ; ++i)
//        ans = max(ans , solve(0 , i));
//    cout << ans << endl ;
     dp[0][0] = a[0] ;
     dp[0][1] = b[0] ;
     dp[0][2] = c[0] ;
     for(int i = 1 ; i < n ; ++i){
        dp[i][0] = a[i] + max(dp[i-1][1] , dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0] , dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0] , dp[i-1][1]);
     }
     for(int i = 0 ; i < 3 ; ++i){
        ans = max(ans , dp[n-1][i]);
     }
     cout << ans ;

    return 0;
}


Measured memory_bytes: 5248