akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize(2)
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
typedef long long ll;
const int MAXN = 1e5 + 5;
const int mod = 1e9 + 7;
using namespace std;
int cot[MAXN];
int nex[MAXN];
int deq[MAXN];
int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for(int i = 1; i <= n; i++)    {
        int x;
        scanf("%d",&x);
        if(i == 1 && x != 1)        {
            ans++;
            continue;
        }        else        {
            nex[i] = x;
            cot[x]++;
        }
    }
    queue<int>Q;
    int t = 0, h = 0;
    for(int i = 2; i <= n; i++)
        if(!cot[i])
            Q.push(i);
    while(!Q.empty())    {
        int u = Q.front();
        Q.pop();
        if(u == 1)
            break;
        if( nex[u] != 1 && deq[u] == (k - 1) )
            ans++;
        else
            deq[nex[u]] = max(deq[nex[u]], deq[u] + 1);
        cot[ nex[u] ]--;
        if(!cot[ nex[u] ])
            Q.push( nex[u]);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
vector<int>v;
string s;
int ary[100005] = {0};
int main(){
  int N,ans = 0;

  cin >>N;
  int res = N;

  for(int i = 0;i<=N;i++){
    int cc = 0;
    int t = i;

    while(t >0){
      cc += t%6;
      t /= 6;
    }
    t = N-i;
    while (t > 0) {
      cc += t%9;
      t /= 9;
    }
    if(res > cc)res = cc;
  }


  cout <<res<<endl;
  return 0;
}


Measured memory_bytes: 256
//It is made by M_sea
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const char s[5]="RYGB";

int main() {
    int n=read(),m=read(),k=read();
    for (re int i=1;i<=n;++i) {
        for (re int j=1;j<=m;++j) {
            int x=((i+j)/k)&1,y=((i-j+m)/k)&1;
            putchar(s[2*x+y]);
        }
        puts("");
    }
    return 0;
}


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

using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,m,x;
	//string s;
	cin >>n >>m >>x;
	VI ca(n+5);
	rep(i,m){
		int z; cin >>z;
		ca[z] = 1;
	}
	
	
	ll sma=0, smb=0;
	rep2(i,x,n){
		sma += ca[i];
	}
	repr(i,x,0){
		smb += ca[i];
	}
	
	cout << min(sma, smb) <<"\n";
	return 0;
	
}


Measured memory_bytes: 256
def main():
    n = iread()
    d = aread()
    recover = 0
    for i in range(n):
        for j in range(i + 1, n):
            recover = recover + d[i] * d[j]
    print(recover)


def iread():
    return int(input())


def sread():
    return input()


def aread(t="int"):
    if t == "int":
        ret = [int(i) for i in input().split()]
    elif t == "str":
        ret = list(input().split())
    return ret


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


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    int max_A = A[0];
    int min_A = A[0];
    long count = 0;

    for(int i = 0; i < n; i++){
        count = count + A[i];
        if(max_A < A[i]){
            max_A = A[i];
        }
        if(min_A > A[i]){
            min_A = A[i];
        }
    }

    cout << min_A << " " << max_A << " " << count << endl;

    return 0;
}


Measured memory_bytes: 3156
N=int(input())
D,X = map(int,input().split())
day = D
cnt=0
for i in range(N+1):
  if i==0:
    pass
  else:
    D = day
    A=int(input())
    while D>=0:
      if D*A+1<=day:
        cnt+=1
      D-=1
print(cnt+X)

Measured memory_bytes: 3060
s = input()
s = list(s)
t = input()
t = list(t)
import string
alpha = string.ascii_lowercase
alpha = list(alpha)
dic_1 = {}
dic_2 = {}
for a in alpha:
  dic_1[a] = 0
  dic_2[a] = 0
s_result = []  
t_result = []
for _ in s:
  if dic_1[_] == 0:
    i = max(dic_1.values()) + 1
    dic_1[_] = i
    s_result.append(i)
  else:
    s_result.append(dic_1[_])
for _ in t:
  if dic_2[_] == 0:
    i = max(dic_2.values()) + 1
    dic_2[_] = i
    t_result.append(i)
  else:
    t_result.append(dic_2[_])    
check = True

for i in range(len(s_result)):
  if s_result[i] != t_result[i]:
    check = False  
if check == True:
  print("Yes")
else:
  print("No")
    



Measured memory_bytes: 10160
using System;

class B5{
  static int count = 0;
  static int n;
  static string[] str;
  static int[] S;
  public static void Main(){
    n = int.Parse(Console.ReadLine());
    str = Console.ReadLine().Split(' ');
    S = new int[n];
    for(int i = 0;i < n;i++){
      S[i] = int.Parse(str[i]);
    }
    mergeSort(ref S,0,n);
    int l = 0;
  foreach(int x in S){
    Console.Write(x);
    l++;
    if(l == n) Console.WriteLine("");
    else Console.Write(" ");
  }
  Console.WriteLine(count);
  }

