akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
  int input_m, input_f, input_r;
  int i;
  char gread;
  for(i=0; i<50; i++){
    scanf("%d %d %d", &input_m, &input_f, &input_r);
    if(input_m==-1 && input_f==-1 && input_r==-1){
      break;
    }else{
      int total=input_m+input_f;
        if(input_m==-1 || input_f==-1){
          printf("F\n");
        }else if(total>=80){
          printf("A\n");
        }else if(total>=65 && total<80){
          printf("B\n");
        }else if(total>=50 && total<65){
          printf("C\n");
        }else if(total>=30 && total<50){
          if(input_r>=50){
            printf("C\n");
          }else{
            printf("D\n");
          }
        }else{
          printf("F\n");
        }
    }
  }
  return 0;
}


Measured memory_bytes: 2032
N = int(input())
a = [int(input()) for i in range(N)]

count = [0]*(N)

i = 1
min_num = 0
count[i-1]+=1
while True:
    i = a[i-1]
    min_num += 1
    if i == 2:
        print(min_num)
        exit()
    if count[i - 1] == 0:
        count[i-1]+=1
    else:
        break

print(-1)

Measured memory_bytes: 13808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define MANX MAXN
#define itn int
#define in(x); { for (auto &to : x) cin>>to;}
#define out(x); { for (auto &to : x) cout<<to<<" ";cout<<'\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

void solve()
{
    ll d,t,s;
    cin>>d>>t>>s;
    if (d<=t*s)
        cout<<"Yes\n";
    else
        cout<<"No\n";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef Mip182
    freopen("a.in","r",stdin);
    #endif
    int _t;
//    cin>>_t;
    _t=1;
    while (_t--)
        solve();
    //n=1 ?
    //recursion - matrix exponential
    //linear algebra - just a joke
    //check ios_base, MAXN, mod1 before submit
    //if debug more than 15 minutes - write stress
    //compression
}

Measured memory_bytes: 3636
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array of array of char;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(h);
    Readln(w);
    SetLength(l,h+2,w+2);

    for i := 0 to h+1 do
      for j := 0 to w+1 do
        l[i][j]:='.';

    for i := 1 to h  do begin
      Readln(s);
      for j := 1 to Length(s) do
        l[i][j]:=s[j];
    end;

    for i := 1 to h do
      for j := 1 to w do begin
        if (l[i][j]='#')and(l[i-1][j]='.')and(l[i+1][j]='.')and(l[i][j-1]='.')and(l[i][j+1]='.') then begin
          Writeln('No');
          Readln;
          exit;
        end;
      end;

    Writeln('Yes');
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

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

// @@ !! LIM()
// --> 
// @@ !! LIM  -- end mark --

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> X(N), Y(N), P(N);
  for (ll i = 0; i < N; i++) {
    ll x, y, p; cin >> x >> y >> p;
    X.at(i) = x;
    Y.at(i) = y;
    P.at(i) = p;
  }

  vector rail(N, int8_t(0));
  auto rnext = [&]() -> bool {
    ll i = 0;
    while (i < N && rail.at(i) == 2) {
      rail.at(i) = 0;
      i++;
    }
    if (i == N) return false;
    rail.at(i)++;
    return true;
  };

  ll pssize = 1LL << N;
  vector distX(pssize, vector(N, 0LL));
  vector distY(pssize, vector(N, 0LL));
  for (ll t = 0; t < pssize; t++) {
    for (ll i = 0; i < N; i++) {
      ll vminx = abs(X.at(i));
      ll vminy = abs(Y.at(i));
      for (ll j = 0; j < N; j++) {
	if (t & (1LL << j)) {
	  vminx = min(vminx, abs(X.at(i) - X.at(j)));
	  vminy = min(vminy, abs(Y.at(i) - Y.at(j)));
	}
      }
      distX.at(t).at(i) = vminx;
      distY.at(t).at(i) = vminy;
    }
  }

  vector<ll> ans(N+1, LLONG_MAX);
  do {
    ll tx = 0;
    ll ty = 0;
    ll k = 0;
    for (ll i = 0; i < N; i++) {
      if (rail.at(i) == 1) tx |= (1LL << i);
      if (rail.at(i) == 2) ty |= (1LL << i);
      if (rail.at(i) != 0) k++;
    }
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
      sum += min(distX.at(tx).at(i), distY.at(ty).at(i)) * P.at(i);
    }
    ans.at(k) = min(ans.at(k), sum);
  }while (rnext());

  for (ll i = 0; i <= N; i++) cout << ans.at(i) << endl;

  return 0;
}



