akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        double sum = 0;

        int base = 0;
        if (n>k){
            base = k;
        }
        else{
            base = n;
        }

        for (int i=1;i<=n;i++){
            int g = log(i,k);
            int check = (int) Math.pow(2,g)*n;
            sum += (double) 1/check;
        }

        System.out.println(sum);


    }

    static int log(int n,int k){
        int sum = 0;
        while (n<k){
            n *= 2;
            sum += 1;
        }
        return sum;
    }
}

Measured memory_bytes: 35800
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b,a%b)

def lcm(a, b):
    return (a * b) // gcd(a, b)
    

def solve(warareru, c, d):
    #cで割れる数.
    num1 = (warareru) // c
    #dで割れる数
    num2 = (warareru) // d
    #cとdで割れる数
    waru = lcm(c, d)
    num3 = (warareru) // waru
    return warareru - num1 - num2 + num3
    
a, b, c, d = map(int, input().split())

ans1 = solve(a-1, c, d)
ans2 = solve(b, c, d)
print(ans2-ans1)


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

typedef long long ll;
#define rep(i, n) for(int i=0; (i) < int(n); ++(i))


int main(void){

	int N; cin >> N;
	int a[100]; rep(i, N) cin >> a[i];

	sort(a, a+N, greater<int>());

	int A=0, B=0;
	rep(i, N){
		if(i%2 == 0){
			A += a[i];
		}else{
			B += a[i];
		}
	}

	cout << A-B << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
char s[15],ch;
int main()
{
    int n;
    scanf("%d",&n);
    int l=0,r=n-1;
    printf("%d\n",l);
    fflush(stdout);
    scanf("%s",s);
    ch=s[0];
    if(ch=='V') return 0;
    while(1)
    {
        int mid=(l+r+1)/2;
        printf("%d\n",mid);
        fflush(stdout);
        scanf("%s",s);
        if(s[0]=='V') return 0;
        else if((s[0]==ch&&mid%2==0)||(s[0]!=ch&&mid%2==1))
        {
            l=mid;
        }
        else
        {
            r=mid;
        }
    }
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,k,a[200010];
    cin>>n>>k;
    rep(i,n)cin>>a[i];
    int ok=1000000000,ng=0;
    while(ok-ng>1){
        int cnt=0,mid=(ok+ng)/2;
        rep(i,n){
            cnt+=(a[i]-1)/mid;
        }
        if(cnt<=k)ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
    return 0;
}


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

main(){
  char S[101];
  for(int ii=0;ii<101;ii++){
    S[ii]=0;
  }
  cin >> S;
  int N;
  for(int ii=0;ii<101;ii++){
    if(S[ii]==0){
      N=ii;
      break;
    }
  }
  int ans=0;
  for(int ii=0;ii<N;ii++){
    if(ii%2==0 && (S[ii]=='L'))ans=1;
    if(ii%2==1 && (S[ii]=='R'))ans=1;
  }
  if(ans==1)cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 256
from math import log10
from functools import reduce
from operator import mul

N = int(input())

nums = [int(s) for s in input().rstrip().split()]

def product(nums):
  limit = 10**18
  result = 1
  if 0 in nums:
    return 0
  for n in nums:
    result *= n
    if result > limit:
      return -1
  return result
    
print(product(nums))

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

using namespace std;
using ll=long long;

const ll INF = 1e10;
ll dp[105][100005];
ll w[100005];
ll v[100005];
ll N, W;

int main()
{
    cin >> N >> W;
    for(int i = 1;i <= N;i++)
    {
        cin >> w[i] >> v[i];
    }
    for(int i = 0;i< 105;i++)
    {
        for(int j = 0;j < 100005;j++)
        {
            dp[i][j] = -INF;
        }
    }
    dp[0][0] = 0;
    ll ans = 0;
    for(int i = 1;i <= N;i++)
    {
        for(int j = 0;j <= W;j++)
        {
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if(j - w[i] >= 0)
            {
                dp[i][j] = max(dp[i][j], dp[i-1][j - w[i]] + v[i]);
            }
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

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

    map<int, int> counter;
    REP (i, N) {
        int A;
        cin >> A;

        counter[A] ^= 1;
    }
    int ans = 0;
    for (auto mp : counter) {
        ans += mp.second;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4864
def read():
    return int(input())


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


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


def factor(n):
    if n % 4 == 0:
        return 2
    elif n % 2 == 0:
        return 1
    else:
        return 0


N = read()
A = readlist()

fac = [factor(A[i]) for i in range(N)]

num2 = fac.count(2)
num1 = fac.count(1)
num0 = fac.count(0)

if num2 >= num0 or (num2 == num0 - 1 and num1 == 0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14484
#include <bits/stdc++.h>
using namespace std;
int main(){
	int long long h,w;
	cin >> h >> w;
  if(h==1||w==1){
    cout << 1 << endl;
  }
  else{
	if(h*w%2==0){

	cout << (h*w)/2 << endl;
}
  else{
    cout << (h*w+1)/2 << endl;
  }
  }
}


Measured memory_bytes: 256
N,K = list(map(int,input().split()))
X = list(map(int,input().split()))

Xrev = X[::-1]
ans = abs(X[0]-X[-1])+abs(X[0])+abs(X[-1])  
for i in range(N-K+1):
    Xdis = abs(X[i])+abs(X[i+K-1]-X[i])
    ans = min(ans,Xdis)
for i in range(N-K+1):
    Xdis = abs(Xrev[i])+abs(Xrev[i+K-1]-Xrev[i])
    ans = min(ans,Xdis)
print(ans)


Measured memory_bytes: 20080
import collections as co
a = []
while True:
    try:
        n = int(input())
    except:
        break
    a.append(n)
b = co.Counter(a)
c = b.most_common()
N = c[0][1]
maxs =[]
for c2 in c:
    if c2[1] == N:
        maxs.append(c2[0])
    maxs.sort()
d = len(maxs)
for j in range(d):
    print(maxs[j])


Measured memory_bytes: 6004
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int N=sc.nextInt();
      int M=sc.nextInt();
      System.out.println();
      int A[]=new int[M];
      int total=0;
      for(int i=0;i<M;i++){
         A[i]=sc.nextInt();
         total+=A[i];
      }
      if(N-total>=0){
         System.out.println(N-total);
      }else{
         System.out.println(-1);
      }
   }
}
         


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

int main(void) {

  char s[100001];
  scanf("%s", s);
  int length = strlen(s);
  int firstL[length],lastR[length];
  for (int i = length-1; i >= 0; i--) {
    if (s[i] == 'L') {
      firstL[i] = i;
    } else {
      firstL[i] = firstL[i+1];
    }
  }
  for (int i = 0; i < length; i++) {
    if (s[i] == 'R') {
      lastR[i] = i;
    } else {
      lastR[i] = lastR[i-1];
    }
  }
  int child[length];
  for (int i = 0; i < length; i++) {
    child[i] = 0;
  }
  int distance;
  for (int i = 0; i < length; i++) {
    if (s[i] == 'L') {
      distance = i-lastR[i];
      if (distance%2 == 0) {
        child[lastR[i]]++;
      } else {
        child[lastR[i]+1]++;
      }
    } else {
      distance = firstL[i]-i;
      if (distance%2 == 0) {
        child[firstL[i]]++;
      } else {
        child[firstL[i]-1]++;
      }
    }
  }
  for (int i = 0; i < length-1; i++) {
    printf("%d ", child[i]);
  }
  printf("%d\n", child[length-1]);

  return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ge(a, b) get<(b)>((a))
#define SZ(x) (x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define CLR(a, b) memset((a), (b), sizeof((a)))
template <typename t> bool ckmin(t& a, const t& b) {return a > b ? a = b, true : false;}
template <typename t> bool ckmax(t& a, const t& b) {return a < b ? a = b, true : false;}

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

    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    F0R(i, n)
        cin >> a[i];

    ll s = accumulate(ALL(a), 0);
    double amt = (double)s/(4*m);
    int cnt = 0;
    for(int i : a)
        if(i >= amt)
            cnt++;

    cout << (cnt >= m ? "Yes" : "No") << endl;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://beta.atcoder.jp/contests/agc023/tasks/agc023_b>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N; cin >> N;
    vector<vector<char>> S(N,vector<char>(N));
    for(auto& vec:S) for(auto& in:vec) cin >> in;
    for(int B = 0; B < N;B++){
        bool ok = true;
        for(int i = 0; i < N;i++){
            for(int j = 0; j < N;j++){
                if(S[i][(j+B)%N] == S[j][(i+B)%N]) continue;
                ok = false;
            }
        }
        if(ok) res += N;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 512
import sys
import math
def gcd(x,y):
    if(x%y==0):
        return y
    else:
        return(gcd(y,x%y))
try:
    while True:
        a,b= map(int, input().split())
        max1=gcd(a,b)
        min1=(a*b)//gcd(a,b)
        print(str(max1)+' '+str(min1))
except EOFError:
    pass


Measured memory_bytes: 5652
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = n / (a + b) * a;
    ans += min(n % (a+b), a);
    cout << ans << endl;
}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-
import sys
import heapq


class Heapq:
    def __init__(self, arr, desc=False):
        if desc:
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)

    def pop(self):
        return heapq.heappop(self.hq) * self.sign

    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)

    def top(self):
        return self.hq[0] * self.sign


def solve():
    N, M = list(map(int, sys.stdin.readline().split()))
    As = list(map(int, sys.stdin.readline().split()))
    h = Heapq([], True)
    for i, a in enumerate(As):
        h.push(a)

    for i in range(M):
        a = h.pop()//2
        h.push(a)

    ans = 0
    for i in range(N):
        ans += h.pop()

    print(ans)



if __name__ == "__main__":
    solve()


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

ll n, k, a[200009], vis[200009], dis[200009], clen;

ll dfs(ll s, ll d)
{
    if(vis[s])
    {
        clen = d - dis[s];
        return s;
    }

    vis[s] = 1;
    dis[s] = d;
    return dfs(a[s], d+1);
}

int main()
{
    ll i, s;
    cin >> n >> k;
    for(i = 1; i <= n; i++)
        cin >> a[i];

    s = dfs(1, 0);

    if(k < dis[s])
    {
        s = 1;
        while(k--)
            s = a[s];
    }

    else
    {
        k = (k - dis[s])%clen;

        while(k--)
            s = a[s];
    }

    cout << s;
}


Measured memory_bytes: 8272
s=input()

ans='YES'
while s:
    if s[-7:]=='dreamer':
        s=s[:-7]
    elif s[-6:]=='eraser':
        s=s[:-6]
    elif s[-5:]=='erase':
        s=s[:-5]
    elif s[-5:]=='dream':
        s=s[:-5]
    else:
        ans='NO'
        break
print(ans)

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

using namespace std;
const int N = 200200;

#include <iostream>
#include <map>

using namespace std;

#define N 500500

void solve() {
        long long x;
        cin >> x;

        long long f = 1;

        for (int i = 1; i <= x + 100; i++) {
                f = (f * 10) % (9 * x);
                if (((f - 1) * 7) % (x * 9) == 0) {
                        cout << i << endl;
                        return;
                }
        }
        cout << -1 << endl;
}


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


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

        for (int i = 1; i <= t; i++) {

//                cout << "Case #" << i << ':' << endl;
                solve();
        }


        return 0;
}

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

int main(void)
{
  int K, S;
  std::cin >> K >> S;

  int ans = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S - x - y;

      if (z >= 0 && z <= K) {
        ans++;
      }
    }
  }
  std::cout << ans << std::endl;

  return 0;
}

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

int main(){
	string a;
	while(cin >> a){
		if(a.compare("0") == 0)
			break;
		int sum = 0;
		for(int i = 0; i < a.length(); i++){
			sum += a[i] - 48;
		}
		cout << sum << endl;
	}
}


Measured memory_bytes: 3180
use std::collections::HashSet;

fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let _n = read1::<usize>();
    let a = readn::<usize>(" ");
    
    let mut set = HashSet::new();
    for &i in a.iter() {
        set.insert(i);
    }
    let ans = if set.len() % 2 == 1 {
        set.len()
    } else {
        set.len() - 1
    };
    println!("{}", ans);
}

Measured memory_bytes: 8444
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <cmath>
#include <limits>
#define ll long long
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    if(s>t){
        cout << ">" << endl;
    }else if(s<t){
        cout << "<" << endl;
    }else{
        cout << "=" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
int main(){
    string str_s;
    string str_t;
    cin >> str_s;
    cin >> str_t;
//    cout << str_s << endl;
//    cout << str_t << endl;
    sort(str_s.begin(),str_s.end());
    sort(str_t.begin(),str_t.end());
    reverse(str_t.begin(),str_t.end());
//    cout << str_s << endl;
//    cout << str_t << endl;
    if(str_s == min(str_s,str_t) && str_t != min(str_s,str_t)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
 		
int main() {
	
	int N;
	cin>>N;
	double some=0;
	vec(A)
	fx(N){
		vecp(A);
		some+=A.at(x);
	}
	some/=N;
	double mini=1000000;
	int index=0;
	fx(N){
		if(abs(some-A.at(x))<mini){
			mini=abs(some-A.at(x));
			index=x;
		}
	}
	
	ce(index)
	
}

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

int main(){
    int N;
    long long A_list[114514];
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> A_list[i];
    }
    sort(A_list, A_list+N);
    long long side1 = -1;
    int i=N-1; 
    while(i>=1){
        if(A_list[i] == A_list[i-1]){
            side1 = A_list[i];
            break;
        }
        i--;
    }
    if(side1 == -1 || i <= 1){
        cout << 0;
        return EXIT_SUCCESS;
    }
    int j = i-2;
    long long side2 = -1;
    while(j>=1){
        if(A_list[j] == A_list[j-1]){
            side2 = A_list[j];
            break;
        }
        j--;
    }
    if(side2 == -1){
        cout << 0;
        return EXIT_SUCCESS;
    }
    cout << side1*side2;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
  {
    if(i%k==0)
    {
      cout<<"OK";
      return 0;
    }
  }
  cout<<"NG";
  return 0;
}

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

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const range = (n: number | bigint) => [...Array(Number(n))].map((_, i) => i);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tuple = <T extends unknown[]>(...ts: T) => ts;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [cin, nCin, bCin] = (() => {
  const inputs = readFileSync("/dev/stdin", "utf-8").split(/[\n|\s]+/);
  let count = 0;
  const cin = () => inputs[count++];
  return tuple(
    cin,
    () => Number(cin()),
    () => BigInt(cin())
  );
})();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isNumber = (x: unknown): x is number => typeof x === "number";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const isBigint = (x: unknown): x is bigint => typeof x === "bigint";
type NumberOrBigintOrElse<T> = number | bigint extends T
  ? undefined
  : T extends number
  ? number
  : T extends bigint
  ? bigint
  : undefined;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const max = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.max(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc >= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const min = <T extends number | bigint>(...ts: T[]) =>
  (ts.length === 0
    ? undefined
    : isNumber(ts[0])
    ? Math.min(...(ts as number[]))
    : (ts as bigint[]).reduce((acc, t) =>
        acc <= t ? acc : t
      )) as NumberOrBigintOrElse<T>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const abs = <T extends number | bigint>(t: T) =>
  (isNumber(t)
    ? Math.abs(t)
    : isBigint(t)
    ? t >= 0n
      ? t
      : -t
    : undefined) as NumberOrBigintOrElse<T>;

/**
 * Program
 */
const getAns = (a: bigint, b: bigint, c: bigint, d: bigint): string =>
  max(a * c, a * d, b * c, b * d).toString();

{
  const [a, b, c, d] = [bCin(), bCin(), bCin(), bCin()];
  const ans = getAns(a, b, c, d);
  console.log(ans);
}


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

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

int main(){
    long long int a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << (a / gcd(a,b)) * b << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
from functools import reduce
  
def perm(n, k, p):
  ret = 1
  for i in range(n, n-k, -1):
    ret = (ret * i)%p
  return ret

def comb(n, k, p):
  """power_funcを用いて(nCk) mod p を求める"""
  a = perm(n, k, p)
  b = perm(k, k, p)
  return (a*pow(b, p-2, p))%p
  
n, a, b = map(int, input().split())

MOD = 10**9 + 7


print((pow(2,n,MOD) - 1 - comb(n, a, MOD) - comb(n, b, MOD))%MOD)

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int> > v;
    rep (i, m) {
        int a, b;
        cin >> a >> b;
        v.push_back(make_pair(b, a));
    }
    sort(v.begin(), v.end());
    int left = -1;
    int cnt = 0;
    rep (i, m) {
        if (left < v[i].second) {
            cnt++;
            left = v[i].first - 1;
        }
    }
    cout << cnt << endl;
    
    return 0;
}



Measured memory_bytes: 1400
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int n, m, c;
vector<int> b;

int solve() {
  int ans{};
  REP(i, n) {
    int sum{};
    REP(i, m) {
      int a;
      cin >> a;
      sum += a * b[i];
    }
    if (sum + c > 0)
      ++ans;
  }
  return ans;
}

int main() {
  cin >> n >> m >> c;
  REP(i, m) {
    int in;
    cin >> in;
    b.push_back(in);
  }
  cout << solve() << endl;
}


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

int main() {
  int A, B;
  scanf("%d", &A);
  scanf("%d", &B);
  if (A > 12) {
    printf("%d", B);
  } else if (A < 6) {
    printf("0");
  } else {
    printf("%d", B / 2);
  }
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int H,W;
  cin>>H>>W;
  vector<string>s(H);
  for(int i=0;i<H;i++)cin>>s[i];
  int sumb=0;
  for(auto it:s)for(auto it2:it)if(it2=='#')sumb++;
  queue<pii>q;
  q.push({0,0});
  int dx[4]={0,1,0,-1};
  int dy[4]={1,0,-1,0};
  vector<vector<int>>d(H,vector<int>(W,0));
  bool ok=false;
  while(q.size()){
    int x=q.front().first;
    int y=q.front().second;
    q.pop();
    if(y==H-1&&x==W-1){
      ok=true;
      break;
    }
    for(int i=0;i<4;i++){
      int X=x+dx[i];
      int Y=y+dy[i];
      if(0<=Y&&Y<H&&0<=X&&X<W&&s[Y][X]!='#'){
        d[Y][X]=max(d[y][x]+1,d[Y][X]);
        s[Y][X]='#';
        q.push({X,Y});
      }
    }
  }
  if(ok)cout<<H*W-sumb-d[H-1][W-1]-1<<endl;
  else cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    from collections import defaultdict
    H, W = map(int, input().split())
    counter = defaultdict(int)
    for _ in range(H):
        for s in input().rstrip():
            counter[s] += 1
    if H % 2 == 0 and W % 2 == 0:
        for cnt in counter.values():
            if cnt % 4 != 0:
                print("No")
                sys.exit()
        print("Yes")
        sys.exit()
    
    if H % 2 == 1 and W % 2 == 1:
        one_cnt = 0
        two_cnt = 0
        for cnt in counter.values():
            if cnt % 4 != 0:
                if cnt % 2 == 0:
                    two_cnt += 1
                else:
                    one_cnt += 1
        if two_cnt <= H // 2 + W // 2 and one_cnt <= 1:
            print("Yes")
        else:
            print("No")
        sys.exit()
    
    if H % 2 == 1 and W % 2 == 0:
        two_cnt = 0
        for cnt in counter.values():
            if cnt % 4 != 0:
                if cnt % 2 == 0:
                    two_cnt += 1
                else:
                    print("No")
                    sys.exit()
        if two_cnt <= W // 2:
            print("Yes")
        else:
            print("No")
        sys.exit() 

    if H % 2 == 0 and W % 2 == 1:
        two_cnt = 0
        for cnt in counter.values():
            if cnt % 4 != 0:
                if cnt % 2 == 0:
                    two_cnt += 1
                else:
                    print("No")
                    sys.exit()
        if two_cnt <= H // 2:
            print("Yes")
        else:
            print("No")
        sys.exit() 

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
a = int(input())
str = list(input())

if a%2 :
	print("No")
	exit()
  
n_str_1 = ""
n_str_2 = ""
  
for i in range(int(a/2)):
    n_str_1 += str[i]
    n_str_2 += str[i+int(a/2)]

if n_str_1 == n_str_2 :
	print("Yes")
else :
  	print("No")

Measured memory_bytes: 3060
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=list(input())
t=list(input())

n=len(s)
same=False
for i in range(0,n):
  if s==t:
    same=True
    break
  t=t[1:]+t[:1]
  

if same:
  print('Yes')
else:
  print('No')



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

#define ll long long
#define F first
#define S second
#define ii pair < int , int >
#define ever (;;)

const int N = 200100;

int n,k,a[N];

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);

    for(int i=k+1;i<=n;i++)
    {
        if( a[i] > a[i-k] )
            printf("Yes\n");
        else
            printf("No\n");
    }
}


Measured memory_bytes: 4580
#include<stdio.h>

int main(){
	int a;
	scanf("%d",&a);
	while(a--){
		int b,c,d;
		scanf("%d%d%d",&b,&c,&d);
		int max=b;
		if(b<c)max=c;
		if(max<d)max=d;
		if(max*max==b*b+c*c+d*d-max*max)printf("YES\n");
		else printf("NO\n");
	}
}

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

using namespace std;

using ll = long long;

int main() {
	int n, k;
	cin >> n >> k;
	int* p = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> p[i];
		p[i]--;
	}
	ll* c = new ll[n];
	for (int i = 0;i < n;i++) {
		cin >> c[i];
	}
	ll scoa = -1e9;
	int* arrived=new int[n];
	ll* t_scoa = new ll[n];
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n;j++) {
			arrived[j] = -1;
			t_scoa[j] = -1e9;
		}
		int index = 1;
		arrived[i] = 0;
		arrived[p[i]] = 1;
		int now = p[i];
		t_scoa[now] = c[now];
		ll scoa_haba=0;
		int haba=0;
		for (;index < k;) {
			if (arrived[p[now]] == 0) {
				scoa_haba = t_scoa[now] + c[p[now]];
				haba = index + 1;
				now = p[now];
				break;
			}
			if (arrived[p[now]] > 0) {
				scoa_haba = t_scoa[now] - t_scoa[p[now]] + c[p[now]];
				haba = index - arrived[p[now]] + 1;
				now = p[now];
				break;
			}
			else {
				t_scoa[p[now]] = t_scoa[now] + c[p[now]];
				now = p[now];
				index++;
				arrived[now] = index;
			}
		}
		if (haba == 0) {

		}
		else {
			int start = now;
			while (1) {
				if (now == i) {
					t_scoa[now] = max(scoa_haba, scoa_haba * (ll)(k / haba));
				}
				else {
					t_scoa[now] = max(t_scoa[now], t_scoa[now] + scoa_haba * (ll)((k - arrived[now]) / haba));
				}
				now = p[now];
				if (now == start)break;
			}
		}
		for (int j = 0;j < n;j++) {
			scoa = max(scoa, t_scoa[j]);
		}
	}
	cout << scoa << endl;
}

