akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main () {
  int s;
  cin >> s;
  int a = s % 100;
  int b = floor(s / 100);
  if ((a >= 1 && a <= 12) && (b >= 1 && b <= 12)) cout <<"AMBIGUOUS";
  else if (a >= 1 && a <= 12) cout << "YYMM";
  else if  (b >= 1 && b <= 12) cout << "MMYY";
  else cout <<"NA";
}


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

int main() {
  int N, K, sam;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    int x;
    cin >> x;
    if (x < K - x){
      sam += x * 2;
    }
    else {
      sam += (K - x) * 2;
    }
  }
  cout << sam << endl;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	string a, b, c;
  	cin >> a >> b >> c;
  	if(a.back()==b.front() && b.back()==c.front()) cout << "YES" << endl;
    else cout << "NO" << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.print(a*b);
        int c = a*2+b*2;
        System.out.println(" " + c);
    }
}


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


void solve(long long N, std::vector<long long> a){
    vector<bool> flg(N, false);
    ll k = 0;
    for(auto x : a){
        x--;
        if(x == 0){
            flg.at(x) = true;
            k = max(k, x + 1);
        }else if(flg.at(x - 1)){
            flg.at(x) = true;
            k = max(k, x + 1);
        }
    }
    if(k == 0){
        cout << -1 << endl;
    }else{
        cout << N - k << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


Measured memory_bytes: 1792
package main

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

var sc = bufio.NewScanner(os.Stdin)

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()

	count := 0

	for i := 0; i < N; i++ {
		A1 := nextInt()
		A2 := nextInt()
		A3 := A2 - A1 + 1
		count = count + A3
	}

	fmt.Println(count)

}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
#define brk system("pause");

const int N = 1e5 + 1;
int dp[N], h[N];
main()
{
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
		cin >> h[i];
	
	dp[2] = abs(h[2] - h[1]);
	for(int i = 3; i <= n; i++)
	{
		dp[i] = abs(h[i] - h[i - 1]) + dp[i - 1];
		for(int j = 1; j <= k; j++)
		{
			if(i - j > 0)
				dp[i] = min(dp[i], abs(h[i] - h[i - j]) + dp[i - j]);
		}
	}
	
	cout << dp[n] << endl;
}


Measured memory_bytes: 1024
// D - Wizard in Maze
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)

// ダイクストラ　O(ElogV)
using PR = pair<int, int>;
#define INF 1'000'000'000
vector<vector<PR>> G; // [from]<to, cost> 隣接リスト
int V; // 頂点数(max:10^3*10^3=10^6)

vi dijkstra(int s){
	vi dist(V, INF);
	dist[s] = 0;
	priority_queue<PR, vector<PR>, greater<PR>> pq; // <dist, u>
	pq.push({0, s});
	while(pq.size()){
		int d, u; tie(d, u) = pq.top(); pq.pop();
		if(dist[u] < d) continue;
		for(auto e:G[u]){
			int v = e.first, next_d = e.second + dist[u];
			if(dist[v] <= next_d) continue;
			dist[v] = next_d;
			pq.push({dist[v], v});
		}
	}
	return dist;
}

// PR dhw[] = { // <h, w>
//         { 1, 0},
// { 0,-1},        { 0, 1},
//         {-1, 0},
// { 2,-2},{ 2,-1},{ 2, 0},{ 2, 1},{ 2, 2},
// { 1,-2},{ 1,-1},        { 1, 1},{ 1, 2},
// { 0,-2},                        { 0, 2},
// {-1,-2},{-1,-1},        {-1, 1},{-1, 2},
// {-2,-2},{-2,-1},{-2, 0},{-2, 1},{-2, 2}
// };

// h*h + w*w
//     1
//   1 0 1
//     1
// 8 5 4 5 8
// 5 2   2 5
// 4       4
// 5 2   2 5
// 8 5 4 5 8

int main(){
	int H, W, sh, sw, eh, ew; cin>>H>>W>>sh>>sw>>eh>>ew;
	string S[H]; rp(i, 0, H) cin>>S[i];

	int dh[] = { 1,-1, 0, 0};
	int dw[] = { 0, 0,-1, 1};
	V = H * W;
	G.resize(V); // 隣接リスト初期化
	rp(u, 0, V){
		int h = u / W, w = u % W;
		rp(i, 0, 4){
			// int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
			int nx_h = h + dh[i], nx_w = w + dw[i];
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			G[u].emplace_back(nx_h*W + nx_w, 0);
		}
		// rp(i, 4, 24){
			// int nx_h = h + dhw[i].first, nx_w = w + dhw[i].second;
		rp(i, -2, 2+1) rp(j, -2, 2+1){ //[i, j]: [-2,-2]~[2,2]
			if(i*i + j*j <= 1) continue; // 上下左右を除く
			int nx_h = h + i, nx_w = w + j;
			if(nx_h < 0 || H <= nx_h || nx_w < 0 || W <= nx_w) continue;
			if(S[nx_h][nx_w] == '#') continue;
			G[u].emplace_back(nx_h*W + nx_w, 1);
		}
	}

	int ans = dijkstra((sh-1)*W + (sw-1))[(eh-1)*W + (ew-1)];
	cout<< (ans==INF? -1:ans) <<endl;
}


