akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  int A,B,C; cin >>A >>B >>C;
  if (A<=C && C<=B) cout <<"Yes" <<endl;
  else cout <<"No" <<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int N, K;
int x[100], y[100];
Pii p[100];
Pii praw[100];

int csum[100][100];

int cntincluded(int top, int bottom, int right, int left) {
  int topy = p[top].second;
  int bottomy = p[bottom].second;
  int rightx = p[right].first;
  int leftx = p[left].first;

  return csum[rightx][topy] - csum[leftx - 1][topy] -
         csum[rightx][bottomy - 1] + csum[leftx - 1][bottomy - 1];
}

int main() {
  cin >> N >> K;
  rep(i, 0, N) {
    cin >> x[i] >> y[i];
    p[i] = Pii(x[i], y[i]);
    praw[i] = Pii(x[i], y[i]);
  }

  sort(p, p + N);

  rep(i, 0, N) { p[i] = Pii(p[i].second, i + 1); }

  sort(p, p + N);

  rep(i, 0, N) { p[i] = Pii(p[i].second, i + 1); }

  sort(p, p + N);

  sort(praw, praw + N);

  repe(i, 1, N) {
    repe(j, 1, N) {
      int add = 0;
      if (p[i - 1].second == j) {
        add = 1;
      }
      csum[i][j] = csum[i - 1][j] + csum[i][j - 1] - csum[i - 1][j - 1] + add;
    }
  }

  ll ans = numeric_limits<ll>::max();
  rep(i, 0, N) {
    rep(j, 0, N) {
      rep(k, 0, N) {
        rep(l, 0, N) {
          ll top = praw[i].second;
          ll bottom = praw[j].second;
          if (bottom > top) continue;

          ll left = praw[k].first;
          ll right = praw[l].first;
          if (right < left) continue;

          if (cntincluded(i, j, l, k) >= K) {
            chmin(ans, (top - bottom) * (right - left));
          }
        }
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3632
def main():
    a, b, k = map(int, input().split())
    count = 0
    for i in range(min(a, b), 0, -1):
        if a%i == 0 and b%i == 0:
            count += 1
            # print(i)
            if count == k:
                print(i)
                break

if __name__ == "__main__":
    main()

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

int64_t mod = 1000000007;

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

	int n = s.size();
	vector<vector<int64_t>> dp(n, vector<int64_t>(13));
	if (s[0] == '?') {
		dp.at(0) = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 };
	} else {
		int s0 = s[0] - '0';
		dp.at(0).at(s0) = 1;
	}

	for (int i = 1; i < n; i++) {
		if (s[i] != '?') {
			int s_i = s[i] - '0';
			for (int j = 0; j < 13; j++) {
				int next = (j * 10 + s_i) % 13;
				dp.at(i).at(next) += dp.at(i - 1).at(j);
			}
		} else {;
			for (int j = 0; j < 13; j++) {
				for (int k = 0; k <= 9; k++) {
					int next = (j * 10 + k) % 13;
					dp.at(i).at(next) += dp.at(i - 1).at(j);
					dp.at(i).at(next) %= mod;
				}
			}
		}
	}

	int64_t ans = dp.at(n - 1).at(5) % mod;
	cout << ans << endl;

}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N ;
  string S;
  cin >>S;
  cin >> K;
  for (int i=0; i<N; i++){
    if(S[i] != S[K-1]){
      S[i] = '*';
    }
    if(S[i] == S[K-1]){
      S[i] =S[i];
 
    }
  }
  cout << S <<endl;
}
  


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

void primun(int *,int *);
int main(void){

	int i,size,*num,count;
	
	scanf("%d",&size);
	num=malloc(sizeof(int)*size);
	
	for(i=0;i<size;i++)
		scanf("%d",num+i);
	primun(num,&size);

	free(num);
	return 0;
}

void primun(int *num,int *size){

	int i,j,count=0;

	for(i=0;i<*size;i++){
		if(*(num+i)==2)
			count++;
		for(j=2;j<*(num+i);j++){
			if(*(num+i)%2==0)
				break;
			if(j>sqrt(*(num+i))){
				count++;
				break;
			}
			if(*(num+i)%(j+1)==0){
				j+=1;
				break;
			}

		}	
	}
	printf("%d\n",count);
}

Measured memory_bytes: 628
k, a, b = map(int, input().split())
bis = 1
if b - a < 3 or k < a + 1:
    print (k+1)
else:
    k -= (a-1)
    bis += (a-1)
    n = k // 2
    bis += (b-a) * n
    bis += k % 2
    print (bis)


Measured memory_bytes: 2940
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int c[3][3];
    cin >> c[0][0] >> c[0][1] >> c[0][2] >> c[1][0] >> c[1][1] >> c[1][2] >> c[2][0] >> c[2][1] >> c[2][2];

    if(c[1][1] - c[1][0] == c[0][1] - c[0][0] && c[1][1] - c[1][0] == c[2][1] - c[2][0] && c[1][2] - c[1][0] == c[0][2] - c[0][0] && c[1][2] - c[1][0] == c[2][2] - c[2][0]){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
AB=sorted(AB,key=lambda x: x[1])
day = 0
Flag = True
for i in range(N):
    day += AB[i][0]
    #print(day, AB[i][1])
    if day > AB[i][1]:
        Flag = False
        break
if Flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 89944
package main
 
import (
  "fmt"
  "os"
  "bufio"
  "strconv"
  "sort"
)

var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
  sc.Split(bufio.ScanWords)
  n := nextInt()
  a := make([]string, n)
  for i := range a {
    a[i] = nextStr()
  }

  sort.Strings(a)
  
  //最も多い回数を求める
  count, max := 1, 1
  for i := 1; i < n; i++ {
    if a[i] == a[i-1] {
      count++
      if max < count {
        max = count
      }
    } else {
      count = 1
    }
  }
  
  //最も多い回数と一致したら文字を出力
  if max == 1 {
    for i := range a {
      fmt.Println(a[i])
    }
  } else {
    ans := 1
    for i := 1; i < n; i++ {
      if a[i] == a[i-1] {
        ans++
      } else {
        ans = 1
      }
      if ans == max {
        fmt.Println(a[i-1])
      }
    }
  }
}

Measured memory_bytes: 10496
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), K = cin.getInt();
    let A = cin.getIntArray(N);
    let ans = N == K ? 1 : Math.ceil((N - 1) / (K - 1));
    console.log(ans);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0;this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');if(t<1)throw new Error('引数は1以上であること！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