Measured memory_bytes: 12920
#include <stdio.h>
#include <string.h>

#define N 100000

int main() {
        int i;
        int len;
        char S[N] = { 0 };
        unsigned int mask1, mask2;
        int cnt1, cnt2;

        scanf("%s", S);

        len = strlen(S);

        mask1 = '0', mask2 = '1';
        cnt1 = cnt2 = 0;
        for (i = 0; i < len; i++) {
                if (S[i] != mask1) cnt1++;
                if (S[i] != mask2) cnt2++;

                mask1 ^= mask2;
                mask2 ^= mask1;
                mask1 ^= mask2;
        }

        int min;
        if (cnt1 < cnt2) min = cnt1;
        else min = cnt2;

        printf("%d\n", min);

        return 0;
}


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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef map<int,int> mii;

const int MOD = 1e9+7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m,k;
	cin >> n >> m >> k;
	vl arr1(n+1),arr2(m+1);
	for (ll i = 1;i <= n;++i) {
		cin >> arr1[i];
	}
	for (ll i = 1;i <= m;++i) {
		cin >> arr2[i];
	}
	for (int i = 1;i <= n;++i) {
		if (i > 1) {
			arr1[i] += arr1[i-1];
		}
	}
	for (int i = 1;i <= m;++i) {
		if (i > 1) {
			arr2[i] += arr2[i-1];
		}
	}
	ll ans = 0;
	for (int i = 0;i <= n;++i) {
		if (arr1[i] > k) break;
		ll curr = i;
		ans = max(ans,curr);
		ll idx = upper_bound(all(arr2),k-arr1[i])-arr2.begin();
		//cout << idx << '\n';
		--idx;
		if (idx < 0) {
			break;
		} else {
			curr += idx;
		}
		ans = max(ans,curr);
	}
	cout << ans << '\n';
	return 0;
}



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

int SelectionSort(int A[], int N){
    int sw = 0;
    int j = 0;
    int minj = 0;
    for(int i = 0; i < N - 1; i++){
        minj = i;
        for(j = i; j < N; j++){
            if(A[j] < A[minj]) minj = j;
        }
        if(i != minj) {
            sw++;
            swap(A[i], A[minj]);
        }
    }
    return sw;
}

