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

int main() {
  int k, n; cin >> k >> n;
  vector <int> a(n);
  for(int i; i<n; i++) cin >> a.at(i);
  
  int x[n-1];
  for(int i; i<n-1; i++){
    x[i] = a.at(i+1)-a.at(i);
  }
  
  int max;
  int it;
    for (int i = 0; i < n-1; i++) {
        if (max < x[i]) {
            max = x[i];
            it = i;
        }
    }
  
  if(max <= k-a.at(n-1)+a.at(0) ){
    cout << a.at(n-1)-a.at(0) << endl;
  }
  else{
    cout << a.at(it)+k-a.at(it+1) << endl;
  } 
}



Measured memory_bytes: 1792
def solve(n, s):

    r_list = [i for i in range(n) if s[i] == "R"]
    g_list = [i for i in range(n) if s[i] == "G"]
    # b_list = [i for i in range(n) if s[i] == "B"]
    b_dict = {i: 1 for i in range(n) if s[i] == "B"}

    res = len(r_list) * len(g_list) * len(b_dict.keys())
    for i in r_list:
        for j in g_list:
            # candidate
            m, n = min(i, j), max(i, j)
            if n + (n - m) in b_dict.keys():
                res -= 1
            if m - (n - m) in b_dict.keys():
                res -= 1
            if (n - m) % 2 == 0 and (n + m) // 2 in b_dict.keys():
                res -= 1

    return res


def main():
    n = int(input())
    s = input()
    res = solve(n, s)
    print(res)


def test():
    assert solve(4, "RRGB") == 1
    assert solve(39, "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB") == 1800


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, k, q; scanf("%d%d%d", &n, &k, &q);

	std::vector<int> vec(n, k);
	for(int i = 0; i < q; i++) {
		int p; scanf("%d", &p); p--;

		vec[p]++;
	}

	for(int i = 0; i < n; i++) {
		if(vec[i] - q <= 0) {
			printf("No\n");
		} else {
			printf("Yes\n");
		}
	}
	return 0;
}


Measured memory_bytes: 1024
n, m = map(int, input().split())
l_max, r_min = 1, n
for _ in range(m):
    a, b = map(int, input().split())
    l_max = max(a, l_max)
    r_min = min(b, r_min)
print(max(0, r_min - l_max + 1))

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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << endl
#define ANS(a,b) int a;cin >> a;cout << b << endl
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const double PI = M_PI;
const long long INF = int(10e9-1);
const long long MOD = int(10e9+7);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t start = clock();
        solve();
        clock_t end = clock();
        const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
        cout << endl << time << "[ms]" << endl;
    }
    else{
        solve();
    }
}

void solve(){
    DGET(N);
    PRINT((int(N)%2==0?0.5:UP(N,2)/N));
}



Measured memory_bytes: 256
def calc():
    mp = {}
    n, m = map(int, input().split())
    for i in range(0, m):
        s, c = map(int, input().split())
        if s in mp and mp[s] != c:
            return -1
        else:
            mp[s] = c
    res = 0
    if n == 1:
        res = mp[1] if 1 in mp else 0
    else:
        for j in range(1, n + 1):
            if j == 1:
                x = mp[1] if 1 in mp else 1
            else:
                x = mp[j] if j in mp else 0
            digit = n - (j - 1)
            res += x * (10 ** (digit - 1))
    if len(str(res)) != n:
        return -1
    return res


print(calc())


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

int main(){
    while(1){
        int h, w;
        cin >> h >> w;
        if(h==0 && w==0) break;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if((i+j)%2==0) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int N, M;

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> N >> M;
    while (M--) {
        int a;
        cin >> a;
        N -= a;
    }
    cout << max(N, -1ll) << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
	ll x;
	cin>>x;

	if(x%10 == 3) cout<<"bon\n";
	else if(x%10 == 0 || x%10 == 1 || x%10 == 6 || x%10 == 8) cout<<"pon\n";
	else cout<<"hon\n";
}

Measured memory_bytes: 3632
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int mod = (int)1e9+7;
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int[] a = new int[n+1];
        int[] b = new int[m+1];
        
        long ans = 1;
        Map<Integer,Integer> map = new HashMap<>();
        for(int i=0; i<n; i++){
            a[i] = Integer.parseInt(sc.next());
            map.merge(a[i], 1, Integer::sum);
            if(map.get(a[i])>=2) ans = 0;
        }
        map.clear();
        for(int i=0; i<m; i++){
            b[i] = Integer.parseInt(sc.next());
            map.merge(b[i], 1, Integer::sum);
            if(map.get(b[i])>=2) ans = 0;
        }
        
        Arrays.sort(a);
        Arrays.sort(b);
        
        int aidx = 0;
        int bidx = 0;
        
        for(int i=n*m; i>=1; i--){
            int at = a[n-aidx];
            int bt = b[m-bidx];
            
            long tmp = 1;
            
            if(at==i && bt==i){
                //tmp = 1;
                aidx++;
                bidx++;
            }else if(at==i){
                tmp = bidx;
                aidx++;
            }else if(bt==i){
                tmp = aidx;
                bidx++;
            }else{
                tmp = aidx*bidx - (n*m-i);
                if(tmp<0) tmp = 0;
            }
            
            ans = ans*tmp%mod;
        }
        
        System.out.println(ans);
        
    }
    
}


