akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;
  cin >> n;
  int a[100001] = {0};
  int q;
  int val;
  ll sum = 0;
  REP(i,n){
    cin >> val;
    sum += val;
    a[val]++;
  }
  cin >> q;
  int b,c;
  REP(i,q){
    cin >> b >> c;
    int cnt = a[b];
    a[b] = 0;
    a[c] += cnt;
    sum = sum + (ll)(c - b)*cnt;
    cout << sum << endl;
  }
  return 0;
}

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

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

const int INF = 100000000;
const double PI=3.14159265358979323846;

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

    vector<int> a(N+1,0);

    for (int j=1; j<=N; j++) {
        int tmp = j;
        for (int i=2;i<=j;i++){
            int cnt = 0;
            while(tmp%i==0) {
                cnt++;
                tmp/=i;
            }
            a[i] += cnt;
        }
    }

    ll ans = 1;
    ll p = pow(10,9)+7;
    for (int i=2; i<=N; i++) {
        if (a[i]!=0) {
            ans*=(a[i]+1);
            //cout << i << " " << a[i] << endl;
            ans %= p;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x,y,X,Y;
  cin>>x>>y>>X>>Y;
  for(int i=0;i<Y-y;i++){
    cout<<"U";
  }
  for(int i=0;i<X-x+1;i++){
    cout<<"R";
  }
  for(int i=0;i<Y-y+1;i++){
    cout<<"D";
  }
  for(int i=0;i<X-x+1;i++){
    cout<<"L";
  }
  cout<<"UL";
  for(int i=0;i<Y-y+1;i++){
    cout<<"U";
  }
  for(int i=0;i<X-x+1;i++){
    cout<<"R";
  }
  for(int i=0;i<Y-y+1;i++){
    cout<<"D";
  }
  for(int i=0;i<X-x;i++){
    cout<<"L";
  }
}

Measured memory_bytes: 256
/*
 * 	If you gave me a chance
 * 		I'll take it
 * 			It's a shot in the dark
 * 				But I will make it:D
 */
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifndef rd
#define endl '\n'
#endif
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=2e18;
const int infi=2e9;
const int mod=1e9+7;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
auto clk=clock();
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

void solve() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c) {
		cout<<"Yes"<<endl;
	} else
		cout<<"No"<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cerr<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////


//long long  Prime[3000000],nPrime;
//long long  mark[10000002];
//
//void seive(long long int n)
//{
//	long long int i,j,limit=sqrt(n*1.0)+2;
//	mark[1]=1;
//	for(i=4; i<=n ;i+=2)
//	mark[i]=1;
//	Prime[nPrime++]=2;
//	for(i=3; i<=n; i+=2)
//	{
//		if(!mark[i])
//		{
//			Prime[nPrime++]=i;
//			if(i<=limit)
//			{
//				for(j=i*i; j<=n ;j+=i*2)
//				{
//					mark[j]=1;
//				}
//			}
//		}
//	}
//}

int main()
{
    FASTIO;

    ll n;

    cin >> n;


    ll count = 0;

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

        ll a;

        cin >> a;

        if(i%2==1 && a%2==1)
        {
            count++;
        }
    }

    cout << count << endl;





    return 0;
}