int main(){
    int A[100], N;

    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    int sw = SelectionSort(A, N);

    for(int i  = 0; i < N; i++){
        if(i) cout << " ";
        cout << A[i];
    }

    cout << endl;
    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3080
while True:
    n, m, a = map(int, input().split())

    if n + m + a == 0:
        break

    lines = list(sorted([tuple(map(int, input().split())) for _ in range(m)]))

    replace = list(range(1, n+1))

    for l in lines:

        _, p, q = l

        p -= 1
        q -= 1

        replace[p], replace[q] = replace[q], replace[p]

    print(replace[a-1])

Measured memory_bytes: 7864
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

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

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int k; cin>>k;

    ll ans = 0;
    for(int i=1; i<=k; i++){
        for(int j=1; j<=k; j++){
            for(int l=1; l<=k; l++){
                int num = __gcd(i, j);
                num = __gcd(num, l);
                ans += num;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>

int main(){
  int n,m,a,b;
  scanf("%d %d",&n,&m);
  if(n>1 && m>1){
  a=(n*(n-1))/2;
    b=(m*(m-1))/2;
    
  }else if(n<=1 && m>1){
  a=0;
    b=(m*(m-1))/2;
  }else  if(n>1 && m<=1){
  a=(n*(n-1))/2;
    b=0;
  }else  if(n<=1&& m<=1){
  a=0;
    b=0;
  }
    printf("%d",a+b);
}

Measured memory_bytes: 128
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n, d = map(int, input().split())
for i in range(n):
    x, y = map(int, input().split())
    if d >= math.sqrt(x*x + y*y):
        count += 1
print(count)

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

bool is_ok(int tdiff, int xdiff, int ydiff)
{
  if (xdiff + ydiff > tdiff) { return false; }
  int d = tdiff - xdiff - ydiff;
  return d % 2 == 0;
}

int main()
{
  int N;
  scanf("%d", &N);
  vector<int> tm(N + 1, 0), xpos(N + 1, 0), ypos(N + 1, 0);
  string ans = "Yes";
  for (int i = 1; i <= N; ++i) {
    scanf("%d %d %d", &tm[i], &xpos[i], &ypos[i]);
    if (not is_ok(tm[i] - tm[i - 1], abs(xpos[i] - xpos[i - 1]), abs(ypos[i] - ypos[i - 1]))) {
      ans = "No";
      break;
    }
  }
  printf("%s\n", ans.c_str());
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define OK { cout << "OK" << endl; return 0; }
#define NG { cout << "NG" << endl; return 0; }
#define sz(v) ((int)(v).size())
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
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 (a>b) { a=b; return 1; } return 0; }
template<class T>void out(T a){cout << a << endl;}
template<class T>void die(T a){cout << a << endl; exit(0);}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}
ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}



ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

string S,T,U;
int a,b,c;
vi A,B,C;


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    cin >> S >> T;
	rep(i,S.size()) {
		if(T[i] != S[i]) No
	}
	Yes
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <string>
#include <stack>
// #include <numeric>
 
using namespace std;
 
#define f(i,a,b) for(int i=a;i<b;i++)
#define fll(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define vvi vector<vector<int> >
#define ss second
#define ff first
#define ll long long
#define lld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pq priority_queue< int >
#define pqll priority_queue< ll >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define INF 1000000000
#define NINF -1000000000
#define endl '\n'

void solve(){
    int a , b;
    cin >> a >> b;
    int temp = gcd(a,b);
    ll mult = ((ll)a*(ll)b);

    cout <<  (mult/(ll)temp) << endl;
}

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

    int t = 1;
    // cin >> t;
    
    while(t--){    
        solve();
    }
}

Measured memory_bytes: 3600
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> B(N+1);
    for(int i=0; i<N; i++) {
        cin >> B[i+1];
    }

    bool ok = true;
    for(int i=1; i<=N; i++) {
        ok &= (B[i] <= i);
    }
    if(ok) {
        vector<int> rec(N+1), checked(N+1);
        vector<int> ans;
        while(ans.size() < N) {
            for(int i=N; i>=1; i--) {
                if(checked[i]) continue;
                int val = B[i];
                if(rec[i-1] + 1 == val) {
                    ans.push_back(val);
                    checked[i] = true;
                    // fprintf(stderr, "i = %lld\n", i);
                    for(int k=i; k<=N; k++) {
                        rec[k]++;
                        // fprintf(stderr, "rec[%lld] = %lld\n", k, rec[k]);
                    }
                    break;
                }
            }
        }

        for(int i=0; i<N; i++) {
            cout << ans[i] << endl;
        }
    }
    else {
        cout << -1 << endl;
    }
    return 0;
}


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

using namespace std;

int N,c,m;

int main()
{
    cin >> N;
    m=0;
    for (int i=1; i<=N; i+=2)
    {
        c=0;
        for (int j=2; j<=sqrt(i); j++)
        {
            if (i%j==0)
            {
                //cout << "\t" << i << "\t" << j << endl;
                c++;
                //cout << c << endl;
            }
            if (c==3)
            {
                m++;
                break;
            }
        }
    }
    cout << m << endl;

}




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