Measured memory_bytes: 27852
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	string s;

	cin >> s;
	while (1) {
		if (s.find("dreamer", s.size() - 7) != -1) {
			s.erase(s.end() - 7, s.end());
		}
		else if (s.find("eraser", s.size() - 6) != -1) {
			s.erase(s.end() - 6, s.end());
		}
		else if (s.find("dream", s.size() - 5) != -1) {
			s.erase(s.end() - 5, s.end());
		}
		else if (s.find("erase", s.size() - 5) != -1) {
			s.erase(s.end() - 5, s.end());
		}
		else {
			break;
		}
	}
	if (s[0] == NULL) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
	int N, D;
	cin >> N >> D;

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

	int ans = 0;
	for (int i = 0; i < N; i++){
		for (int j = i + 1; j < N; j++){
			int sum = 0;
			for (int k = 0; k < D; k++){
				int diff = X[i][k] - X[j][k];
				sum += diff * diff;
			}

			for (int k = 1; true; k++){
				int sqr = k * k;
				if (sqr >= sum){
					if (sqr == sum){
						ans++;
					}
					break;
				}
			}
		}
	}

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


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n,l;
    cin >> n >> l;
    vi a(n);
    rep(i,n)a[i] = l+i;
    int ans = 0;
    rep(i,n)ans += a[i];

    if(a.front() <= 0 && a.back() >= 0){
        ;
    }else{
        if(abs(a.back()) < abs(a.front()))ans-=a.back();
        else ans-=a.front();
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readline_s = sys.stdin.readline
readlines = sys.stdin.buffer.readlines


def main():

    S = input()

    ans = 0
    count = 0
    for i in range(len(S)):
        if S[i] in ('A', 'C', 'G', 'T'):
            count += 1
            ans = max(ans, count)
        else:
            count = 0

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

/*
    ここに問題名を入力
*/

int main() {
    int q; cin >> q;
    vector<int> a;

    rep(i,q){
        int q_; cin >> q_;
        if(q_ == 0){
            int x; cin >> x;
            a.push_back(x);
        }else if(q_ == 1){
            int p; cin >> p;
            cout << a[p] << endl;
        }else{
            a.pop_back();
        }
    }


    return 0;
}
 
 



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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String input;

        while ((input = br.readLine()) != null) {
            StringBuilder result = new StringBuilder();
            int n = Integer.parseInt(Integer.toBinaryString(Integer.parseInt(input)));
            int weight = 1;
            while (n != 0) {
                if (n % 10 == 1) {
                    result.append(weight + " ");
                }
                n /= 10;
                weight *= 2;
            }
            System.out.println(result.substring(0,result.length()-1));
        }

    }
}


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