  static void merge(ref int[] S,int left,int mid,int right){
    int i,j;
    int n1 = mid - left;
    int n2 = right - mid;
    int[] L = new int[n1 + 1];
    int[] R = new int[n2 + 1];
    for(i = 0;i < n1;i++){
      L[i] = S[left + i];
    }
    for(i = 0;i < n2;i++){
      R[i] = S[mid + i];
    }
    L[n1] = int.MaxValue;
    R[n2] = int.MaxValue;
    i = 0;
    j = 0;
    for(int k = left;k < right;k++){
      if(L[i] <= R[j]){
        S[k] = L[i];
        count++;
        i++;
      }else{
        S[k] = R[j];
        count++;
        j++;
      }
    }
  }

  static void mergeSort(ref int[] S,int left,int right){
    if(left + 1 < right){
      int mid = (left + right) / 2;
      mergeSort(ref S,left,mid);
      mergeSort(ref  S,mid,right);
      merge(ref S,left,mid,right);
    }
  }
}



Measured memory_bytes: 70716
import heapq
mod = 998244353
n = int(input())
d = list(map(int, input().split()))
q = []
if d[0] != 0:
  print(0)
else:
  for x in d[1:]:
    heapq.heappush(q, x)
  prev = 0
  x = 0
  y = 1
  ans = 1
  for i in range(n-1):
    a = heapq.heappop(q)
    if a == 0:
      print(0)
      break
    elif a == prev:
      x += 1
    elif a == prev + 1:
      x += 1
      ans = ans * (y ** x) % mod
      y = x
      x = 0
    else:
      print(0)
      break
    prev = a
  else:
    x += 1
    ans = ans * (y ** x) % mod
    print(ans)

Measured memory_bytes: 14020
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main()
{
    Hello
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(a + b >= k) cout << min(a, k);
    else{
        k -= a;
        k -= b;
        cout << a - k;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h> //ライブラリ全読み込み
using namespace std; //std:を省略できる

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout << (a+b+c+d)/60 << endl << (a+b+c+d)%60 << endl;
    return 0;
}


Measured memory_bytes: 3080
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<vector>
using namespace std;
#define ll long long int
#define INF 0x3f3f3f3f
const int maxn = 1e5 + 10;
int main()
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int ans = a * b / 2;
	cout << ans << endl;
	return 0;
}
//_CRT_SECURE_NO_WARNINGS

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

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

    int n;
    cin >> n;

    vector< P > v;
    rep(i, n){
        int x, y;
        cin >> x >> y;
        v.emplace_back(x, y);
    }
    SORT(v);

    double ans = 0;
    do{
        rep(i, n - 1){
            ans += sqrt((v[i].first - v[i + 1].first) * (v[i].first - v[i + 1].first) + (v[i].second - v[i + 1].second) * (v[i].second - v[i + 1].second));
        }
    }while(next_permutation(v.begin(), v.end()));

    reps(i, n){
        ans /= (double)i;
    }

    cout << ans << endl;

    cout << flush;

    return 0;
}

Measured memory_bytes: 256
//by Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	ll n,a,b;
	cin >> n >> a >> b;
	ll a1 = n * a;
	cout << min(a1,b) << ln;
	return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N,M,X,Y; cin >> N >> M >> X >> Y;
    VI x(N), y(M); REP(i,N) cin >> x[i]; REP(i,M) cin >> y[i];

    SORT(x); SORT(y);

    cout << (max(x[N-1],X) < min(y[0],Y) ? "No War" : "War") << endl;
    return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var ab = lines[0].split(' ');
 var n = Number(ab[0] + ab[1]);
 var tmp = Math.sqrt(n);
 if(tmp % 1 == 0){
   console.log("Yes");
 }else{
   console.log("No");
 }
});

Measured memory_bytes: 7500
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e9;
const ll MOD = 1e9 + 7;