mod = 10 ** 9 + 7

ans = 0
for i in range(k, n + 2):
    ans += ((2 * n - i + 1) * i // 2 - (i - 1) * i // 2 + 1) % mod
ans %= mod
print(ans)

Measured memory_bytes: 9164
#include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
using ld = long double;

ld p[6];
ld q[6];


ld func(const ld r)
{
    ld ans = 0;
    for(int i=0;i<6;i++){
        if((r*p[i]+(1-r)*q[i])!=0.0){
            ans += (r*p[i]+(1-r)*q[i])*max(r*p[i],(1-r)*q[i])/(r*p[i]+(1-r)*q[i]);
        }
    }
    return ans;
}

ld trinary_search()
{
    ld lb = 0.0;
    ld ub = 1.0;
    while(ub-lb>0.000000001){
        ld x1 = (2.0*lb+1.0*ub)/3.0;
        ld x2 = (2.0*ub+1.0*lb)/3.0;
        if(func(x1)>=func(x2)){
            lb = x1;
        }else{
            ub = x2;
        }
    }
    return (lb+ub)/2.0;
}

int main()
{
    for (int i = 0; i < 6; i++) {
        cin >> p[i];
        p[i] /= 100.0;
    }
    for (int i = 0; i < 6; i++) {
        cin >> q[i];
        q[i] /= 100.0;
    }
    cout << fixed << setprecision(15) << func(trinary_search()) << endl;
    return 0;
}


Measured memory_bytes: 384
#!/usr/bin/env python

import sys

N,M=list( int(i) for i in input().split() )
A=[] # large
B=[] # small

for i in range(0, N):
    A.append(input())

for i in range(0, M):
    B.append(input())

'''
print(A)
print(B)
'''

def check(start_x, start_y):
    for i in range(0, M):
        for j in range(0, M):
            # print("checking:","A:", start_x+i, start_y+j, "B:", i, j)
            if( A[start_x+i][start_y+j] != B[i][j] ):
                return False
    return True

for i in range(0, N-M+1):
    for j in range(0, N-M+1):
        # print("calling:", i, j)
        # check(i, j)
        if( check(i, j) ):
            # print("match", i, j)
            print("Yes")
            sys.exit()

print("No")


Measured memory_bytes: 3064
#include <stdio.h>

#define ROOM 10
#define FLOOR 3
#define BUILDING 4

void Initialize(int Residents[BUILDING][FLOOR][ROOM])
{
	int b,f,r;
	for(b = 0; b < BUILDING; ++b){
		for(f = 0; f < FLOOR; ++f){
			for(r = 0; r < ROOM; ++r){
				Residents[b][f][r] = 0;
			}
		}
	}
}
void Change(int Residents[BUILDING][FLOOR][ROOM])
{
	int b, f, r, v;
	scanf("%d %d %d %d", &b, &f, &r, &v);
	Residents[b-1][f-1][r-1] += v;
}
void Print(int Residents[BUILDING][FLOOR][ROOM])
{
	int b,f,r;
	for(b = 0; b < BUILDING; ++b){
		if(b != 0){
			printf("####################\n");
		}
		for(f = 0; f < FLOOR; ++f){
			for(r = 0; r < ROOM; ++r){
				printf(" %d", Residents[b][f][r]);
			}
			printf("\n");
		}
	}
}

int main()
{
	int Residents[BUILDING][FLOOR][ROOM];
	int n, b, f, r, v;
	int i;
	Initialize(Residents);
	scanf("%d", &n);
	for(i = 0; i < n; ++i){
		Change(Residents);
	}
	Print(Residents);
	return 0;
}

Measured memory_bytes: 612
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

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

fn main() {
    input! {
        a: i8,
        b: i8,
        c: i8,
    }

    let num = vec![a, b, c];

    let five_count = num.iter().filter(|&n| *n == 5).count();
    let seven_count = num.iter().filter(|&n| *n == 7).count();

    if five_count == 2 && seven_count == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
N = int(input())
L = list(map(int, input().split()))

ans = 0

for i in range(len(L) - 2):
    for j in range(i + 1, len(L) - 1):
        for k in range(j + 1, len(L)):
            if not (L[i] == L[j] or L[j] == L[k] or L[k] == L[i]):
                tmp = sorted([L[i], L[j], L[k]], reverse=True)
                if tmp[0] < tmp[1]+tmp[2]:
                    ans+=1
                    # print(i,j,k)
                    # print(tmp[1]+tmp[2])
print(ans)

Measured memory_bytes: 9152
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;



int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s, t;
    cin >> s >> t;

    auto encode = [&](string& s) {
        char ch = 'a';
        vector<char> M(128, -1);

        string res;
        for (auto c : s) {
            if (M[c] == -1) {
                M[c] = ch++;
            }
            res += M[c];
        }
        return res;
    };
    auto check = [&](string s, string t) {
        int n = s.length();
        int m = t.length();
        if (n != m) {
            return false;
        }


        if (encode(s) != encode(t)) {
            return false;
        }

        // sort(s.begin(), s.end());
        // sort(t.begin(), t.end());
        // s.resize(unique(s.begin(), s.end()) - s.begin());
        // t.resize(unique(t.begin(), t.end()) - t.begin());
        // if (s != t) {
        //     return false;
        // }

        return true;
    };

    if (check(s, t)) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 1684
s = input(); f = 0
words = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(words)):
    if words[i] not in s:
        print(words[i])
        f = 1
        break
    
if f == 0:
    print('None')

Measured memory_bytes: 3188
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
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(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int n; cin >> n;

	vector<pair<LL, LL>> p(n);
	for (int i = 0; i < n; i++) {
		LL a, b; cin >> a >> b;

		p[i] = { b, a };

	}

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

	LL now = 0;
	for (int i = 0; i < n; i++) {
		now += p[i].second;
		
		if (p[i].first < now) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

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

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

	long long int temp;
	long long int base = 0;
	long long int all = 0;
	long long int a = 0;

	for (int i = 0; i < n; i++) {
		cin >> temp;
		base += temp;
		if (a < temp) {
			a = temp;
		}
		all += a;
	}
	cout << all - base;
}

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

using namespace std;
typedef long long ll;


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

    int n;
    cin >> n;
    ll totalLeaves = 0;
    vector<ll> a(n+1);
    for (auto &x: a) {
        cin >> x;
        totalLeaves += x;
    }

    ll cnt = 1;
    ll ans = 0;
    for (int i = 0; i <= n; ++i) {
        if (cnt < a[i]) {
            ans = -1;
            break;
        }
        ans += cnt;
        totalLeaves -= a[i];
        cnt -= a[i];
        cnt = min(cnt * 2, totalLeaves);
    }

    cout << ans << '\n';
}

Measured memory_bytes: 3976
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int h, w, k;
int di[] = {0, 1, 0, -1};
int dj[] = {1, 0, -1, 0};
inline bool able(int i, int j) {
    return i >= 0 and j >= 0 and i < h and j < w;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w >> k;
    vs s(h);
    rep(i, h) cin >> s[i];

    P start;
    rep(i, h) rep(j, w) if(s[i][j] == 'S') start = P(i, j);
    queue<P> q1;
    PQG<tuple<int, int, int>> q;
    q1.push(start);
    vvi check(h, vi(w, INF));
    check[start.first][start.second] = 0;
    while(!q1.empty()) {
        int i, j;
        tie(i, j) = q1.front();
        q1.pop();
        if(check[i][j] == k+1) continue;
        rep(h, 4) {
            int ni = i+di[h];
            int nj = j+dj[h];
            if(able(ni, nj) and s[ni][nj] == '.' and chmin(check[ni][nj], check[i][j]+1)) {
                q1.emplace(ni, nj);
            }
        }
        q.emplace(1, i, j);
    }
    int mi = INF;
    while(!q.empty()) {
        int now, i, j;
        tie(now, i, j) = q.top();
        q.pop();
        chmin(mi, min({i, j, h-1-i, w-1-j}));
    }
    cout << 1+(mi-1+k)/k << endl;
}

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

int main() {
  int n, k;
  int j=1;
  cin >> n >> k;

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

  n = n - k;
  while(n > 0) {
    j++;
    n = n - (k-1);
    if( n <= 0 ) {
      cout << j << endl;
      return 0;
    }
  }
  cout << j << endl;

  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void) {
    char str[1000];
    scanf("%s",&str);
    int loop,i;
    //???????????°??\???
    scanf("%d",&loop);
    for(i=0;i<loop;i++){
        //??????
        char command[10],change[1000],reverse[1];
        //?????????????????????????????????
        int start,end;
        scanf("%s %d %d",&command,&start,&end);
        //replace??§????????°
        int j;
        if(strcmp(command,"replace")==0){
            scanf("%s",&change);
            for(j=start;j<=end;j++) str[j]=change[j-start];
        }else if(strcmp(command,"reverse")==0){
            for (j=0;j<=(end-start)/2;j++){
                reverse[0]=str[j+start];
                str[j+start]=str[end-j];
                str[end-j]=reverse[0];
            }
        }else{
            for(j=start;j<=end;j++)printf("%c",str[j]);
            printf("\n");
        }
    }

	return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(998244353)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

// 素数かどうかの判定
bool IsPrime(ll num){
    if(num<2) return false;
    else if(num==2) return true;
    else if(num%2==0) return false; // 偶数はあらかじめ除く
    double sqrtNum = sqrt(num);
    for(ll i=3; i<=sqrtNum; i+=2){
        if(num%i==0) return false;
    }
    return true;
}


signed main() {
	int a; cin>>a;
	cout<<(int)(a+pow(a,2)+pow(a,3))<<endl;
	return 0;
}


Measured memory_bytes: 4080
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\n'
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,0,N)cin>>A[i];
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    int alice = 0;
    int bob = 0;
    rep(i, 0, N)
    {
        if (i % 2 == 0)
            alice += A[i];
        else
            bob += A[i];
    }
    cout << abs(alice - bob) << endl;
}