Measured memory_bytes: 3600
{-# LANGUAGE FlexibleInstances #-}

import Data.List

-- stdin
class In a where stdin :: IO a
instance In [Int] where stdin = map read . words <$> getLine

type N = Int
type ChunkCount = Int

getIndex :: [Int] -> Int
getIndex ns = treeBottom (search ns []) [1..(product ns)]
  where
    -- [3, 2, 1, 4] []                       -> [(2, 4)]
    -- [2, 1, 4]    [(2, 4)]                 -> [(2, 4), (1, 3)]
    -- [1, 4]       [(2, 4), (1, 3)]         -> [(2, 4), (1, 3), (0, 2)]
    -- [4]          [(2, 4), (1, 3), (0, 2)] -> [(2, 4), (1, 3), (0, 2), (0, 1)]
    search :: [Int] -> [(N, ChunkCount)] -> [(N, ChunkCount)]
    search [] acc = acc
    search all@(n:ns) acc = search ns $ acc ++ [(length $ takeWhile (/=n) $ sort all, length all)]

    -- [(2, 4), (1, 3), (0, 2), (0, 1)] [1..24] -> 15
    treeBottom :: [(N, ChunkCount)] -> [Int] -> Int
    treeBottom [] [n] = n
    treeBottom ((n,cc):remains) ns = treeBottom remains $ chunk ns cc !! n
      where
        -- [1, 2, 3, 4, 5, 6] -> [[1, 2], [3, 4], [5, 6]]
        chunk :: [Int] -> ChunkCount -> [[Int]]
        chunk ns n = chunk_ ns (length ns `div` n) []
          where
            chunk_ [] _ acc = acc
            chunk_ ns len acc = chunk_ (drop len ns) len (acc ++ [take len ns])

main = do
    _ <- getLine
    a <- stdin
    b <- stdin

    print $ abs (getIndex a - getIndex b)


Measured memory_bytes: 3452
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <map>
#define mp make_pair
#define pb push_back
#define p push
#define FOR(a,c) for(int a = 0;a<c;a++)
#define ll long long
#define abs(x) (x<0 ? (-x) : x)
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d %d",&a,&b)
#define getIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a,b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a,b) printf("%lld%lld",a,b);
#define SIZE 1000000007
using namespace std;

typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpl;
int gcd(int a, int b){return (a == 0) ? b : gcd(b%a, a);}
/*ios_base::sync_with_stdio(false);cin.tie(0);*/



int main (){
    ios_base::sync_with_stdio(false);cin.tie(0);
    ll n;
    cin >> n;
    vl vec;
    for (int i = 0; i <n ; ++i) {
        ll k;
        cin>>k;
        vec.pb(k);

    }
     sort(vec.begin(),vec.end());
    ll mid = n/2;
    ll res = vec[mid]-vec[mid-1];
    cout << res;



}

Measured memory_bytes: 1400
#include <cstdio>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

char arr[1000000];
int ans[1000000];

int main()
{
	int cur = 0;
	int length;
	long long a = 0;

	scanf("%s", arr);

	length = strlen(arr);

	for (int i = 0; i < length; i++)
	{
		if (arr[i] == '<')
			ans[i + 1] = ans[i] + 1;
	}

	for (int i = length - 1; i >= 0; i--)
	{
		if (arr[i] == '>')
			if (ans[i] < ans[i + 1] + 1)
				ans[i] = ans[i + 1] + 1;
	}

	for (int i = 0; i <= length; i++)
		a += ans[i];

	printf("%lld", a);

	return 0;
}

Measured memory_bytes: 4480
import sys
def divide(p,q):
    a = p*10 // q
    b = p*10 - a*q
    arr1.append(a)
    if b == 0:
        return -1
    elif b in arr2:
        return arr2.index(b)
    else:
        arr2.append(b)
        return divide(b,q)

for line in sys.stdin:
    p,q = map(int, line.split())
    arr1 = []
    arr2 = [p]
    repeat = []
    r = divide(p,q)
    if r == -1:
        print(''.join(map(str, arr1)))
    else:
        for i in range(len(arr1)):
            if i < r:
                repeat.append(' ')
            else:
                repeat.append('^')
        print(''.join(map(str, arr1)))
        print(''.join(repeat))

Measured memory_bytes: 7644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e15;

int main() {
  ll h,n;
  cin >> h >> n;
  vec a(n),b(n);
  for(ll i=0;i<n;i++) cin >> a[i] >> b[i];
  vec dp(h+1,inf);
  dp[0]=0;
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<=h;j++) {
      if(j+a[i]<=h) {
        dp[j+a[i]]=min(dp[j+a[i]],dp[j]+b[i]);
      }
      else {
        dp[h]=min(dp[h],dp[j]+b[i]);
      }
    }
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 384
n = int(input())
B = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i == 0:
        a = B[0]
    elif i == n - 1:
        a = B[-1]
    else:
        a = min(B[i-1], B[i])
    ans += a
print(ans)


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

int main()
{
  int n, k =2;
  cin >> n;
  vector<int> v(n), dp(n, INT_MAX);
  for(int i = 0; i < n; i++)
  {
    cin >> v[i];
  }
  dp[0] = 0;
  for(int i = 1; i < n; i++)
  {
    for(int j = i - 1; abs(i - j) <= k && j >=0; j--)
    {
      if (j >= 0)
      {
        dp[i] = min(dp[j] + abs(v[i] - v[j]), dp[i]);
      }
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <map>
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, a[100], sum = 0;
	cin >> N;
	FOR(i, 0, N) {
		cin >> a[i];
	}
	sort(a, a + N);
	FOR(i, 0, N) {
		if (i % 2 == 0)sum += a[N - i - 1];
		else sum -= a[N - i - 1];
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
package main

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

var (
	rdr   = bufio.NewReaderSize(os.Stdin, 1000000)
	reply string
)

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s); i++ {
		fmt.Printf("x")
	}
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

// ---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

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

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

// ---------------------------------------------------

func yesOrNo(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

func yesorNO(b bool) {
	if b {
		reply = "YES"
		fmt.Println(reply)
		return
	}
	reply = "NO"
	fmt.Println(reply)
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// ?¨??????\???????????????????????????????????????
Scanner sc = new Scanner(System.in);
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for (int i = 0; i < values.length; i++) {
values[i] = i + 1;
}
for (int i = 0; i < n; i++) {
String str = sc.next();
String[] ab = str.split(",");
int a = Integer.parseInt(ab[0]) - 1;
int b = Integer.parseInt(ab[1]) - 1;
// a??¨b????????£???values??????????????????
int tmp = values[a];
            values[a] = values[b];
            values[b] = tmp;
}
// values??????????????????
for(int i=0;i<w;i++){
System.out.println(values[i]);
}
}
}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<long> a(M+1);
  for (int i=0; i<M; i++){
    cin >> a.at(i);
  }
  a[M] = -1;

  long div = 1000000007;

  vector<long> ans(N+1);
  ans[0] = 1;
  int break_counter = 0;
  ans[1] = 1;
  if(a[break_counter] == 1) {
    ans[1] = 0;
    break_counter++;
  }
  ans[2] = ans[0] + ans[1];
  if(a[break_counter] == 2) {
    ans[2] = 0;
    break_counter++;
  }

  for(int i=3; i<N+1; i++) {
    if(a[break_counter] == i){
      ans[i] = 0;
      break_counter++;
    } else {
      ans[i] = ans[i-1] + ans[i-2];
      ans[i] %= div;
    }
  }

  cout << ans[N] <<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>  // ver2.2.8
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define COUNT(a,k) upper_bound(ALL(a),k)-lower_bound(ALL(a),k)
#define BIGGER(a,k) a.end()-upper_bound(ALL(a),k)
#define SMALLER(a,k) lower_bound(ALL(a),k)-a.begin()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define cyes cout<<"yes"<<endl
#define cno cout<<"no"<<endl
#define _ <<' '<<
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){if(!a[lY].empty()){Vout(a[lY]);}else cout<<endl;}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define Verr(a) rep(iZ,0,a.size()-1)cerr<<a[iZ]<<' ';cerr<<a.back()<<endl
#define VVerr(a) rep(J,0,a.size()){if(!a[J].empty()){Verr(a[J]);}else cerr<<'.'<<endl;}
#define VPerr(a) rep(iX,0,a.size())cerr<<a[iX].FI<<' '<<a[iX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void press(auto &v){v.erase(unique(ALL(v)),v.end());}  //  圧縮
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n;
  cin >> n;
  if(n==1){
    cYes;
    cout<<2<<endl<<"1 1"<<endl<<"1 1"<<endl;
    return 0;
  }
  if(n==3){
    cYes;
    cout<<3<<endl<<"2 1 2"<<endl<<"2 2 3"<<endl<<"2 1 3"<<endl;
    return 0;
  }
  int now = 1,ct = 2;
  
  bool ok = false;
  
  while(now < 100010){
    now += ct;
    if(now == n){
      ok = true;
      break;
    }
    ct++;
  }
  cerr<<ok _ ct<<endl;
  if(ok == false) {cNo;return 0;}
  
  VVi ans(ct+1);
  now = 1;
  
  rep(i,0,ct){
    rep(j,i+1,ct+1){
      ans[i].pb(now);
      ans[j].pb(now);
      now++;
    }
  }
  
  //VVerr(ans);
  
  cYes;
  cout<<ct+1<<endl;
  rep(i,0,ct+1){
    cout<<ans[i].size()<<' ';
    Vout(ans[i]);
  }
  return 0;
}

Measured memory_bytes: 3200
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern

let (n, m, k) = Scanf.sscanf (read_line ()) "%d %d %d" @@ fun n m k -> (n, m, k)
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string
let b = read_line () |> split_string ~pattern:" " |> List.map int_of_string

let rec cumulative_sum res = function
  | [] -> List.rev res
  | x :: xs -> cumulative_sum ((List.hd res + x) :: res) xs
let cumulative_sum = cumulative_sum [0]

let sa = cumulative_sum a |> Array.of_list
let sb = cumulative_sum b |> Array.of_list

let rec solve i = function
  | 0 -> (i, 0)
  | j -> if sa.(i) + sb.(j) > k then solve i (j - 1) else (i + j, j)

let () =
  Printf.printf "%d\n" @@ fst 
    @@ Array.fold_left (fun (m, j) i -> 
      if sa.(i) > k then (m, j)
      else let (nm, nj) = solve i j in (max m nm, nj)
    ) (0, m) 
    @@ Array.init (n + 1) @@ fun i -> i

Measured memory_bytes: 46524
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int s,w;
	cin>>s>>w;
	if(w>=s){
		cout<<"unsafe"<<endl;
	}else{
		cout<<"safe"<<endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3640
import math

class Point:
    def __init__(self, num_x, num_y):
        self.x = num_x
        self.y = num_y

def kock(n, p1, p2):
    if n == 0:
        return

    s = Point(0, 0)
    t = Point(0, 0)
    u = Point(0, 0)

    s.x = (2 * p1.x + p2.x) / 3.0
    s.y = (2 * p1.y + p2.y) / 3.0
    t.x = (p1.x + p2.x * 2) / 3.0
    t.y = (p1.y + p2.y * 2) / 3.0
    u.x = (t.x - s.x) * math.cos(math.pi / 3) - (t.y - s.y) * math.sin(math.pi / 3) + s.x
    u.y = (t.x - s.x) * math.sin(math.pi / 3) + (t.y - s.y) * math.cos(math.pi / 3) + s.y

    kock(n - 1, p1, s)
    print "%.8f %.8f" % (s.x, s.y)
    kock(n - 1, s, u)
    print "%.8f %.8f" % (u.x, u.y)
    kock(n - 1, u, t)
    print "%.8f %.8f" % (t.x, t.y)
    kock(n - 1, t, p2)

n = input()

p1 = Point(0, 0)
p2 = Point(100, 0)

print "%.8f %.8f" % (p1.x, p1.y)
kock(n, p1, p2)
print "%.8f %.8f" % (p2.x, p2.y)

Measured memory_bytes: 6592
from operator import itemgetter

N=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))

a=[]
for i in range(N):
    temp = abs(T-h[i]*0.006 - A)
    a.append([i+1,temp])

a = sorted(a,key=itemgetter(1))

print(a[0][0])


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define pb push_back
set<int > se;

int main(){
	int l,r,d;
	cin >> l >> r >> d;

	int count = 0;
	for (int i = l; i<=r; ++i)
	{
		if(i%d==0) count++;
	}

	cout << count << endl;

}

Measured memory_bytes: 3632
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
ll longinf=1ll<<60;
int inf=1<<29;

int N;
string s;
int keta;

int main(){
    cin>>N;
    if(N==0){
        cout<<0<<endl;
        return 0;
    }
    keta=0;
    while(N!=0){
        if(N%2==0){
            s='0'+s;
            N=-N/2;
        }
        else{
            s='1'+s;
            if(keta%2==0){
                N-=1;
            }
            else{
                N+=1;
            }
            N=-N/2;
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
void swap(int* a,int* b){
	int c;
	c=*a;
	*a=*b;
	*b=c;
}
int main(void){
	int i,j,l,N;
	int a[100];
	scanf("%d",&N);
	for(i=0;i<N-1;i++){
		scanf("%d ",&a[i]);
	}
	scanf("%d",&a[N-1]);
	for(l=0;l<N;l++){
		for(j=0;j<N-1;j++){
					printf("%d ",a[j]);
		}
		printf("%d",a[N-1]);
		printf("\n");
		for(i=l;0<=i;i--){
			if(a[i]>a[i+1]){
				swap(&a[i],&a[i+1]);
			}
		}
	}
}

Measured memory_bytes: 2688
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N=scan.nextInt();
		String s=scan.next();
		long K =Long.parseLong(s);

		int[][] ab = new int[N][2];
		for(int i=0;i<N;i++){
			ab[i][0]=scan.nextInt();
			ab[i][1]=scan.nextInt();
		}


		Arrays.sort(ab,new Comparator<int[]>(){
			@Override
			public int compare(int[] o1,int[] o2){
				return o1[0] -o2[0];
			}
		});

		int cnt=0;
		long ans=0;
		while(true){
			long k =ab[cnt][1];
			K-=k;
			if(K<=0){
				ans = ab[cnt][0];
				break;
			}
			cnt++;

		}
		System.out.println(ans);
	}

}


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

int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int i = 0;
  int cnt = 0;
  while (i < n) {
    while (i < n - 1 && s[i] == s[i+1]) {
      ++i;
    }
    ++cnt;
    ++i;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 512
a = int(input())
b = int(input())
c = int(input())
d = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if d == 500*i + 100*j + 50*k:
                count += 1
print(count)

Measured memory_bytes: 3060
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include<stack>
#include<queue>
#include <cassert>
using namespace std;

 
int main(){
    string  s;
    cin >> s;
    if(s == "AAA" || s == "BBB"){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i <= x ; i --) 
using namespace std ;
typedef long long ll ;
typedef pair<int , int> pii ;
const int inf = 0x3f3f3f3f ;
const int maxn = 2005 ;
const int maxm = 5005 ;
typedef pair<int , int> pii ;
int n , x , y ;
int ans[maxn] ;
struct Link
{
	int num , head[maxn] ;
	struct Edge
	{
		int v , w , next ;
	} edge[maxm << 1] ;
	void init()
	{
	    num = 0 ;
	    memset(head , -1 , sizeof(head)) ;
	}
	void add_edge(int u , int v , int w)
	{
		edge[num].v = v ;
		edge[num].w = w ;
		edge[num].next = head[u] ;
		head[u] = num ++ ;	
	} 
} link ;
struct Dij
{
	int dis[maxn] ;
	priority_queue<pii , vector<pii> , greater<pii> > q ;
	void init()
	{
		memset(dis , inf , sizeof(dis)) ;	
	}
	void dijkstra(int s)
	{
		dis[s] = 0 ;
		q.push(make_pair(0 , s)) ;
		while(!q.empty())
		{
			pii p = q.top() ;
			q.pop() ;
			int u = p.second ;
			if(p.first != dis[u])  continue ; //优化，不用旧值更新。
			for(int i = link.head[u] ; i != -1 ; i = link.edge[i].next)
			{
				int v = link.edge[i].v , w = link.edge[i].w ;
				if(dis[v] > dis[u] + w)
				{
					dis[v] = dis[u] + w ;
					q.push(make_pair(dis[v] , v)) ;
				}
			}
		}
	}
	void print()
	{
		rep(i , 1 , n)  ans[dis[i]] ++ ;
	}
} dij[maxn] ;
void solve(int i)
{
	dij[i].init() ;
	dij[i].dijkstra(i) ;
	dij[i].print() ;
}
int main()
{
	link.init() ;
	scanf("%d%d%d" , &n , &x , &y) ;
    rep(i , 1 , n - 1)  link.add_edge(i , i + 1 , 1) , link.add_edge(i + 1 , i , 1) ;
    link.add_edge(x , y , 1) ;
    link.add_edge(y , x , 1) ;
    rep(i , 1 , n)  solve(i) ;
    rep(i , 1 , n - 1)  printf("%d\n" , ans[i] / 2) ;
	return 0 ;	
}

Measured memory_bytes: 16128
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

//Princess in Danger
public class Main{

	int[][] dist, wf;
	int INF = 1<<29, P = 107;
	int N, M, L, K, A, H;
	
	class E{
		int t, d;
		public E(int t, int d) {
			this.t = t;
			this.d = d;
		}
	}
	
	@SuppressWarnings("unchecked")
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			N = sc.nextInt(); M = sc.nextInt(); L = sc.nextInt(); K = sc.nextInt(); A = sc.nextInt(); H = sc.nextInt();
			if((N|M|L|K|A|H)==0)break;
			boolean[] ice = new boolean[N];
			ice[A] = ice[H] = true;
			while(L--!=0)ice[sc.nextInt()] = true;
			List<E>[] es = new ArrayList[N];
			for(int i=0;i<N;i++)es[i]=new ArrayList<E>();
			wf = new int[N][N];
			for(int[]a:wf)Arrays.fill(a, INF);
			while(K--!=0){
				int s = sc.nextInt(), t = sc.nextInt(), d = sc.nextInt();
				wf[s][t] = wf[t][s] = d;
				es[s].add(new E(t, d)); es[t].add(new E(s, d));
			}
			for(int k=0;k<N;k++)for(int i=0;i<N;i++)for(int j=0;j<N;j++)wf[i][j]=Math.min(wf[i][j], wf[i][k]+wf[k][j]);
			dist = new int[N][M+1];
			for(int[]a:dist)Arrays.fill(a, INF);
			for(int i=0;i<=M;i++)dist[A][i] = 0;
			PriorityQueue<Integer> q = new PriorityQueue<Integer>(N, new Comparator<Integer>() {
				public int compare(Integer o1, Integer o2) {
					int a = o1/P, b = o1%P, c = o2/P, d = o2%P;
					return (dist[a][b]+wf[a][H])-(dist[c][d]+wf[c][H]);
				}
			});
			q.add(A*P+M);
			int res = INF;
			while(!q.isEmpty()){
				int v = q.poll();
				int pos = v/P, m = v%P;
				if(pos==H){
					res = dist[pos][m]; break;
				}
				for(E e:es[pos]){
					for(int t=0;t+m<=M;t++){
						if(t>0&&!ice[pos])break;
						int nm = t+m-e.d;
						if(nm<0)continue;
						int w = dist[pos][m]+t+e.d;
						if(w<dist[e.t][nm]){
							q.remove(e.t*P+nm); dist[e.t][nm] = w;
							int r = nm-1;
							while(r>=0&&w<=dist[e.t][r]){
								q.remove(e.t*P+r); dist[e.t][r] = w; r--;
							}
							q.add(e.t*P+nm);
						}
					}
				}
				
			}
			System.out.println(res==INF?"Help!":res);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 16000
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)

int main(){
    string s;
    s.resize(1001);
    cin >> s;
    bool c1=false,c2=false,c3=false,c4=false;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='N') c1 = true;
        else if(s[i]=='W') c2 = true;
        else if(s[i]=='E') c3 = true;
        else if(s[i]=='S') c4 = true;
    }
    if((c1!=c4)||(c2!=c3)) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,k;cin>>a>>b>>k;
    a=a-k;
    if(a<0){
        b=b+a;
        a=0;
    }
    if(b<0)b=0;
    cout<<a<<' '<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100
int main(){
  int n,i,j,k,l,m;
  int graph[N][N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      graph[i][j]=0;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&k,&l);
    k--;
    for(j=0;j<l;j++){
      scanf("%d",&m);
      m--;
      graph[k][m]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j==n-1)printf("%d\n",graph[i][j]);
      else printf("%d ",graph[i][j]);
    }
  }
  return 0;
}



Measured memory_bytes: 2112
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define rs(a, b) ((a) >> (b))
#define ls(a, b) ((a) << (b))
#define gcd __gcd
#define lcm(a, b) ((a * b) / gcd(a, b))
#define pq priority_queue
#define um unordered_map
#define us unordered_set
#define lb lower_bound
#define ub upper_bound
#define F first
#define B begin()
#define E end()
#define ln length()
#define sz size()
#define S second
#define em empty()
#define nani(x) cerr << #x << " is " << x << endl;
#define ch(x) (x - 'a' + 1)
#define mp make_pair
#define pb push_back
#define loop(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define scan(x, n) loop(i, 0, n) cin >> x[i];
#define adde(g, u, v) g[u].pb(v), g[v].pb(u);
#define addew(g, u, v, w) g[u].pb({ v, w }), g[v].pb({ u, w });
#define print(x, n) loop(i, 0, n) cout << x[i] << " ";
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define inf 1000000000
#define mod 1000000007

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef pair<long, long> pll;
typedef vector<ii> vii;
typedef vector<pll> vll;
typedef um<int, int> umii;
typedef um<char, int> umci;
typedef map<char, int> mci;
typedef map<int, int> mii;

int dp[100001][3];
int main()
{
    fast;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, k;
    cin >> n;
    int a[n][3];

    for (int i = 0; i < n; i++)
        cin >> a[i][0] >> a[i][1] >> a[i][2];

    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];

    for (int i = 1; i < n; i++) {
        dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = a[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
    }

    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));

    return 0;
}


