akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let s = sc.chars();
    if s[2] == s[3] && s[4] == s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
def read():
    return(list(map(float,input().split(","))))
def triArea(va,vb,vc):
    return(abs((va[0]-vc[0])*(vb[1]-vc[1])-(va[1]-vc[1])*(vb[0]-vc[0]))/2)
v1=read()
va=read()
vb=read()
s=triArea(v1,va,vb)
while 1:
    try:
        va=vb
        vb=read()
        s+=triArea(v1,va,vb)
    except:break
print(s)


Measured memory_bytes: 5588
//shara's here
#include<bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
int main(){
    //costs A, has B, at most C
    q a,b,c,z;
    cin>>a>>b>>c;
    z=a*c;
    if(z-b<=0){cout<<c;}
    else if(z-b>=0&&(b/a)>=1){cout<<b/a;}
    else{cout<<0;}
return 0;}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

def calc(l):
    dp = [[0]*3 for _ in range(len(l)+1)]
    
    for i in range(len(l)):
        dp[i+1][0] = max(dp[i][1], dp[i][2])+(R if l[i]=='s' else 0)
        dp[i+1][1] = max(dp[i][2], dp[i][0])+(S if l[i]=='p' else 0)
        dp[i+1][2] = max(dp[i][0], dp[i][1])+(P if l[i]=='r' else 0)

    return max(dp[-1])
    
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()[:-1]
d = defaultdict(list)

for i in range(N):
    d[i%K].append(T[i])

ans = 0

for i in range(K):
    ans += calc(d[i])

print(ans)

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

int a[100005];

int main()
{
    long long q, h, s, d, n;
    scanf("%lld%lld%lld%lld%lld",&q, &h, &s, &d, &n);

    h = min(h, q * 2);
    s = min(s, h * 2);
    d = min(d, s * 2);
    n *= 4;

    long long ans = 0;
    ans += (n / 8) * d; n %= 8;
    ans += (n / 4) * s; n %= 4;
    ans += (n / 2) * h; n %= 2;
    ans += n * q;
    printf("%lld\n", ans);
}


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

bool is_bipartite (const vector<vector<int>>& g) {
    int n = g.size(), ret = 1;
    struct UnionFind {
        vector<int> data;
        UnionFind(int sz) : data(sz, -1) { }
        bool unite(int x, int y) {
            if ((x = root(x)) == (y = root(y))) { return false; }
            if (data[x] > data[y]) { swap(x, y); }
            data[x] += data[y]; data[y] = x; return true;
        }
        bool same(int x, int y) { return root(x) == root(y); }
        int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
        
    } uf(2*n);
    for (int x = 0; x < n; x++) {
        for (auto& y : g[x]) { uf.unite(x, y+n); uf.unite(x+n, y); }
    }
    for (int x = 0; x < n; x++) if (uf.same(x, x+n)) { ret = 0; break; }
    return ret;
}


int main() {
    const int INF = 1e9;
    int n, ans = -1;
    cin >> n;
    vector<string> s(n);
    vector<vector<int>> g(n);
    vector<vector<int>> d(n, vector<int>(n, INF));
    for (auto& e : s) cin >> e;
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
        if (s[i][j] == '1') { g[i].emplace_back(j);  d[i][j] = 1; }
    }
    
    if (is_bipartite(g)) {
        for (int k = 0; k < n; k++) {
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }
        for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) {
            if (i != j) ans = max(ans, d[i][j] + 1);
        }
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  
  	String S, T, U;
  	S = sc.next();
  	T = sc.next();
  	int A=0, B=0;
  	A = sc.nextInt();
  	B = sc.nextInt();
	U = sc.next();
	
  	if (S.compareTo(U)==0){
      A--;
    }
   if (T.compareTo(U)==0){
      B--;
    }
  
	System.out.println(A + " " + B);
	}
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int a[124][124] = {{}};
int start[124] = {};
int e[124] = {};
int c = 0;
int n;
void dfs(int k){
  if(start[k] != 0) return;
  c++;
  start[k] = c;

  for(int i = 0;i < n;i++){
    if(a[k][i] == 1){
      dfs(i);
    }
  }
  c++;
  e[k] = c;
}
int main(){

  int u,k,x;
  cin >> n;



  for(int i = 0;i < n;i++){
    cin >> u >> k;
    for(int j = 0;j < k;j++){
      cin >> x;
      a[u - 1][x - 1] = 1;
    }
  }


  for(int i = 0;i < n;i++)  dfs(i);

  for(int i = 0;i < n;i++){
    cout << i + 1 << " " << start[i] << " " << e[i] << endl;
  }
}

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

int Exp(long long int exp_n,long long int exp_e, long long exp_mod);