int main()
{


  string s;
  cin>>s;
  int a=0,b=0;
  for(int index=0;index<s.size();index++)
    if(s[index]=='A')
    a++;
  else
    b++;

  if(!a||!b)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
#define inf 100000000/*10^8*/

/////////////////////////////////

int main(){
    int n;cin>>n;
    ll a[n],b[n];
    ll suma=0,sumb=0;
    for(int i=0;i<=n-1;i++){
        cin>>a[i];suma+=a[i];
    }
    for(int i=0;i<=n-1;i++){
        cin>>b[i];sumb+=b[i];
    }
    ll count=sumb-suma;
    bool flag=true;
    if(count<0)flag=false;
    else{
        ll ca=0,cb=0;
        for(int i=0;i<=n-1;i++){
            if(b[i]>a[i]){
                ca+=(b[i]-a[i]+1)/2;
            }
            else if(b[i]<a[i]){
                cb+=a[i]-b[i];
            }
        }
        ll c=max(ca,cb);
        if(c>count)flag=false;
        else flag=true;
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

#define ll      long long
#define MAX     1000007
#define inf     99999999999999
#define MOD     1000000007
#define pii     pair<int,int>
#define FIN     freopen("input.txt","r",stdin);
#define FOUT    freopen("output.txt","w",stdout);

ll adj[305][305];
ll dis[305][305];
bool mark[305][305];
ll i,j,k;

int main ()
{
    ll n;
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%lld",&adj[i][j]);
            dis[i][j] = adj[i][j];
        }
    }
    for(k=1;k<=n;k++)
    {
        for(i=1;i<=n;i++)
        {
            for(j=1;j<=n;j++)
            {
                if(dis[i][j] > dis[i][k] + dis[k][j])
                {

                    dis[i][j] = dis[i][k] + dis[k][j];
                }
                else if(i!=k && k!=j &&  dis[i][j] == dis[i][k] + dis[k][j])
                {
                    mark[i][j] = 1;
                }
            }
        }
    }
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(dis[i][j]!=adj[i][j])
            {
                printf("-1\n");
                return 0;
            }
        }
    }
    ll res = 0;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            if(!mark[i][j])
            {
                res += dis[i][j];
                mark[j][i] = 1;
            }
        }
    }
    printf("%lld\n",res);
    return 0;
}


Measured memory_bytes: 1792
N,M,*sc=map(int,open(0).read().split())
ans=-1
for i in range(10**N):
    i=str(i)
    if len(i)==N and all(i[s-1]==str(c) for s,c in zip(sc[0::2],sc[1::2])):
        ans=i
        break
print(ans)

Measured memory_bytes: 3060
N = input()
le = len(N)

if le == 1:
    print(N)
    exit()

if all([N[i] == "9" for i in range(1, le)]):
    ans = sum([int(N[i]) for i in range(le)])
else:
    tmp = int(N[0]) * (10 ** (le - 1)) - 1
    ans = sum([int(t) for t in str(tmp)])
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <memory.h>
#include <deque>
#include <stdlib.h>
#include <time.h>
using namespace std;
typedef long long ll;
#define mp make_pair
const int M=100005;
const int N=1000001;
const int K=1000000007;
const ll MAX=1000000000000000000ll;
int n;
double a[3000],dp[2][3000];
int main(){
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>a[i];
    dp[(n-1)%2][0]=1-a[n-1];
    dp[(n-1)%2][1]=a[n-1];
    for(int i=n-2;i>=0;i--)
    	for(int j=0;j<=n;j++)
    	{
    		double &ret=dp[i%2][j];
    		ret=dp[(i+1)%2][j-1]*a[i];
    		ret+=dp[(i+1)%2][j]*(1-a[i]);
    	}
    double ans=0;
    for(int i=n/2+1;i<=n;i++)
    	ans+=dp[0][i];
    printf("%0.9lf",ans);
}

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

int main() {
    int A,B,C,D,i,j;
    
    cin >> A >> B >> C >> D;
    
    i = A + B;
    j = C + D;
    
    if(i > j)cout << "Left" << endl;
    if(i == j)cout << "Balanced" << endl;
    if(i < j)cout << "Right" << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long
signed main(){
	float a;
	vector<float> d;
	while( scanf("%f", &a) != EOF ){
		d.push_back(a);
	}
	sort(d.begin(),d.end());
	cout << d[d.size()-1] - d[0] << endl;
	return 0;
}

Measured memory_bytes: 3284
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"Sunny"# => "Cloudy",
r#"Cloudy"# => "Rainy",
r#"Rainy"# => "Sunny",

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        s: String,
    }
    if s == "Sunny" {
        "Cloudy"
    } else if s == "Cloudy" {
        "Rainy"
    } else {
        "Sunny"
    }.to_string()
}

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    int t=0,a=0,b=0,h,w,n,max=-100000000,k,ans=0;
    int aa,bb;
    string s,s2;
    cin >> n;
    VI o(n);
    rep(i,n){
        cin >> o[i];
    }
    for(int i=0;i<n-1;i++){
        if(o[i] >= o[i+1]){
            t++;
        }
        else{
            if(max<=t){
                max = t;
            }
            t=0;
        }
    }
    if(max<=t){
        max = t;
    }

    cout << max <<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
