akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func NextIntLine() int {
	integer, e := strconv.Atoi(NextLine()) // 500
	if e != nil {
		panic(e)
	}
	return integer
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func main() {
	var (
		A, B, C, X int
	)

	A = NextIntLine() // 500
	B = NextIntLine() // 100
	C = NextIntLine() // 50
	X = NextIntLine()

	a := min(X/500, A)
	b := min(X/100, B)
	c := min(X/50, C)

	cnt := 0
	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500*i+100*j+50*k == X {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)
}


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

using namespace std;

long long n,q,cnt,mx,a,b,m,temp,c,k;
long long arr[100005];
long long table[100005];
string str;
long long N;

long long solve(int i){
    
    if(i>=N)return 0;

    if(table[i]!=-1) return table[i];

    table[i] =min( abs(arr[i]-arr[i+1])+solve(i+1) , abs(arr[i]-arr[i+2])+solve(i+2));
    return table[i];
}

int main()
{
    cin>>n;
    N=n;
    
    for(int i=0;i<n;i++){
        table[i]=-1;
    }
    
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    arr[n+1]=arr[n-1];
    arr[n]=arr[n-1];
    cout<<solve(0);
    
    return 0;
}


Measured memory_bytes: 4224
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <vector>
typedef long long ll;
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n - 1); i >= 0; --i)
#define mod 100000
#define INF 93193111451418101
#define MIN -933111451418101
using namespace std;
typedef pair<ll, ll> P;

