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

#define DEBUG

#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

//#define int long long
typedef long long ll;
//constexpr int INF = 1e9;
//constexpr int MOD = 1000000007;

template<typename Monoid>
struct SegmentTree {
    using Func = function<Monoid (Monoid, Monoid)>;
    int size;
    vector<Monoid> seg;

    const Func func;
    const Monoid iden;

    SegmentTree(int n, const Func f, const Monoid& identity)
        :func(f), iden(identity)
    {
        size = 1;
        while (size < n) size <<= 1;
        seg.assign(2 * size, identity);
    }

    void update(int k, const Monoid& x) {
        k += size;
        seg[k] = x;
        while (k >>= 1) {
            seg[k] = func(seg[2 * k], seg[2 * k + 1]);
        }
    }

    Monoid query(int a, int b) {
        Monoid L = iden, R = iden;
        for (a += size, b += size; a < b; a >>= 1, b >>= 1) {
            if (a & 1) L = func(L, seg[a++]);
            if (b & 1) R = func(seg[--b], R);
        }
        return func(L, R);
    }
};

int m_gcd(int a, int b) {
    return b != 0 ? m_gcd(b, a % b) : a;
}

decltype(1) main() {
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    int n, a;
    cin >> n;
    SegmentTree<int> s(n, m_gcd, 0);
    for (int i = 0;i < n; ++i) {
        cin >> a;
        s.update(i, a);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        auto l = s.query(0, i);
        auto r = s.query(i+1, n);
        ans = max(ans, m_gcd(l, r));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<typename T> using v2 = vector<vector<T>>;
template<typename T> using v3 = vector<vector<vector<T>>>;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
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; }
const int MOD = 998244353;
const int INF = 1e9 + 200;
const ll INFLL = 2e18 + 200;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N + 1);
    cin >> A;
    ll now = 1;
    vector<ll> max_v(N + 1);
    max_v[0] = 1;
    if (N == 0 && A[0] == 1) {
        cout << 1 << endl;
        return 0;
    }
    if (A[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 1; i <= N; i++) {
        if (now >= INFLL) now = INFLL;
        now *= 2LL;
        if (now >= INFLL) {
            now = INFLL;
        } else {
            now -= A[i];
        }
        max_v[i] = now;
        if (now <= 0 & i != N) {
            cout << -1 << endl;
            return 0;
        }
        if (now < 0 && i == N) {
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans = 0;
    now = 0;
    for (int i = N; i >= 1; i--) {
        now += A[i];
        ans += now;
        if (now > max_v[i - 1]) {
            now = max_v[i - 1];
        }
    }
    cout << ans + 1 << endl;
}


Measured memory_bytes: 4844
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        String[] st = new String[8];
        int[] x = new int[4];
        int[] y = new int[4];
        while(input.hasNext()){
            int index = 0;
	        for(int i = 0 ; i < 8 ; i++){
	            st[i] = input.next();
	        }
	        for(int i = 0 ; i < 8 ; i++){
	            for(int j = 0 ; j < 8 ; j++){
	                if(st[i].charAt(j) == '1'){
	                    x[index] = j;
	                    y[index] = i;
	                    index++;
	                }
	            }
	        }
	        System.out.println(Tetris(x,y));
	        input.nextLine();
        }
        input.close();
    }

    public static String Tetris(int[] x,int[] y){
        if(x[1] == x[0]+1 && y[1] == y[0]){
            if(x[2] == x[0] && y[2] == y[0]+1){
                return "A";
            }else if(x[2] == x[1] && y[2] == y[0]+1){
                return "E";
            }else if(x[2] == x[1]+1 && y[2] == y[1]){
                return "C";
            }else if(x[2]+1 == x[0] && y[2] == y[0]+1){
                return "G";
            }
        }else if(x[0] == x[1] && y[0]+1 == y[1]){
            if(x[1] == x[2] && y[1]+1 == y[2]){
                return "B";
            }else{
                return "F";
            }
        }else{
            return "D";
        }
        return "Impossible";
    }
}

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

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}

template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }

template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }

template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T>
void chkmax(T &x, const T &y){ if(y > x) x = y; return; }

template <typename T>
void chkmin(T &x, const T &y){ if(y < x) x = y; return; }

#ifdef ONLINE_JUDGE
#define debug(x,c) ;
#else
#define DEBUG
#define debug(x,c) cerr<<#x<<"="<<x<<c;
#endif

void TZL();

void RANK1();

#define tzl int
#define ak main
#define IOI ()
tzl ak IOI
{
#undef tzl
#undef ak
#undef IOI

	TZL();
	RANK1();

#define tzl return
#define caisi 0
#define myy ;
	tzl caisi myy
#undef tzl
#undef caisi
#undef myy
}

//---------------------------head----------------------------

LL a, b, c, n;