Measured memory_bytes: 3588
N = int(input())
S = [int(input()) for _ in range(N)]

S.sort()
ans = sum(S)
for s in S:
    if ans % 10 == 0:
        if s % 10 != 0:
            ans -= s
            break
        elif s == S[-1]:
            ans = 0
    else:
        break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}

int main() {
    string s, t;

    cin>>s>>t;
    ll sum = 0;
    rep(i, 3) if(s[i]==t[i]) sum++;
    pr(sum);
    
}


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

int main(){
	int x,n;
	cin>>x>>n;
	if(n==0){
		cout<<x<<endl;
		return 0;
	}
	vector<int>p(n);
	rep(i,n)cin>>p[i];
	int t,tt;
	rep(i,n*2){
		t=x-i;
		tt=1;
		rep(j,n){
			if(p[j]==t)tt=0;
		}
		if(tt==1){
			cout<<t<<endl;
			break;
		}
		t=x+i;
		tt=1;
		rep(j,n){
			if(p[j]==t)tt=0;
		}
		if(tt==1){
			cout<<t<<endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3604
#include<iostream>

using namespace std;

int main(){
    bool flag = 1;
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++) cin>>a[i];
    int count = 0;
    
    while(flag){
        flag=0;
        for(int j=n-1; j>0; j--){
            if(a[j]<a[j-1]){
                swap(a[j],a[j-1]);
                flag=1;
                count++;
            }
        }
    }
    for(int i=0; i<n; i++){
        cout<<a[i]<<" \n"[i==n-1];
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int g=0,k=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(!(i%2)) g++;
        if(i%2) k++;
    }
    printf("%d\n",g*k);
}


Measured memory_bytes: 256
import java.util.Scanner;
 public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String line = scan.nextLine();
        int length = line.length();
        for(int i=0;i < length;i++){
            char ch = line.charAt(i);
            if(Character.isLowerCase(ch)){
                ch = Character.toUpperCase(ch);
                System.out.printf("%c",ch);
            } else {
                ch = Character.toLowerCase(ch);
                System.out.printf("%c",ch);
            }
        }
        System.out.println("");
        scan.close();
    }
}