Measured memory_bytes: 2560
#if __has_include("noamoa_atcoder_lib.h")
#include "noamoa_atcoder_lib.h"
#else
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) (x).begin(),(x).end()
namespace atcoder {
	using namespace std;
	using ll = long long;
	using intv = vector<int>;
	using charv = vector<char>;
	using boolv = vector<bool>;
	using floatv = vector<float>;
	using doublev = vector<double>;
	using stringv = vector<string>;

	constexpr ll MOD  = 1000000007;
	constexpr ll MOD9 = 1000000009;

	template<typename T>
	void sort(vector<T>& v){
		sort(all(v));
	}
	template<typename T>
	void sortInv(vector<T>& v){
		sort(all(v), greater<T>());
	}

	template<typename T>
	T sum(const vector<T>& v){
		T ret = 0;
		for(const auto& e : v) ret += e;
		return ret;
	}

	template<typename T>
	inline vector<T>& operator+=(vector<T>& v, const T& e){
		v.push_back(e);
		return v;
	}

	template<typename T>
	void in(vector<T>& v){
		for(auto& e : v) cin >> e;
	}

	template<typename T>
	istream& operator>>(istream &stream, vector<T>& v){
		for(auto& e : v) stream >> e;
		return stream;
	}

	template<typename T>
	void out(const vector<T>& v){
		for(const auto& e : v) cout << e << ' ';
		cout << endl;
	}