int main(){
  long long int H,W,N;
  
  cin >> H >> W >> N;
  long long int B[N][2], O[10];
  map<pair<long long int,long long int>,int> mp;
  for(int i=0;i<10;i++){
    O[i]=0;
  }
  
  
  for(int i=0;i<N;i++){
    cin >> B[i][0] >> B[i][1];
    B[i][0]--;
    B[i][1]--;
    mp[pair<long long int,long long int>(B[i][0],B[i][1])] = 1;
  }
  
  
  int c= 0;
  int A[5][5];
  for(int i=0;i<N;i++){
    for(int j=0;j<5;j++){
      for(int k=0;k<5;k++){
        A[j][k]=0;
      }
    }
    
    for(int k=0;k<5;k++){
      for(int l=0;l<5;l++){
        A[k][l]=mp[pair<long long int,long long int>(B[i][0]+k-2,B[i][1]+l-2)];
      }
    }
    
    for(int j=max(0,int(2-B[i][0]));j<min(3,int(H-B[i][0]));j++){
      for(int k=max(0,int(2-B[i][1]));k<min(3,int(W-B[i][1]));k++){
        for(int l=0;l<3;l++){
          for(int m=0;m<3;m++){
            if(A[j+l][k+m]==1){
              c++;
            }
          }
        }
        //cout << j << ":" <<k << ":" << c <<endl;
        O[c]++;
        c=0;
      }
    }
  }
  
  
  long long int ans;
  ans = (W-2)*(H-2);
  for(int i=1;i<10;i++){
    O[i] = O[i]/i;
    ans = ans -O[i];
  }
  O[0]=ans;
  for(int i=0;i<10;i++){
    cout << O[i] <<endl;
  }
  
  return 0;
}


int Exp(long long int exp_n,long long int exp_e, long long int exp_mod){
  long long int exp_o = 1;
  long long int exp_x=exp_n;
  long long int exp_tmp;
  
  while(0<exp_e){
    exp_tmp = exp_e/2;
    if(exp_e - exp_tmp*2 == 1){
      exp_o = exp_o*exp_x;
      if(exp_o>exp_mod){
        exp_o=exp_o%exp_mod;
      }
    }
    
    exp_x = exp_x*exp_x;
    if(exp_x>exp_mod){
      exp_x=exp_x%exp_mod;
    }
    exp_e = exp_tmp;
  }
  return exp_o;
}


Measured memory_bytes: 161412
n = int(input())
if n == 1:
    print(1)
    exit()
mod = 10**9+7
ans = {}
ans[2] = 0
for i in range(2,n+1):
    for j in ans.keys():
        while i % j == 0:
            ans[j] += 1
            i //= j
    if i != 1:
        ans[i] = 1
k = 1
for i in ans.values():
    k *= i+1
    k %= mod
print(k)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;
//obj;
class binary{
public:
    bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}
int binary_search(int key,vi a) {
   
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key,a)) ok = mid;
        else ng = mid;
    }
    return ok;
}
}obj;

int main(){
int n;cin>>n;
if(n>=400&&n<=599)cout<<'8'<<endl;
else if(n>=600&&n<=799)cout<<'7'<<endl;
else if(n>=800&&n<=999)cout<<'6'<<endl;
else if(n>=1000&&n<=1199)cout<<'5'<<endl;
else if(n>=1200&&n<=1399)cout<<'4'<<endl;
else if(n>=1400&&n<=1599)cout<<'3'<<endl;
else if(n>=1600&&n<=1799)cout<<'2'<<endl;
else if(n>=1800&&n<=1999)cout<<'1'<<endl;








return 0;

 }


Measured memory_bytes: 3620
import java.util.Scanner;
 
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new aoj230().doIt();
	}
	class aoj230{
		
		void up(int a[],int b[],int a2[],int b2[],int n){
			for(int i = 0;i < n-1;i++){
				if(a[i] == 1 && a[i+1] == 1 && a2[i] == 1){
					a2[i+1] = a2[i];
					a2[i] = 0;
				}
				if(b[i] == 1 && b[i+1] == 1 && b2[i] == 1){
					b2[i+1] = b2[i];
					b2[i] = 0;
				}
			}
		}
		
		void down(int a[],int b[],int a2[],int b2[],int n){
			for(int i = n - 1;i > 0;i--){
				if(a[i] == 2 && a2[i] == 1){
					a2[i-1] = a2[i];
					a2[i] = 0;
				}
				if(b[i] == 2 && b2[i] == 1){
					b2[i - 1] = b2[i];
					b2[i] = 0;
				}
			}
		}
		
		void jump(int a[],int b[],int n){
			int a2[] = new int [n+2];
			int b2[] = new int [n+2];
			for(int i = 0;i < n;i++){
				if(a[i] == 1){
					b2[i] = a[i];
					b2[i+1] = a[i];
					b2[i+2] = a[i];
				}
				if(b[i] == 1){
					a2[i] = b[i];
					a2[i+1] = b[i];
					a2[i+2] = b[i];
				}
			}
			for(int i = 0;i < n;i++){
				a[i] = a2[i];
				b[i] = b2[i];
			}
		}
		
		int tower(int a[],int b[],int n){
			int result = 0;
			int a2[] = new int [n];
			int b2[] = new int [n];
			a2[0] = 1;b2[0] = 1;
//			for(int i = n-1;i >= 0;i--)System.out.println(i+":"+a[i]+" "+b[i]);
//			System.out.println("---------------");
			while(true){
				up(a,b,a2,b2,n);
				down(a,b,a2,b2,n);
				if(a2[n-1] == 1 || b2[n-1] == 1)return result;
				if(result == 1000)break;
//				for(int i = n-1;i >= 0;i--)System.out.println(i+":"+a2[i]+" "+b2[i]);
//				System.out.println("---------------");
				jump(a2,b2,n);
				result++;
			}
			return -1;
		}
		void doIt() {
			while(true){
				int n = sc.nextInt();
				int a[] = new int [n];
				int b[] = new int [n];
				if(n == 0)break;
				for(int i = 0;i < n;i++)a[i] = sc.nextInt();
				for(int i = 0;i < n;i++)b[i] = sc.nextInt();
				int cnt = tower(a,b,n);
				if(cnt != -1)System.out.println(cnt);
				else System.out.println("NA");
			}
		}
	}
}

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

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