int main(){
    string s;
    cin >> s;
    sort(all(s));
    if(s[0] == s[2]) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define ABS(a) (((a) >= 0) ? (a) : -(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#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 REP(i, n) for (int i = 0; i < (n); ++i)
#define NINTH_POWER_OF_TEN 1000000000
#define LL_INF (numeric_limits<long long>::max()/2)
#define int long long

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

const int kMaxH = 500;
const int kMaxW = 500;

int H, W;
int a[kMaxH][kMaxW];
vector<Pair> ans;

int Next(int ij) {
  int x = ij/W, y = ij%W;
  if (x%2 == 0) {
    if (y+1 < W) { return ij+1; }
    return ij+W;
  } else {
    if (y-1 >= 0) { return ij-1; }
    return ij+W;
  }
}

signed main() {
  cin >> H >> W;
  REP(i, H) { REP(j, W) { cin >> a[i][j]; } }

  int ij = 0;
  bool f = false;
  while (true) {
    while (true) {
      int i = ij/W, j = ij%W;
      // cout << "a " << i << " " << j << endl;
      if (a[i][j]%2 == 1) {
        break;
      } else {
        ij = Next(ij);
        if (ij >= H*W) {
          f = true;
          break;
        }
      }
    }
    if (f) { break; }
    int ij2 = Next(ij);
    if (ij2 >= H*W) { break; }
    vector<Pair> v;

    while (true) {
      int i = ij2/W, j = ij2%W;
      // cout << "b " << i << " " << j << endl;
      if (a[i][j]%2 == 1) {
        v.push_back(Pair(ij, ij2));
        REP(i, v.size()) { ans.push_back(v[i]); }
        ij = Next(ij2);
        if (ij >= H*W) { f = true; }
        break;
      } else {
        v.push_back(Pair(ij, ij2));
        ij = ij2;
        ij2 = Next(ij2);
        if (ij2 >= H*W) {
          f = true;
          break;
        }
      }
    }
    if (f) { break; }
  }

  cout << ans.size() << endl;
  REP(i, ans.size()) {
    int yy = ans[i].first/W + 1, xx = ans[i].first%W + 1;
    int y = ans[i].second/W + 1, x = ans[i].second%W + 1;
    cout << yy << " " << xx << " " << y << " " << x << endl;
  }
  return 0;
}


Measured memory_bytes: 6256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ret = 0;
    for (int i = 0; i <= 999; ++i) {
        string pin = to_string(i);
        while (pin.size() < 3)
            pin = "0" + pin;
        int idx = 0;
        for (int j = 0; j < n; ++j) {
            if (s[j] == pin[idx]) {
                idx++;
                if (idx == 3) {
                    break;
                }
            }
        }
        if (idx == 3)
            ret++;
    }
    cout << ret << "\n";
    return 0;
}

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

const string YES = "YES";
const string NO = "NO";

void solve(long long N, std::vector<long long> p){

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N; cin >> N;
    string S[N+1];
    for(int i = 1;i <= N;i++) cin >> S[i];
    int counter = 0;
    for(int i = 1;i <= N;i++){
        if(i != stoi(S[i])) counter ++;
    }
    if(counter > 2){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 256
import std.stdio, std.string, std.algorithm, std.array, std.range, std.conv,
    std.typecons, std.math, std.container, std.format;

void main(string[] args)
{
    long n;
    readf("%d\n", &n);
    auto s = readln.strip.split(" ");
    writeln(roundRobin(s[0], s[1]).array);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		String b = scan.next();
		String result = " " ;

		switch(b) {
		case "A":
			result = "T" ;
			break;
		case "T":
			result = "A";
			break;
		case "C":
			result = "G";
			break;
		case "G":
			result = "C";
			break;
		}

		  System.out.println(result);
	}
}

Measured memory_bytes: 19924
import java.math.BigDecimal;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double sum = 100000;

		double n = sc.nextDouble();

		System.out.println((int)solve(n, sum));
	}

	public static double solve(double a, double b){

		for(int i = 0; i < a; i++){
			b = b * 1.05;
			
			if((b % 1000) != 0){
				BigDecimal bd = new BigDecimal(b / 1000);
				b = (bd.setScale(0, BigDecimal.ROUND_UP).doubleValue()) * 1000;
			}
		}
		return b;
	}
}

Measured memory_bytes: 17272
#include<stdio.h>
int max(int a,int b){
	if(a>=b) return a;
	return b;
}
int main(){
	int n;
	scanf("%d",&n);
	int a[n],b[n],c[n],x[n],y[n],z[n];
	for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);
	x[0]=a[0],y[0]=b[0],z[0]=c[0];
	for(int i=1;i<n;i++){
		x[i]=a[i]+max(y[i-1],z[i-1]);
		y[i]=b[i]+max(x[i-1],z[i-1]);
		z[i]=c[i]+max(y[i-1],x[i-1]);
	}
	int ans=max(x[n-1],max(y[n-1],z[n-1]));
	printf("%d\n",ans);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n,i,j,sum=0;
  cin>>n;
  vector<int> w(n),r(n),a(n);
  for(i=0;i<n;i++){
	cin>>w[i];
    sum+=w[i];
  }
  r[0]=w[0];
  for(i=1;i<n;i++){
	r[i]=r[i-1]+w[i];
  }
  
  for(i=0;i<n;i++){
	a[i]=abs(sum-2*r[i]);
  }
  
  sort(a.begin(),a.end());
  
  cout<<a[0]<<endl;
}