int main()
{
	ll A,B,C;
	cin>>A>>B>>C;
	if(A%2==0||B%2==0||C%2==0)
	{
		cout<<0<<endl;
	}
	else
	{
		cout<<min(min(B*C,A*C),A*B)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3604
import static java.util.Arrays.*;

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		String[] ss = sc.nextLine().split("\\s+");
		int[] r = new int[ss.length - 1];
		int L = Integer.parseInt(ss[0]);
		for (int i = 1; i < ss.length; i++) {
			r[i-1] = Integer.parseInt(ss[i]);
		}
		int n = r.length;
		double[][] dp = new double[1 << n][n];
		double INF = 1e9;
		for (int i = 0; i < dp.length; i++) fill(dp[i], INF);
		for (int i = 0; i < n; i++) {
			dp[1 << i][i] = r[i];
		}
		for (int set = 1; set < (1 << n); set++) {
			for (int last = 0; last < n; last++) {
				if (dp[set][last] < INF/2) {
					for (int next = 0; next < n; next++) if ((set >> next & 1) == 0) {
						double dx = Math.sqrt(Math.pow(r[last] + r[next], 2) - Math.pow(r[last] - r[next], 2));
						double ncost = dp[set][last] + dx;
						int nset = set | (1 << next);
						dp[nset][next] = Math.min(dp[nset][next],  ncost);
					}
				}
			}
		}

		double EPS = 1e-10;
		double best = INF;
		for (int last = 0; last < n; last++) {
			best = Math.min(best, dp[(1 << n) - 1][last] + r[last]);
		}
		out.println(best < L + EPS ? "OK":"NA");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	Scanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}
}

Measured memory_bytes: 29112
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
MOD = 10**9 + 7
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
c = [0] * (k+1)
c[1] = n - k + 1
print(c[1])
for i in range(1, k):
    c[i+1] = c[i] * (k-i) * (n - k - i + 1) // (i * (i+1))
    print(max(c[i+1]%MOD, 0))