template <typename T, typename U>
typename std::enable_if<std::rank<T>::value == 0>::type fill_all(T &arr,
                                                                 const U &v) {
  arr = v;
}
template <typename ARR, typename U>
typename std::enable_if<std::rank<ARR>::value != 0>::type fill_all(ARR &arr,
                                                                   const U &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------?????°-----------------------//
ll n, yo[114515];
std::vector<ll> a, b, c;
//-------------------??¢??°----------------------//
int main() {
  cin >> n;
  REP(i, n) {
    ll hoge;
    cin >> hoge;
    a.push_back(hoge);
  }
  REP(i, n) {
    ll hoge;
    cin >> hoge;
    b.push_back(hoge);
  }
  REP(i, n) {
    ll hoge;
    cin >> hoge;
    c.push_back(hoge);
  }
  ll cnt = 0;
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  for (ll i = n - 1; i >= 0; i--) {
    yo[i] = yo[i + 1] + n -
            distance(c.begin(), upper_bound(c.begin(), c.end(), b[i]));
  }
  REP(i, n) {
    cnt += yo[distance(b.begin(), upper_bound(b.begin(), b.end(), a[i]))];
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  rep(i,N) cin >> d[i];
  sort(d.begin(), d.end());
  int ans = d[N/2] - d[N/2 - 1];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3268
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if (b % a == 0)
    {
        cout << a + b << endl;
    }
    else
    {
        cout << b - a << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[2]={1,0};
int dy[2]={0,1};

int h,w;
char c[110][110];
int dp[110][110];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
   
  cin >> h >> w;
  rep(i,h){
    rep(j,w){
      cin >> c[i][j];
      dp[i][j]=1e9;
    }
  }
  if(c[0][0]=='.')dp[0][0]=0;
  else dp[0][0]=1;
  rep(i,h){
    rep(j,w){
      rep(k,2){
        int ni=i+dy[k];
        int nj=j+dx[k];
        if(ni>=h ||nj>=w)continue;
        int cnt=0;
        if(c[ni][nj]=='#' && c[i][j]=='.')cnt++;
        chmin(dp[ni][nj],dp[i][j]+cnt);
      }
    }
  }
  
  cout << dp[h-1][w-1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int D, N;
	cin >> D >> N;
	if(N==100) ++N;
	int ans = pow(100, D) * N;
	cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    n %= 10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) cout << "hon" << endl;
    else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
    else cout << "bon" << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;

int main()
{
    ll N, M;
    cin >> N >> M;
    vll A(N), B(N);
    vector<pair<ll, ll>> P(N);
    rep(i, N)
    {
        cin >> A[i] >> B[i];
        P[i] = make_pair(A[i], B[i]);
    }
    sort(all(P));
    ll ans = 0;
    ll num = 0;
    rep(i, N)
    {
        if(num + P[i].second<M)
        {
            ans += P[i].first * P[i].second;
            num += P[i].second;
        }
        else
        {
            int kau = M - num;
            ans += P[i].first * kau;
            break;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3456
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int x = sc.nextInt();
        int[] m = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            m[i] = sc.nextInt();
            sum += m[i];
        }
        Arrays.sort(m);
        x -= sum;
        int ans = n + x / m[0];

        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21460
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read(){
    register int x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

#define int long long
const int maxn = 100;
int n;
int a[maxn];
int dp[maxn][1010], yes[maxn][1100];
signed main() {
	n = read();
	for (int i = 1; i <= n; i++){
		a[i] = read();
	}
	int qian = 1000, gs = 0;
	a[0] = 0x3f3f3f3f3f3f3f3f, a[n + 1] = -1;
	for (int i = 1; i <= n; i++) {
		if (a[i - 1] >= a[i] && a[i] < a[i + 1]) {
			gs += qian / a[i];
			qian %= a[i];
		}
		if (a[i - 1] <= a[i] && a[i] > a[i + 1]) {
			qian += gs * a[i];
			gs = 0;
		}
	}
	cout << qian;
	return 0;
}


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

vector<pair<int,int>>adj[100005];
bool flag=true;
int col[300001],vis[300005];

void dfs(int u,int p,int c)
{
    col[u]=c;
    // cout<<u<<" "<<c<<endl;
    vis[u]=1;
    for(auto v:adj[u])
    {
        int x=v.first;
        int y=v.second;
        if(x==p) continue;
        dfs(x,u,(c+y)%2);


    }

}
int main()
{
    int n;
    cin>>n;
    for(int i=1; i<n; i++)
    {
        int u,v,w;
        cin>>u>>v>>w;
        adj[u].push_back({v,w});
        adj[v].push_back({u,w});
    }
    dfs(1,-1,0);


    for(int i=1; i<=n; i++)
        cout<<col[i]<<endl;
    return 0;

}
/*
ll dfs(ll node,ll c)
{
    vis[node]=1;
    col[node]=c;
    for(ll child:ar[node])
    {
        if(vis[child]==0)
        {
            ll code=dfs(child,c^1);
            if(code==-1)
            {
                return -1;
            }
        }
        else
        {
            if(col[child]==col[node])return -1;
        }
    }
    return 0;
}
*/


Measured memory_bytes: 11848
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;
const ll MOD = 1000000007;

ll factr[2000010];

ll modpow(ll x, ll y) {
	x %= MOD;
	ll ans = 1;
	while (y) {
		if (y & 1)ans *= x;
		y /= 2;
		x *= x;
		ans %= MOD;
		x %= MOD;
	}
	return ans;
}

ll moddiv(ll a, ll b) {
	return a * modpow(b, MOD - 2) % MOD;
}

ll solve(ll X, ll Y) {
	ll ans = 0;
	
	for (ll i = 0;i <= X;i++) {
		ans += moddiv(moddiv(factr[i + Y + 1], factr[i + 1]), factr[Y]);
		ans %= MOD;
	}
	return ans;
}

int main() {
	ll r1, r2, c1, c2;
	cin >> r1 >> c1 >> r2 >> c2;

	factr[0] = 1;
	for (ll i = 1;i < 2000010;i++)factr[i] = factr[i - 1] * i % MOD;

	ll ans = solve(r2, c2) - solve(r2, c1 - 1) - solve(r1 - 1, c2) + solve(r1 - 1, c1 - 1);
	ans %= MOD;
	if (ans < 0)ans += MOD;

	cout << ans << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int

struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<edge>> graph;
const ll MOD = 1000000007;
using namespace std;

int main()
{
  int n;
  cin >> n;
  ll a[100000];
  ll x[100000] = {};
  REP(i, n)
  {
    cin >> a[i];
  }

  REP(i, n)
  {
    x[0] += i % 2 == 1 ? -a[i] : a[i];
  }
  x[0] /= 2;

  FOR(i, 1, n)
  {
    x[i] = a[i - 1] - x[i - 1];
  }

  REP(i, n)
  {
    cout << 2 * x[i];
    if (i != n - 1)
    {
      cout << " ";
    }
  }
  cout << endl;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


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

  cout << (n.find("7") != string::npos ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3604
import Data.Char
main :: IO ()
main = do
    k <- readLn
    mapM_ print $ solve k

sn :: Int -> Int
sn = sum . map digitToInt . show

nDivSn :: Int -> Float
nDivSn n = (fromIntegral n) / (fromIntegral (sn n))

solve :: Int -> [Int]
solve k = take k $ sunuke 0 1

sunuke n diff
    | xf < yf   = x : (sunuke x diff)
    | otherwise = y : (sunuke y (diff*10))
        where x = n + diff
              y = n + diff*10
              xf = nDivSn x
              yf = nDivSn y


Measured memory_bytes: 1020
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {

        Console.WriteLine(Console.ReadLine().Contains("AC") ? "Yes" : "No");

        Console.ReadLine();
    }


    
   

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

    public static int Max(params int[] values)
    {
        var maxes = -1;
        for (int i = 0; i < values.Length; i++)
        {
            maxes = Math.Max(values[i], maxes);
        }
        return maxes;
    }

    #endregion
}



Measured memory_bytes: 13140
#include <iomanip>
#include <random>
#include <time.h>
#include <vector>
#include <queue>
#include <functional>
#include <map>
#include <string>
#include <cstdlib>
#include <typeinfo>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int main() {
	ll s, c;
	cin >> s >> c;
	ll ans = min(s, c / 2);
		c -= 2 * s;
		ans += max(c / 4, 0ll);
		cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    int num = atoi((a+b).c_str());

    for (int i = 1; i <= 1000; i++)
    {
        if (i*i == num)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    
    cout << "No" << endl;
}

Measured memory_bytes: 256
input()
strs = input().split(' ')
nums = [int(i) for i in strs]

ct = 0
b_flag = False
while(1):
  for i, num in enumerate(nums):
    if num % 2 == 0:
      nums[i] = num/2
      continue
    else:
      b_flag = True
      break  
  if b_flag:
    break
  ct += 1
print(ct)
  

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[2][2000];
int dp[2][2000];
signed main(){
	int n;scanf("%d",&n);
	rep(i,2)rep(j,n)scanf("%d",&a[i][j]);
	dp[0][0]=a[0][0];
	rep(i,2)rep(j,n){
		if(i)dp[i][j]=max(dp[i][j],dp[i-1][j]+a[i][j]);
		if(j)dp[i][j]=max(dp[i][j],dp[i][j-1]+a[i][j]);
	}
	cout<<dp[1][n-1]<<endl;
}

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

int main(){
  string s;
  cin >> s;
  int topping, price = 700;
  if(s[0] == 'o') ++topping;
  if(s[1] == 'o') ++topping;
  if(s[2] == 'o') ++topping;
  
  cout << price + 100 * topping << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[3][3],c[3][3]={{0,0,0},{0,0,0},{0,0,0}};
  for(int i=0;i<3;i++)for(int j=0;j<3;j++)cin>>a[i][j];
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    for(int i=0;i<3;i++)for(int j=0;j<3;j++)c[i][j]=(c[i][j]||(b==a[i][j]));
  }
  int f=0;
  for(int i=0;i<3;i++)f=f||(c[i][0]&&c[i][1]&&c[i][2])||(c[0][i]&&c[1][i]&&c[2][i]);
  f=(f||(c[0][0]&&c[1][1]&&c[2][2])||(c[2][0]&&c[1][1]&&c[0][2]));
  cout<<(f?"Yes":"No")<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

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

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

const ll L = 1e5+5;

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

    ll N;
    cin >> N;

    ll cur_min = 1e17;

    ll ans = 0;

    for(ll i=0; i<N; i++)
    {
        ll p;
        cin >> p;

        if(p <= cur_min)
        {
            ans++;
            cur_min = p;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int N[4],i,j,f,A[4]={1,9,7,4};
  scanf("%d %d %d %d",&N[0],&N[1],&N[2],&N[3]);
  f = 0;
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      if(N[i]==A[j]){A[j]=99;f++;break;}
    }
  }
  if(f==4){printf("YES\n");}else{printf("NO\n");}
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                                                  it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;

// →↑←↓
const int dx[] = {1,0,-1,0};
const int dy[] = {0,-1,0,1};


const double EPS = 1e-9;


int main(){
    while(true){
        int n,k;
        cin >> n >> k;
        if(n == 0) break;

        vector<int> C(n);
        for(int i=0;i<n;i++){
            cin >> C[i];
        }

        ll sensei = -1;
        {
            ll now = 1;
            for(int l=0;l<k;l++){
                now *= C[l];
            }
            sensei = max(sensei,now);

            for(int l=k;l<n;l++){
                now /= C[l-k];
                now *= C[l];
                sensei = max(sensei,now);
            }
        }

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

                swap(C[i],C[j]);

                ll now = 1;
                for(int l=0;l<k;l++){
                    now *= C[l];
                }
                maxi = max(maxi,now);

                for(int l=k;l<n;l++){
                    now /= C[l-k];
                    now *= C[l];
                    maxi = max(maxi,now);
                }
                swap(C[i],C[j]);
            }
        }
        if(maxi < sensei){
            cout << "NO GAME" << endl;
        }else{
            cout << maxi - sensei << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1192
from collections import deque


n=int(input())
que_r=deque()

for i in range(n):
    s=input()
    l=len(s)
    if s[0]=="i":
        que_r.appendleft(s[7:])
    elif s[6]==" ":
        try:
            que_r.remove(s[7:])
        except: pass
    elif l>10:
        que_r.popleft()
    elif l>6:
        que_r.pop()

print(*que_r)


Measured memory_bytes: 69732
def min_number_changes_palindrome(input_str):
    first = ""
    second = ""
    half_len = int(len(input_str) / 2)
    first = input_str[:half_len]
    if len(input_str) % 2 == 0:
        second = input_str[half_len:]
    else:
        second = input_str[half_len + 1:]
    second = second[::-1]
    changes_count = 0
    for i in range(0, len(first)):
        if first[i] != second[i]:
            changes_count += 1
    return changes_count

print(min_number_changes_palindrome(input("")))

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<vector>
using namespace std;

int main(){
    int n, k, d[210000], a[210000];
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        d[a[i]]++;
    }
    sort(d, d + n + 1);
    int ans = 0;
    for(int i = 0; i <= n - k; i++) ans += d[i];
    cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1792
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val s = in.next()
  val _x, y = in.next().toInt
  val N = s.length
  var x = _x

  var dir = 0
  var sayuu: List[Int] = Nil
  var updown: List[Int] = Nil

  def calc(com: Char, num: Int): Unit = {
    com match {
      case 'F' =>
        if(dir == 0)
          sayuu = num :: sayuu
        else
          updown = num :: updown
      case 'T' =>
        if(num % 2 == 1)
          dir += 90
        dir %= 180

    }
  }

  var ind = 0
  ////
  breakable {
    while(ind < N) {
      if(s(ind) == 'F') {
        ind += 1
      }
      else
        break
    }
  }

  x -= ind

  while(ind < N) {
    val now = s(ind)
    var r = ind + 1

    breakable {
      while(true) {
        if(r == N || now != s(r)) {
          calc(now, r-ind)
          ind = r
          break
        }
        else {
          r += 1
        }
      }
    }
  }

  var setlr: Set[Int] = Set(0)
  var sumlr = sayuu.sum
  for(e <- sayuu.sorted) {
    var now: Set[Int] = Set()

    for(e2 <- setlr) {
      if(Math.abs(e2 - x) <= sumlr)
        now = now + (e2 + e) + (e2 - e)
    }
    sumlr -= e

    setlr = now
  }

  var setud: Set[Int] = Set(0)
  var sumud = updown.sum
  for(e <- updown.sorted) {
    var now: Set[Int] = Set()

    for(e2 <- setud) {
      if(Math.abs(e2 - y) <= sumud)
        now = now + (e2 + e) + (e2 - e)
    }

    sumud -= e

    setud = now
  }


  if(setlr.contains(x) && setud.contains(y))
    println("Yes")
  else
    println("No")
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 106328
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    vector<int> result1(1010, 0), result2(1010, 0);
    while(getline(cin, s), s != "")
    {
        int idx = -1;
        for(int i = 0; i < s.size(); i++) if(s[i] == ',') idx = i;
        if(idx == -1) break;
        int c = stoi(s.substr(0, idx));
        result1[c]++;
    }
    while(cin >> s)
    {
        int idx = -1;
        for(int i = 0; i < s.size(); i++) if(s[i] == ',') idx = i;
        int c = stoi(s.substr(0, idx));
        result2[c]++;
    }
    for(int i = 0; i < result1.size(); i++)
    {
        if(result1[i] && result2[i]) cout << i << " " << result1[i] + result2[i] << endl;
    }
    return 0;
}




Measured memory_bytes: 3176
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

a,b = LI()
print(str(min(a,b))*max(a,b))

Measured memory_bytes: 5072
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    vector<int>v(n); erep(e,v) cin >> e;
    map<int,int>g,k,rg,rk;
    rep(i,v.size()){
        if(i%2)k[v[i]]++;
        else g[v[i]]++;
    }
    vector<pii>gv,kv;
    for(auto itr : g) gv.push_back(pii(itr.second,itr.first));
    for(auto itr : k) kv.push_back(pii(itr.second,itr.first));
    sort(all(gv),greater<pii>());
    sort(all(kv),greater<pii>());
    if(gv[0].first > kv[0].first or (gv[0].first == kv[0].first and gv.size() > kv.size())){
        if(gv[0].second == kv[0].second){
            cout << n - gv[0].first - (kv.size() == 1 ? 0 : kv[1].first) << endl;
        } else {
            cout << n - gv[0].first - kv[0].first << endl;
        }
    } else{
        if(gv[0].second == kv[0].second){
            cout << n - kv[0].first - (gv.size() == 1 ? 0 : gv[1].first) << endl;
        } else {
            cout << n - kv[0].first - gv[0].first << endl;
        }
    }
    
}





Measured memory_bytes: 9592
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    int b[n];
    long long int A=0, B=0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        A += a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
        B += b[i];
    }
    if(A < B){
        cout << -1 << endl;
        return 0;
    }
    bool flag = true;
    int sub[n];
    int lackCount = 0;
    long long int needPoint = 0;
    for(int i = 0; i < n; i++){
        sub[i] = a[i]-b[i];
        if(a[i] < b[i]){
            needPoint += (b[i]-a[i]);
            lackCount++;
            flag = false;
        }
    }
    if(flag){
        cout << 0 << endl;
        return 0;
    }

    sort(sub, sub+n);
//    cout << lackCount << endl;
//    for(int i = 0; i < n; i++){
//        cout << sub[i] << endl;
//    }
    while(needPoint > 0){
        needPoint -= sub[--n];
        lackCount++;
    }

    cout << lackCount << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>

int bubbleSort(int *,int);

int main(){
  int i=0;
  int j=0;
  int count=0;
  scanf("%d",&i);
  int A[i];
  for(j=0;j<i;j++){
    scanf("%d",&A[j]);
  }
  count=bubbleSort(A,i);
  for(j=0;j<i;j++){
    printf("%d",A[j]);
    if(j!=i-1) printf(" ");
  }
  printf("\n");
  printf("%d",count);
  printf("\n");
  return 0;
}

int bubbleSort(int *A,int N){
  int flag=1;
  int j=0;
  int swapnumber=0;
  int count=0;
  while(flag)
    {
      flag=0;
      for(j=N-1;j>=1;j--)
	{
	  if(A[j]<A[j-1])
	    {
	      swapnumber=A[j];
	      A[j]=A[j-1];
	      A[j-1]=swapnumber;
	      flag =1;
	      count++;
	    }
	}
    }
  return count;
}



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

int main(){
  int n;
  int a[100];

  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=0;i<n-1;i++)
    cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;
  for(int i=1;i<n;i++){
    int v=a[i];
    int j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    for(int i=0;i<n-1;i++)
      cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
  }
}


Measured memory_bytes: 1160
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

ll calc(ll n){
    switch(n % 4){
    case 0:
        return n;
    case 1:
        return 1;
    case 2:
        return n + 1;
    default:
        return 0;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b;
    cin >> a >> b;
    cout << (calc(b) ^ (a ? calc(a - 1) : 0)) << '\n';
}


Measured memory_bytes: 888
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};

ostream& operator << (ostream& os, const mint a) {
    os << a.x;

    return os;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    vll C(N);
    REP(i, N) cin >> C[i];

    sort(ALL(C), greater<>());

    mint ans = 0;
    mint s = 1;
    mint b = 1;
    mint p = mint(4).pow(N);
    REP(i, N) {
        p /= 4;
        mint tmp = p * C[i] * s * mint(2).pow(i + 1);
        ans += tmp;


        if (i > 0) {
            b *= 2;
        }
        s = s * 2 + b;

    }

    print(ans);
    
}


Measured memory_bytes: 4776
from sys import stdin
H,W,D = [int(x) for x in stdin.readline().rstrip().split()]
data = [0]*(H*W+1)
for i in range(H):
    for j,A in enumerate([int(x) for x in stdin.readline().rstrip().split()]):
        data[A] = (i,j)
dp = [0]*(H*W+1)
for j in range(H*W+1):
    if j > D:
        dp[j] = dp[j-D] + abs(data[j][0]-data[j-D][0]) + abs(data[j][1]-data[j-D][1])
Q = int(stdin.readline().rstrip())
for _ in range(Q):
    L,R = [int(x) for x in stdin.readline().rstrip().split()]
    print(dp[R]-dp[L])

Measured memory_bytes: 14500
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int avl = a - b ; 
        if(c>avl)System.out.println(c-avl);
        else
        System.out.println(0);
    }
}


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

int main(){

  string S;
  cin>>S;
	
	
  ll countB=0;
  ll sum=0;
  
  rep(i,S.size()){

    if(S.at(i)=='W')sum+=countB;
    else countB++;
    
  }
  cout<<sum<<endl;
  
  /*
  ll ch=0;
  ll co=0;
  rep(i,S.size()){
    if(S.at(i)=='W'){
      ch+=i+1;
      co++;
    }
  }
  cout<<ch-co*(co+1)/2<<endl;
  */

}


Measured memory_bytes: 640
x, n = map(int, input().split())
a = [int(i) for i in input().split()]
b = [0]*200
for i in range(200):
    b[i] = i
for i in range(len(a)):
    b.remove(a[i])
min = 1000000
ans=0
for i in range(len(b)):
    dist = abs(b[i] - x)
    if min > dist:
        min = dist
        ans = b[i]
print(ans)




Measured memory_bytes: 9080
import java.util.*;

public class Main{

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(), K = sc.nextInt(), X = sc.nextInt(), Y = sc.nextInt();
        
        if (N > K) {
            System.out.println(K*X+(N-K)*Y);
        } else if(N <= K) {
            System.out.println(N*X);
        }

        sc.close();
    }
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 200005;
int a[N];

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a, a + n);
    ll res = a[n-1];
    int j = n - 2;
    for (int i = n - 3, cnt = 0; i >= 0; i--, cnt++) {
        res += a[j];
        if (cnt & 1) j--;
    }
    printf("%lld", res);
    return 0;
}


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#include<cstring>
using namespace std;
int main()
{
//	int t;
//	cin>>t;
// 	while(t--)
//	{
		long long int n,x,t;
		cin>>n>>x>>t;
		long long int i,j;
		if(n>x)
		{
			if(n%x==0)
				i=(n/x)*t;
			else
			{
				i=(n/x)*t;
				i+=t;
			}	
			
		}
		else
		{
			i=t;
		}
		cout<<i;
//	}
}

Measured memory_bytes: 3636
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 111;
     
using namespace std;

int q, n, w, a[maxn], b[maxn], dp[105][maxn], ans;

void solve(){    
	cin >> n >> w;

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

	for (int i = 0; i <= n; i++)
		for (int j = 1e5; j >= 0; j--)
			dp[i][j] = inf;

	dp[0][0] = 0;

	for (int i = 1; i <= n; i++){
		for (int j = 1e5; j >= 0; j--){
			dp[i][j] = dp[i - 1][j];
			if (j - b[i] >= 0)
				dp[i][j] = min(dp[i][j], dp[i - 1][j - b[i]] + a[i]);
			if (dp[i][j] <= w)
				ans = max(ans, j);
		}
		/*for (int j = 1; j <= 20; j++)
			cout << dp[i][j] << " ";
		cout << endl;	*/
		//cout << dp[i][100000] << endl;
	}

	//cout << dp[n][100000] << " ";

	/*for (int i = 0; i <= w; i++)
		cout << dp[i] << " ";
	*/
	cout << ans;
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define LEN(x) ((int)(x).length())

template <typename T>
struct countmap {
    std::map<T, long long> dict;

    countmap() {
        dict = map<T, long long>();
    }

    bool contains(T key) {
        return (dict.find(key) != dict.end());
    }

    long long operator[](T key) {
        if (dict.find(key) != dict.end()) {
            return dict[key];
        } else {
            return 0;
        }
    }

    // key に対応する値があれば inc 増加させる，なければキーを新設して inc をセット
    void incrementFor(T key, long long inc = 1) {
        if (dict.find(key) != dict.end()) {
            dict[key] += inc;
        } else {
            dict.emplace(key, inc);
        }
    }

    // for (auto &p: dict) でループできるように
    auto begin() const {
        return dict.begin();
    }

    auto end() const {
        return dict.end();
    }
};


int main() {
    int n;
    cin >> n;
    auto d = countmap<pair<int, int>>();
    reps(i, n) {
        auto s = to_string(i);
        auto a = s[0];
        auto b = s[LEN(s) - 1];
        d.incrementFor(MP(a, b));
    }
    Int ans = 0;
    for (auto &p : d) {
        auto k = p.F;
        auto v = p.S;
        auto a = k.F;
        auto b = k.S;
        if (a == b) {
            ans += v * v;
        } else if (a < b) {
            ans += 2 * v * d[MP(b, a)];
        }
    }
    PUTS(ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
using namespace std;

int main()
{
    int a,b,i;
    scanf("%d%d",&a,&b);
    int sz[a];
    for(i=0;i<a;i++)
        scanf("%d",&sz[i]);
    sort(sz,sz+a);
    int cnt=1;
    for(i=1;i<a;i++)
    {
        if(sz[i]==sz[0])
            cnt++;
        else
            break;
    }
    a=a-cnt;
    int s=0;
    s=a/(b-1);
    if(a%(b-1))
        s++;
    printf("%d\n",s);
    return 0;
}


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

#define sz(s) (int)(s).size()
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin,(x).end()
#define Sor(x) sort(all(x))
#define REV(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 222222
#define MOD 100000007

using namespace std;

typedef long long ll;
vector <ll> vll;
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}

int a[222222];
int main()
{	
	int m, n;
	cin >> m >> n;
	re(i, n)
		cin >> a[i];
	int ans = 0;
	re(i, n)
		ans += a[i];
	if (ans >= m)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}







	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 640
from collections import Counter
def p_factorization(n):
  p=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      p.append(i)
      n//=i
  if n>1:
    p.append(n)
  return p

n,p=map(int,input().split())
ans=1
for i,j in Counter(p_factorization(p)).items():
  ans*=(i**(j//n) if j//n>0 else 1)
print(ans)

Measured memory_bytes: 3444
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define int long long
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false),cin.tie(nullptr);
#endif
#define ff first
#define ss second
#define endl '\n'
#define all(c) c.begin(),c.end()
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" "; cout<<endl;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int is_square(int n){
   double x=sqrt(n);
   return (x-floor(x)==0);
}
void solve(){
  string a,b,ans;
  cin>>a>>b;
  ans+=a;
  ans+=b;
  cout<<(is_square(stoi(ans))?"Yes":"No")<<endl;
}
int32_t main(){
  IOS;
  solve();
  //debug();
 #ifdef LOCAL_DEFINE
 cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
 #endif	
}


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

int main(){
  int i,j,n,w,h,s,t,wx,hy,map[101][101];
  while(1){
  cin >> n;
  if(n==0)break;
  int datax[501];
  int datay[501];
  cin >> w >> h;
  for(i = 1; i <= n; i++){
    cin >> wx >> hy;
    map[hy][wx]=1;
    datax[i]=wx;
    datay[i]=hy;
  }
  cin >> s >> t;
  int max=-1;
  for(i = 1; i <=h; i++){
    for(j = 1; j <=w; j++){
      int count=0;
      for(int k = 1; k <=n; k++){
	if(datay[k]>=i && datay[k] <i+t){
	  if(datax[k]>=j && datax[k] <j+s){
	    count++;
	    if(max<count)max=count;
	  }
	}
      }
    }
  }
  cout << max << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
  int N; cin >> N;
  vector<int> h(N); cinf(N,h);
  int ans=0;
  while(true){
    if(*max_element(h.begin(),h.end())==0) break;
    int i=0;
    while(i<N){
      if(h[i] ==0) i++;
      else{
        ans++;
        while(i<N && h[i] >0){
          h[i] --;
          i++;
        }
      }
    }
  }
  cout << ans << endl;
}
       

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

INF = 10**18
mod = 10**9+7
# AOJ GRL_1_A Single Sourse Shortest Path
import heapq as hp

N, M = map(int, input().split())
s, t = map(int, input().split())
s -= 1; t -= 1
graph = [[] for _ in range(N)]
for _ in range(M):
    n, m, d = map(int, input().split())
    graph[n-1].append((d, m-1)) 
    graph[m-1].append((d, n-1)) #無向グラフならこれ使う

def dijkstra(s):
    D = [INF for _ in range(N)] # 頂点iへの最短距離がD[i]
    B = [0]*N
    D[s] = 0
    B[s] = 1
    q = [] # しまっていく優先度付きキュー
    hp.heappush(q, (0, s))

    while q:
        nd, np = hp.heappop(q)
        if D[np] < nd:
            continue
        for d, p in graph[np]:
            if D[p] > D[np] + d:
                D[p] = D[np] + d
                B[p] = B[np]
                hp.heappush(q, (D[p], p))
            elif D[p] == D[np] + d:
                B[p] = (B[p] + B[np])%mod
    return D, B

sD, sB = dijkstra(s)
tD, tB = dijkstra(t)

distance = sD[t]

ans = 0
for n in range(N):
    for d, m in graph[n]:
        if sD[n] + d + tD[m] == distance and 2*sD[n] < distance < 2*(sD[n]+d):
            ans = (ans + (sB[n]*tB[m])**2)%mod
    if sD[n] + tD[n] == distance and 2*sD[n] == distance:
        ans = (ans + (sB[n]*tB[n])**2) % mod
ans = (sB[t]*tB[s] - ans) % mod
print(ans)

Measured memory_bytes: 117680
i=list(map(int,input().split()))
i.sort()
j=i[0]
k=i[1]
l=i[2]
a="No"
if j==k:
  if k!=l:
    a="Yes"
  else :
    a="No"
elif k==l:
  a="Yes"
print(a)
    

Measured memory_bytes: 3060