Measured memory_bytes: 172484
package main

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

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	bs := NewBufScanner(in)
	bw := NewBufWriter(out)
	defer bw.w.Flush()
	x, y, z := bs.Scan(), bs.Scan(), bs.Scan()

	bw.Printf("%v %v %v", z, x, y)
}

// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// IntScan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
    int S;
    int h, m, s;

    scanf("%d", &S);

    h = S/3600;
    m = (S-h*3600)/60;
    s = S-h*3600-m*60;

    printf("%d:%d:%d\n", h, m, s);

	return 0;
}

Measured memory_bytes: 592
poors = """
1 1 2
1 1 3
1 1 4
1 1 5
1 1 6
1 1 7
1 1 8
1 1 9
1 2 1
1 2 2
1 3 1
1 3 3
1 4 1
1 4 4
1 5 1
1 5 5
1 6 1
1 6 6
1 7 1
1 7 7
1 8 1
1 8 8
1 9 1
1 9 9
2 1 1
2 1 2
2 2 1
2 2 3
2 2 4
2 2 5
2 2 6
2 2 7
2 2 8
2 2 9
2 3 2
2 3 3
2 4 2
2 4 4
2 5 2
2 5 5
2 6 2
2 6 6
2 7 2
2 7 7
2 8 2
2 8 8
2 9 2
2 9 9
3 1 1
3 1 3
3 2 2
3 2 3
3 3 1
3 3 2
3 3 4
3 3 5
3 3 6
3 3 7
3 3 8
3 3 9
3 4 3
3 4 4
3 5 3
3 5 5
3 6 3
3 6 6
3 7 3
3 7 7
3 8 3
3 8 8
3 9 3
3 9 9
4 1 1
4 1 4
4 2 2
4 2 4
4 3 3
4 3 4
4 4 1
4 4 2
4 4 3
4 4 5
4 4 6
4 4 7
4 4 8
4 4 9
4 5 4
4 5 5
4 6 4
4 6 6
4 7 4
4 7 7
4 8 4
4 8 8
4 9 4
4 9 9
5 1 1
5 1 5
5 2 2
5 2 5
5 3 3
5 3 5
5 4 4
5 4 5
5 5 1
5 5 2
5 5 3
5 5 4
5 5 6
5 5 7
5 5 8
5 5 9
5 6 5
5 6 6
5 7 5
5 7 7
5 8 5
5 8 8
5 9 5
5 9 9
6 1 1
6 1 6
6 2 2
6 2 6
6 3 3
6 3 6
6 4 4
6 4 6
6 5 5
6 5 6
6 6 1
6 6 2
6 6 3
6 6 4
6 6 5
6 6 7
6 6 8
6 6 9
6 7 6
6 7 7
6 8 6
6 8 8
6 9 6
6 9 9
7 1 1
7 1 7
7 2 2
7 2 7
7 3 3
7 3 7
7 4 4
7 4 7
7 5 5
7 5 7
7 6 6
7 6 7
7 7 1
7 7 2
7 7 3
7 7 4
7 7 5
7 7 6
7 7 8
7 7 9
7 8 7
7 8 8
7 9 7
7 9 9
8 1 1
8 1 8
8 2 2
8 2 8
8 3 3
8 3 8
8 4 4
8 4 8
8 5 5
8 5 8
8 6 6
8 6 8
8 7 7
8 7 8
8 8 1
8 8 2
8 8 3
8 8 4
8 8 5
8 8 6
8 8 7
8 8 9
8 9 8
8 9 9
9 1 1
9 1 9
9 2 2
9 2 9
9 3 3
9 3 9
9 4 4
9 4 9
9 5 5
9 5 9
9 6 6
9 6 9
9 7 7
9 7 9
9 8 8
9 8 9
9 9 1
9 9 2
9 9 3
9 9 4
9 9 5
9 9 6
9 9 7
9 9 8
"""[1:-1].split("\n")
if input() in poors:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//239///F.Sugoroku
	int n,k;
	string s;
	cin>>n>>k>>s;
	s[k-1] = s[k-1]+'a'-'A';
	cout<<s;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