Measured memory_bytes: 67692
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N = 1e5+10;
int pass[12];
void foo(vector<int>& ans){
    memset(pass,0,sizeof pass);
    int n = ans.size()-1;
    int find = 0;
    while(n>0){
        if (abs(ans[n] - ans[n-1]) > 1 || ans[n]==10)
        {
            pass[n] = 1;
            find = 1;
            ans[n-1]++;
        }
        n--;
    }
    if(ans[0] == 10){
        ans[0] = 1;
        ans.push_back(0);
        for(int i=1;i<ans.size();++i){
            ans[i] = 0;
        }
    }
    else if(find){
        for(int i=1;i<ans.size();++i){
            if(pass[i]){
                ans[i] = max(ans[i-1]-1,0);
            }
        }
    }
}
int main(){
    int k;
    cin >> k;
    if(k<=12){
        cout << k << '\n';
        return 0;
    }
    k-= 10;
    vector<int> ans;
    ans.push_back(1);
    ans.push_back(0);
    while(k){
        ans[ans.size()-1]++;
        k--;
        foo(ans);
    }
    for(auto i:ans){
        cout << i;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

std::vector<int> num;

struct State {
  int num;
  int depth;
  State(int a, int b) {
    num   = a;
    depth = b;
  }
};

int Solve_all(int n) {
  bool visited[1000001] = {};
  std::queue<State> bfs;
  for (auto x : num) {
    if (x > n) break;
    bfs.push(State(x, 1));
    visited[x] = true;
  }
  while (!bfs.empty()) {
    State newstate = bfs.front();
    bfs.pop();
    if (newstate.num == n) {
      return newstate.depth;
    }
    for (auto x : num) {
      if (newstate.num + x > n) break;
      if (visited[newstate.num + x]) continue;
      bfs.push(State(newstate.num + x, newstate.depth + 1));
      visited[newstate.num + x] = true;
    }
  }
}

int Solve_odd(int n) {
  bool visited[1000001] = {};
  std::queue<State> bfs;
  for (auto x : num) {
    if (x % 2 == 0) continue;
    if (x > n) break;
    bfs.push(State(x, 1));
    visited[x] = true;
  }
  while (!bfs.empty()) {
    State newstate = bfs.front();
    bfs.pop();
    if (newstate.num == n) {
      return newstate.depth;
    }
    for (auto x : num) {
      if (x % 2 == 0) continue;
      if (newstate.num + x > n) break;
      if (visited[newstate.num + x]) continue;
      bfs.push(State(newstate.num + x, newstate.depth + 1));
      visited[newstate.num + x] = true;
    }
  }
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  for (int n = 1; n < 1000; n++) {
    int push = n * (n + 1) * (n + 2) / 6;
    if (n > 1000000) break;
    num.push_back(push);
  }

  while (1) {
    int n;
    cin >> n;
    if (n == 0) return 0;
    cout << Solve_all(n) << " " << Solve_odd(n) << endl;
  }

  return 0;
}



Measured memory_bytes: 10588
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define endl '\n'
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a,ans=0;
    cin>>a;
    string x;
    cin>>x;
    for(int i=0;i<a;i++){
        string tmp=x.substr(i);
        vector<int>vec=z_function(tmp);
        for(int c=0;c<vec.size();c++){
            if(vec[c]<=c)
                ans=max(ans,vec[c]);
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
const ll mod = 1e9+7;
int a[man];
ll pre[man];

signed main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    int n;cin >> n;
    for(int i = 1;i <= n;++i){
        cin >> a[i];
        pre[i] = pre[i-1] + a[i];
        pre[i] %= mod;
    }
    ll res = 0;
    for(int i = 2;i <= n;++i){
        ll tp = 1ll * a[i-1] * ((pre[n] - pre[i-1] + mod) % mod)%mod;
        res = res + tp;
        res %= mod;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 5964
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n=0,a=0,b=0,sum=0;
	cin>>n;
	while(n--){
		cin>>a>>b;
		sum=sum+(b-a+1);
		
	}
	cout<<sum;
	return 0;
 } 

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

ld dist(ld x1,ld y1,ld x2,ld y2)
{
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

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

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

    cout<<fixed<<setprecision(10);
    READV(N);
    ld X[N];
    ld Y[N];
    ld Px=0,Py=0;
    FORI(i,0,N)
    {
        READ(X[i]);
        READ(Y[i]);
        Px+=X[i];
        Py+=Y[i];
    }
    Px/=(ld)N;
    Py/=(ld)N;
    ld rad=0;
    ld gradient=0.1;
    FORI(i,0,100000)
    {
        rad=dist(X[0],Y[0],Px,Py);
        ll z=0;
        FORI(j,0,N)
        {
            ld x=dist(X[j],Y[j],Px,Py);
            if (x>rad)
            {
                z=j;
                rad=x;
            }
        }
        Px+=gradient*(X[z]-Px);
        Py+=gradient*(Y[z]-Py);
        gradient*=0.999;
    }
    cout<<rad<<endl;

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


  
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;

int main(){
    string S; cin >> S;
    vector<char> ss;
    int Q; cin >> Q;
    bool f=true;
    for(int i=0;i<Q;i++){
        cerr << "\t" << S << endl;
        int ti; cin >> ti;
        if(ti==1){
            f = !f;
        }else{
            int fi;char ci;
            cin >> fi >> ci;
            if(f){
                if(fi==1) ss.push_back(ci);
                else S += ci;
            }else{
                if(fi==1) S += ci;
                else ss.push_back(ci);
            }         
        }
    }
    if(f){
        for(int i=0;i<ss.size();i++){
            cout << ss[ss.size()-i-1];
        }
        cout << S << endl;
    }else{
        for(int i=S.size()-1;i>=0;i--){
            cout << S[i];
        }
        for(int i=0;i<ss.size();i++){
            cout << ss[i];
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 1028
s = int(input())

val = s
mp = {s:1}
i= 1
while True:
  i+=1
  if val%2==0:
    val = val//2
  else:
    val = 3*val+1
  
  if val in mp:
    print(i)
    break
  else:
    mp[val] = 1

Measured memory_bytes: 3060
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


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

    N, M = il()

    ret = 0
    if N * 2 <= M:
        ret += N
        ret += (M - N * 2) // 4
    else:
        ret += M // 2
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9820
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }
int mid (int a, int b, int c) {
    return a + b + c - max({a, b, c}) - min({a, b, c});
}

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		float x[] = new float[N];
		String u[] = new String[N];

		for (int i=0; i<N; i++) {
			x[i] = sc.nextFloat();
			u[i] = sc.next();
		}

		float sum = 0;
		for (int i = 0; i<N; i++) {
			if ("JPY".equals(u[i])) {
				sum += x[i];
			} else {
				sum += x[i]*380000;
			}
		}

		System.out.println(sum);
	}
}

Measured memory_bytes: 25300
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int n;
	cin >> n;
	deque<int> b;
	REP(i, n) {
		int a;
		cin >> a;
		if (i % 2) b.push_back(a);
		else b.push_front(a);
	}
	if (n % 2 == 0) {
		REP(i, n) {
			int a = b.back();
			b.pop_back();
			cout << a;
			if (i == n - 1) cout << "\n";
			else cout << " ";
		}
	}
	else {
		REP(i, n) {
			int a = b.front();
			b.pop_front();
			cout << a;
			if (i == n - 1) cout << "\n";
			else cout << " ";
		}
	}

	return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	int ans=100*(n-m)+1900*m;
	cout<<ans*(1<<m)<<endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char s;
		int cnt=0, ans=0;
		for (int i = 0; i < S.length(); i++) {
			s = S.charAt(i);
			if (s == 'A'||s=='T'||s=='G'||s=='C')
				cnt++;
			else {
				ans = Math.max(cnt, ans);
				cnt = 0;
			}
		}
		ans = Math.max(cnt, ans);
		System.out.println(ans);
	}
}

Measured memory_bytes: 23636
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [X, Y, Z] = input[0].map(Number);

  const width = X - Z;

  return Math.floor(width / (Y + Z));
};

console.log(main(read()));


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

const int maxn = 100001;

vector < vector < pair < int, int > > > g(maxn);
vector < int > c(maxn, 0);

void paint (int u) { // paint the roses green huh?
    for (auto edge: g[u]) {
        int v = edge.first, z = edge.second;
        if (!c[v]) {
            if ((z && c[u] == 1) || (!z && c[u] == 2))
                c[v] = 2;
            else
                c[v] = 1;
            paint(v);
        }
    }
}

signed main () {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int x, y, z;
        cin >> x >> y >> z;
        g[x].push_back(make_pair(y, (z & 1)));
        g[y].push_back(make_pair(x, (z & 1)));
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (!c[i]) {
            c[i] = 1;
            paint(i);
            ++ans;
        }
    }
    cout << ans << '\n';
}


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

int main() {
  //整数X,Yを入力して、縦X、横Yの２次元配列を作る
  int X,Y;
  cin >> X >> Y;
  vector<vector<char>> A(X,vector<char>(Y));
  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      cin >> A.at(i).at(j);
    }
  }
  //周囲８方向の定義
  int dx[8]={1,1,0,-1,-1,-1,0,1};
  int dy[8]={0,1,1,1,0,-1,-1,-1};
  
  //各マスに対して処理を行う
  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      //爆弾がある場合はそのマスの処理を終了
      //以下爆弾が無いマスの処理
      if(A.at(i).at(j)!='#'){
        int count=0;//周囲８マスのうち爆弾のマスの数
        for(int d=0;d<8;d++){//周囲８マスに順に移動させる
          int x=i+dx[d];
          int y=j+dy[d];
          //移動したマスが配列内にあり、爆弾があれば、カウントを増やす
          if(0<=x &&  x<X && 0<=y && y<Y && A.at(x).at(y)=='#'){
            count++;
          }
        }
        //周囲の爆弾の数にマスの値を置き換える
        A.at(i).at(j)='0'+count;
      }
    }
  }
  
  //各マスを出力する
  //行末は改行する
  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      cout << A.at(i).at(j);
      if(j==Y-1){
        cout << endl;
      }
    }
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b,c,d,e,f=map(int,input().split())
    Water=set()
    Sugar=set()
    for i in range(30):
        for j in range(30):
            w=100*i*a+100*j*b
            if(w>f): break
            Water.add(w)
    Water.remove(0)

    for i in range(b):
        for j in range(1500):
            s=i*c+j*d
            if(s*(100+e)>f*e): break
            Sugar.add(s)

    from itertools import product
    SW=list(product(Water,Sugar))
    SW.sort(lambda x:x[1]/(x[0]+x[1]), reverse=1)
    for w,s in SW:
        if(s+w<=f and s*(100+e)<=e*(s+w)):
            print(s+w,s)
            return