Measured memory_bytes: 3272
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	r := getNextInt(scanner)
	d := getNextInt(scanner)
	x := getNextInt(scanner)
	for i := 0; i < 10; i++ {
		x = r*x - d
		fmt.Fprintln(writer, x)
	}
}


Measured memory_bytes: 640
package main

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

func sliceAtoi(sa []string) ([]int, error) {
	si := make([]int, 0, len(sa))
	for _, a := range sa {
		i, err := strconv.Atoi(a)
		if err != nil {
			return si, err
		}
		si = append(si, i)
	}
	return si, nil
}

func stdInInt() int {
	var N int
	fmt.Scan(&N)
	return N
}

func stdInNumSlice() []int {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	stringInput := scanner.Text()
	A, _ := sliceAtoi(strings.Split(stringInput, " "))
	return A
}

func stdOutList(list *[]int) {
	str := fmt.Sprintf("%v", *list)
	str = strings.Trim(str, "[]")
	fmt.Println(str)
}

func main() {
	N := stdInInt()
	A := stdInNumSlice()
	i := 0
	s := 0
	for i < N {
		for j := N - 1; j >= 1; j-- {
			if A[j] < A[j-1] {
				tmp := A[j]
				A[j] = A[j-1]
				A[j-1] = tmp
				s++
			}
		}
		i++
	}
	stdOutList(&A)
	fmt.Println(s)
}