int main() {
   int x, a, b;
   cin >> x >> a >> b;
   //xからaとbを引いてaかbの絶対値が小さい方を出力
   int A = abs(x-a);
   int B = abs(x-b);
   if(A<B)cout << "A" <<endl;
   else cout << "B" <<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  ll L, R;
  cin >> L >> R;
  
  R = min(R,L+4038);
  int ans = 2018;
  for (ll i = L; i <= R-1; i++) {
    for (ll j = i+1; j <= R; j++) {
      int x = i*j%2019;
      ans = min(ans, x);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC029A
{
    class Program
    {
        static void Main(string[] args)
        {
            //var input = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var S = Console.ReadLine();

            long count = 0;
            long lastB = S.Length;
            for (int i = S.Length - 1; i >= 0; i--)
            {
                if (S[i] == 'B')
                {

                    count += lastB - i - 1;
                    lastB--;
                }


            }

            Console.WriteLine(count);
            Console.ReadKey();
        }
    }
}


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

bool PrimeNumber(int x){
    if(x == 0 || x == 1) return false;
    for(int i = 2; i*i <= x; i++){
        if(x%i == 0) return false;
    }
    return true;
}

int main(){
    int n, a, cnt = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        cnt += PrimeNumber(a);
    } 
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    map<char, ll> mp;
    rep(i, N) {
        string s;
        cin >> s;
        if (s[0] == 'M' | s[0] == 'A' | s[0] == 'R' | s[0] == 'C' | s[0] == 'H') {
            mp[s[0]]++;
        }
    }
    ll ans = 0;
    ans += mp['M'] * mp['A'] * mp['R'];
    ans += mp['M'] * mp['A'] * mp['C'];
    ans += mp['M'] * mp['A'] * mp['H'];
    ans += mp['M'] * mp['R'] * mp['C'];
    ans += mp['M'] * mp['R'] * mp['H'];
    ans += mp['M'] * mp['C'] * mp['H'];
    ans += mp['A'] * mp['R'] * mp['C'];
    ans += mp['A'] * mp['R'] * mp['H'];
    ans += mp['A'] * mp['C'] * mp['H'];
    ans += mp['R'] * mp['C'] * mp['H'];
    print(ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define up(j,k,i) for(i=j;i<k;i++)
#define down(j,k,i) for(i=j;i>k;i--)
#define pp(n) printf("%lld\n",n)
#define ps(s) printf("%s",s)
#define is(n) scanf("%lld",&n)
#define ips(n) scanf("%lld",n)
#define ss(s) scanf("%s",s)
#define cool 0
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define f(i) cout<<i<<endl;
#define pll pair<lld,lld> 
#define pi acos(-1)
#ifdef G
#define dg(x) cout<<#x<<' '<<x<<endl;
#define dg2(x,y) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<endl;
#define dg3(x,y,z) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<' '<<#zz<<' '<<zz<<endl;
#else
#define dg(x) ;
#define dg2(x,y) ;
#define dg3(x,y,z) ;
#define dg4(x,y,z,zz) ;
#endif
#define ds(n,m) scanf("%lld %lld",&n,&m)
#define ts(n,m,k) scanf("%lld %lld %lld",&n,&m,&k)
#define yes printf("YES\n")
#define no printf("NO\n")
typedef long double ld;
typedef long long int lld;
using namespace std;
const lld M =1e6+7;
const lld mod=1e9+7;
const lld infi =LLONG_MAX;
lld ans,k,n,x,y,m,mymax=LLONG_MIN,mymin=LLONG_MAX,b,c,z,sum;
lld a[M];
lld cnt[10];
int main()
{
      lld i,j;
        is(n);
        up(1,n+1,i)
        {
          is(a[i]);
          lld temp=a[i]/400;
          if(a[i]>=3200)cnt[8]++;
          else
          cnt[temp]++;
        }
        ans=0;
        up(0,8,i)
        {
          if(cnt[i]!=0)
          {
            ans++;
          }
        }
        lld ans1=ans;
        if(ans==0)
        ans1=1;
         cout<<ans1<<' ';
        ans=ans+cnt[8];
        cout<<ans<<endl;
        return 0;
}

Measured memory_bytes: 256
import java.awt.geom.Point2D;
import java.util.*;

// Foobar Level 4: bringing_a_gun_to_a_guard_fight

public class Main {

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

		int N = in.nextInt();
		int Z = in.nextInt();
		int W = in.nextInt();
		
		int[] a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = in.nextInt();
		}
		
		if (N == 1) {
			System.out.println(Math.abs(a[0] - W));
		} else {
			System.out.println(Math.max(Math.abs(a[N - 1] - a[N - 2]), Math.abs(a[N - 1] - W)));
		}
   }
}

Measured memory_bytes: 29012
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		List<Integer> L = new ArrayList<Integer>();
		for(int i = 0;i < N;i++) {
			L.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		long sum = 0;
		L.sort(Comparator.reverseOrder());

		for(int i = 0;i < N-2;i++) {
			for(int j =i+1;j < N-1;j++){
				for(int k = j+1;k < N;k++) {
					if(L.get(i) <  L.get(j) + L.get(k)) {
						sum++;
					}else {
						break;
					}
				}
			}
		}
		System.out.println(sum);
	}
}

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

using namespace std;

int main(void) {
  int N; long long K; cin >> N >> K;
  vector<long long> Ap, Am, Az;
  for (int i = 0; i < N; i++) {
    long long a; cin >> a;
    if (a > 0) {
      Ap.push_back(a);
    } else if (a < 0) {
      Am.push_back(a);
    } else {
      Az.push_back(a);
    }
  }

  sort(Ap.begin(), Ap.end());
  sort(Am.begin(), Am.end());

  long long pairs_minus = Am.size() * Ap.size();
  long long pairs_plus = Ap.size() * (Ap.size()-1) / 2 + Am.size() * (Am.size()-1) / 2;
  long long pairs_zero = Az.size() * (N-Az.size()) + Az.size() * (Az.size()-1) / 2;

  long long ans = 0;
  if (K <= pairs_minus) {
    long long max = -1;
    long long min = -1000000000000000001LL;
    
    while (max - min != 1) {
      long long bound = (max + min) / 2;
      long long S = 0;
      for (int i = 0; i < Am.size(); i++) {
        int l = 0, r = Ap.size()-1;
        if (Am[i] * Ap[r] > bound) {
          break;
        }
        if (Am[i] * Ap[l] <= bound) {
          S += Ap.size();
          continue;
        }

        while (r - l != 1) {
          if (Am[i] * Ap[(r+l)/2] <= bound) {
            r = (r+l)/2;
          } else {
            l = (r+l)/2;
          }
        }
        S += Ap.size() - r;
      }

      if (S < K) {
        min = bound;
      } else {
        max = bound;
      }
    }

    ans = max;
  } else if (K <= pairs_minus + pairs_zero) {

    ans = 0;
  } else {
    long long max = 1000000000000000000LL;
    long long min = 0;

    while (max - min != 1) {
      long long bound = (max + min) / 2;
      long long S = pairs_minus + pairs_zero;
      for (int i = 0; i < (int)Ap.size()-1; i++) {
        int l = i+1, r = Ap.size()-1;
        if (Ap[i] * Ap[l] > bound) {
          break;
        }
        if (Ap[i] * Ap[r] <= bound) {
          S += Ap.size() - l;
          continue;
        }

        while (r - l != 1) {
          if (Ap[i] * Ap[(r+l)/2] <= bound) {
            l = (r+l)/2;
          } else {
            r = (r+l)/2;
          }
        }
        S += r - i - 1;
      }

      for (int i = (int)Am.size()-1; i > 0; i--) {
        int l = 0, r = i-1;
        if (Am[i] * Am[r] > bound) {
          break;
        }
        if (Am[i] * Am[l] <= bound) {
          S += i;
          continue;
        }

        while (r - l != 1) {
          if (Am[i] * Am[(r+l)/2] <= bound) {
            r = (r+l)/2;
          } else {
            l = (r+l)/2;
          }
        }
        S += i - r;
      }

      if (S < K) {
        min = bound;
      } else {
        max = bound;
      }
    }
    ans = max;
  }

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

Measured memory_bytes: 2548
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <queue>

using namespace std;
using ll=long long;
ll N, Q, S;
vector<ll> A, B, C;

ll cnt[100005];

int main()
{
    cin >> N;
    A.resize(N);
    S = 0;
    for(int i = 0;i < N;i++)
    {
        cin >> A[i];
        cnt[A[i]]++;
        S += A[i];
    }
    cin >> Q;
    B.resize(Q);
    C.resize(Q);
    for(int i = 0;i < Q;i++)
    {
        cin >> B[i];
        cin >> C[i];
    }
    for(int i = 0;i < Q;i++)
    {
        S += cnt[B[i]] * (C[i]-B[i]);
        cnt[C[i]] += cnt[B[i]];
        cnt[B[i]] = 0;
        cout << S << endl;
    }
    return 0;
}

Measured memory_bytes: 6024
import java.io.*;

public class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().split(" ");
		int w = Integer.parseInt(s[0]);
		int h = Integer.parseInt(s[1]);
		int x = Integer.parseInt(s[2]);
		int y = Integer.parseInt(s[3]);
		int r = Integer.parseInt(s[4]);
		
		String result = "Yes";
		
		if(x-r<0||y-r<0)result = "No";
		if(x+r>w||y+r>h)result = "No";
		
		System.out.println(result);
	}
}