resolve()

Measured memory_bytes: 39024
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int X, A, B;
  cin >> X >> A >> B;
  int num = B - A;

  if (num <= 0)
    cout << "delicious" << endl;
  else if (num <= X)
    cout << "safe" << endl;
  else
    cout << "dangerous" << endl;
}


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

int main() {
  string S;
  cin >> S;

  int ans = 0;

  stack<bool> st;
  for (int i = 0; i < S.size(); ++i) {
    st.push(S[i] == '1');

    while (st.size() >= 2) {
      int a = st.top();
      st.pop();

      if (a != st.top()) {
        ans += 2;
        st.pop();
      } else {
        st.push(a);
        break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
int n,a,b,c;
scanf("%d",&n);
a=n%10;
b=n/100;
c=n%100;
if(a==7)
printf("Yes\n");
else if(b==7)
printf("Yes\n");
else if(c>=70&&c<=79)
printf("Yes\n");
else
printf("No\n");
return 0; 
}

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

int main() {
  int k,a,b;
  cin >>k>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      cout << "OK"<<endl;
      return 0;
    }
  }
  cout << "NG"<<endl;
}


Measured memory_bytes: 3632
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
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 INF = 1e9;
const ll LLINF = 1e16;
const int mod = 1000000007;
const int mod2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> h(n);
    cin >> h;
    h.push_back(LLINF);
    int ans = 0,res = 0;
    for(int i = 0;i<n;i++){
        if(h[i]>=h[i+1]) res++;
        else{
            ans = max(ans,res);
            res = 0;
        }
    }
    cout << ans << endl;
}

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