	template<typename T>
	void outln(const vector<T>& v){
		for(const auto& e : v) cout << e << endl;
	}

	void init(){
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}
using namespace atcoder;
#endif

int main(){
	init();

	int N,M;cin >>N>>M;
	intv A(M);cin>>A;
	if(N-sum(A)>=0)cout<<(N-sum(A));
	else cout <<-1;
}

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

enum Status {
	NONE,
	OPEN,
	CLOSED,
	WALL,
};

struct Cell {
	int x;
	int y;
	Status status;
	int c;
	int h;
	int s;
	Cell *parent;
};

void OpenCell(Cell &cell, Cell *parent) {
	cell.status = OPEN;
	cell.c = parent->c + 1;
	cell.s = cell.c + cell.h;
	cell.parent = parent;
}

void CloseCell(Cell &cell) {
	cell.status = CLOSED;
}

int main(void)
{
	int height, width;
	cin >> height >> width;

	vector <vector<Cell>> maze;
	maze.resize(height);
	for (int i = 0; i < height; i++) {
		maze[i].resize(width);
	}

	// 迷路構築
	int num_space = 0;
	for (int y = 0; y < height; y++) {
		for (int x = 0; x < width; x++) {
			maze[y][x].x = x;
			maze[y][x].y = y;

			char c;
			cin >> c;
			if (c == '.') {
				maze[y][x].status = NONE;
				maze[y][x].h = (width - x) + (height - y);
				num_space++;
			} else {
				maze[y][x].status = WALL;
			}
		}
	}

	// スタート地点を初期化
	maze[0][0].status = CLOSED;
	maze[0][0].h = height + width;
	maze[0][0].c = 0;
	maze[0][0].s = maze[0][0].h + maze[0][0].c;
	maze[0][0].parent = nullptr;

	Cell *current = &maze[0][0];

	vector<Cell*> open;
	while (true) {
		int x = current->x;
		int y = current->y;
		if (x != 0 && maze[y][x - 1].status == NONE) {
			OpenCell(maze[y][x - 1], current);
			open.push_back(&maze[y][x - 1]);
		}
		if (x != (width - 1) && maze[y][x + 1].status == NONE) {
			OpenCell(maze[y][x + 1], current);
			open.push_back(&maze[y][x + 1]);
		}
		if (y != 0 && maze[y - 1][x].status == NONE) {
			OpenCell(maze[y - 1][x], current);
			open.push_back(&maze[y - 1][x]);
		}
		if (y != (height - 1) && maze[y + 1][x].status == NONE) {
			OpenCell(maze[y + 1][x], current);
			open.push_back(&maze[y + 1][x]);
		}

		if (open.size() == 0) {
			cout << -1;
			return 0;
		}

		Cell *next = nullptr;
		auto itr = open.begin();
		auto itr_close = open.begin();
		for (; itr != open.end(); itr++) {
			if (next == nullptr) {
				next = *itr;
				itr_close = itr;
			}
			else if ((*itr)->c < next->c) {
				next = *itr;
				itr_close = itr;
			}
			else if ((*itr)->c == next->c && (*itr)->h < next->h) {
				next = *itr;
				itr_close = itr;
			}
		}

		current = next;
		CloseCell(*current);
		open.erase(itr_close);
		if (current->x == width - 1 && current->y == height - 1) {
			break;
		}
	}

	int cells = 1;
	while (current->parent != nullptr) {
		current = current->parent;
		cells++;
	}

	cout << num_space - cells;

	return 0;
}


Measured memory_bytes: 384
n = int(input())
P = list(map(int, input().split()))
S = [i for i in range(1, n + 1)]
ans = "YES"
if P != S:
  ans = "NO"
  for i in range(n):
    for j in range(i + 1, n):
      P[i], P[j] = P[j], P[i]
      if P == S:
        ans = "YES"
        break
      P[i], P[j] = P[j], P[i]
print(ans)

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

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