int n, a, m, fl, c[100005];
int main() {
	scanf("%d", &n);
	for(int i=0; i<n; i++) {
		scanf("%d", &a);
		c[a]++;
		if(a>m) m=a;
	}
	if(c[m]+c[m-1]==n) {
		if(c[m]==n) {
			if(m==n-1 || m<=n/2) fl = 1;
		} else {
			if(c[m-1]<m && m<=c[m-1]+c[m]/2) fl = 1;
		}
	}
	puts(fl ? "Yes":"No");
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		String numstr = "";
		for(int i = 0; i < 80; i++){
			numstr += "9";
		}
		int n;
		BigInteger a,b,c;
		BigInteger max = new BigInteger(numstr); //numstr : 9999 ... 999
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			a = sc.nextBigInteger();
			b = sc.nextBigInteger();
			c = a.add(b);
			if(c.compareTo(max) > 0){
				System.out.println("overflow");
			}else{
				System.out.println(c.toString());
			}
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <queue>
#include <string>

using namespace std;

const double PI = 3.14159265358979;

int G[101][101];


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

	for (int i = 0; i < n; i++)	{
		int id, degree;
		cin >> id >> degree;
		for (int j = 0; j < degree; j++) {
			int idx; cin >> idx;
			G[id][idx] = 1;
		}
	}

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			if (j == 1) cout << G[i][j];
			else cout << " " << G[i][j];
		}
		cout << endl;
	}


	return 0;
}



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

#define fi first
#define se second
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define pb push_back
#define int long long

typedef pair<int, int> ii;

const int N = 1e5 + 10;

int mx, mn, n;
set<int> st;

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

    cin >> n;
    FOR(i, 1, n)    {
        int x; cin >> x;
        if(st.find(x) != st.end())  {
            if(mx < x)  {
                mn = mx;
                mx = x;
            } else if(mn < x) mn = x;
            st.erase(st.find(x));
        } else st.insert(x);
    }
    cout << mx * mn;
}


Measured memory_bytes: 4992
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String args[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int a = Integer.parseInt(br.readLine());
        int ans = a +(a*a) + (a*a*a);
        System.out.println(ans);
        
    }
}

Measured memory_bytes: 25376
#include<bits/stdc++.h>
using namespace std;
int maxtime(int x) {
	
	return (x + 9) / 10 * 10;
}
int remtime(int x) {
	
	return maxtime(x) - x;
}
int main() {
	int A, B, C, D, E;
	cin >> A >> B >> C >> D >> E;
	int sum = maxtime(A) + maxtime(B) + maxtime(C) + maxtime(D) + maxtime(E);
	sum -= max({ remtime(A), remtime(B), remtime(C), remtime(D), remtime(E) });
	cout << sum << endl;
	return 0;
}


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



int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
   	int n;
   	cin>>n;
   	vector<int> v(n);
   	for(int i = 0; i < n; i++)
   		cin>>v[i];

   	int minEle = v[0];
   	int ans = 1;
 	for(int i = 1; i < n;i++) {
 		if(v[i] <= minEle) {
 			ans++;
 			minEle = v[i];
 		}
 	}
 	cout<<ans;
	return 0;		
}



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

string S;
ll K;
vector<string> A;

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

	cin >> S >> K;
	for (ll i = 0; i < S.length(); i++) {
		for (ll j = 1; j <= 5 && i+j <= S.length(); j++) {
			A.push_back(S.substr(i, j));
		}
	}

	sort(A.begin(), A.end());
	A.resize(distance(A.begin(), unique(A.begin(), A.end())));
	cout << A[K-1] << "\n";

}

Measured memory_bytes: 1660
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int max = 0, min = 1000000000;
		int n = sc.nextInt();
		int a = 0;
		for(int i = 0; i < n; i++) {
			a = sc.nextInt();
			if(max < a) {
				max = a;
			}
			if(a < min) {
				min = a;
			}
		}
		System.out.println(max - min);
		sc.close();
	}

}


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