using namespace std;
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= 180; i++) {
		if (360*i%n == 0){
			printf("%d\n", 360*i/n);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3796
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int a[]=new int[n+1];//食べた順番
    for (int i=1;i<=n;i++) {
      a[i]=sc.nextInt();
    }
    int b[]=new int[n+1];//料理の満足度
    for (int i=1;i<=n;i++) {
      b[i]=sc.nextInt();
    }
    int c[]=new int[n];//連続する番号の料理を食べた時の満足度の追加
    for (int i=1;i<=n-1;i++) {
      c[i]=sc.nextInt();
    }

    int total=0;

    for (int i=1;i<=n;i++) {
      //System.out.println(b[a[i]]);
      total+=b[a[i]];
      if (a[i]==a[i-1]+1) {
        total+=c[a[i-1]];
      }
    }

    System.out.println(total);

  }
}


Measured memory_bytes: 21844
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(string s) {
    // 全ての文字を c にするのに必要な操作回数を求める
    int f(dchar c, dchar[] s) {
        if (s.length == 1) return 0;

        auto cs = new dchar[s.length - 1];
        for (int i = 0; i < cs.length; i++) {
            if (s[i] == c || s[i+1] == c) cs[i] = c;
            else cs[i] = s[i];
        }

        if (cs.all!(e => e == c)) return 1;
        return f(c, cs.array) + 1;
    }

    if (s.all!(c => c == s[0])) return 0;
    return s.map!(c => f(c, s.array)).reduce!min;
}

void main() {
    string s = read!string;
    writeln(calc(s));
}


Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
const int M=200000+5;
int A[M],n;
int mx,mx2;
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		scanf("%d",&A[i]);
		if(A[mx]<A[i]) mx2=mx,mx=i;
		else if(A[mx2]<A[i]) mx2=i;
	}
	for(int i=1; i<=n; i++){
		if(mx==i) printf("%d\n",A[mx2]);
		else printf("%d\n",A[mx]);
	}
	return 0;
}

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

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

  if(s.length()<=k){
    cout<<s<<endl;
    return 0;
  }
  else cout<<s.substr(0,k)+"..."<<endl;
return 0;
}

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