Measured memory_bytes: 29544
//
// Created by 李青坪 on 2018/10/11.
//

#include "cstdio"

using namespace std;

void swap(int a[], int i, int j){
    int temp = a[i];
    a[i] = a[j];
    a[j] = temp;
}

int partion(int a[], int low, int high){
    int x = a[high];
    int i = low - 1;
    for (int j = low; j < high; ++j) {
        if (a[j] <= x){
            ++i;
            swap(a, i, j);
        }
    }
    swap(a, i+1, high);
    return i+1;
}

int main(){
    int n ;
    scanf("%d", &n);
    int a[100000];
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    int index = partion(a, 0, n-1);
    for (int j = 0; j < n; ++j) {
        if (j) printf(" ");
        if (j == index){
            printf("[%d]", a[j]);
        }
        else{
            printf("%d",a[j]);
        }
    }
    printf("\n");
}


Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main() {

	ios_base::sync_with_stdio(0); cin.tie(0);	int x,y;

	cin>>x>>y;

	if((4*x-y)/2>=0&&(4*x-y)%2==0&&(y-2*x)/2>=0&&(y-2*x)%2==0&&(y>x))

	{

	    cout<<"Yes"<<"\n";

	}

	else

	{

	    cout<<"No"<<"\n";

	}

	

}

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