Measured memory_bytes: 24388
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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



int main(){

    int n;
    cin >> n;
    ll d[n];
    inrep(n,d);

    ll ans = 0;
    rep(i,0,n-1){
	rep(j,i+1,n){
	    ans += d[i] * d[j];
	}
    }
    P(ans);
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

typedef long long   ll;
typedef long double ld;
const int N  = 5e5+10;
const int M  = 20;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define iceil(n,x)      ((n)+(x)-1)/(x)
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }
ll choose2(ll n)   { ll ans=(n*(n-1))/2; return ans;  }
ll dist2(ll x1,ll y1,ll x2,ll y2){ ll ans=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return ans;}

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

    ll a[n],b[n];
    forn(i,0,n)
    cin>>a[i]>>b[i];

    ll c[n];
    forn(i,0,n)
    {
        c[i]=b[i]-a[i];
    }

    vector<pll>times;
    forn(i,0,n)
    {
        times.pb({b[i],i});
    }

    sort(all(times));
    //reverse(all(times));
    bool isok=1; 
    ll stored=0;
    ll T=0;
    forn(i,0,n) 
    {
       //cout<< times[i].second<<endl;
       if(T+a[times[i].second]<=b[times[i].second])
       {
          T += a[times[i].second];
       }
       else
       isok=0;   
    }

    if(isok)
        cout<<"Yes";
    else
        cout<<"No";

    return 0;
}