Measured memory_bytes: 256
function Main(input){
    input = input.split("\n");
    var mem = input[0].split(" ").map(Number);
    var arr = input[1].split(" ").map(Number);
    var sum = 0;
    for(var i=0;i<arr.length;i++){
        sum += arr[i];
    }
    console.log(sum>mem[0]?"-1":mem[0]-sum);
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 30512
import sys
from itertools import combinations

MOD = 2019


def solve(l, r):
    if l // 673 != r // 673 or l % 673 == 0:
        if l // 3 != r // 3 or l % 3 == 0:
            return 0
    ans = 10000
    for i, j in combinations(range(l, r + 1), 2):
        ans = min(ans, i * j % MOD)
    return ans


def main():
    input = sys.stdin.buffer.readline
    l, r = map(int, input().split())
    print(solve(l, r))


if __name__ == "__main__":
    main()


Measured memory_bytes: 9192
/* Atcoder abc170b
 * See tasks at: https://atcoder.jp/contests/abc170/tasks/abc170_b
 */
#include <bits/stdc++.h>

#define until(symbol, max) for (int symbol = 0; (symbol) < (max); (symbol)++)

using namespace std;
using ll = long long;
int main()
{
    int x, y;
    cin >> x >> y;
    
    if (y % 2 == 0 && 4 * x - y >= 0 && -2 * x + y >= 0)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

bool debug = 0;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n, 0);
    int m = 0;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = n; i > 0; --i) {
        int cnt = 0;
        for (int j = 1; j * i <= n; j++) {
            if (b[j * i - 1] == 1) ++cnt;
        }
        if (a[i - 1] != cnt % 2) {
            b[i - 1] = 1;
            ++m;
        }
    }
    cout << m << endl;
    for (int i = 0; i < n; i++) {
        if (b[i] == 1) cout << i + 1 << " ";
    }
    cout << endl;
}