int main(){
    string a,b;
    cin >> a >> b;
    a += b;
    int n = stoi(a);
    for(int i=0; i<=1000; i++){
        if(i*i == n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
#include <iomanip>
using namespace std;
using ll = long long int;


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

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

int main()
{
  int n;
  string x;
  cin>>n>>x;
  queue<char>q;
  for(auto it:x) q.push(it);

  int ans=0;

  while(!q.empty())
  {
    char u=q.front();
    while(!q.empty() && q.front()==u) q.pop();
    ans++;
  }

  cout<<ans;

  return 0;
}

Measured memory_bytes: 512
#include <iostream>      // cout, endl, cin
#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
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  int X, N, t;
  cin >> X >> N;
  vector<bool> a(102, false);
  for (int i = 0; i < N; i++)
  {
    cin >> t;
    a[t] = true;
  }

  t = 0;
  while (true)
  {
    if (a[X - t] == false)
    {
      cout << X - t << endl;
      return 0;
    }
    if (a[X + t] == false)
    {
      cout << X + t << endl;
      return 0;
    }

    t++;
  }
}


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

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


Measured memory_bytes: 3080
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define per(i,a,b) for(int i = (a); i >= (b); i--)
#define mst(a,b) memset(a,b,sizeof(a));
#define clr(a) mst(a,0);
#define pb  push_back
#define mp  make_pair
#define first fi
#define second se
int dir[4][2] = {1,0,-1,0,0,1,0,-1};
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
ll _gcd(ll a,ll b){return b?_gcd(b,a%b):a;}
const double PI = acos(-1);
//head
const int maxn = 1e5 + 11;
int a[maxn];
int main(int argc, char const *argv[]){

	int n; cin >> n;
	rep(i,1,n) cin >> a[i];
	sort(a+1,a+1+n);
	// 1 2 3 6 8
	int l = 1,r = n;
	ll sum = 0;
	while(r-l+1 > 3){
		sum += 2ll*(a[r]-a[l]);
		r--;l++;

	}
	if(r-l+1 == 3){
		sum += max(2ll*a[r]-1ll*a[r-1]-1LL*a[l],1ll*a[r]+1ll*a[r-1]-2ll*a[l]);
	}else if(r-l+1 == 2){
		sum += (ll)(a[r] - a[l]);
	}
	cout << sum << endl;



	return 0;
}












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

using namespace std;


double dp[3000][3000];
double arr[3000];

int main(){
	int n;
	cin>>n;
	for(int x=1;x<=n;x++) cin>>arr[x];
		memset(dp, 0, sizeof(dp));
	dp[0][0] = 1;
	
	// for(int x=1;x<=n;x++) dp[0][x] = dp[0][x-1]*arr[x];
	// for(int x=1;x<=n;x++) dp[x][0] = dp[x-1][0]*(1-arr[x]);
	double ans = 0;
	for(int x=0;x<=n;x++){
		for(int i=0;i<=n;i++){
			if(x+i > n) break;
			if(i>0) dp[x][i] = dp[x][i-1]*arr[x+i];
			if(x>0) dp[x][i] += dp[x-1][i]*(1-arr[x+i]);
			if(x+i == n && i>x){
				// cout<<x<<" "<<i<<" "<<dp[x][i]<<"\n";
				ans += dp[x][i];
			}
			// cout<<x<<" "<<i<<" "<<dp[x][i]<<"\n";
		}
	}
	printf("%0.10f",ans);
	return 0;
}


Measured memory_bytes: 70528
import sys
def main():
    input = sys.stdin.readline
    N,S = map(int, input().split())
    A = list(map(int, input().split()))
    MOD = 998244353

    dp0 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp1 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp2 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp0[0][0] += 1
    for i in range(N):
        a = A[i]
        dp0i = dp0[i]
        dp1i = dp1[i]
        dp2i = dp2[i]
        dp0n = dp0[i+1]
        dp1n = dp1[i+1]
        dp2n = dp2[i+1]
        for j in range(S+1):
            dp0n[j] = (dp0n[j] + dp0i[j]) % MOD
            dp1n[j] = (dp1n[j] + dp1i[j]) % MOD
            dp2n[j] = (dp2n[j] + dp2i[j]) % MOD

            if j+a > S: continue
            dp1n[j+a] = (dp1n[j+a] + dp1i[j] + (dp0i[j] * (i+1))) % MOD
            dp2n[j+a] = (dp2n[j+a] + (dp1i[j] * (N-i)) + (dp0i[j] * (i+1) * (N-i))) % MOD

    print(dp2[N][S])

if __name__ == '__main__':
    main()

Measured memory_bytes: 270088
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
ll N,M;
ll ans;
int main(void) {
	map<ll,ll> mp;
	cin >> N;
	FOR(i, 0, N) {
		ll a; cin >> a;
		mp[a]++;
	}
	for (auto it = mp.begin(); it != mp.end(); it++) {
		ll tmp=it->second - (it->first);
		if (tmp < 0)ans += it->second;
		else ans += tmp;
	}
	ct(ans);
	
	return 0;
}

Measured memory_bytes: 6272
#include <iostream> // cout, endl, cin
#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
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main()
{
    int N;
    cin >> N;
    vector<int> aa(N);
    rep(i, N) cin >> aa.at(i);

    int cnt = 0;
    rep(i, N)
    {
        while (aa.at(i) % 2 == 0)
        {
            aa.at(i) /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    int A[N];
    rep(i, N) {
        cin >> A[i];
    }
    sort(A, A+N);
    const int mod = 1000000007;

    if(N % 2 == 1) {
        if(A[0] != 0) {
            cout << 0 << endl;
            return 0;
        }
        else {
            for(int i = 1; i < N; i += 2) {
                if(A[i] != i+1 || A[i+1] != i+1) {
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    else {
        for(int i = 0; i < N; i += 2) {
                if(A[i] != i+1 || A[i+1] != i+1) {
                    cout << 0 << endl;
                    return 0;
                }
            }
    }

    int m = N/2;
    int ans = 1;

    rep(i, m) {
        ans = 2*ans % mod;
    }

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

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define ri(x) scanf("%d",&(x))
#define ri2(x,y) scanf("%d %d",&(x),&(y))
#define ri3(x,y,z) scanf("%d %d %d",&(x),&(y),&(z))
#define rll(x) scanf("%lld",&(x))
#define rll2(x,y) scanf("%lld %lld",&(x),&(y))
#define rll3(x,y,z) scanf("%lld %lld %lld",&(x),&(y),&(z))
#define gc(x) ((x) = getchar())
using namespace::std;

const long double PI = acos(-1);
const long long MOD = 1000000000 +7;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> tll;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;

ll gcd(ll a, ll b){ return b==0?a:gcd(b,a%b);}

ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}

ll pow_mod(ll a, ll b, ll m = MOD){
	ll res = 1LL;
	a = a%m;
	while(b){
		if(b&1) res = mul(res,a,m);
		b >>= 1;
		a = mul(a,a,m);
	}
	return res;
}

ll fastexp(ll a, ll b){
	ll res = 1LL;
	while(b){
		if(b&1) res = res*a;
		b >>= 1;
		a *= a;
	}
	return res;
}

int gcdExtendido(int a, int b, int *x, int *y){
	if(a == 0){
		*x = 0;
		*y = 1;
		return b;
	}
	int x1, y1;
	int gcd = gcdExtendido(b%a,a,&x1,&y1);
	
	*x = y1-(b/a)*x1;
	*y = x1;
	return gcd;
}

int modInverso(int a, int m){
	int x, y;
	int g = gcdExtendido(a,m,&x,&y);
	if(g!=1) return -1;
	else return (x%m + m)%m;
}

/****************************************
*************P*L*A*N*T*I*L*L*A************
*****************************************/

const int N = 3000+5;

int n;
int memo[N][N]; // memo[pos][x]: ways to fix the first pos elements such that the last value added is x
string s;

int main(){
	ri(n);
	cin >> s;
	s = " " + s;
	memo[1][1] = 1;
	memo[1][2] = -1;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			memo[i][j] = add(memo[i][j],memo[i][j-1]);
		}
		if(i == n) break;
		for(int j=1; j<=i; j++){
			int l, r;
			if(s[i] == '<'){
				l = j+1;
				r = i+1;
			}
			else{
				l = 1;
				r = j;
			}
			if(l <= r){
				memo[i+1][l] = add(memo[i+1][l],memo[i][j]);
				memo[i+1][r+1] = add(memo[i+1][r+1],-memo[i][j]);
			}
		}
	}
	int ans = 0;
	for(int i=1; i<=n; i++){
		ans = add(ans,memo[n][i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 35456
K, N = [int(i) for i in input().split()]
array = [int(i) for i in input().split()]

distances = []
for i in range(N):
    if i == N-1:
        distances.append(array[0] + (K - array[i]))
    else :
        distances.append(abs(array[i] - array[i+1]))
        
print(K - max(distances))

Measured memory_bytes: 24948
#include<stdio.h>
int main(void)
{
	int W,H,x,y,r,f;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	f=0;
	if(x+r>W)f=1;
	if(y+r>H)f=1;
	if(r>x)f=1;
	if(r>y)f=1;
	if(f==0) {
			printf("Yes\n");
	}
	else {
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << '\n';
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll=unsigned long long;
/*
1以上、条件以下の組み合わせの積を出せばいい
もうだめ。。。なにが違うのかわからない。
ああ、末端で上昇したときが判定できてない
もおお7WAだよおおお
統括する
*/
int main(){
  ll N,MOD=1e9+7,ans=1; cin>>N;
  vector<ll> T(N+2,0), A(N+2,0);
  for(int i=1; i<=N; i++) cin>>T[i];
  for(int i=1; i<=N; i++) cin>>A[i];
  for(int i=1; i<=N; i++){//Tが上がったら確定。それ以下だったらNG
    if((T[i-1]<T[i] && T[i]>A[i]) || (A[i]>A[i+1] && T[i]<A[i])) ans=0;
    if(T[i-1]==T[i] && A[i]==A[i+1])
      (ans*=min(T[i], A[i]))%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B;
    cin >> A >> B;

    if(A >= 13){
        cout << B << endl;
    }else if(A >= 6){
        cout << B/2 << endl;
    }else{
        cout << 0 << endl;
    }

}

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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int main(){
  int n;
  int a[100];
  ll mo=1000,st=0;
  
  scanf("%d", &n);
  rep(i, n){
    scanf("%lld", &a[i]);
  }
  
  rep(i, n){
    if(i==0){
      if(a[0]<a[1]){
        st=mo/a[0];
        mo-=st*a[0];
      }
    }
    else if(i==n-1){
      if(st==0)break;
      mo+=st*a[i];
      st=0;
    }
    else{
      if(a[i-1]<=a[i]&&a[i]>a[i+1]){
        if(st==0)continue;
        mo+=st*a[i];
        st=0;
      }
      else if(a[i-1]>=a[i]&&a[i]<a[i+1]){
        if(st>0)continue;
        st=mo/a[i];
        mo-=st*a[i];
      }
    }
  }
      
  
  printf("%lld",mo);
                
  return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stack>
#include <array>
#include <queue>
#include <string>
#include <vector>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <new>
#include <map>
#define ESP (1e-13)
#define INF 2000000000
#define ll long long

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	cout << (n - 1)*(m - 1) << endl;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;

}
      
       

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

#define ll long long 
#define MAXN 100010
#define mod 1000000007

using namespace std;

int ans, n, m;

int a = 0, b = 0;

int main(){
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		a = a * 10 + m;
	}
	for (int i = 1; i <= m; i++) {
		b = b * 10 + n;
	}
	cout << max(a, b) << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int x,n;
    int data[4][3][10]={{{0}}};
    scanf("%d",&n);
    for(x=0;x<n;x++){
        int b,f,r,v;
        scanf("%d %d %d %d",&b,&f,&r,&v);
        data[b-1][f-1][r-1]+=v;
    }
    
    int i,j,k;
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++)
            printf(" %d",data[i][j][k]);
            printf("\n");
        }
        if(i<3)printf("####################\n");
    }
    return(0);
}



Measured memory_bytes: 2108
#include <stdio.h>
int main(){
  int a,b,c,d;
  char S[100];
  scanf("%d%d",&a,&b);
  if(a<b){
    c=a;
    a=b;
    b=c;
  }
  if((a-b)%2==0)
    printf("%d",a-(a-b)/2);
  else
    printf("IMPOSSIBLE");
  return 0;
}

Measured memory_bytes: 128
///***###                               بسم الله الرحمن الرحيم                            ###***///


/*
                    Author          : Borhan Uddin Rafi
                    University      : Begum Rokeya University,Rangpur.
                    Date            : 27 June,2020;
*/


///************************Start Of Template*************************///


#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#define Read_Fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(a) a.begin(),a.end()
#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define f1n(i,n) for(i=1;i<=n;i++)
#define szf sizeof()
#define sz size()
#define ln length()
#define mem(x,r) memset(x,r,sizeof(x))
using namespace std;
using ll=long long;
const int N=2e5+5;
string str,ans,rafi,chk;

map<string,string>maap;
queue<int>q;

/*** this solution will not work in terminal because of freopen................
    If you close that freopen then its work here.
    But before submission you need to open freopen line ***/

     //////return sum of all digits///////

int arr[10000004];


int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    Read_Fast;
    int t;
    // cin>>t;
    //  while(t--)
    //  {
    ll n,m,i,j,cnt1=0,cnt2=0,cnt=0,even=0,odd=0,len,k,r,l,z=0,x=0,y=0,flag=0,sum=0;
    ll a=0,b=0,c=0,d,ans=0,zero=0,fst=0,snd=0,lst=0,one=0,mn=INT_MAX,mx=INT_MIN;
    char ch;
    int h1,h2,m1,m2,h,time;
    string str,store="";
    cin>>n;
   // map<ll,ll>arr;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j=j+i)
        {
            arr[j]++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        sum=sum+(i*arr[i]);
    }
    cout<<sum<<endl;

    // }
    return 0;
///***###            ٱلْحَمْدُ لِلَّٰهِ          ###***///
}



Measured memory_bytes: 42720
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

# input
K = int(input())

# output
print(L[K-1])


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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int n; std::cin >> n;
  map<int, int> cnt;
  rep(i, n) {
    int a; std::cin >> a;
    cnt[a]++;
  }
  bool ok = true;
  for (auto p : cnt) {
    if (p.se > 1) ok = false;
  }
  std::cout << (ok ? "YES" : "NO") << "\n";
}


Measured memory_bytes: 9600