Measured memory_bytes: 256
local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  local x1, y1 = mfl(x / 31623), mfl(y / 31623)
  local x0, y0 = x - x1 * 31623, y - y1 * 31623
  return (x1 * y1 * 14122 + (x1 * y0 + x0 * y1) * 31623 + x0 * y0) % mod
end

local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local n = io.read("*n", "*l")
local t = {}
for i = 1, 60 do
  t[i] = 0
end
local s = io.read()

local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

local ret = 0
local i = 0
for w in s:gmatch("(%d+)") do
  i = i + 1
  local a = lltonumber(w)
  local mul = 1
  for j = 1, 60 do
    if a % 2LL == 1LL then
      ret = badd(ret, bmul(i - 1 - t[j], mul))
      t[j] = t[j] + 1
    else
      ret = badd(ret, bmul(t[j], mul))
    end
    mul = badd(mul, mul)
    a = a / 2LL
  end
end
print(ret)


Measured memory_bytes: 31072
def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

n, k = map(int, input().split())
mod = 1000000007

r = n - k
fac, inv = factorial(max(r+1, k-1), mod)

f = min(r + 1, k)

for i in range(1, f+1):
    insert_n  = fac[r+1] * inv[r+1-i] % mod * inv[i] % mod
    split_n = fac[k-1] * inv[k-i] % mod * inv[i-1] % mod
    print(split_n * insert_n % mod)

for _ in range(r+1, k):
    print(0)

Measured memory_bytes: 73212
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const s = stdin.split('\n')[0].split('')

const res = s.filter((e,i)=>{
  if(i === 0 || i === s.length - 1)return 0
  return s[i+1] === e && s[i-1] === e ? 1 : 0
}).length

console.log(res > 0 ? 'Yes' : 'No')


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

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

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

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