int main() {
    int n;
    string s1, s2;
    cin >> n;
    
    char c[3] = {'.', '#'};
    
    string res;
    while (res != "end") {
        char tes[3];
        bool ok = 0;
        for (int i=0; i<2; i++) for (int j=0; j<2; j++) {
            if (ok) break;
            cout << s1 + c[i] << "\n" << s2 + c[j] << "\n"; fflush(stdout);
            cin >> res;
            if (res == "end") return 0;
            if (res == "T") ok = 1, tes[0] = c[i], tes[1] = c[j];
        }
        
        if (ok) s1 += tes[0], s2 += tes[1];
        else break;
    }
    
    
    while (res != "end") {
        char tes[3];
        bool ok = 0;
        for (int i=0; i<2; i++) for (int j=0; j<2; j++) {
            if (ok) break;
            cout << (string)"" + c[i] + s1 << "\n" << (string)"" + c[j] + s2 << "\n"; fflush(stdout);
            cin >> res;
            if (res == "end") return 0;
            if (res == "T") ok = 1, tes[0] = c[i], tes[1] = c[j];
        }
        
        if (ok) s1 = (string)"" + tes[0] + s1, s2 = (string)"" + tes[1] + s2;
        else break;
    }
    return 0;
}

Measured memory_bytes: 596
tmp = input()
N = int(tmp.split(' ')[0])
M = int(tmp.split(' ')[1])
C = int(tmp.split(' ')[2])
B = [int(b) for b in input().split(' ')]
cnt = 0
for i in range(N):
  A = [int(a) for a in input().split(' ')]
  sum = C
  for j in range(M):
    sum += B[j]*A[j]
  if sum > 0:
    cnt += 1
print(cnt)

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

int main(){
  string s; cin >> s;
  int N = s.size(), counter = 0, cS = 0;
  for( int i = 0; i < N; i++ ){
    if(s[i] == 'S') cS++;
    else{
      if(cS != 0) counter += 2, cS--;
    }
  }
  cout << N - counter << endl;
}

Measured memory_bytes: 640
var MIN = 0,
    MAX = 9;
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on("data",function(chunk){
    var n = String(chunk).trim().split("\n").map(function(v){return parseInt(v, 10)});
        for (var m = 0; m < n.length; m++) {
            var count = 0;
        for (var i = MIN; i <= MAX; i++) {
            for (var j = MIN; j <= MAX; j++) {
            for (var k = MIN; k <= MAX; k++) {
            for (var l = MIN; l <= MAX; l++) {
            if(i + j + k + l == n[m]) {
                count++;
            }
        }
        }
        }
        }
        console.log(count);
        }
});

Measured memory_bytes: 16020
import java.util.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
	public static void main(String[] args) throws ParseException{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
      	int x = sc.nextInt();
      	int as[] = new int[a];
      	int ans = 0;
      
      	for(int i = 0; i < a;i++){
          as[i] = sc.nextInt();
        }
      
      	Arrays.sort(as);
      
      	for(int i = 0; i < a && x > 0;i++){
          x -= as[i];
          if(x >= 0) ans++;
        }
      
      	if(ans == a && x > 0) ans--;
      
      	System.out.println(ans);
      	
        
	}
}

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

using namespace std;

void solve() {
    int x, ans;
    cin >> x;

    if (x < 600) {
        ans = 8;
    } else if (x < 800) {
        ans = 7;
    } else if (x < 1000) {
        ans = 6;
    } else if (x < 1200) {
        ans = 5;
    } else if (x < 1400) {
        ans = 4;
    } else if (x < 1600) {
        ans = 3;
    } else if (x < 1800) {
        ans = 2;
    } else {
        ans = 1;
    }

    cout << ans << endl;
}

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3608
n=int(input())
s=[input() for i in range(n)]

ac=s.count('AC')
wa=s.count('WA')
tle=s.count('TLE')
re=s.count('RE')

print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))


Measured memory_bytes: 79388
#include<bits/stdc++.h>
using namespace std;
#define ll long long 

int main()
{
	
	std::ios::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vector<int>a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	int j = 1, ans  = 0;
	for(auto i : a){
		if(i == j) j++;
		else ans++;
	}
	if(ans == n) ans = -1;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>

using namespace std;

const int N = 100'009;

int p[N];

int find(int x) {
  if (p[x] != x) {
    p[x] = find(p[x]);
  }
  return p[x];
}

int x[N];
int y[N];
int sz[N];
long long ans[N];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", x + i, y + i);
  }
  for (int i = 0; i < n; ++i) {
    p[i] = i;
    sz[i] = 1;
  }
  ans[m - 1] = (long long)n * (n - 1) / 2;
  for (int i = m - 1; i >= 1; --i) {
    ans[i - 1] = ans[i];
    int px = find(x[i]);
    int py = find(y[i]);
    if (px != py) {
      ans[i - 1] -= (long long)sz[px] * sz[py];
      p[py] = px;
      sz[px] += sz[py];
    }
  }
  for (int i = 0; i < m; ++i) {
    printf("%lld\n", ans[i]);
  }
}