int main() {
  string s;
  cin >> s;
  int maxPrefix = 0, prefix[s.size() + 1];
  prefix[0] = 0;
  for (int i = 1; i <= s.size(); ++i) {
    if (s[i - 1] == '1') {
      prefix[i] = prefix[i - 1] + 1;
    } else {
      prefix[i] = prefix[i - 1] - 1;
    }
    maxPrefix = max(maxPrefix, prefix[i]);
  }
  auto solve = [&](int maxPrefix) {
    int capacity[s.size() + 1];
    for (int i = s.size(), j = numeric_limits<int>::max(); i > 0; --i) {
      j = min(j, maxPrefix - prefix[i]);
      capacity[i] = j / 2;
    }
    int sum = 0, tempMaxPrefix = 0, tempMinPrefix = 0, count = 0;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == '1') {
        ++sum;
      } else if (s[i] == '0') {
        --sum;
      } else if (capacity[i + 1] > count) {
        ++sum;
        ++count;
      } else {
        --sum;
      }
      tempMaxPrefix = max(tempMaxPrefix, sum);
      tempMinPrefix = min(tempMinPrefix, sum);
    }
    return tempMaxPrefix - tempMinPrefix;
  };
  cout << min(solve(maxPrefix), solve(maxPrefix + 1));
  return 0;
}

Measured memory_bytes: 11784
import numpy as np
def get():
    s = input()
    k = int(input())
    nums = []
    for item in s:
        nums.append(int(item))
    nums = np.array(nums)
    # if k >= nums.shape[0]:
    #     m = np.max(nums)
    # else:
    #     m = np.max(nums[:k])
    # count = np.bincount(nums)
    for i in nums[:k]:
        if i!=1:
            return i
    return 1
a = get()
print(a)

Measured memory_bytes: 21384
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
void func(int,int,int);
int d,g,p[11],c[11],mn;
int main(void)
{
	int i;
	scanf("%d %d",&d,&g);
	for(i=1;i<=d;i++)	scanf("%d %d",&p[i],&c[i]);
	mn=1000;
	func(1,0,0);
	printf("%d\n",mn);
	return 0;
}
void func(int dd,int n,int sum)
{
//	printf("dd=%d n=%d sum=%d\n",dd,n,sum);
	int cnt,i,cc,wk;
	if(dd>d)	{
		if(sum<g)	{
			for(i=d;i>=1;i--)	{
				cc=(g-sum)/(i*100);
				if((g-sum)%(i*100)!=0)	cc++;
				if(cc<=p[i])	{
					n=n+cc;
					
					break;
				}
				else {
					n+=p[i];
				}
			}
		}
//		printf("sum=%d\n",sum);
		mn=min(mn,n);
	}
	else {
		func(dd+1,n,sum);
		wk=p[dd];
		p[dd]=0;
		func(dd+1,n+wk,sum+wk*(dd*100)+c[dd]);
		p[dd]=wk;
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(a,b) printf(a,b);
#define o(s) cout<< s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int n,k; cin>>n>>k;
    o((n%k==0?0:1));
}


Measured memory_bytes: 256
def dfs(i, f, result):
    if i == l - 1:
        if result == 7:
            print(f + '=7')
            exit()
    else:
        dfs(i + 1, f + '-' + s[i + 1], result - int(s[i + 1]))
        dfs(i + 1, f + '+' + s[i + 1], result + int(s[i + 1]))


s = input()
l = len(s)

dfs(0, s[0], int(s[0]))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	long long int n;
	cin >> n;
	vector<long long int> a(n, 0);
	for (long long int i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long int c = 0;
	vector<long long int> b(n, 0);
	for (long long int i = 0; i < n; i++) {
		if (a[i] % 2 == 0 && a[i] >= 2) {
			c += (a[i]-2)/2;
			a[i] = 2;
		} else if (a[i] % 2 == 1) {
			c += a[i]/2;
			a[i] = 1;
		}
		b[i] = a[i];
	}
	long long int aa = 0;
	long long int bb = 0;
	for (long long int i = 0; i < n-1; i++) {
		if (a[i] == 2) {
			a[i] = 0;
			aa++;
		} else if (a[i] == 1 && a[i+1] >= 1) {
			aa++;
			a[i] = 0;
			a[i+1]--;
		}
	}
	if (a[n-1] == 2) {
		aa++;
	}
	for (long long int i = n-1; i > 0; i--) {
		if (b[i] == 2) {
			b[i] = 0;
			bb++;
		} else if (b[i] == 1 && b[i-1] >= 1) {
			bb++;
			b[i] = 0;
			b[i-1]--;
		}
	}
	if (b[0] == 2) {
		bb++;
	}
	cout << c+max(aa, bb) << endl;
	return 0;
}

Measured memory_bytes: 1792