LL calc(LL x)
{
	rep(i, 800000000)
	{
		if(x & 1) return i;
		x = (n - x >> 1);
	}
	return linf;
}

void TZL()
{
	scf(a, b, c);
	n = a + b + c;
	LL x = calc(a), y = calc(b), z = calc(c);
	LL ans = min(min(x, y), z);
	if(ans == linf) ans = -1;
	printf("%lld\n", ans);
	return;
}

void RANK1()
{
}

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

import sys

def solve(K: int, S: str):
    if (len(S) <= K):
        print(S)
    else:
        print(S[0:K], "...", sep='')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(K, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9184
#include <stdio.h>

int main(){
    int n, k, a[100000], tmp, max, i, j;
    
    while (scanf("%d%d", &n, &k)) {
        if ( n == 0 && k == 0)break;
        max = 0;
        for (i = 0; i < n; i++)
            scanf("%d", &a[i]);
        tmp = 0;
        for (i = 0; i < k; i++) tmp += a[i];
        max = tmp;
        for (j = k; j < n; j++){
            tmp += a[j] - a[j -k];
            if (tmp >= max) max = tmp;
        }
        printf("%d\n", max);
    }
    return 0;
}

Measured memory_bytes: 988
function Main(input) {
    input = input.split("\n");
    var a = input[1].split(' ').map(n => Number(n));
    var ans = 0
    for (var n of a) {
		while(n%2 === 0) {
         	n = n / 2;
      		ans++;
        }
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 10292
#include<bits/stdc++.h>
using namespace std;
//BEGIN CUT HERE
template<typename T> 
struct BIT2D{
  int n,m;
  T d;
  vector<vector<T> > bit;
  //1-indexed
  BIT2D():n(-1),m(-1){}
  BIT2D(int n_,int m_,T d_):n(n_),m(m_),d(d_),bit(n_+1,vector<T>(m+1,d_)){}
  T sum(int i,int j){
    T s=d;
    for(int x=i;x>0;x-=(x&-x))
      for(int y=j;y>0;y-=(y&-y))
	s+=bit[x][y];
    return s;
  }
  void add(int i,int j,T a){
    if(i==0||j==0) return;
    for(int x=i;x<=n;x+=(x&-x))
      for(int y=j;y<=m;y+=(y&-y))
	bit[x][y]+=a;
  }
  // (x1,x2] * (y1,y2];
  T sum(int x1,int y1,int x2,int y2){
    return sum(x1,y1)-sum(x1,y2)-sum(x2,y1)+sum(x2,y2);
  }
};
//END CUT HERE

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int h,w,t,q;
  cin>>h>>w>>t>>q;
  BIT2D<int> beet(h+100,w+100,0);
  BIT2D<int> ushi(h+100,w+100,0);
  typedef pair<int,int> P;
  typedef pair<int,P> PP;
  queue<PP> qq; 
  for(int i=0;i<q;i++){
    int a,c,x1,y1;
    cin>>a>>c>>x1>>y1;
    while(!qq.empty()&&qq.front().first<=a){
      P p=qq.front().second;qq.pop();
      int x=p.first,y=p.second;
      assert(beet.sum(x-1,y-1,x,y)==1);
      beet.add(x,y,-1);
      assert(ushi.sum(x-1,y-1,x,y)==0);
      ushi.add(x,y,1);
    }
    if(c==0){
      assert(beet.sum(x1-1,y1-1,x1,y1)==0);
      beet.add(x1,y1,1);
      qq.push(PP(a+t,P(x1,y1)));
    }
    if(c==1){
      if(ushi.sum(x1-1,y1-1,x1,y1)==0) continue;
      ushi.add(x1,y1,-1);
    }
    if(c==2){
      int x2,y2;
      cin>>x2>>y2;
      x1--;y1--;
      cout<<ushi.sum(x1,y1,x2,y2)<<" "<<beet.sum(x1,y1,x2,y2)<<endl;
    }
  }
  return 0;
}

/*
verified on 2017/09/22
http://judge.u-aizu.ac.jp/onlinejudge/cdescription.jsp?cid=ACPC2017Day3&pid=E
 */

Measured memory_bytes: 38700
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;



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

	cin >> N >> K;
	string s;
	cin >> s;
	vector<int>v(N);
	for (int i = 1; i < N; i++) {
		if (s[i] == 'C'&&s[i - 1] == 'A')v[i]++;
		v[i] += v[i - 1];
	}
	for (int i = 0; i < K; i++) {
		cin >> L >> R;
		R--;
		L--;
		cout << v[R] - v[L] << endl;
	}
	return 0;
}

Measured memory_bytes: 1488
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 5100,mod = 1e9 + 7;
int n,tot,head[N],siz[N];
int f[N][N],g[N],res[N << 1];
struct node{int nex,to;} a[N << 1];
void add(int f,int t) {a[++ tot].nex = head[f]; a[tot].to = t; head[f] = tot;}
void dfs(int now,int fa)
{
	f[now][siz[now] = 1] = 1;
	for(int i = head[now],to;i;i = a[i].nex)
	{
		to = a[i].to; if(to == fa) continue;
		dfs(to,now);
		for(int j = 1;j <= siz[now] + siz[to];j ++) res[j] = 0;
		for(int j = 1;j <= siz[now];j ++) for(int k = 0;k <= siz[to];k ++) res[j + k] = (res[j + k] + 1ll * f[now][j] * f[to][k] % mod) % mod;
		siz[now] += siz[to]; for(int j = 1;j <= siz[now];j ++) f[now][j] = res[j];
	}
	for(int i = 2;i <= siz[now];i += 2) f[now][0] = (f[now][0] + mod - 1ll * f[now][i] * g[i] % mod) % mod;
}
int main()
{
	n = read(); for(int i = 1,x,y;i < n;i ++) {x = read(); y = read(); add(x,y); add(y,x);}
	g[0] = 1; for(int i = 2;i <= n;i += 2) g[i] = 1ll * g[i - 2] * (i - 1) % mod;
	dfs(1,0); cout << mod - f[1][0] << "\n";
	return 0;
}

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

using namespace std;

#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define repr(i, j) for(int i = j; i >= 0; --i)
#define INF (1 << 30)
#define TMP 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

int main() {
	int a[3];
	rep(i, 3) cin >> a[i];
	sort(a, a + 3);
	if(a[0] == a[1] && a[0] == a[2]) cout << 1 << endl;
	else if(a[0] == a[1] || a[1] == a[2]) cout << 2 << endl;
	else cout << 3 << endl;
	return 0;
} 

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

int main(){
    string s,t;
    cin >> s >> t;
    string ans;
    for(int i=0;i<s.size();i++){
        ans+=s.at(i);
        if(i==t.size())break;
        ans+=t.at(i);
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		int sum = 0;
		sum = K * (int)Math.pow((K - 1), (N - 1));
		System.out.println(sum);
		scan.close();
	}

}


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

int main() {
    uint64_t N;
    std::cin >> N;

    uint64_t A[N];
    uint64_t sum_e[N] = {0};
    uint64_t sum_o[N] = {0};
    for (size_t i = 0; i < N; ++i) {
        std::cin >> A[i];
        if (i % 2 == 0) {
            if (i == 0) {
                sum_e[i] = A[i];
                sum_o[i] = 0;
            } else {
                sum_e[i] = sum_e[i-1] + A[i];
                sum_o[i] = sum_o[i-1];
            }
        } else {
           sum_e[i] = sum_e[i-1];
           sum_o[i] = sum_o[i-1] + A[i];
        }
    }

    const uint64_t r0 = sum_e[N-1] - sum_o[N-1];
    std::printf("%lu", r0);

    uint64_t r = r0;
    for (size_t i = 1; i < N; ++i) {
        std::printf(" ");

        r = 2 * A[i-1] - r;
        std::printf("%lu", r);
    }
    std::printf("\n");

    return 0;
}


Measured memory_bytes: 3712
import math
n=int(input())

x = n / 1.08
x_p = math.floor(x) + 1
x_n = math.floor(x) - 1


if x%1 == 0:
    print(int(x))
else:
    if math.floor(x_p * 1.08) == n:
        print(math.floor(x_p))
    elif math.floor(math.floor(x) * 1.08) == n:
        print(math.floor(x))
    elif math.floor(x_n * 1.08) == n:
        print(math.floor(x_n*1.08))
    else:
        print(':(')










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

int main() {
    string str;
    cin >> str;
    vector<int> N(str.size());
    for (int i=0; i<str.size(); i++) {
        N.at(i) = str.at(i) - '0';
    }
    int sum = 0;
    for (int i=0; i<str.size(); i++) {
        sum += N.at(i);
    }
    if (sum%9 == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 4436
import itertools as it
n,m = map(int, input().split())
keiro = []
for i in range(m):
    a,b = map(int, input().split())
    keiro.append([a,b])
per = it.permutations(range(2,n+1),n-1)
ans = 0
for pe in per:
    Flag = True
    pe = list(pe)
    pe.insert(0,1)
    for i in range(len(pe)-1):
        if [pe[i],pe[i+1]] not in keiro and [pe[i+1],pe[i]] not in keiro:
            Flag = False
            break
    if Flag == True:
        ans +=1
print(ans)

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> cnt(m);
  for (int i=0;i<n;++i){
    int k;//その人が選んだ種類数
    cin >> k;
    for (int j=0;j<k;++j){
      int a;//何番目か
      cin >> a;
      a--;//0からM-1までだから
      cnt[a]++;
    }
  }
  //カウント配列cnt(m)のi番目には食べ物iが好きな人の人数が格納されている
  
  int ans = 0;
  for (int i=0;i<m;++i){
    if (cnt[i]==n){
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

P toporogical_sort(const vector<vector<int>> g){
	int n = g.size();
	vector<int> in_degree(n,0);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < g[i].size(); j++){
			in_degree[g[i][j]]++;
		}
	}

	vector<int> res,length(n);
	stack<int> S;
	for(int i = 0; i < n; i++){
		if(in_degree[i]==0) S.push(i),length[i]=0;
	}

	while(!S.empty()){
		int p = S.top();
		S.pop();
		res.push_back(p);
		for(int i = 0; i < g[p].size(); i++){
			in_degree[g[p][i]]--;
			if(in_degree[g[p][i]]==0) S.push(g[p][i]),length[g[p][i]]=length[p]+1;
		}
	}

	//res.size()==nならばgはDAG
	//resはトポロジカルソートされた頂点列
	//*max_element(all(length))はgの最長パスの長さ
	if(res.empty() || res.size()!=n){
		return P(-1,-1);
	}else{
		vector<int> dp(n,0);
		rep(i,n){
			int p = res[i];
			rep(j,g[p].size()){
				dp[g[p][j]] = max(dp[g[p][j]],dp[p]+1);
			}
		}

		return P(n,*max_element(all(dp)));
	}

}

int main()
{
	int n;
	cin>>n;
	vector<vector<int>> a(n,vector<int>(n-1));
	rep(i,n){
		rep(j,n-1){
			cin>>a[i][j];
		}
	}
	rep(i,n)rep(j,n-1)a[i][j]--;


	vector<vector<int>> idx(n,vector<int>(n,-1));
	int idxnum=0;
	rep(i,n)repi(j,i+1,n)idx[i][j]=idxnum,idx[j][i]==idxnum++;
	
	vector<vector<int>> g(n*(n-1)/2);
	rep(i,n){
		rep(j,n-2){
			int p=i,from=a[i][j];
			if(p>from)swap(p,from);

			int q=i,to=a[i][j+1];
			if(q>to)swap(q,to);

			int x=idx[p][from];
			int y=idx[q][to];
			g[x].push_back(y);
		}
	}

	P ans=toporogical_sort(g);
	cout<<(ans.first==n*(n-1)/2?ans.second+1:-1)<<endl;


	return 0;
}


Measured memory_bytes: 70644
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    int ar[100005]={0};
    int n,m,l,r,i,mx=0,c=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>l>>r;
        ar[l]+=1;
        ar[r+1]=-1;
        if(l>mx)
        mx=l;
        if(r>mx)
        mx=r;
    }
    for(i=1;i<=mx;i++)
    {
        ar[i]+=ar[i-1];
    }
    for(i=0;i<=mx;i++)
    {
        if(ar[i]==m)
        c+=1;
    }
    cout<<c<<"\n";
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    REP(i,a){
        if(s[i]=='-'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s[a]!='-'){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<b;i++){
        if(s[i+a+1]=='-'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
main()
{
	int k;
	cin>>k;
	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};
	cout<<a[k-1]<<endl;
}


Measured memory_bytes: 3492
import Data.List
import qualified Data.Set as S
import qualified Data.Map as M
main=print.solve.lines=<<getContents
solve::[String]->Int
solve(hw:s)=if M.notMember(h,w)v then -1 else h*w-S.size m-v M.!(h,w)-1 where
  [h,w]=map read.words$hw
  m=foldr(\(i,s)m->foldr(\(j,c)m->if c=='#' then S.insert(i,j)m else m)m$zip[1..]s)S.empty$zip[1..]s
  v=f 1[(1,1)][]$M.singleton(1,1)0
  f _[][]v=v
  f c[]p v=f(c+1)p[]v
  f c((i,j):qs)p v=f c qs(q++p)$foldr(\xy->M.insert xy c)v q where
    q=[(x,y)|(dx,dy)<-[(0,1),(1,0),(0,-1),(-1,0)],let x=i+dx, 0<x && x<=h, let y=j+dy, 0<y && y<=w, S.notMember(x,y)m, M.notMember(x,y)v]

Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(l.begin(), l.end());
    int sum = 0;
    rep(i, n-1) {
        sum += l[i];
    }
    string ans = "Yes";
    if (l[n-1]>=sum) {
        ans = "No";
    }
    
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {

	int H,W;
	int i,n,m;

	while (1) {

                cin>>H>>W;

		if (H == 0 && W == 0) break;

		for (n = 0; n < H; n++) {

			for (m = 0; m < W; m++) {
				cout << "#";
			}

			cout << endl;

		}

		cout << endl;

	}
	return 0;
}

Measured memory_bytes: 3068
n,m,x = map(int,input().split())
ans = 12*(10**5)+1
C = []
A = []

for _ in range(n):
    AC = list(map(int,input().split()))
    C.append(AC[0])
    A.append(AC[1:])

for i in range(2**n):
    understood = [0]*m
    cost = 0
    
    for j in range(n):
        if (i>>j)&1:
            cost += C[j]
            
            for k in range(m):
                understood[k] += A[j][k]
                
    ok = 0
        
    for j in understood:
        if j >= x:
            ok += 1
            
    if ok == m:
        ans = min(ans,cost)

if ans == 12*(10**5)+1:
    ans = -1
        
print(ans)

Measured memory_bytes: 9256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int n;
  cin>>n;
  vector<string>s(n);
  vector<int>t(n);
  rep(i,n)cin>>s[i]>>t[i];
  string x;
  cin>>x;
  int ans=0;
  bool flg=false;
  rep(i,n){
    if(flg)ans+=t[i];
    if(x==s[i])flg=true;
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
 
int main()
{
    int n, a[201], ans = 0, cnt, fcnt = 0, i;

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

    while(1){
        cnt = 0;
        for(i = 0;i < n;i++){
            if(a[i] % 2 == 0){
                a[i] = a[i] / 2;
            }
            if(a[i] % 2 == 1){
                cnt++;
            }
        }

        if(cnt == 0){
            ans++;
        }
        if(cnt >= 1){
            if(fcnt != 0){
                ans++;
            }
            break;
        }
        fcnt++;
    }

    std::cout << ans;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import numpy as np
 
R, G, B, N = map(int,input().split())

lst = sorted([R, G, B], reverse=True)


cnt = 0
var_1 = N
while True: #一番高いものを買う
  var_2 = var_1
  while True: #二番目に高いものを買う
    if var_2 % lst[2] == 0:
      cnt += 1
    var_2 -= lst[1]
    if var_2 < 0:
      break
  var_1 -= lst[0]
  if var_1 < 0:
    break
    
print(cnt)
 

  

Measured memory_bytes: 21520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

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

    struct edge { ll from, to, cost; };
    vector<edge> edges(m);
    rep2(i, m) {
        ll from, to, cost;
        cin(from); cin(to); cin(cost);

        --from; --to;

        edges[i] = { from, to, cost };
    }

    vector<ll> d(n, LLONG_MIN);
    d[0] = 0;

    rep2(i, n - 1) {
        rep2(j, m) {
            edge e = edges[j];

            if (d[e.from] != LLONG_MIN && d[e.from] + e.cost > d[e.to]) {
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }

    ll x = d[n - 1];

    rep2(i, n - 1) {
        rep2(j, m) {
            edge e = edges[j];

            if (d[e.from] != LLONG_MIN && d[e.from] + e.cost > d[e.to]) {
                d[e.to] = d[e.from] + e.cost;
            }
        }
    }

    if (x != d[n - 1]) {
        print("inf");
    } else {
        print(x);
    }

    return 0;
}

Measured memory_bytes: 3632
#include "stdio.h"
int N;
int num[100] = {};
long long int dp[99][21] = {};


int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &num[i]);
	}
	dp[0][num[0]] = 1;
	for (int i = 1; i < N - 1; i++) {
		for (int j = 0; j <= 20; j++) {
			if (j - num[i] >= 0) dp[i][j] += dp[i - 1][j - num[i]];
			if (j + num[i] <= 20)dp[i][j] += dp[i - 1][j + num[i]];
		}
	}
	printf("%lld\n", dp[N - 2][num[N - 1]]);
	return 0;
}

Measured memory_bytes: 1044
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#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 repR(i,n) for(int i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue<int>
#define PQR priority_queue<int,VE,greater<int>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int a[200010],ans[200010];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n; 
	FORR(i,1,n)cin >> a[i];
	
	for (int i = n; i >= 1; i--) {
		int cnt = 0;
		for (int j = 2 * i; j <= n; j += i) {
			cnt += ans[j];
		}
		if (cnt % 2 != a[i] % 2)ans[i]++;
	}
	VE vec;
	FORR(i,1,n) {
		if (ans[i])vec.push_back(i);
	}
	cout << vec.size() << endl;
	if (!vec.empty())cout << vec[0];
	FORR(i,1,(int)vec.size()-1)cout << " " << vec[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 2936
using System;
public class c
{
  public static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    string[] s = Console.ReadLine().Split(' ');
    int[]  L = new int[N*2];
    for(int i=0;i<2*N;i++)
    {
      L[i]=int.Parse(s[i]);
    }
    Array.Sort(L);
    int x=0;
   for(int i=0;i<N;i++)
  {
    x+=L[2*i];
  }Console.WriteLine(x);
}}

Measured memory_bytes: 13140
#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return x

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return x

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import numpy as np



# main code
N = input()

Ns = str(N)

a = 0

for i in range(0,len(Ns)):
    a += int(Ns[i])

if a%9 == 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 27180
#define rep(i,n) for (int i=0;i<n;i++)
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const long long INF = 1LL<<60;

int main(){
  
  int H,W,count=0;
 // bool torf=false;
  cin >> H >> W;
  
  pair<int,int> p;
  vector<vector<char>> A(H,vector<char>(W));
  vector<vector<int>> B(H,vector<int>(W,0));
  deque<pair<int,int>> d;
  
  
  rep(i,H){
    rep(j,W){
      cin >> A.at(i).at(j);
      if(A.at(i).at(j)=='#'){
        p=make_pair(i,j);
        d.push_back(p);
      }
    }
  }

  while(!(d.empty())){
    
    if(d.front().second+1<W && A.at(d.front().first).at(d.front().second+1)=='.'){
      A.at(d.front().first).at(d.front().second+1)='#';
      B.at(d.front().first).at(d.front().second+1)=B.at(d.front().first).at(d.front().second)+1;
      p=make_pair(d.front().first,d.front().second+1);
      d.push_back(p);
      //torf=true;
    }
    if(d.front().second-1>=0 && A.at(d.front().first).at(d.front().second-1)=='.'){
      A.at(d.front().first).at(d.front().second-1)='#';
      B.at(d.front().first).at(d.front().second-1)=B.at(d.front().first).at(d.front().second)+1;
      p=make_pair(d.front().first,d.front().second-1);
      d.push_back(p);
     // torf=true;
    }
    if(d.front().first-1>=0 && A.at(d.front().first-1).at(d.front().second)=='.'){
      A.at(d.front().first-1).at(d.front().second)='#';
      B.at(d.front().first-1).at(d.front().second)=B.at(d.front().first).at(d.front().second)+1;
      p=make_pair(d.front().first-1,d.front().second);
      d.push_back(p);
      //torf=true;
    }
    if(d.front().first+1<H && A.at(d.front().first+1).at(d.front().second)=='.'){
      A.at(d.front().first+1).at(d.front().second)='#';
      B.at(d.front().first+1).at(d.front().second)=B.at(d.front().first).at(d.front().second)+1;
      p=make_pair(d.front().first+1,d.front().second);
      d.push_back(p);
      //torf=true;
    }
    
   // cout << d.front().first << d.front().second <<  endl;
    d.pop_front();
  //  if(torf==true)
    //count++;
    
   // torf=false;
    
  }
  rep(i,H){
    rep(j,W)
      count=max(B.at(i).at(j),count);

  }
  
  
  cout << count << endl;
  
}

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

using namespace std;
typedef long long int ll;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(auto c : s)
    {
        c += n;
        if(c > 90)
        {
            c -= 26;
        }
        printf("%c", c);
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*
//import kotlin.math.*
 
private fun readString() = readLine()!! // string line
private fun readInt() = readString().toInt() // single int
private fun readLong() = readString().toLong()
private fun readStrings() = readString().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of ints
 
val INF = 1000000000
 
fun main(args: Array<String>)
{
    var n = readInt()
	var a = readInts().toTypedArray()
	var ret = 0L
	
	var b = Array<Int>(n, {x -> x})
	b.sortBy({-a[it]})
	
	var H = TreeSet<Int>()
	H.add(-2)
	H.add(-1)
	H.add(n)
	H.add(n+1)
	for (i in 0..n-1)
	{
		var x = b[i]
		var yR = H.higher(x)
		var zR = H.higher(yR)
		if (zR > n) zR = n
		var yL = H.lower(x)
		var zL = H.lower(yL)
		if (zL < -1) zL = -1
		ret += a[x].toLong()*(yL-zL)*(yR-x)
		ret += a[x].toLong()*(zR-yR)*(x-yL)
		H.add(x)
	}
	
	print(ret)
}


Measured memory_bytes: 84876
n, k = [int(i) for i in input().split()]

ab=[]
for i in range(n):
    ab.append([int(i) for i in input().split()])

ab2 = sorted(ab)

cum=0
for i in range(n):
    cum += ab2[i][1]
    if cum >= k: break

print(ab2[i][0])


Measured memory_bytes: 22420
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x;
  cin >> N >> x;
  int a[N];
  long long y = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < N; i++) {
    y += min(max(a[i]-x+a[i-1],0),a[i]);
    a[i] -= min(max(a[i]-x+a[i-1],0),a[i]);
  }
  if (a[0] > x) {
    y += a[0]-x;
  }
  cout << y;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

  int n, k;
  cin >> n >> k;
  int r, s, p;
  cin >> r >> s >> p;
  string t;
  cin >> t;
  ll res = 0;
  vector <bool> ok(n);
  string x(n, '.');
  for(int i = 0; i < n; i++){
    if(t[i] == 'r'){ // igraj p
      if(i >= k){
        if(t[i - k] != 'r' || ok[i - k]){ 
          res += p;
          ok[i] = 0;
          x[i] = 'p';
        }
        else ok[i] = 1;
      }
      else{
        res += p;
        x[i] = 'p';
        ok[i] = 0;
      }
    }
    else if(t[i] == 's'){ // igraj r
      if(i >= k){
        if(t[i - k] != 's' || ok[i - k]){
          res += r;
          x[i] = 'r';
          ok[i] = 0;
        }
        else ok[i] = 1;
      }
      else{
        res += r;
        x[i] = 'r';
        ok[i] = 0;
      }
    }
    else{ // igraj s
      if(i >= k){
        if(t[i - k] != 'p' || ok[i - k]){
          res += s;
          x[i] = 's';
          ok[i] = 0;
        }
        else ok[i] = 1;
      }
      else{
        res += s;
        x[i] = 's';
        ok[i] = 0;
      }
    }
  }
  cout << res;
}

Measured memory_bytes: 512
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

class Solve
{
	const int mod = 1000000007;
	static void Main(string[] args)
	{
		var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
		string s = Console.ReadLine();
		var ans = new StringBuilder();
		ans.Append(s.Substring(0, input[1] - 1));
		ans.Append(char.ToLower(s[input[1] - 1]));
		ans.Append(s.Substring(input[1], input[0] - input[1]));

		
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13396
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0)); 
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

int n, m;
int a[100005];
map<int, int> cnt;
ll sum, ans;

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    cin >> n >> m;
    rep(i, n) cin >> a[i];
    sum = 0;
    rep(i, n){
        sum = (sum + a[i]) % m;
        ans += cnt[sum];
        if(sum == 0) ans++;
        cnt[sum] += 1;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <iostream>

int f(int x) {
	return x * x;
}

int main() {
	int d, ans;
	while (1 == scanf("%d", &d)) {
		ans = 0;
		for (int i = 0; i * d < 600; ++i) {
			ans += d * f(i * d);
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1184
/**
 *      purpose : ABC 113 B
 *      author  : kyomukyomupurin
 *      created : 2018-11-04 21:03:08
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; double T, A; cin >> N >> T >> A;
    double H[N] = {};
    for (int i = 0; i < N; ++i) cin >> H[i];

    double temp[N] = {};
    for (int i = 0; i < N; ++i) {
        temp[i] = (double) (T - 0.006 * H[i]);
    }

    int ans; double mm = 1e9;

    for (int i = 0; i < N; ++i) {
        if (abs(temp[i] - A) < mm){
            mm = abs(temp[i] - A); ans = i;
        }
    }
    print(ans + 1);
    
    return 0;
}

Measured memory_bytes: 256
x = int(input())

pos_array = []
neg_array = []

idx = 0
num = 0
while num < 10**15:
    num = pow(idx, 5)
    pos_array.append(num)
    idx += 1

idx = 0
num = 0
while num > -10**15 - 1:
    num = pow(idx, 5)
    neg_array.append(num)
    idx -= 1

for i in range(len(pos_array)):
    for j in range(len(pos_array)):
        if pos_array[i] - pos_array[j] == x:
            print("%d %d" % (i, j))
            exit(0)

for i in range(len(pos_array)):
    for j in range(len(neg_array) - 1, -1, -1):
        if pos_array[i] - neg_array[j] == x:
            print("%d %d" % (i, -j))
            exit(0)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    queue<ll> up, down;
    ll last = -1;
    bool upping = false;
    rep(i, N) {
        ll a = A[i];
        if (upping) {
            if (a < last) {
                up.push(last);
                upping = false;
            }
        } else {
            if (last != -1 && a > last) {
                down.push(last);
                upping = true;
            }
        }
        last = a;
    }
    if (upping) {
        up.push(A[N - 1]);
    } else {
        down.push(A[N - 1]);
    }
    ll ans = 1000;
    ll s = 1000;
    bool f = true;
    ll c = 0;
    while (!up.empty() || !down.empty()) {
        if (c == 0) {
            ll a = down.front();
            down.pop();
            c = s / a;
            s -= a * c;
        } else {
            ll a = up.front();
            up.pop();
            s += c * a;
            c = 0;
        }
        ans = max(ans, s);
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;

//Frisbee Dogs
public class Main{

	double[] sub(double[] a, double[] b){
		return new double[]{a[0]-b[0],a[1]-b[1]};
	}
	
	double dot(double[] a, double[] b){
		return a[0]*b[0]+a[1]*b[1];
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if((n|m)==0)break;
			double[][] dog = new double[n][2];
			double[] v = new double[n];
			for(int i=0;i<n;i++){
				for(int j=0;j<2;j++)dog[i][j]=sc.nextDouble();
				v[i]=sc.nextDouble();
			}
			int[] get = new int[n];
			while(m--!=0){
				double[] f = new double[2];
				f[0] = sc.nextDouble();
				f[1] = sc.nextDouble();
				double[] fv = new double[2];
				fv[0] = sc.nextDouble();
				fv[1] = sc.nextDouble();
				boolean[] e = new boolean[n];
				//ツ債猟ャツ予ツ津ィツ地ツ点
				double[][] p = new double[n][2];
				double min = Double.MAX_VALUE;
				int id = -1;
				for(int i=0;i<n;i++){
					double A = dot(fv, fv)-v[i]*v[i];
					double B = 2*dot(fv, sub(f, dog[i]));
					double C = dot(sub(f, dog[i]), sub(f, dog[i]));
					double D = B*B-4*A*C;
					if(D<0)continue;
					double t1 = (-B+Math.sqrt(D))/2/A;
					double t0 = (-B-Math.sqrt(D))/2/A;
					double t = Integer.MAX_VALUE;
					if(t1>=0)t = t1;
					if(t0>=0)t = Math.min(t, t0);
					if(t==Integer.MAX_VALUE)continue;
					p[i][0] = f[0]+t*fv[0];
					p[i][1] = f[1]+t*fv[1];
					e[i] = true;
					if(t<min){
						min = t;
						id = i;
					}
				}
				get[id]++;
				for(int i=0;i<n;i++){
					if(!e[i])continue;
					double[] d = sub(p[i], dog[i]);
					double norm = Math.hypot(d[0], d[1]);
					d[0]/=norm;
					d[1]/=norm;
					dog[i][0] += min*v[i]*d[0];
					dog[i][1] += min*v[i]*d[1];
//					System.out.println("DOG :" + i + " " + dog[i][0] + "," + dog[i][1]);
				}
			}
			for(int i=0;i<n;i++)System.out.print(get[i]+(i<n-1?" ":"\n"));
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int  i,j,cur=0,t,k,a,b,c=0;
    cin>>a>>b;
    for(i=0;i<=a;i++)
    {
        for(j=0;j<=a;j++)
        {
            cur=b-(i+j);
            if(cur>=0&&cur<=a)
               c++;
        }
    }
    cout<<c<<"\n";


return 0;
}


Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  ll n, m;
  cin >> n >> m;
  if (n == 1) {
    if (m == 1) {
      cout << 1 << endl;
    } else {
      cout << m-2 << endl;
    }
   return 0;
  }
  if (m == 1) {
    cout << n-2 << endl;
    return 0;
  }
  
  cout << (n-2)*(m-2) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



ll pow(long long n, long long p) {
    ll a=10;
    if (n==0) return 1;
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * pow(n - 1, p)) % p;
    long long t = pow(n / 2, p);
    return (t * t) % p;
}



int main(){
    ll n,p; string s; cin>>n>>p>>s;
    ll res=0;
    map<ll,ll> prev;
    if(p==2 || p==5){
        rep(i,n){
            if(i==0){
                prev[(s[i]-'0')%p]++;
                res+=prev[0];
            }else{
                map<ll,ll> current;
                rep(j,p){
                    current[(j*10+(s[i]-'0'))%p]+=prev[j];
                }
                current[(s[i]-'0')%p]++;
                res+=current[0];
                prev=current;
            }
        }
        cout<<res<<endl;
    }else{
        vector<ll> bubunwa(n+1);
        bubunwa[0]=0;
        rep(j,n){
            ll i=j+1;
            if(i==1) bubunwa[i]=((s[i-1]-'0')*pow(n-1,p))%p;
            else bubunwa[i]=(bubunwa[i-1]+((s[i-1]-'0')*pow(n-i,p))%p)%p;
        }
        vector<ll> cnt(p,0);
        rep(i,n+1){
            res+=cnt[bubunwa[i]];
            cnt[bubunwa[i]]++;
        }
        cout<<res<<endl;
    }
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

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

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

int N,K;

signed main(){
	cin>>N>>K;
	vint P(N);
	rep(i,N)cin>>P[i];

	deque<int>mi,ma;
	int ans=N-K+1;

	vint x(N),y(N),z(N);
	rep(i,N){
		while(mi.size()&&P[mi.back()]>P[i])mi.pop_back();
		while(ma.size()&&P[ma.back()]<P[i])ma.pop_back();
		mi.pb(i);ma.pb(i);
		if(i+1<K)continue;
		if(mi.front()==i-K+1)x[i]=1;
		if(ma.front()==i)y[i]=1;
		if(mi.size()==K)z[i]=1;
		if(mi.front()==i-K+1)mi.pop_front();
		if(ma.front()==i-K+1)ma.pop_front();
	}
	int cnt=0;
	for(int i=K-1;i<N;i++){
		if(x[i-1]&&y[i]){
			ans--;
			continue;
		}
		else{
			if(z[i])cnt++;
		}
	}
	if(cnt)ans-=cnt-1;
	cout<<ans<<endl;
}

Measured memory_bytes: 8192