Measured memory_bytes: 3584
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)1e5 + 5;
const int mod = (int)1e9 + 7;

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    ll n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    if (a > b)
        swap(a, b);
    for (int i = 0; i <= n - 1; i++) {
        ll l = i * 1ll * c, r = i * 1ll * d;
        l -= 1ll * (n - 1 - i) * d, r -= 1ll * (n - 1 - i) * c;
        
        if (a + l <= b && b <= a + r) {
            
//            cout << i << " and " << a + l << ' '<< a + r << endl;
            
            cout << "YES\n";
            return 0;
        }
    }
    cout << "NO\n";
    return 0;
}


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

typedef long long ll;
 
int main(){
  int n;
  cin >> n;
  int c[n], s[n], f[n];
  for(int i=0; i<n; i++){
    cin >> c[i] >> s[i] >> f[i];
  }
  for(int i=0; i<n-1; i++){
    int tmp = s[i]+c[i];
    for(int j=i+1; j<n-1; j++){
      if(tmp<s[j]){
        tmp = s[j]+c[j];
      }else{
        if((tmp-s[j])%f[j]==0){
          tmp += c[j];
        }else{
          tmp = s[j]+((tmp-s[j])/f[j]+1)*f[j]+c[j];
        }
      }
    }
    cout << tmp << endl;
  }
  cout << 0 << endl;
  return 0;
}


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

namespace Tasks
{
    public class K
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var (N, K) = Scanner.Scan<int, int>();
            var A = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();

            var dp = new bool[K + 1];
            for (var i = 0; i <= K; i++)
            {
                for (var j = 0; j < N; j++)
                {
                    if (i - A[j] >= 0) dp[i] |= !dp[i - A[j]];
                }
            }

            Console.WriteLine(dp[K] ? "First" : "Second");
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
        }
    }
}


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

int main() {
    string O, E;
    cin >> O >> E;

    string ans;

    int i = 0;
    while (i < O.size() || i < E.size()) {
        if (i < O.size()) ans.push_back(O.at(i));
        if (i < E.size()) ans.push_back(E.at(i));
        i++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<ll> v1, v2;
	ll n,m,k;
	cin>>n>>m>>k;
	for(ll i=0; i<n; ++i){
		ll x; cin>>x;
		v1.push_back(x);
	}
	for(ll i=0; i<m; ++i){
		ll y; cin>>y;
		v2.push_back(y);
	}
	vector<ll> pre(n+1,0);
	vector<ll> pre2(m+1,0);
	for(int i=1; i<=n; ++i){
		pre[i] = pre[i-1];
		pre[i] += v1[i-1];
	}
	for(int i=1; i<=m; ++i){
		pre2[i] = pre2[i-1];
		pre2[i] += v2[i-1];
	}

	int ans = 0;
	for(int i=0; i<=n; ++i){
		if( pre[i] > k ){ break; }
		ans = max(ans, i);
		ll left = k - pre[i];
		auto get = prev(upper_bound(pre2.begin(), pre2.end(), left));
		if( (*get) > left ){ continue; }
		int dist = distance(pre2.begin(), get);
		ans = max(ans, i + dist);
	}
	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 9500
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
long long const mod = 1000000007;

int n, x[3], v;
vector< vector<long long> > dp;

bool g(int mem, int a){
    int m = mem, sum = 0, prc = 2;
    if(a == x[2]) prc--;
    else sum = a;
    while(m > 0){
        int tmp = 1;
        while(m%2 == 0){
            m >>= 1;
            tmp++;
        }
        sum += tmp;
        if(sum == x[prc]){
            sum = 0;
            if(prc-- == 0) return false;
        }else if(sum > x[prc]) return true;
        m >>= 1;
    }
    return true;
}

long long f(int id, int mem){
    if(id == n) return 1;
    if(dp[id][mem] != -1) return dp[id][mem];
    long long res = 0;
    for(int a = 1; a <= 10; a++){
        if(g(mem, a)) res += f(id+1, ((mem<<a)+(1<<(a-1)))%v);
    }
    return dp[id][mem] = res % mod;
}

int main(void){
    cin >> n >> x[0] >> x[1] >> x[2];
    v = (1<<(x[0]+x[1]+x[2]-1));
    dp.assign(n, vector<long long>(v, -1));
    long long ans = 1;
    for(int i=0;i<n;i++) ans = ans * 10 % mod;
    ans += mod - f(0, 0);
    cout << ans%mod << endl;

}


Measured memory_bytes: 21376
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		if(s.equals("Sunny")) {
			System.out.println("Cloudy");
		}else if(s.equals("Cloudy")) {
			System.out.println("Rainy");
		}else {
			System.out.println("Sunny");
		}
	}
}