int main() {
    if (debug) {
        while (true) {
            cout << "********" << endl;
            solve();
        }
    } else {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4736
n = int(input())
l = list(map(int, input().split()))

mod_check=0
mod_check_ =0

for i in l:
    if i % 2 == 0 :
        mod_check += 1
        if i % 3 == 0 or i % 5 == 0:
            mod_check_ += 1
        else:
            pass
    else:
        pass

print('APPROVED') if mod_check==mod_check_ else print('DENIED')


Measured memory_bytes: 9144
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = inl()
b = inl()
ia = ib = 0
for i in range(n):
    if a[i]>b[i]:
        ib += a[i]-b[i]
    elif a[i]<b[i]:
        d = b[i]-a[i]
        if d%2==0:
            ia += d//2
        else:
            ia += (d+1)//2
            ib += 1
print('Yes' if ia>=ib else 'No')


Measured memory_bytes: 40816
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval<newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, t, a;
  cin>>n>>t>>a;
  vi h(n);
  rep(i,n) cin >> h[i];
  double err = 1e+16;
  int ans;
  rep(i,n){
    double avgtmp = t - 0.006 * h[i];
    double erri = abs(a-avgtmp);
    if(erri<err) {err = erri; ans = i+1;}
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<bitset>
#define For(i,a,b) for(register int i=a;i<=b;i++)
using namespace std;
const int maxn=1e5+1000;
int n,m,pos[maxn],x[maxn],cf[maxn],a,s[maxn];
long long ans[maxn],k;
bitset <maxn> vis;
inline void swap(int &a,int &b){int c=a;a=b;b=c;}
signed main(){
	scanf("%d",&n);
	For(i,1,n){
		scanf("%d",&x[i]);
		pos[i]=i;
		cf[i]=x[i]-x[i-1];
	}
	scanf("%d%lld",&m,&k);
	For(i,1,m){
		scanf("%d",&a);
		swap(pos[a],pos[a+1]);
	}
	For(i,1,n){
		if(vis[i]){
			continue ;
		}
		int cnt=0;
		for(int j=i;!vis[j];j=pos[j]) {
			s[++cnt]=j;
			vis[j]=1;
		}
		For(j,1,cnt) {
			ans[s[j]]=1ll*cf[s[(k+j-1)%cnt+1]];
		}
	}
	For(i,1,n){
		ans[i]+=ans[i-1];
		printf("%lld.0\n",ans[i]);
	}
	return 0;
}

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

int main()
{
	int n,a[100],cnt = 0;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];

	for(int i = 0; i < n - 1; i++){
		int min = a[i], ret = i;
		for(int j = i + 1; j < n; j++){
			if(min > a[j]){
				min = a[j]; ret = j;
			}
		}
		if(ret != i) {
			int z = a[i]; a[i] = a[ret]; a[ret] = z;
			cnt++;
		}
	}

	for(int i = 0; i < n - 1 ; i++)
		cout << a[i] <<" ";
	cout << a[n-1] << endl;
	cout << cnt << endl;
}

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


int main()
{
  int a, b;
  cin >> a >> b;

  int sockets = 1;
  int x = 0;
  while (sockets < b)
  {
    sockets += a - 1;
    ++x;
  }
  cout << x << endl;
  return 0;
}

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

class P
{
  static int[] Input(){
    return Console.ReadLine().Split().Select(int.Parse).ToArray();
  }

  static int[][] Input2(int n){
    int[][] X = new int[n][];
    for(int i = 0; i < n; i++){
      X[i] = Input();
    }
    return X;
  }

  static void Main()
  {
    int[] NY = Input();
    for(int i = 0; i <= NY[0]; i++){
      for(int j = 0; j <= NY[0]-i; j++){
        if ((NY[0]-i-j)*1000 + i*5000 + j*10000 == NY[1]){
          Console.WriteLine($"{j} {i} {NY[0]-i-j}");
          return ;
      }
      }
    }
    Console.WriteLine("-1 -1 -1");
  }
}


Measured memory_bytes: 13396
N = int(input())
A =list(map(int, input().split()))

B = [0]*N

for i in range(1,N):
  if A[i] >= A[i-1]:
    B[i] = 0
  if A[i] < A[i-1]:
    num = A[i-1] - A[i]
    B[i] = num
    A[i] = A[i] + num
    
print(sum(B))

Measured memory_bytes: 32060
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var ans = 0;
  for(var i = 0; i < n; i++){
    var x = o.a(1);
    var y = o.a(1);
    if(y === "JPY")ans += +x;
    else ans += +x * 380000;
  }
  return ans;
}

Measured memory_bytes: 21192
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
// #define INF __INT32_MAX__
#define INF 1e9
#define LINF __LONG_LONG_MAX__

typedef pair<int, int> P;

int N;
vector<vi> G;

vi dijkstra(int start) {
    vi d(N, INF);
    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push(P{0, start});
    d[start] = 0;

    while (!pq.empty()) {
        P p = pq.top(); pq.pop();
        int x = p.second;
        if (p.first > d[x]) continue;

        for (int i = 0; i < G[x].size(); i++) {
            int j = G[x][i];
            if (d[j] > d[x] + 1) {
                d[j] = d[x] + 1;
                pq.push(P{d[x] + 1, j});
            }
        }
    }

    return d;
}

int main() {
    cin >> N;
    G.resize(N);
    int X, Y; cin >> X >> Y;
    X--; Y--;

    rep(i, N - 1) {
        G[i].push_back(i + 1);
        G[i + 1].push_back(i);
    }
    G[X].push_back(Y);
    G[Y].push_back(X);

    map<int, int> cnt;
    rep(i, N) {
        vi res = dijkstra(i);

        // rep(i, N) cout << res[i] << " "; cout << endl;

        for (int j = i + 1; j < N; j++) {
            cnt[res[j]]++;
        }
    }

    for (int i = 1; i < N; i++) {
        cout << cnt[i] << endl;
    }
}


Measured memory_bytes: 3840
import java.util.*;
public class Main {
	public static void main(String[] args)
	{
		//変数
		int count=0;
		boolean sw=false;
		double answer=0;
		//String answer="NO";
		//List<Integer> h=new ArrayList<Integer>();
		//int af=Integer.MAX_VALUE;
		double T=0;
		double X=0;
		int max=0;
		int min=0;
		int a=0;
		//int t[]=new int[(int)Math.pow(10,5)];
		
		//入力
		Scanner sc = new Scanner(System.in);
		T=sc.nextDouble();
		X=sc.nextDouble();
		//for(int i=0;i<N;i++)
		//{
		//	t[i]=sc.nextInt();
		//	d[i]=sc.nextInt();
		//}
		//String S=sc.next();
		
		//処理
		answer=T/X;
		// 出力
		//System.out.println(Arrays.deepToString(td));
		System.out.println(answer);
		//System.out.println(max+" "+min);
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;
    ll ans= (n-2)*180;
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string A; cin >> A; long long N = (long long)A.size();
  map<char,long long> mp;
  for(long long i = 0; i < N; i++){
    mp[A[i]]++;} long long res = 0;
  for(auto ne: mp){ res += ne.second*(ne.second-1)/2;}
  res = N*(N-1)/2 - res; cout << res+1 << endl; return 0;}
  

Measured memory_bytes: 640
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let a: i32 = read();
    let b: i32 = read();

    let ans = if a % 2 != b % 2 {
        "IMPOSSIBLE".to_string()
    } else {
        ((a + b) / 2).to_string()
    };

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <stdio.h>


int max(x,y){
  int plus,minus,times;
  plus = x+y;
  minus = x-y;
  times = x*y;

  if(plus > minus){

    if(plus > times){
      return plus;
    }
    else{return times;
    }
  
  }else{

    if(minus < times){
      return times;
    }

    else{return minus;
    }

  }
}

int main(void){
  int A,B,kekka;
  scanf("%d %d",&A,&B);
  kekka = max(A,B);
  printf("%d",kekka);
}

Measured memory_bytes: 128
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main(void){
    int N;
    cin >> N;
    int r = N%10;
    if(r==3) {
        cout << "bon\n";
    } else if (r==0 || r==1 || r==6||r==8) cout << "pon\n";
    else cout << "hon\n";
    return 0;
}

Measured memory_bytes: 3512
n, m, l = gets.split.map{|v|
      v.to_i
}
a = Array.new
b = Array.new
c = Array.new(n){ Array.new(l) }

for i in 1..n
  a[i-1] = gets.split(" ").map(&:to_i)
end

for j in 1..m
  b[j-1] = gets.split(" ").map(&:to_i)
end

o = 0
for i in 1..n
  for j in 1..l
    for k in 1..m
      o += a[i-1][k-1] * b[k-1][j-1]
    end
    c[i-1][j-1] = o
    o = 0
  end
end

for i in 1..n
  for j in 1..l
    print " " unless j == 1
    print c[i-1][j-1]
  end
  print "\n"
end


Measured memory_bytes: 7188
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

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

const ll INF = 1e10;
const ll MOD = 1e9 + 7;



int main(){
	ll n;
	cin >> n;
	vll A;
	ll i, j;
	ll maxA = 0;
	ll minA = INF;
	for (i = 0; i < n; i++){
		ll a;
		cin >> a;
		maxA = max(maxA, a);
		minA = min(minA, a);
		A.push_back(a);
	}
	ll u, d;
	u = maxA;
	d = minA;
	if (maxA % 2 == 0){
		ll ideal = maxA / 2;
		ll dist = abs(ideal - d);
		for (i = 0; i < n; i++){
			if (abs(A[i] - ideal) < dist){
				d = A[i];
				dist = abs(ideal - d);
			}
		}
		cout << u << " " << d << endl;
	}
	else{
		ll ideal_u = (maxA + 1) / 2;
		ll ideal_d = (maxA - 1) / 2;
		ll dist = abs(ideal_u - d);
		for (i = 0; i < n; i++){
			if (abs(A[i] - ideal_u) < dist){
				d = A[i];
				dist = abs(ideal_u - d);
			}
			if (abs(A[i] - ideal_d) < dist){
				d = A[i];
				dist = abs(ideal_d - d);
			}
		}
		cout << u << " " << d << endl;
	}

	return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int w[101];
    fill(w, w+101, 0);
    for (int i = 2; i <= n; i++) {
        int j = 2;
        int t = i;
        while (t > 1) {
            if (t % j == 0) {
                w[j]++;
                t = t / j;
            } else {
                j++;
            }
        }
    }

    int c2=0, c4=0, c14=0, c24=0, c74=0;
    for (int i = 2; i < 101; i++) {
        if (w[i] >= 74) c74++;
        if (w[i] >= 24) c24++;
        if (w[i] >= 14) c14++;
        if (w[i] >= 4)  c4++;
        if (w[i] >= 2)  c2++;
    }

    int ans = 0;
    ans += c74;
    ans += c24 * (c2-1);
    ans += c14 * (c4-1);
    ans += c4 * (c4-1) * (c2-2) / 2;

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
mo = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * (W+1) for _ in range(N+1)]

for i, m in enumerate(mo):
    for j in range(W+1):
        if j < m[1]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-m[1]] + m[0], dp[i+1][j-m[1]] + m[0])