Measured memory_bytes: 11120
if __name__ == '__main__':
    N, A = input().split()[0:]
    assert 2<=int(N)<=200
    assert -100<=int(A)<=100

    L = int(A)
    R = int(A)+int(N)-1

    if R <= 0:
        eat = R
    elif L >= 0:
        eat = L
    else:
        eat = 0

    ans = (R+L)*(R-L+1)//2-eat
    print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0 ; i < (n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using p = pair<int, int>;

int tate(vector<vector <int>> & a, int x, int y)
{
    if (y == 0) {
        if (a.at(1).at(x) == 0 && a.at(2).at(x) == 0)    
            return 1;
    }
    else if (y == 1) {
        if (a.at(0).at(x) == 0 && a.at(2).at(x) == 0)
            return 1;
    }
    else {
        if (a.at(0).at(x) == 0 && a.at(1).at(x) == 0)
            return 1;
    }

    return 0;
}

int yoko(vector<vector <int>>& a, int x, int y)
{
    if (x == 0) {
        if (a.at(y).at(1) == 0 && a.at(y).at(2) == 0)
            return 1;
    }
    else if (x == 1) {
        if (a.at(y).at(0) == 0 && a.at(y).at(2) == 0)
            return 1;
    }
    else {
        if (a.at(y).at(0) == 0 && a.at(y).at(1) == 0)
            return 1;
    }

    return 0;
}

int naname(vector<vector <int>>& a, int x, int y)
{
    
    if (a.at(0).at(0) == 0 && a.at(1).at(1) == 0 && a.at(2).at(2) == 0) {       
        return 1;
    }
    else if (a.at(0).at(2) == 0 && a.at(1).at(1) == 0 && a.at(2).at(0) == 0) {
        return 1;
    }

    return 0;
}


int main()
{
    vector<vector <int>> a(3, vector <int>(3));
    rep(i, 3) {
        rep(j, 3) {
            cin >> a.at(i).at(j);
            //cout << a.at(i).at(j) << ' ';
        }
        //cout << endl;
    }

    int n;
    vector<int> b(n);
    cin >> n;
    rep(i, n) {
        cin >> b.at(i);
        //cout << b.at(i) << endl;
    }

    rep(i, 3) {
        rep(j, 3) {
            //選ばれた数とビンゴカードの数字を比較する
            rep(k, n) {
                if (a.at(i).at(j) == b.at(k)) {
                    //そろった数は、ビンゴカード側の数字を0にして目印をつける。
                    a.at(i).at(j) = 0;
                    //cout << "i=" << i << " j=" << j << " a=" << a.at(i).at(j) << endl;
                }
            }
        }
    }


    int ans = 0;
    rep(i, 3) {
        rep(j, 3) {

            if (a.at(i).at(j) == 0) {
                ans = tate(a, j, i);
                if (ans == 1) {
                    cout << "Yes" << endl;
                    return 0;
                }

                ans = yoko(a, j, i);
                if (ans == 1) {
                    cout << "Yes" << endl;
                    return 0;
                }

                ans = naname(a, j, i);
                if (ans == 1) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    if (ans == 0)
        cout << "No" << endl;

    return 0;
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] a = new int[3][n];
        for(int i=0;i<n;i++) {
            for(int j=0;j<3;j++) {
                a[j][i] = sc.nextInt();
            }
        }
        int[] score = new int[n];
        for(int k=0;k<3;k++) {
            for(int i=0;i<n;i++) {
                boolean flag = true;
                for(int j=0;j<n;j++) {
                    if (i == j) {
                        continue;
                    }
                    if (a[k][i] == a[k][j]) {
                        flag = false;
                        break;
                    }
                }
                if (flag) {
                    score[i] += a[k][i];
                }
            }
        }
        for(int i=0;i<n;i++) {
            System.out.println(score[i]);
        }
    }
}

Measured memory_bytes: 20808
N = int(input())
oddNum = set()

for x in list(map(int, input().split())):
    if (x % 2 == 0):
        oddNum.add(x)

for o in oddNum:
    if ((o % 3 != 0) & (o % 5 != 0)):
        print("DENIED")
        exit()

print("APPROVED")

Measured memory_bytes: 3064
import java.util.*;

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

    int n = sc.nextInt();
    int[] p = new int[n];

    for (int i = 0; i < n; i++) {
      p[i] = sc.nextInt();
    }

    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
      if (p[i - 1] < p[i] && p[i] <= p[i + 1]) ans++;
      if (p[i + 1] < p[i] && p[i] <= p[i - 1]) ans++;
    }
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        //Compute c1 = new Compute();//calc
        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();
        //input
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        String s =sc.next();
        String ss[]=new String[n];
        for (int i=0;i<n;++i) ss[i]=s.substring(i,i+1);

        String ans = "";
        for (int i=0;i<n-1;++i)
        {
            if (!ss[i].equals(ss[i+1]))
            {
                ans+=ss[i];
            }
        }

        System.out.println(ans.length()+1);
        sc.close();
    }
}