Measured memory_bytes: 20820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128_t LL;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;


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

    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i + 1 < n; i++) {
        if (s[i] == s[i + 1]) {
            cout << i + 1 << " " << i + 2 << "\n";
            return 0;
        }
    }
    for (int i = 0; i + 2 < n; i++) {
        if (s[i] == s[i + 2]) {
            cout << i + 1 << " " << i + 3 << "\n";
            return 0;
        }
    }
    cout << "-1 -1\n";

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 3708
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;
const int M = 1e5 + 10;
struct Node
{
	int x, y, r, pre;
};
class Graph
{
public:
	int top[N];
	Node e[M];
	int k;
	void init(int sz = N)
	{
		memset(top, -1, sizeof(int) * sz);
		k = 0;
	}
	void addEdge(int x, int y, int w, int w2 = 0)
	{
		e[k] = Node{ x,y,w,top[x] };
		top[x] = k++;
		e[k] = Node({ y,x,w2,top[y] });
		top[y] = k++;
	}
	Node& operator [](int i)
	{
		return e[i];
	}
} g;
int layer[N];
int s, t;
int current[N];
bool bfs(int sz = N)
{
	memset(layer, -1, sizeof(int) * sz);
	layer[s] = 1;
	queue<int> q;
	q.push(s);
	while (!q.empty())
	{
		int x = q.front();
		q.pop();
		for (int i = g.top[x]; ~i; i = g[i].pre)
		{
			int y = g[i].y;
			int r = g[i].r;
			if (r > 0 && layer[y] == -1)
			{
				layer[y] = layer[x] + 1;
				q.push(y);
				if (y == t) return true;
			}
		}
	}
	return false;
}
int dfs(int x, int tot = INF)
{
	if (x == t) return tot;
	int ret = 0;
	for (int i = current[x]; ~i; i = g[i].pre)
	{
		int y = g[i].y, r = g[i].r;
		if (layer[y] == layer[x] + 1 && r > 0)
		{
			current[x] = i;
			int tmp = dfs(y, min(r, tot - ret));
			g[i].r -= tmp;
			g[i ^ 1].r += tmp;
			ret += tmp;
			if (ret == tot) return ret;
		}
	}
	layer[x] = -1;
	return ret;
}
int solve(int sz = N)
{
	int ret = 0;
	while (bfs(sz))
	{
		memcpy(current, g.top, sizeof(int) * sz);
		ret += dfs(s);
	}
	return ret;
}
pair<int, int> p[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
	s = 0, t = 2 * n + 1;
	g.init(t + 1);
	for (int i = 1; i <= n; i++) g.addEdge(s, i, 1), g.addEdge(i + n, t, 1);
	for (int i = 1; i <= n; i++)
	{
		int x, y;
		cin >> x >> y;
		for (int j = 1; j <= n; j++)
		{
			if (x >= p[j].first && y >= p[j].second)
				g.addEdge(j, i + n, 1);
		}
	}
	cout << solve(t + 1) << endl;
	return 0;
}


Measured memory_bytes: 384
n = int(input())
t, a = (float(_) for _ in input().split())
h = [float(_) for _ in input().split()]

p = 0
ans = 9999999999
for i in range(n):
    at = t - h[i]*0.006
    if(abs(at-a) < ans):
        ans = abs(at-a)
        p = i+1

print(p)

Measured memory_bytes: 3060
/*input
3485
*/
#include <bits/stdc++.h>
#define fastIo ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define sz size
#define pb push_back
#define mp make_pair
using namespace std;

//#define LOCAL
#ifdef LOCAL
	#define DEBUG(x) do { cout << #x << ": " << x << '\n'; } while (0)
#else
	#define DEBUG(x) 
#endif

const double EPS = 1e-18;
const double PI = 3.141592653589793238462;