print(dp[N][W])


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

int n;
vector<pii> a;
vector<int> b;
map<pll,int> m;

void nhap()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i)
    {
        int x,y;
        scanf("%d %d",&x,&y);
        a.push_back({x,y});
    }
    sort(a.begin(),a.end());
}

void process()
{
    for (int i=1;i<n;++i)
    {
        for (int j=0;j<i;++j)
        {
            m[{a[j].first-a[i].first,a[j].second-a[i].second}]++;
        }
    }
    if (m.empty())
    {
        cout<<1;
        return;
    }
    for (auto i:m)
    {
        b.push_back(i.second);
    }
    sort(b.begin(),b.end(),greater<int>());
    int s=n;
    for (int i=0;i<b.size();++i)
    {
        s=min(s,n-b[i]);
    }
    cout<<s;
}

int main()
{
    nhap();
    process();
    return 0;
}


Measured memory_bytes: 384
{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.Map.Strict               as M
import           Data.Char


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

isNum :: Int -> Bool
isNum a 
    | a `mod` 5 == 0 = False
    | a `mod` 3 == 0 = False
    | otherwise = True



main = do
    n <- readInt
    print $ sum $ filter (isNum) [1..n]





Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

long long N, dat[100000000];

void init(int n) {
    N = 1;
    while(N < n) N *= 2;
    rep (i, 2 * N - 1) dat[i] = (1LL << 31) - 1;
}

void update(int k, long long v) {
    k += N - 1;
    dat[k] = v;
    while(k > 0) {
        k = (k - 1) / 2;
        dat[k] = min(dat[2 * k + 1], dat[2 * k + 2]);
    }
}

long long query(int a, int b, int k = 0, int l = 0, int r = N) {
    if (b <= l || r <= a) return (1LL << 31) - 1;

    if (a <= l && r <= b) return dat[k];

    long long vl = query(a, b, 2 * k + 1, l, (l + r) / 2),
              vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return min(vl, vr);
}

int main() {
    int q;
    cin >> N >> q;
    init(N);
    while(q--) {
        long long com, x, y;
        cin >> com >> x >> y;
        if (com) {
            cout << query(x, y + 1) << endl;
        }
        else {
            update(x, y);
        }
    }
    return 0;
}


Measured memory_bytes: 5192
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int k, t, amax = 0;
    cin >> k >> t;
    vector<int> a(t);
    for(int i = 0; i < t; i++){
        scanf("%d", &a[i]);
        amax = (amax < a[i] ? a[i] : amax);
    }
    cout << (amax * 2 > k + 1 ? (amax - (k+1)/2 - 1)*2 + 1 : 0) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll INF = 0x1fffffffffffffff;
int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>> z(n);
    for(ll i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        z[i]=make_pair(x,y);
    }
    vector<vector<float>> l(n,vector<float> (n));
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            ll a,b;
            a=z[i].first-z[j].first;
            b=z[i].second-z[j].second;
            l[i][j]=sqrt(a*a+b*b);
        }
    }
    ll m1=1;
    for(ll i=0;i<n;i++)m1*=i+1;
    ll m2;
    m2=(m1*2)/n;
    float ans=0;
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            ans+=(l[i][j]*m2)/m1;
        }
    }
    cout<<setprecision(15)<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k,n;
    cin>>k>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int res=min(a[n-1]-a[0],k-a[1]+a[0]);
    for(int i=1;i<n-1;i++){
        int d1=a[i]-a[i-1],d2=a[i+1]-a[i];
        int l=k-max(d1,d2);
        res=min(res,l);
    }
    res=min(k-a[n-1]+a[n-2],res);
    cout<<res<<endl;
}


Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d %d %d %d", $A, $B, $C, $K);
if($A >= $K){
  echo 1 * $K;
}elseif($A < $K){
  $a = $K - $A;
  if($a <= $B){
   $ans = 1 * $A + 0 * $a;
   echo $ans;
  }elseif($a > $B){
    $b = $a - $B;
    $ans2 =  1 * $A + 0 * $a + (-1 * $b);
    echo $ans2;
  }
}