Measured memory_bytes: 347916
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long int ll;

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

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

    int s, w;
    cin >> s >> w;
    if (w >= s) puts("unsafe");
    else puts("safe");
}




Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;
     
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
     
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll, ll>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


int main () {
  string s;
  cin >> s;
  s[3] = '8';
  cout << s << endl;
}


Measured memory_bytes: 256
// 2011/01/17 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	int cnt[4][2];
	for(int i=0; i<4; i++)
		for(int j=0; j<2; j++)
			cnt[i][j] = 0;

	while(!cin.eof()){
		string str;
		getline(cin, str);
		if(str.empty())
			continue;

		istringstream ist(str);
		double eye[2];
		ist >> eye[0] >> eye[1];

		for(int j=0; j<2; j++)
			if(eye[j]>=1.1)
				cnt[0][j]++;
			else if(eye[j]>=0.6)
				cnt[1][j]++;
			else if(eye[j]>=0.2)
				cnt[2][j]++;
			else
				cnt[3][j]++;
	}

	for(int i=0; i<4; i++)
		cout << cnt[i][0] << ' ' << cnt[i][1] << endl;

	return 0;
}

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

const int MAX_N=100005;
int n;
int a[MAX_N];

int main()
{
	ios::sync_with_stdio(false);
	while(cin>>n){
		int Max=0,Min,mi;
		for(int i=0;i<n;++i)
		{
			cin>>a[i];
			if(Max<a[i])
			{
				mi=i;
				Max=a[i];
			}
			Max=max(Max,a[i]);
		}
		int m1=Max,h1=(Max+1)/2,h2=(Max/2),p=Max;
		for(int i=0;i<n;++i){
			if(m1>=abs(h1-a[i]) && mi!=i){
				m1=abs(h1-a[i]);
				p=a[i];	
//				p=min(p,a[i]);
			}
			if(m1>=abs(h2-a[i])&&mi!=i){
				m1=abs(h2-a[i]);
				p=a[i];
//					p=min(p,a[i]);
			}
		}
//		sort(a,a+n);
//		int k=lower_bound(a,a+n,Max/2)-a;
//		if(a[k-1]+a[k]<Max){
//			p=a[k];
//		}else	p=a[k-1];

		cout<<Max<<" "<<p<<endl;
	}
	
	return 0;
}

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

int gcd(int m, int n) {
  while(n != 0) {
    int r = m % n;
    m = n; n = r;
  }
  return m;
}