Measured memory_bytes: 1220
#include<iostream>
using namespace std;
#define rep(i,n) for(i = 1;i < n;i++)

int main(){
	int i,j;
	rep(i,10){
		rep(j,10){
			cout << i << "x" << j << "=" << i*j << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const int INF = 1001001001;
const int MOD = 1000000007;


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<vector<ll>> dp(n + 1, vector<ll>(n + 1, 0));

    for (int len=1;len<=n;++len) {
        for (int i=0;i<=(n-len);++i) {
            int j = i + len;

            // 先手の場合。
            if ((n - len) % 2 == 0) {
                dp[i][j] = max(dp[i + 1][j] + a[i], dp[i][j - 1] + a[j - 1]); // 先頭を取る場合と、末尾を取る場合の大きい方。
            // 後手の場合。
            } else {
                dp[i][j] = min(dp[i + 1][j] - a[i], dp[i][j - 1] - a[j - 1]);
            }
        }
    }

    cout << dp[0][n] << endl;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
int main(){
    char arr[3];
    fo(i,3){
        cin >> arr[i];
    }
    if(arr[0]=='7'||arr[1]=='7'||arr[2]=='7'){
        cout <<"Yes";
    }
    else{
        cout << "No";
    }

}

Measured memory_bytes: 3592
/* Volume0-0007(借金地獄) */

import java.io.*;
import java.util.*;

public class Main {
  public static void main (String[] args) throws java.lang.Exception {
    // 入力された値をゲット
    Scanner sc = new Scanner(System.in);
    double n = sc.nextInt();  // 1個目をxにセット
    double kane = 100000;     // 借金を開始
    for(int i=0; i<n; i++) {
      // n週間後の利息
      kane = kane + (kane * 0.05);
      // 1000円未満を切り上げて出力
      kane = (Math.ceil((double)kane / 1000)) * 1000;
    }
    int total = (int)kane;
    System.out.println(total);
  }
}




Measured memory_bytes: 25980
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int main(){
	int a, b, c, d, e, k;
	
	cin >> a >> b >> c >> d >> e >> k;
	
	if (e-a > k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	
	return 0;
}

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

using namespace std;

const int N = 200 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, m, t;
vector<int> g[N];
int used[N], f[N];
vector< pair<int, int> > E;

bool read() {
    if (!(cin >> n >> m))
        return false;

    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].emplace_back(v - 1);
        g[v - 1].emplace_back(u - 1);
    }

    return true;
}

int dfs(int v, int pr) {
    used[v] = ++t;
    auto cur = 0;

    for (const auto& to : g[v])
        if (!used[to]) {
            cur ^= dfs(to, v);
        } else if (to != pr && used[to] < used[v]) {
            cur ^= 1;
            E.emplace_back(v, to);
        }

    if (pr != v) {
        if (cur == 1)
            E.emplace_back(v, pr);
        else
            E.emplace_back(pr, v);
    }

    return cur ^ 1;
}

void solve() {
    if (m & 1) {
        cout << "-1\n";
        return ;
    }

    dfs(0, 0);

    for (const auto& e : E)
        cout << e.first + 1 << ' ' << e.second + 1 << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 15220
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <math.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,n1,n2) for(int i=n1;i<n2;i++)
using namespace std;
typedef long long ll;

int main() {
    int d,n;
    cin >> d >> n;
    int res;
    if(n<100){
        res = n*pow(100,d);
    }else{
        res = (n+1)*pow(100,d);
    }
    //int cnt = 0;
    cout << res << endl;
    /*vector<pair<int,int>> pair1(n);
     vector<pair<int,int>> pair2(n);
     REP(i,n){
     int a,b;
     cin >> a >> b;
     pair1[i] = make_pair(a,b);
     }
     REP(i,n){
     int c,d;
     cin >> c >> d;
     pair2[i] = make_pair(c,d);
     }
     
     sort(pair1.begin(),pair1.end());
     sort(pair2.begin(),pair2.end());
     REP(i, n){
     cout << pair1[i].first << pair1[i].second <<endl;
     }
     int maxn = -1;
     int cand = -1;
     REP(i,n){
     REP(j,n){
     if(pair1[i].first<pair2[j].first){
     if(pair1[i].second>maxn){
     cand = i;
     }
     }
     }
     }
     /*REP(i, n){
     cout << pairs[i].first << pairs[i].second <<endl;
     }
     /*int n;
     int res = 100000;
     cin >> n;
     //vector<int> x(n);
     REP2(i,1,n/2+1){
     res = min(res,psum(i)+psum(n-i));
     if(psum(i)+psum(n-i)==1){
     cout << "i:" << i <<endl;
     }
     }
     cout << res << endl;*/
    return 0;
}



Measured memory_bytes: 892
#include <iostream>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)

int n, x[4096][4096];
long long a[4096], s[4096], c[4096][4096];

int main() {
    cin >> n;
    rep (i, n) cin >> a[i];
    rep (i, n) s[i+1] = s[i]+a[i];
    rep (w, n) if (w) rep (i, n-w) {
        int j = i+w+1;
        c[i][j] = c[i][i+1]+c[i+1][j], x[i][j] = i+1;
        if (w>1) for (int k=x[i][j-1]; k<=x[i+1][j]; k++) {
            if (c[i][j]>c[i][k]+c[k][j]) c[i][j] = c[i][k]+c[k][j], x[i][j] = k;
        }
        c[i][j] += s[j]-s[i];
    }
    cout << c[0][n] << endl;
    return 0;
}

Measured memory_bytes: 195720
import java.io.*;
import java.util.*;
import java.math.*;
     
public class Main{
	public static void main(String[] args) throws Exception {
	IO io = new IO();
	PrintWriter out = new PrintWriter(System.out);
	Solver sr = new Solver();
	sr.solve(io,out);
	out.flush();
	out.close();
    	}

	static class Solver
	{
	    void solve(IO io, PrintWriter out)
	    {
           	int n = io.nextInt();
          	double tmp = 2*((double)22/7);
            out.println(tmp*n);
	    }
    	
	}
	//Special thanks to Petr (on codeforces) who inspired me to implement IO class!
	static class IO
	{
    	BufferedReader reader;
        StringTokenizer tokenizer;
    	public IO() {
                reader = new BufferedReader(new InputStreamReader(System.in));
                tokenizer = null;
            }
     
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public String nextLine() {
            String s="";
            try {
                    s=reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            return s;
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    
        public long nextLong() {
            return Long.parseLong(next());
        }
    	double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
	}
}

Measured memory_bytes: 33248
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int k, n, q, a[N], sz;
pair < long long, int > tree[N * 4];

pair < long long, int > Merge(pair < long long, int > a, pair < long long, int > b){
    return make_pair(a.first + b.first * (a.second ? (-1) : 1), (a.second + b.second) % 2);
}

void add(int v, int x){
    if (x == 0)tree[v] = make_pair(0, 1);else tree[v] = make_pair(x, 0);
    v >>= 1;
    while (v){
        tree[v] = Merge(tree[v + v], tree[v + v + 1]);
        v >>= 1;
    }
}

pair < long long, int > get(int v, int l, int r, int ll, int rr){
    if (l > r || ll > rr || l > rr || r < ll)return make_pair(0, 0);
    if (l >= ll && r <= rr)return tree[v];
    int mid = (l + r) / 2;
    return Merge(get(v + v, l, mid, ll, rr), get(v + v + 1, mid + 1, r, ll, rr));
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >>k>>n>>q;
    sz = 1;
    while (sz < n)sz *= 2;
    for (int i = 1; i <= n; ++i){
        cin >>a[i];
        if (a[i] == 0)tree[sz + i - 1] = make_pair(0, 1);else tree[sz + i - 1] = make_pair(a[i], 0);
    }
    for (int i = sz - 1; i >= 1; --i){
        tree[i] = Merge(tree[i + i], tree[i + i + 1]);
    }
    for (int i = 1; i <= q; ++i){
        int l, r;
        cin >>l>>r;
        swap(a[l], a[r]);
        add(sz + l - 1, a[l]);
        add(sz + r - 1, a[r]);
        pair < long long, int > v = get(1, sz, sz + sz - 1, sz, sz + n - 1);
        if (v.first >= 0 && v.second == 0){
            v.first %= k;
            v.first = (v.first + k - 1) % k;
            cout <<k - v.first<<'\n';
        }
        if (v.first >= 0 && v.second == 1){
            v.first %= k;
            v.first = (v.first + k - 1) % k;
            cout <<-(k - v.first)<<'\n';
        }
        if (v.first < 0 && v.second == 0){
            v.first *= -1;
            v.first %= k;
            cout <<1 + v.first<<'\n';
        }
        if (v.first < 0 && v.second == 1){
            v.first *= -1;
            v.first %= k;
            cout <<-(1 + v.first)<<'\n';
        }
    }
}



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

n = int(input())
h = list(map(int, input().split()))

ans = 0
long = 0
for i in range(n-1) :
  if h[i] >= h[i+1] :
    long += 1
  else :
    if long > ans :
      ans = long
    long = 0

if long > ans :
  ans = long
  
print(ans)

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

int main() {
  
  int A=0, B=0;
  
  cin >> A >> B;
  
  int mul = A*B;
  
  if(10<=A || 10<=B) {
    
    cout << "-1" << endl;
    
  } else {
    
    cout << mul << endl;
    
  }
  
  return 0;
  
}

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

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

int main()
{




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

  while(t--)
{
  string s;
    cin>>s;

   if(s[2]==s[3] && s[4]==s[5])
   cout<<"Yes";

   else
    cout<<"No";
}

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    if((a*b)%2 == 0) puts("No");
    else puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
  int i,j,k,key,N,A[100];

  scanf("%d",&N);
  if (N<1||N>100){
    printf("N ha 1-100 dene\n");
    exit(1);
  }
  for (i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  for (i=1;i<=N;i++){
    for (k=0;k<N;k++){
      printf("%d",A[k]);
      if (k!=N-1){
        printf(" ");
      }
    }
    printf("\n");
    key = A[i];
    j = i-1;
    while (j>=0 && A[j]>key){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;
  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
#ifdef XENON
#include <debug.h>
#endif

#define F first
#define S second
#define endl "\n"
#define eb emplace_back
#define fastio() ios_base:: \
  sync_with_stdio(false); \
  cin.tie(NULL)

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pii = pair<int,int>;

const int N = 2e5+5;
const ll INF = 1e18+1;
const int MOD = 1e9+7;

vector <int> adj[N];
vector <int> parent(N);

void bfs (int src)
{
  queue <int> q;

  q.push(1);
  parent[src] = -1;

  while (q.size())
  {
    auto u = q.front(); q.pop();

    for (auto i: adj[u])
      if (parent[i] == 0)
      {
        parent[i] = u;
        q.push(i);
      }
  }
}

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

  for (int i = 0; i < m; i++)
  {
    int src, dst; cin >> src >> dst;
    adj[src].eb(dst);
    adj[dst].eb(src);
  }

  bfs (1);

  bool pos = true;
  vector <int> ans;
  for (int i = 2; i <= n; i++)
    if (parent[i] == 0)
    {
      pos = false; break;
    }
    else ans.eb(parent[i]);

  if (pos)
  {
    cout << "Yes" << endl;
    for (auto i: ans) cout << i << endl;
  }
  else cout << "No";

  return 0;
}


Measured memory_bytes: 13088
from collections import defaultdict
n,t=map(int,input().split())
a=list(map(int,input().split()))
min_v=a[0]
div=0
for i in range(1,n):
  min_v=min(min_v,a[i])
  div=max(div,a[i]-min_v)
d=defaultdict(int)
for i in range(n):
  d[a[i]]=i
ans=0
for i in range(n):
  if d[a[i]]<d[a[i]+div]:
    ans+=1
print(ans)

Measured memory_bytes: 32988
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

const int INF = 1e9;

int num(int A) {
    switch(A) {
        case 1:
            return 2;
        case 2:
            return 5;
        case 3:
            return 5;
        case 4:
            return 4;
        case 5:
            return 5;
        case 6:
            return 6;
        case 7:
            return 3;
        case 8:
            return 7;
        case 9:
            return 6;
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; i++) {
        cin >> A[i];
    }

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

    vector<int> dp(N + 1, -INF);
    dp[0] = 0;
    for (int i = 2; i <= N; i++) {
        for (int j = 0; j < M; j++) {
            int nj = num(A[j]);
            if (i - nj >= 0) {
                dp[i] = max(dp[i], dp[i - nj] + 1);
            }
        }
    }

    int pos = 0;
    while (pos < M and N > 0) {
        int np = num(A[pos]);
        if (N - np >= 0 and dp[N - np] == dp[N] - 1) {
            cout << A[pos];
            N -= np;
        } else {
            pos++;
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
X = input()
Y = input()
l = min(len(X),len(Y))
m = max(len(X),len(Y))
for i in range(l):
    if i==0:
        word = X[0]+Y[0]
    else:
        word += X[i]+Y[i]
x,y = [X],[Y]
if len(X) < len(Y):
    word += ''.join(y[0][l:])
    print(word)
elif len(X) > len(Y):
    word += ''.join(x[0][l:])
    print(word)
else:
    print(word)

Measured memory_bytes: 3064