Measured memory_bytes: 16156
#include<stdio.h>

int search(int A[], int n, int key){
  int i = 0;
  A[n] = key;
  while( A[i] != key) i++;
  return i != n;
}

int main(){
  int i, n, A[10000+1],q,key,sum =0;

  scanf("%d",&n);
  for(i = 0; i < n; i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i = 0; i < q; i++){
    scanf("%d",&key);
    if(search(A, n, key)) sum++;
  }
  printf("%d\n", sum);

  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<math.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
const ll INF=1e9;

main(){
  ll N,K;
  cin >> N >> K;
  ll h[N];
  for(ll ii=0;ii<N;ii++)cin >> h[ii];
  ll dp[N+K+2];
  for(ll ii=0;ii<=N+K;ii++)dp[ii]=INF;
  dp[0]=0;
  for(ll ii=0;ii<=N;ii++){
    for(ll jj=1;jj<=K;jj++){
      dp[ii+jj]=min(dp[ii+jj],dp[ii]+abs(h[ii+jj]-h[ii]));
    }
  }
  //for(ll ii=0;ii<=N;ii++)cout << dp[ii] << endl;
  cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
int W, H;

void setPos(int &x, int &y) {
    if (x < 1) x = 1;
    if (x > H) x = H;
    if (y < 1) y = 1;
    if (y > W) y = W;
}

int main()
{
    int sx, sy, m, dir;
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    char str[8];
    while (1) {
        std::scanf("%d %d", &W, &H);
        if (W == 0 && H == 0) break;
        dir = 0;
        sx = 1, sy = 1;
        while(1) {
            std::scanf("%8s", &str[0]);
            if (str[0] == 'F') {
                std::scanf("%d", &m);
                sx += m * dx[dir], sy += m * dy[dir];
                setPos(sx, sy);
            }
            else if (str[0] == 'B') {
                std::scanf("%d", &m);
                sx += m * dx[(dir+2)%4], sy += m * dy[(dir+2)%4];
                setPos(sx, sy);
            }
            else if (str[0] == 'L') dir = (dir - 1) < 0 ? 3 : dir - 1;
            else if (str[0] == 'R') dir = (dir + 1) % 4;
            else if (str[0] == 'S') { break; }
        }
        std::printf("%d %d\n", sy, sx);
    }
    return 0;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

ll modpow(ll a, ll b, ll m) {
  if (b == 0) return 1;
  ll ret;
  if (b % 2 == 0) {
    ll t = modpow(a, b / 2, m) % m;
    ret = t * t % m;
  } else {
    ll t = modpow(a, (b - 1) / 2, m) % m;
    ret = a * t % m * t % m;
  }
  ret %= m;
  return ret;
}

const ll MOD = 1e9 + 7;
ll n;
vector<vector<ll>> to;
ll s;

ll dfs(ll cv, ll par) {
  ll node = 0;
  FOREACH(nv, to[cv]) {
    if (nv == par) continue;
    ll t = dfs(nv, cv);
    (s += modpow(2, t, MOD)) %= MOD;
    node += t;
  }
  if (node != n - 1) {
    (s += modpow(2, n - 1 - node, MOD)) %= MOD;
  }
  return node + 1;
}

int main() {
  cin >> n;
  to = vector<vector<ll>>(n);
  REP(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  s = 0;
  dfs(0, -1);
  ll ans = n * modpow(2, n - 1, MOD) % MOD + n % MOD + (MOD - 2) % MOD +
           (MOD - s) % MOD;
  ll inv2 = modpow(2, MOD - 2, MOD);
  REP(i, n) { (ans *= inv2) %= MOD; }
  cout << ans << endl;
}

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

int main() {
    vector<int> V(3);
    rep(i, 3){
        cin >> V.at(i);
    }

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

    int X = V.at(2) * 2 - V.at(0) - V.at(1);
    if (X % 2 == 0)cout << X / 2 << endl;
    else cout << (X / 2) + 2 << endl; 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool prime(int a){
	if(a<2)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0) return false;
	}
	return true;
}
int main(){
	ios::sync_with_stdio(false);
	int m,n;
	cin>>n>>m;
	int ans=n;
	if(m<n) ans--;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int isPrime(int);

int main(){
  int i,l,count,a;

  count = 0;
  
  scanf("%d",&l);
  
  for(i = 0; i < l; i++){
    scanf("%d",&a);
    count += isPrime(a);
  }

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

int isPrime(int a){
  int i;
    if(a < 2) return 0;
    else if(a == 2) return 1;
    else if(a % 2 == 0) return 0;
    else {
      for(i = 3; i <= a/i; i += 2)
	if((a % i) == 0) {
	  return 0;
	}
    }
    return 1;
}



Measured memory_bytes: 2088
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n % 2 == 0) {
            System.out.println(n / 2);
        } else {
            System.out.println(n / 2 + 1);
        }
    }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>
using namespace std;

int main() {
	long double x1, y1, x2, y2, x3, y3, x4, y4;
	int n; cin >> n;
	for (; n > 0; n--) {
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;
		if ((x1-x2)*(y3-y4) == (y1-y2) * (x3-x4))
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


Measured memory_bytes: 3016
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma region header
#include <bits/stdc++.h>
#define all(a) begin(a), end(a)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i > -1; i--)
using namespace std;

using vi = vector<int>;

#pragma endregion header

void solve(int N, vi a, vi b) {
  int ans = 0;
  vi t(29, 1), u(29);
  rep(i, 28) t[i + 1] = t[i] << 1;
  rep(i, 29) u[i] = t[i] * 2 - 1;
  rrep(k, 29) {
    rep(i, N) a[i] &= u[k];
    rep(i, N) b[i] &= u[k];
    sort(all(b));
    bool odd = false;
    int t1 = t[k], t2 = t[k] * 2, t3 = t[k] * 3, t4 = t[k] * 4;
    rep(i, N) odd ^= ((lower_bound(all(b), t4 - a[i]) - lower_bound(all(b), t3 - a[i])) ^ (lower_bound(all(b), t2 - a[i]) - lower_bound(all(b), t1 - a[i]))) & 1;
    if(odd) ans += t[k];
  }
  cout << ans << endl;
}


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

  int N;
  cin >> N;
  vi a(N);
  for(int i = 0 ; i < N ; i++){
    cin >> a[i];
  }
  vi b(N);
  for(int i = 0 ; i < N ; i++){
    cin >> b[i];
  }
  solve(N, move(a), move(b));
}
#pragma endregion main


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for(ll i = 0 ; i < n; i++)

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    ll A, B, C ,D;

    cin >> A >> B >> C >> D;

    ll countA = (C+B-1) / B;
    ll countB = (A+D-1) / D;

    if( countA <= countB ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3636
#pragma region template 1.0
#pragma region def
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion enddef

int main()
{
    ll N, K, C;
    cin >> N >> K >> C;
    string S;
    cin >> S;

    C = min(C, N - 1);
    vi dp(N + 1);
    REP(i, C + 1)
    {
        if (S[i] == 'o')
        {
            dp[i + 1] = 1;
        }
        else
        {
            dp[i + 1] = dp[i];
        }
    }
    for (ll i = C + 1; i < N; ++i)
    {
        if (S[i] == 'o')
        {
            dp[i + 1] = 1 + dp[i - C];
        }
        else
        {
            dp[i + 1] = dp[i];
        }
    }
    if (dp[N] > K)
    {
        return 0;
    }
    vi acc(K + 1);
    REP1(i, N)
    {
        if (S[i - 1] == 'o')
        {
            ++acc[dp[i]];
        }
    }
    vector<bool> first(K + 1, true);
    ll i = N;
    vi ans;
    while (i >= 1)
    {
        if (S[i - 1] == 'o' and first[dp[i]])
        {
            first[dp[i]] = false;
            if (acc[dp[i]] == 1)
            {
                ans.push_back(i);
            }
            REP(j, C)
            {
                if (i == 1)
                {
                    break;
                }
                --i;
                if (S[i - 1] == 'o')
                {
                    --acc[dp[i]];
                }
            }
        }
        --i;
    }
    SORT(ans);
    REP(i, ans.size()) { cout << ans[i] << endl; }
}
#pragma endregion template

Measured memory_bytes: 6520
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int N,T,A,point;
  cin >> N >> T >> A;
  double sa,ka=T+1000;
  int H[N+10];
  for(int i=0; i<N; i++){
    cin >> H[i];
  }for(int i=0; i<N; i++){
      sa=T-H[i]*0.006;
      sa=abs(sa-A);
      if(sa<ka){
        point =i;
        ka=sa;
      }
  }cout << point+1 << endl;
}

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

int main() {
    using namespace std;
    long N;
    long X, D;
    cin >> N >> X >> D;
    if(D < 0){
        X += D * (N - 1);
        D *= -1;
    }
    if(D == 0){
        if(X == 0)return 0 & puts("1");
        cout << N + 1 << endl;
        return 0;
    }
    vector<pair<long, pair<long, long>>> p(N + 1UL);
    auto x = (X % D + D) % D;
    for(long i = 0; i <= N; ++i){
        auto t = (x * i) % D;
        auto k = (X * i - t) / D;
        p[i] = {t, {k + i * (i - 1) / 2, k + i * (2 * N - i - 1) / 2 + 1}};
    }
    sort(p.begin(), p.end());
    vector<pair<long, pair<long, long>>> q{{D, {0, 0}}};
    for(const auto& i : p){
        if(i.first != q.back().first)q.push_back(i);
        else if(q.back().second.second >= i.second.first)q.back().second.second = max(q.back().second.second, i.second.second);
        else q.push_back(i);
    }
    long ans{0};
    for(const auto& i : q)ans += i.second.second - i.second.first;
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    while(true){
    ll a,b; char c;
    cin>>a>>c>>b;
    if(c=='+') cout<<a+b<<endl;
    else if(c=='-') cout<<a-b<<endl;
    else if(c=='*') cout<<a*b<<endl;
    else if(c=='/') cout<<a/b<<endl;
    else return 0;
    }
    return 0;
}


Measured memory_bytes: 3072
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
char s[1000111],t[1000111];
int n;
int q[1000111],qb,qe;
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	scanf("%s",t+1);
	int it=n,ans=0,cnt=0;
	for(int i=n;i>=1;i--)
	{
		while(qb<qe&&q[qb]-(qe-qb)==i)qb++;
		it=min(it,i);
		bool flag=0;
		while(it>=1&&s[it]!=t[i])it--,flag=1;
		if(it<1)
		{
			puts("-1");
			return 0;
		}
		if(flag)
		{
			q[qe++]=it;
		}
		ans=max(ans,qe-qb);
//		cerr<<it<<" "<<i<<" "<<cnt<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 6144