int main() {
  int N; cin>>N;
  int A; cin>>A;
  int ans = A;
  for(int i = 2; i <= N; i++) {
    cin>>A;
    ans = gcd(ans, A);
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

set<int> st[28];
int n,q;
string s;

void del(int idx)
{
    for(int i=0; i<26; i++)
    {
        if (st[i].find(idx) != st[i].end())
        {
            st[i].erase(idx);
            return;
        }
    }
}

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

    cin >> n >> s >> q;
    for(int i=0; i<n; i++)
    {
        st[s[i]-'a'].insert(i);
    }

    while(q--)
    {
        int t,l,r,idx;
        char ch;
        cin >> t;
        if (t==1)
        {
            cin >> idx >> ch;
            idx--;
            del(idx);
            st[ch-'a'].insert(idx);
        }
        else
        {
            cin >> l >> r;
            l-- , r--;
            int res=0;
            for(int i=0; i<26; i++)
            {
                auto it = st[i].upper_bound(l-1);
                if (it != st[i].end() && *it <= r) res++;
            }
            cout << res << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 24348
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def concentrate(water, sugar):
    if water+sugar == 0:
        return 0
    else:
        return sugar/(water+sugar)


A, B, C, D, E, F = map(int, input().split())
A *= 100
B *= 100
water_list = set()
sugar_list = set()

max_cont = E/(E+100)

max_water = F//B+1
for i in range(max_water):
    remain = F - B*i
    if remain < 0:
        break
    else:
        j = remain//A
        for k in range(j+1):
            # water_list.append(A*k+B*i)
            water_list.add(A*k+B*i)

max_sugar = F//D+1
for i in range(max_sugar):
    tmp = D*i
    remain = F - tmp
    if remain < 0:
        break
    else:
        j = remain//C
        for k in range(j+1):
            # sugar_list.append(D*i+C*k)
            sugar_list.add(D*i+C*k)

#water_list = sorted(set(water_list))
#sugar_list = sorted(set(sugar_list))
water_list = sorted(list(water_list))
sugar_list = sorted(list(sugar_list))

max_tmp = 0
ans = [0, 0]
for water in water_list:
    for sugar in sugar_list:
        if water+sugar > F:
            break
        else:
            conc = concentrate(water, sugar)
            if conc > max_cont:
                break
            else:
                if max_tmp <= conc:
                    max_tmp = conc
                    ans = [water, sugar]
print(sum(ans), ans[1])


Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC166
{
    class MainClass
    {


        public static void Main(string[] args)
        {
            string s = ReadLine();
            if(s=="ABC"){
                WriteLine("ARC");
            }else{
                WriteLine("ABC");
            }
        }
    }
}


Measured memory_bytes: 25784
import sys
import heapq

def main():
    n=int(input())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))

    h=[]
    for i in range(n):
        if b[i]>a[i]:
            heapq.heappush(h,(b[i]*-1,i))

    loop=0
    idx=0
    while(1):
    #print(b)
        if not h:
            break
        buf,idx=heapq.heappop(h)
        buf=-1*buf

        x=(buf-a[idx])//(b[(idx-1)%n]+b[(idx+1)%n])
        buf-=x*(b[(idx-1)%n]+b[(idx+1)%n])
        loop+=x
        b[idx]=buf
        if x==0:
            #print(b)
            print(-1)
            sys.exit()
        elif buf>a[idx]:
            heapq.heappush(h,(buf*-1,idx))

    print(loop)

if __name__ == '__main__':
    main()

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

int main(){
  string S; cin >> S;
  int N=S.size();
  string S1=S;
  string Sa=S.substr(0,(N-1)/2);
  string Saa=Sa;
  string Sb=S.substr((N-1)/2+1);
  string Sbb=Sb;
  reverse(S1.begin(),S1.end());
  reverse(Saa.begin(),Saa.end());
  reverse(Sbb.begin(),Sbb.end());
  if(S==S1&&Sa==Saa&&Sb==Sbb) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
n=int(input())
j=False
k=-1
for i in range(1,1000):
    if i*(i+1)//2==n:
        j=True
        k=i
if j:
    print("Yes")
    print(k+1)
    res=[[0 for _ in range(k)] for _ in range(k+1)]
    t=1
    for i in range(k):
        for j in range(i,k):
            res[i][j]=t+j
        t+=k-i-1
    res=[[res[i][j] for i in range(k)] for j in range(k)]
    res.insert(0,[0 for _ in range(k)])
    t=1
    for i in range(k):
        for j in range(i,k):
            res[i][j]=t+j
        t+=k-i-1
    for t in res:
        t=list(map(str,t))
        print(str(k)+" "+" ".join(t))
else:
    print("No")

Measured memory_bytes: 47196
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}
func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	H := make([]int, N)
	for i := 0; i < N; i++ {
		var h int
		fmt.Scan(&h)
		H[i] = h
	}
	max := 0
	cnt := 0
	pos := 0
	for pos < N-1 {
		curr := H[pos]
		next := H[pos+1]
		if curr >= next {
			cnt++
		} else {
			if max < cnt {
				max = cnt
			}
			cnt = 0
		}
		pos++
	}
	if max < cnt {
		max = cnt
	}
	fmt.Println(max)
}


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

int main(){
    int h, w, cnt = 0;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            char tmp;
            cin >> tmp;
            if(tmp == '#'){
                cnt++;
            }
        }
    }
    if(cnt == h + w - 1) cout << "Possible" << endl;
    else cout << "Impossible" << endl;

    return 0;
}

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

const int INF = 1000000007;

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

int aans = 0,bans= 0;

int a[9],b[9];
void rec(int i,int asum,int bsum){
  if(i == 9){ // ???????????¶
    if(asum > bsum ) aans++;
    else bans++;
  }
  rep(j,9){
    if(b[j] != INF){
      if(a[i] > b[j]){
	asum += a[i]+b[j];
	int tmp = b[j];	b[j] = INF;
	rec(i+1,asum,bsum);
	b[j] = tmp;
	asum -= a[i]+b[j];
      }
      else{
	bsum += a[i]+b[j];
	int tmp = b[j];	b[j] = INF;
	rec(i+1,asum,bsum);
	b[j] = tmp;
	bsum -= a[i]+b[j];
      }
    }
  }
}