    int d, n;
    cin >> d >> n;

    int ans;
    switch(d){
        case 0:
            if(n < 100) ans = n;
            else ans = 101;
            break;
        case 1:
            if(n < 100) ans = n * 100;
            else ans = 10100;
            break;
        case 2:
            if(n < 100) ans = n * 10000;
            else ans = 1010000;
            break;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    b()
}

fun a() {
    when(readLine()) {
        "ABC" -> println("ARC")
        "ARC" -> println("ABC")
        else -> Unit
    }
}

fun b() {
    val (N, K) = readLine()!!.split(" ").map { it.toInt() }.let { it[0] to it[1] }
    val set = (1 .. N).toMutableSet()
    repeat(K) {
        val d = readLine()!!.toInt()
        val As = readLine()!!.split(" ").map { it.toInt() }
        set.removeAll(As)
    }
    println(set.count())
}

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

int main() {
    double d, t, s;
    cin >> d >> t >> s;
    if (t >= d/s) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3716
import scala.io.StdIn.readLine

object Main extends App {
  val Array(w, h, x, y, r) = readLine().split(" ").map { _.toInt }

  val isIn = x + r <= w &&
    x - r >= 0 &&
    y + r <= h &&
    y - r >= 0

  println(if (isIn) "Yes" else "No")
}



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

int main(){
  int D,N;
  cin >>D>>N;
  
  int ans;
  if(D==0){
    if(N==100) ans = 101;
    else ans = N;
  }else if(D==1){
    if(N==100) ans = 10100;
    else ans = N*100;
  }else if(D==2){
    if(N==100) ans = 1010000;
    else ans = N*10000;
  }
  cout <<ans<< endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

map<string,int> note2idx;
const static int idx2dist[] = {1,-1,-2};
const static int offset[] = {11,0,1};
vector<int> stair;
vector<int> song;

bool dfs(int note_pos,int stair_pos){
  if(note_pos == -1 && stair_pos == -1){
    return true;
  }
  else if(stair_pos < 0 || note_pos < 0) return false;

  bool res = false;
  for(int i = 0; i < 3; i++){
    if(song[note_pos] != (stair[stair_pos] + offset[i]) % 12) continue;
    int next = stair_pos + idx2dist[i];
    res |= dfs(note_pos - 1,next);
  }
  return res;
}

int main(){
  int total_test_cases;
  note2idx["C"] = 0;
  note2idx["C#"] = 1;
  note2idx["D"] = 2;
  note2idx["D#"] = 3;
  note2idx["E"] = 4;
  note2idx["F"] = 5;
  note2idx["F#"] = 6;
  note2idx["G"] = 7;
  note2idx["G#"] = 8;
  note2idx["A"] = 9;
  note2idx["A#"] = 10;
  note2idx["B"] = 11;

  while(~scanf("%d",&total_test_cases)){
    for(int test_i = 0; test_i < total_test_cases; test_i++){
      stair.clear();
      song.clear();

      int num_of_steps;
      int song_length;
      scanf("%d %d",&num_of_steps,&song_length);
      for(int i = 0; i < num_of_steps; i++){
        string note;
        cin >> note;
        stair.push_back(note2idx[note]);
      }
      for(int i = 0; i < song_length; i++){
        string note;
        cin >> note;
        song.push_back(note2idx[note]);
      }

      printf("%s\n",(dfs(song.size()-1,stair.size()-2)
                     || dfs(song.size()-1,stair.size()-1)) 
             ? "Yes" : "No");
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,ll> pil;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

namespace io{
    const int L = (1 << 20) + 1;

    char buf[L], *S , *T, c;

    char getchar() {
        if(__builtin_expect(S == T, 0)) {
            T = (S = buf) + fread(buf, 1, L, stdin);
            return (S == T ? EOF : *S++);
        }
        return *S++;
    }

    int inp() {
        int x = 0, f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }

    unsigned inpu()
    {
        unsigned x = 0; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar());
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x;
    }

    ll inp_ll() {
        ll x = 0; int f = 1; char ch;
        for(ch = getchar(); !isdigit(ch); ch = getchar())
            if(ch == '-') f = -1;
        for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
        return x * f;
    }

    char B[25], *outs=B+20, *outr=B+20;
    template<class T>
    inline void print(register T a,register char x=0){
        if(x) *--outs = x, x = 0;

        if(!a)*--outs = '0';
        else
            while(a)
                *--outs = (a % 10) + 48, a /= 10;

        if(x)
            *--outs = x;

        fwrite(outs, outr - outs , 1, stdout);
        outs = outr;
    }
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;
const int maxN = 1e5;
int a[maxN];
int main()
{
	int n = inp();
	int k = inp();
	if(1 + 2*(k-1) <= n)
	{
		puts("YES");
	}
	else
	{
		puts("NO");
	}

	return 0;
}

Measured memory_bytes: 256
using System;using System.Linq;
class A{
static void Main()
{
double s=int.Parse(Console.ReadLine());
double []a=Console.ReadLine().Split().Select(double.Parse).ToArray();
double z=0;
for(int i=0;i<(int)s;i++){z+=a[i];}
double ret = Math.Round((double)z/s, MidpointRounding.AwayFromZero);
int d=(int)ret;
int ans=0;
for(int i=0;i<(int)s;i++)
{//int u=(int)a[i]-d;if(u<0){u*=-1;}
ans+=((int)a[i]-d)*((int)a[i]-d);}
Console.WriteLine(ans);
}}

Measured memory_bytes: 13396
#include <iostream>
#include <cstdlib>
using namespace std;
const int MAX=50;
int main(){
    int n,m,a[MAX],b[MAX],c[MAX],d[MAX],l[MAX];
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>a[i];
        cin>>b[i];
    }
    for(int i=0;i<m;i++){
        cin>>c[i];
        cin>>d[i];
    }
    int min;
    int index;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
         l[j]=abs(a[i]-c[j])+abs(b[i]-d[j]);   
        }
        for(int j=0;j<m;j++){
            if(0==j||min>l[j]){
                min=l[j];
                index=j;
            }
        }
        cout<<index+1<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M; cin>>N>>M;
  vector<vector<bool>>C(N,vector<bool>(N,false));
  for(int i=0;i<M;i++){
    int a,b; cin>>a>>b;
    C[a-1][b-1]=true;
    C[b-1][a-1]=true;
  }
  int count=1;
  for(int i=1;i<N;i++)count*=i;
  int ans=0;
  vector<int>B(N);
  for(int i=0;i<N;i++)B[i]=i+1;
  for(int i=0;i<count;i++){
    for(int j=1;j<N;j++){
      if(!C[B[j]-1][B[j-1]-1])break;
      if(j==N-1)ans++;
    }
    next_permutation(B.begin(),B.end());
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.rbegin(), t.rend());
  if(s < t){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long int t,a,b,k;
    scanf("%lld %lld %lld",&a,&b,&k);
    if(a>=k)
    {
        a-=k;
        printf("%lld %lld",a,b);
        return 0;
    }
    else
    {
        b = b - (k-a);
        if(b<0)
        {
            printf("0 0");
            return 0;
        }
        printf("0 %lld",b);
        return 0;
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  string s,t; cin >> s >> t;
  int cnt = 0;
  if(n == 1){
    if(s.at(0) == t.at(0))
      cout << 1;
    else
      cout << 2;
    return 0;
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n - i; j++){
      if(s.at(i+j) == t.at(j)) cnt++;
     // cout << i << "  " << j << "  " <<s.at(j) << "  " << t.at(j) << "  " << cnt << endl;
    }
    if(cnt == n - i){
      cout << n + i;
      return 0;
    }
    cnt = 0;
  }
  cout << 2 * n;
}

Measured memory_bytes: 3636
n = int(input())
a = list(map(int,input().split()))
a.sort()
a=a[::-1]
ans = 0
if n%2==0:
    k=(n//2)
    ans+=2*sum(a[:k])-a[0]
else:
    k=(n+1)//2
    ans+=2*sum(a[:k])-a[0]-a[k-1]
print(ans)


Measured memory_bytes: 31572
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
    tmp = input()
    if tmp == "AC":
        ac += 1
    elif tmp == "WA":
        wa += 1
    elif tmp == "TLE":
        tle += 1
    else:
        re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))

Measured memory_bytes: 9024
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 100005;
struct Edge{
	int to,next,w;
}e[MAXN<<1];
long long val[MAXN<<1];
int n,m,k,cnt,head[MAXN<<1];
bool vis[MAXN<<1];
inline void insert(int u,int v,int w)
{
	e[++cnt].to=v,e[cnt].next=head[u],head[u]=cnt,e[cnt].w=w;
	e[++cnt].to=u,e[cnt].next=head[v],head[v]=cnt,e[cnt].w=w;
}
long long kn,km;
bool dfs(int x,long long now)
{
	if(vis[x]){
		if(val[x]!=now)return false;
		return true;
	}
	vis[x]=true;
	val[x]=now;
	if(x<=n)kn=min(kn,now);
	else km=min(km,now);
	for(int i=head[x];i;i=e[i].next){
		if(!dfs(e[i].to,e[i].w-now))return false;
	}
	return true;
}
int main()
{
	scanf("%d%d",&n,&m);
	scanf("%d",&k);
	for(int i=1;i<=k;++i){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		insert(u,v+n,w);
	}
	int tot=n+m;
	for(int i=1;i<=tot;++i){
		if(!vis[i]){
			kn=0x3f3f3f3f3f3f3f3f,km=0x3f3f3f3f3f3f3f3f;
			if(!dfs(i,0) || kn+km<0){
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 8192
N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)

th = 10**18

tmp = 1

if A.include?(0)
  puts 0
  exit
end

N.times do |i|
  tmp *= A[i]

  if tmp > th
    puts -1
    exit
  end
end

p tmp


Measured memory_bytes: 23480