using namespace std;

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

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

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	ll k,a,b;
	cin >> k >> a >> b;
	ll ans = k + 1;

	if(b - a >= 2){
		const ll d = k - (a - 1);
		const ll cur = a + (d / 2) * (b - a) + (d % 2);
		chmax(ans, cur);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 2000005
using namespace std;

typedef long long ll;
ll n, k, ans, M = 1e9 + 7;
ll fac[N]={1,1}, inv[N]={1,1}, fiv[N]={1,1};
ll c(ll p, ll q) {return fac[p] * fiv[p-q] % M * fiv[q] % M;}

int main()
{
	ll i, j, t;
	cin >> n >> k;
	k = min(n, k);
	for(i=2; i<=n; i++) {
		fac[i] = fac[i-1] * i % M;
		inv[i] = inv[M%i] * (M-M/i) % M;
		fiv[i] = fiv[i-1] * inv[i] % M;
	}
	for (i = 0; i <= k; i++) {
		t = (c(n, i) * c(n - 1, i)) % M;
		ans = (ans + t) % M;
	}
	cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int n,x;
    cin >> n >> x;
    vector<int> m(n);
    int sum = 0;
    rep(i,n){
        cin >> m[i];
        sum += m[i];
    }
    sort(m.begin(), m.end());
    int ans = n;
    x -= sum;
    ans += (x / m[0]);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define lli long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fi(a,n) for(lli i=a; i<=n; i++)
const int M=1000000007;
using namespace std;
const int mxn=2e5;
int n,m,p[mxn];
vector<int> adj[mxn],ans;
int dp[mxn];
int vis[mxn],act[mxn];



int main() {
	// io
fast
int n;cin>>n;
int c=0,f=0;
for(int i=0;i<n;i++){
int a,b;
cin>>a>>b;
if(a==b)c++;
else c=0;
if(c>=3) {f=1;break;}
}
if(f)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 8348
#include<iostream>
using namespace std;
long long ok(long long x,long long n)
{
    long long ans;
    if(n%x==0)
        return n*2-x;
    ans=n/x*x*2+ok(n%x,x);
    return ans;
}
int main()
{
    long long n,x,ans;
    scanf("%lld%lld",&n,&x);
    ans=ok(x,n-x)+n;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int inf = 999999999;
const double pi = acos(-1);

#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}

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

int main(){
	ull n,k;
	cin >> n >> k;
	ull index = 0;
	map<ull,ull> m;

	rep(i,0,n){
        int a,b;
        cin >> a >> b;
        m[a] += b;
    }
    
	for(auto im : m){
       
        index += im.second;
        if(k <= index){
            cout << im.first << endl;
            return 0;
        } 
	}

	return 0;
}

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

using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N, W;
  cin >> N >> W;
  vector<int> weight(N);
  vector<int> value(N);
  for(int i = 0; i < N; ++i)
  {
    cin >> weight[i] >> value[i];
  }
  
  vector<int64_t> dp(W + 1, 0);
  
  for(int i = 0; i <= N; ++i)
  {
    for(int j = W; j >= weight[i]; --j)
    {
      dp[j] = max(dp[j], value[i] + dp[j - weight[i]]);
    }
  }
  
  cout << dp[W] << "\n";
  
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s; i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

int main(){
    int n, m; cin >> n >> m;
    priority_queue<int> que;
    REP(i, n){
        int a; cin >> a; que.push(a);
    }
    REP(i, m){
        int tmp = que.top(); que.pop();
        que.push(tmp/2);
    }
    ll ans = 0;
    REP(i, n){
        ans += que.top(); que.pop();
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 892
#include <stdio.h>

int main(void) {
	int n;
	int v[20],c[20];

	scanf("%d", &n);
	for (int i = 0;i < n;i++) {
		scanf("%d", &v[i]);
	}
	for (int i = 0;i < n;i++) {
		scanf("%d", &c[i]);
	}
	
	int ans = 0;
	for (int i = 0;i < n;i++) {
		if (v[i] > c[i]) {
			ans += v[i]-c[i];
		}
	}
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 128
n=int(input())
ans=0
a=0
b=0
num=0
for i in range(n):
    cnt=0
    s=input()
    ans+=s.count("AB")
    if s[0]=="B":
        b+=1
        cnt+=1
    if s[-1]=="A":
        a+=1
        cnt+=1
    if cnt==2:
        num+=1

print(ans+min(a,b) if num!=max(a,b) else ans+min(a,b)-1 if num!=0 else ans+min(a,b))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <stack>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <numeric>
using namespace std;

int main(){
    int A,B,T;
    cin >> A >> B >> T;

    int ans = (T / A ) * B;

    cout << ans << endl;
}

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

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

    int n, q;
    cin >> n >> q;

    vector <P> vec(2 * n);
    for (int i = 0; i < n; i++) {
        int s, t, x;
        cin >> s >> t >> x;
        vec[i] = P(s - x, x);
        vec[n + i] = P(t - x, -x);
    }

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

    int idx = 0;
    set <int> st;
    while (q--) {
        int d;
        cin >> d;

        while (idx < vec.size() && vec[idx].first <= d) {
            int x = vec[idx++].second;
            if (x < 0) st.erase(-x);
            else st.insert(x);
        }

        if (st.size()) cout << *st.begin() << '\n';
        else cout << -1 << '\n';
    }

    return 0;


}

Measured memory_bytes: 13824
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long target = sc.nextLong();
		long base=100;
		int counts=0;
		while(base<target) {
			base+= (base/100);
			counts++;
		}
		System.out.println(counts);
	}

	static class Pair {
		int x;
		int y;

		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


Measured memory_bytes: 32504
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;


int main(){
	int a,b,c;
	
	cin >> a >> b >> c;
	
	if(a+c+b >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
	
	
	
	return 0;
}

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

def main():
    H, W, D = map(int, input().split())
    hw = [None for i in range(H*W+1)]

    # 各数字の座標をhw[]に格納
    for i in range(H):
        a = list(map(int, input().split()))
        for j in range(W):
            hw[a[j]] = [i, j]

    # for i in range(len(hw)):
    #     print(i, hw[i])
    
    # Dのmodごとにmod Dからの距離を計算(累積和)
    modd = [0] * (H*W + 1)
    for start in range(D):
        tmp = start + D
        cost = 0
        if tmp == D:
            tmp = D * 2
        while tmp <= (H*W):
            tmp_cost = abs(hw[tmp][0] - hw[tmp-D][0]) + abs(hw[tmp][1] - hw[tmp-D][1])
            # print("{} - {} : {}".format(tmp-D, tmp, tmp_cost))
            # print(hw[tmp-D], hw[tmp], abs(hw[tmp][0] - hw[tmp-D][0]) + abs(hw[tmp][1] - hw[tmp-D][1]))
            cost += tmp_cost
            modd[tmp] = cost
            tmp += D
    # print(modd)
    Q = int(input())
    for i in range(Q):
        l, r = map(int, input().split())
        print(modd[r] - modd[l])

if __name__ == "__main__":
    main()

Measured memory_bytes: 17320
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<bitset>
#include<iomanip>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;


struct dice{
    int top, bottom, center, back, right, left;
};

int main(){
    dice a;
    cin >> a.top >> a.center >> a.right >> a.left >> a.back >> a.bottom;
    string s;
    cin >> s;
    for(int i=0; i < s.size(); i++){
        int tmp = a.top;
        if(s[i] == 'W'){
            a.top = a.right;
            a.right = a.bottom;
            a.bottom = a.left;
            a.left = tmp;
        }
        if(s[i] == 'E'){
            a.top = a.left;
            a.left = a.bottom;
            a.bottom = a.right;
            a.right = tmp;
        }
        if(s[i] == 'N'){
            a.top = a.center;
            a.center = a.bottom;
            a.bottom = a.back;
            a.back = tmp;
        }
        if(s[i] == 'S'){
            a.top = a.back;
            a.back = a.bottom;
            a.bottom = a.center;
            a.center = tmp;
        }
    }
    cout << a.top << endl;
}


Measured memory_bytes: 3204
#include <cstdio>
#include <algorithm>

static const auto NMAX = 100000;
static const auto EMAX = 16;

static int N, X[NMAX];
static int L;
static int J[NMAX][1 + EMAX];

static int solve(int sta, int dst) {
	auto ret = 1;
	for(auto e = EMAX; e >= 0; e--) {
		if(J[sta][e] < dst) {
			sta = J[sta][e];
			ret += 1 << e;
		}
	}
	return ret;
}

static void build() {
	J[N - 1][0] = N - 1;
	auto j = N - 1;
	for(auto i = N - 2; i >= 0; i--) {
		while(X[j] - X[i] > L) j--;
		J[i][0] = j;
	}
	for(auto e = 1; e <= EMAX; e++) {
		J[N - 1][e] = N - 1;
		for(auto i = N - 2; i >= 0; i--) J[i][e] = J[J[i][e - 1]][e - 1];
	}
}

int main() {
	scanf("%d", &N);
	for(auto i = 0; i < N; i++) scanf("%d", X + i);
	scanf("%d", &L);
	build();
	int Q;
	for(scanf("%d", &Q); Q > 0; Q--) {
		int a, b;
		scanf("%d%d", &a, &b); a--; b--;
		if(a > b) std::swap(a, b);
		printf("%d\n", solve(a, b));
	}
	return 0;
}

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

using namespace std;

int main() 
{
	int m,j=1,count=0;
	cin>>m;
	int arr[m];
	for(int i=0;i<m;i++) cin>>arr[i];
	for(int i=0;i<m;i++)
	{
	    if(arr[i]!=j) count++;
	    j++;
	}

	if(count==2 || count==0) cout<<"YES";
	else cout<<"NO";
}


Measured memory_bytes: 256
from decimal import *
import re
def solve2(m, n):
    maxlen = 80
    PREC=200
    getcontext().prec = PREC
    x = Decimal(m) / Decimal(n)
    s = x.to_eng_string()
    if len(s) < PREC:
        return(s[2:],'')
    rep = 1
    while True:
        r = r'(.{%d})\1{%d,}' % (rep, int(maxlen/rep))  #ex. '(.{6})\\1{12,}'
        a=re.search(r, s)
        if a:
            break
        rep += 1
        if rep > maxlen:
            raise ValueError('This cannot happen.rep=%d' % rep)

    u = s[2:a.start()+len(a.group(1))]
    v = (' '*PREC + '^'*len(a.group(1)))[-len(u):]
    return(u,v)

while True:
    try:
        m,n = map(int, input().strip().split())
        s,t = solve2(m, n)
        print(s)
        if t!='':
            print(t)
    except EOFError:
        break

Measured memory_bytes: 9904
#include <stdio.h>
#include <map>
using namespace std;
int main()
{
    int n;
    map<long long,int> mp;
    long long cur=0;
    mp[0]=1;
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        int x;
        scanf("%d",&x);
        cur+=x;
        ++mp[cur];
    }
    long long ans=0;
    for (auto it:mp)
        ans+=(long long)it.second*(it.second-1)/2;
    printf("%lld\n",ans);
    return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,x;
map <int,int> mp;
bool ok=true,ok2=true;

int main()
{
	cin>>n;
	rep(i,n)
	{
		scanf("%d",&x);
		for(int j=2;j*j<=x;j++)
		{
			if(x%j>0) continue;
			mp[j]++;
			while(x%j==0) x/=j;
		}
		if(x>1) mp[x]++;
	}
	for(map <int,int>::iterator it=mp.begin();it!=mp.end();it++)
	{
		if((it->se)>1) ok=false;
		if((it->se)==n) ok2=false;
	}
	if(ok) puts("pairwise coprime");
	else if(ok2) puts("setwise coprime");
	else puts("not coprime");
	return 0;
}

Measured memory_bytes: 7348
/*
    Mbak Sana Dong
    Mbak Chaeyoung Dong
*/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
vector<pair<ll, int> > vi;
int main()
{
    int n,i,j,k,x,y,ans,temp,curr,m;
    int a,b,c;
    int xa,ya;
    cin >> xa >> ya >> a >> b >> c;
    ll cost;
    for(i=1;i<=a;i++)
    {
        cin >> cost;
        vi.push_back({cost, 1});
    }
    for(i=1;i<=b;i++)
    {
        cin >> cost;
        vi.push_back({cost, 2});
    }
    for(i=1;i<=c;i++)
    {
        cin >> cost;
        vi.push_back({cost, 3});
    }
    sort(vi.begin(), vi.end());
    reverse(vi.begin(), vi.end());
    int nowa = 0, nowb = 0;
    ll chaeng = 0;
    int netral = 0;
    for(auto x : vi)
    {
        if(x.second == 3)
        {
            netral++;
            chaeng += x.first;
        }
        else if(x.second == 1)
        {
            if(nowa == xa) continue;
            nowa++;
            chaeng += x.first;
        }
        else
        {
            if(nowb == ya) continue;
            nowb++;
            chaeng += x.first;
        }
        int need = xa + ya - nowa - nowb - netral;
        if(need <= 0) break;
    }
    cout << chaeng << endl;
    return 0;
}


Measured memory_bytes: 10348
#include<iostream>
#include<vector>
#include<bitset>
using namespace std;
int n, m, i, j, jj, ok, ii;
int a[105][105], x[105], y[105];
vector<int> v[105];
bitset<105> viz;
int cuplaj(int nod){
    if(viz[nod] == 1){
        return 0;
    }
    viz[nod] = 1;
    for(int i = 0; i < v[nod].size(); i++){
        int vecin = v[nod][i];
        if(y[vecin] == 0){
            x[nod] = vecin;
            y[vecin] = nod;
            return 1;
        }
    }
    for(int i = 0; i < v[nod].size(); i++){
        int vecin = v[nod][i];
        if(cuplaj(y[vecin]) == 1){
            x[nod] = vecin;
            y[vecin] = nod;
            return 1;
        }
    }
    return 0;
}
int main(){
    cin>> n >> m;
    for(i = 1; i <= n; i++){
        for(j = 1; j <= m; j++){
            cin>> a[i][j];
            a[i][j]--;
        }
    }
    for(j = 1; j <= m; j++){
        for(i = 1; i <= n; i++){
            v[i].clear();
            x[i] = y[i] = 0;
        }
        for(i = 1; i <= n; i++){
            for(jj = j; jj <= m; jj++){
                v[i].push_back(a[i][jj] / m + 1);
            }
        }
        do{
            ok = 0;
            viz.reset();
            for(i = 1; i <= n; i++){
                if(x[i] == 0 && cuplaj(i) ){
                    ok = 1;
                }
            }
        }while(ok == 1);

        for(i = 1; i <= n; i++){
            for(jj = j; jj <= m; jj++){
                if(a[i][jj] / m + 1 == x[i]){
                    swap(a[i][jj], a[i][j]);
                    break;
                }
            }
        }
    }
    for(i = 1; i <= n; i++){
        for(j = 1; j <= m; j++){
            cout<< a[i][j] + 1 <<" ";
        }
        cout<<"\n";
    }
    for(j = 1; j <= m; j++){
        for(i = 1; i <= n; i++){
            for(ii = i; ii <= n; ii++){
                if(a[ii][j] / m + 1 == i){
                    swap(a[ii][j], a[i][j]);
                    break;
                }
            }
        }
    }
    for(i = 1; i <= n; i++){
        for(j = 1; j <= m; j++){
            cout<< a[i][j] + 1 <<" ";
        }
        cout<<"\n";
    }
}


Measured memory_bytes: 384
import sys,collections,math
input = sys.stdin.readline

n,a,b = list(map(int,input().split()))
m = 10**9+7
ans = pow(2,n,m)


la  = 1
laa = 1
for i in range(n,n-a,-1):
    la = (la*i)%m
for i in range(1,a+1):
    laa = (laa*i)%m

lb  = 1
lbb = 1
for i in range(n,n-b,-1):
    lb = (lb*i)%m
for i in range(1,b+1):
    lbb = (lbb*i)%m

la = (la*pow(laa,10**9+5,m))%m
lb = (lb*pow(lbb,10**9+5,m))%m

print((ans-la-lb-1)%m)


Measured memory_bytes: 9480
N = int(input())
H = list(map(int, input().split()))

left, right = 0, 1
counter = 0
ans = 0
for i in range(len(H)):
    if right >= len(H):
        break
    
    if H[left] >= H[right]:
        counter += 1
        left += 1
        right += 1
    else:
        counter = 0
        left, right = i, i + 1
    ans = max(counter, ans)

print(ans)


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  ll N, A, B; cin >> N >> A >> B;
  if(A + B < N) {
    ll ans = (A * (N / (A + B)));
    if((N % (A + B)) <= A) ans += (N % (A + B));
    else ans += A;
    cout << ans << endl;
  } else if(A + B >= N && A <= N) {
    cout << A << endl;
  } else if(A > N) {
    cout << N << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
       
int main(void){
 int a,b;
 scanf("%d %d",&a,&b);
  
 if(a<b){
 printf("a < b\n");
 }
 else if(a>b){
 printf("a > b\n");
 }
 else{
 printf("a == b\n");
 }
return 0;
}


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

using namespace std;
typedef long long ll;
const int N = 450;
typedef pair<ll, ll> pll;
pll items[N];
ll max_v[N][N];
ll tmp_max_v[N][N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    ll n, w;
    cin >> n >> w;
    for (int i = 0; i < n; i++) {
        cin >> items[i].first >> items[i].second;
    }
    ll w1 = items[0].first;
    for (int a = 0; a < N; a++) {
        for (int b = 0; b < N; b++) {
            max_v[a][b] = -1;
            tmp_max_v[a][b] = -1;
        }
    }
    max_v[0][0] = 0;
    tmp_max_v[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int a = 0; a < N; a++) {
            for (int b = 0; b < N; b++) {
                if (max_v[a][b] < 0)
                    continue;
                ll num = a * w1 + b;
                num += items[i].first;
                ll new_a = num / w1;
                ll new_b = num % w1;
                tmp_max_v[new_a][new_b] = max(max_v[new_a][new_b], max_v[a][b] + items[i].second);
            }
        }
        for (int a = 0; a < N; a++) {
            for (int b = 0; b < N; b++) {
                max_v[a][b] = tmp_max_v[a][b];
            }
        }
    }
    ll res = 0;
    for (int a = 0; a < N; a++) {
        for (int b = 0; b < N; b++) {
            ll num = a * w1 + b;
            if (num > w)
                continue;
            res = max(max_v[a][b], res);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3456
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long K, string S){
  vector<ll> v;
  char now = '1';
  ll cnt = 0;
  for(ll i=0; i<N; i++) {
    if(S[i]==now) {
      cnt++;
    } else {
      now = S[i];
      v.push_back(cnt);
      cnt = 1;
    }
  }
  v.push_back(cnt);
  if(*(S.end()-1) == '0') v.push_back(0);
  //std::cout << v << std::endl;
  ll ans = 0;
  for(ll i=0; i<v.size(); i+=2) {
    ll now = 0;
    for(ll j=i; j<min((ll)i+K*2+1, (ll)v.size()); j++) {
      now += v[j];
    }
    //std::cout << now << std::endl;
    ans = max(ans, now);
  }

  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  string S;
  cin>>S;
  solve(N, K, S);
  return 0;
}



Measured memory_bytes: 1656
#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() {
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans = w*h/2;
    printf("%.10f\n", ans);
    if (x == w/2 && y == h/2) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3776
/*<----------------------------------------------------------------------->

<-------------------------------------------------------------------------->
            _           __                _      _____ _____ _____ 
  ___ _   _| |__   ___ / _|_ __ ___  __ _| | __ |___  |___  |___  |
 / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ /    / /   / /   / / 
| (__| |_| | |_) |  __/  _| | |  __/ (_| |   <    / /   / /   / /  
 \___|\__,_|_.__/ \___|_| |_|  \___|\__,_|_|\_\  /_/   /_/   /_/   

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
typedef unordered_map <ll,ll> umap ; 
//#pragma GCC optimize "trapv"
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define em emplace_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<"\n"
#define pff(n) cout << n << " " ; 
long const M=1e9+7;
const long mxN =1e5+2 ;
const long mxNN =1e6+2 ;
void solve(){
    string s ;cin  >> s ;
    if(s[0]=='7' || s[1]=='7'|| s[2]=='7'){
        pf("Yes") ;
    }
    else pf("No") ;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout << setprecision(20) << fixed ;
    solve() ;
    //ll t ; cin >> t ; while(t--)solve();
	return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




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

	cout << (N-1)/2<< endl;
}

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

int n;
int l[201];
int ans;

int main() {
	std::cin >> n;
	for (int i = 0; i < 2 * n; ++i)std::cin >> l[i];

	std::sort(l, l + 2 * n);

	for (int i = 0; i < 2 * n; i += 2) {
		ans += std::min(l[i], l[i + 1]);
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256