int main(){

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

      rep(i,9){
	cin >> a[i];
      }
      rep(i,9){
	cin >> b[i];
      }
      int x= 1;;
      rep(i,9){
	x *= (i+1);
      }


      aans = 0;bans = 0;
      rec(0,0,0);
      double answer = (double)aans/(double)x;
      printf("%.5lf %.5lf\n",answer,1-answer);
      //      cout <<  <<" "<< (double)bans/(double)x <<endl;

      n--;
    }
  return 0;
}

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

int main(){
  int k;
  cin>>k;
  if(k%2==0){
    cout<<-1;
    return 0;
  }
  if(k%5==0){
    cout<<-1;
    return 0;
  }
  k=k*9;
  if(k%7==0)
    k=k/7;
  int amari=10%k;
  int i;
  for(i=1; ; i++){
    if(amari==1){
      break;
    }else{
      amari=amari*10%k;
    }
  }
  cout<<i<<"\n";
  
  return 0;
}


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

#define debug(x) cout << #x" = " << x;

#define st first
#define nd second

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

const int MAXN = 800 + 10;
const int d[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};

int n, m, K;
char s[MAXN][MAXN];
int dis[MAXN][MAXN];

int main(){
	scanf("%d%d%d", &n, &m, &K);
	int sx, sy;
	for (int i = 1; i <= n; ++i){
		scanf("%s", s[i] + 1);
		for (int j = 1; j <= m; ++j)
			if (s[i][j] == 'S')
				sx = i, sy = j;
	}

	queue<PII> Q;
	Q.emplace(sx, sy);
	dis[sx][sy] = 1;
	while (!Q.empty()){
		int x0 = Q.front().st, y0 = Q.front().nd;
		Q.pop();
		for (int i = 0; i < 4; ++i){
			int x = x0 + d[i][0], y = y0 + d[i][1];
			if (s[x][y] == '.' && !dis[x][y]){
				dis[x][y] = dis[x0][y0] + 1;
				if (dis[x][y] < K + 1)
					Q.emplace(x, y);
			}
		}
	}

	int ans = INT_MAX;
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			if (dis[i][j]){
				int t = min(min(i - 1, n - i), min(j - 1, m - j));
				ans = min(ans, (t + K - 1) / K + 1);
			}
	printf("%d\n", ans);
	return 0;
}


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

int main() {
  int N;
  cin >> N ;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A.at(i);
  int LED = 1;
  vector<int> count(N,0);
  count.at(0) = 1;

  while(1){
     LED = A.at(LED-1);

     if(count.at(LED-1) == 1){
       
       LED = -1;
     	 break;

     }else if(LED == 2){

       LED = 0;
       for (int i = 0; i < N; i++)
        LED += count.at(i);
       //LED++;
       break;

     }else{

       count.at(LED-1) = 1;

     }
  }
  cout << LED << endl;
}


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

using ll=long long;
const ll MOD=1e9+7;
int main(){
    int k,n;
    cin>>n>>k;
    vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));
    dp[0][n]=1;
    for(int i=0;i<n;i++){
        ll sum=0;
        for(int j=n;j>=0;j--){
            if(n-j-1>=i) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
            dp[i+1][j]=(dp[i+1][j]+sum)%MOD;
            sum=(sum+dp[i][j])%MOD;
        }
    }
    
    

    ll res=0;
    for(int i=1;i<=n;i++){
            //cerr<<dp[k][i]<<endl;
        res=(res+dp[k-1][i])%MOD;
    }
    ll w=1;
    for(int i=0;i<n-k-1;i++){
        w<<=1;
        w%=MOD;
    }
    cout<<(res*w)%MOD<<endl;
    
    
    return 0;
}

Measured memory_bytes: 31616
while True:
    a, op, b = input().split()
    if op == "+":
        print(int(a) + int(b))
    elif op == "-":
        print(int(a) - int(b))
    elif op == "*":
        print(int(a) * int(b))
    elif op == "/":
        print(int(a) // int(b))
    else:
        break


Measured memory_bytes: 5596
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	string s;
	cin>>s;
	if(s=="MON")
		cout<<6<<endl;
	else if(s=="TUE")	cout<<5<<endl;
	else if(s=="WED")	cout<<4;
	else if(s=="THU")	cout<<3;
	else if(s=="FRI")	cout<<2;
	else if(s=="SAT")	cout<<1;
	else				cout<<7;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 3564
// atcoder/abc072/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  string s;
  while (cin >> s) {
    for (int i = 0; i < s.size(); i += 2) {
      cout << s[i];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 592