const int dr[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dc[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int n;

int BS(int i, int j){
	int lo = 1, hi = 3500;
	int ans = -1;
	while(lo <= hi){
		int mid = (lo + hi) / 2;
		long long lhs = 1LL * j * mid * n + 1LL * i * mid * n + 1LL * i * j * n;
		long long rhs = 4LL * i * j * mid;
		if(lhs == rhs){
			ans = mid;
			break;
		}
		if(lhs < rhs){
			hi = mid - 1;
		}
		else{
			lo = mid + 1;
		}
	}
	return ans;
}

int main(){
	fastIo;

	cin >> n;

	for(int i = 1; i <= 3500; i++){
		for(int j = 1; j <= 3500; j++){
			int ans = BS(i, j);
			if(ans != -1){
				cout << i << ' ' << j << ' ' << ans << '\n';
				return 0;
			}
		}
	}

	return 0;
}

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

typedef long long ll;

int main() {
    set<int> a,b;
    int n, m;
    cin >> n;
    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        a.insert(x);
    }
    cin >> m;
    for(int i=0; i<m; i++){
        int x;
        cin >> x;
        b.insert(x);
    }
    
    vector<int> c;
    set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), back_inserter(c));
    
    for(int i=0; i<c.size(); i++){
        cout << c[i] << endl;
    }
    
}



Measured memory_bytes: 23616
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <cmath>
#include<queue>
#define PI 3.141592653589793238
#define ll long long
using namespace std;

int main()
{
	vector<int> bricks;
	int n, tmp;
	int sarch = 1;
	int dis = 0;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> tmp;
		bricks.emplace_back(tmp);
	}

	for (int i = 0; i < bricks.size(); i++) {
		if (bricks[i] == sarch) {
			sarch++;
		} else {
			dis++;
		}
	}

	if (sarch == 1) {
		cout << -1;
	} else {
		cout << dis;
	}

	return 0;
}

Measured memory_bytes: 1400
#pragma warning(disable:4996)
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

bool check(vec<int>& v) {
	REP(i, v.size()) {
		if (v[i] > 0)return false;
	}
	return true;
}

int main(void) {
	int N;
	cin >> N;
	vec<int> h(N);
	REP(i, N) {
		cin >> h[i];
	}
	int ans = 0;
	while (1) {
		if (check(h))break;
		for (int i = 0; i < N; ++i) {
			if (h[i] > 0) {
				++ans;
				for (int j = i; j < N; ++j) {
					if (h[j] > 0) {
						h[j] = max(h[j] - 1, 0);
					}
					else {
						break;
					}
				}
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) throws Exception {
		sc = new Scanner(System.in);
		sc.nextInt();
		int Q = sc.nextInt();

		String[] S = sc.next().split("");

		int[][] questions = new int[Q][2];

		for (int i = 0; i < questions.length; i++) {
			questions[i][0] = sc.nextInt();
			questions[i][1] = sc.nextInt();

		}

		// N字ごとのACの表れる回数を数えて配列に格納しておく

		int[] arry = new int[S.length];

		for (int i = 0; i < S.length; i++) {
			if (i == 0) {
				arry[i] = 0;
			} else {
				if ("AC".equals(S[i - 1] + S[i])) {
					arry[i] = arry[i - 1] + 1;
				} else {
					arry[i] = arry[i - 1];
				}
			}
		}

		for (int i = 0; i < questions.length; i++) {
			System.out.println(arry[questions[i][1] - 1] - arry[questions[i][0] - 1]);
		}

	}
}

Measured memory_bytes: 104100
#include<stdio.h>

int gcdf(int x, int y);

int main(){
  int gcd,lcm,a,b,c;
  while(scanf("%d %d",&a,&b) != EOF){

    /*--gcd--*/ 
   gcd = gcdf(a,b);
   /*lcm*/
   int k,m;
   k = a/gcd;
   m = b/gcd;
   lcm = gcd*k*m;
  
   printf("%d %d\n",gcd,lcm);
  }
  return 0;
}

int gcdf(int x, int y)
{
  int z;
  if(x<y){
    return gcdf(y,x);}
  else{
  z = x%y;
  if (z==0){
    return y;}
  else{
    return gcdf(y,z);
  }
  }
}

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

int main(){
  int K , A , B;
  bool flag=0;
  cin >> K >> A >> B;
  for(int i=1; i<1001 ; i++){
    if(A<=K*i&&K*i<=B)
      flag=1;
  }
  if(flag)
    cout << "OK" << endl;
  else
    cout << "NG" << endl;
}

Measured memory_bytes: 3592