akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m, a[100001];

void rf()
{
    ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    cin >> n >> m;
}

void xuli()
{
    ll t = 0;
    for (ll i = 1; i <= m; i++)
    {
        cin >> a[i]; t += a[i];
    }
    ll re = n - t;
    if (re < 0)
    {
        cout << "-1"; return;
    }
    cout << re;
}

int main()
{
    rf(); xuli();
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	ll s; cin >> s;
	ll a = sqrt(s), d = min((ll)(1e9), a + 1); while(a * d < s) a++;
	ll b = 1, c = a * d - s;
	cout << "0 0 " << a << " " << b << " " << c << " " << d << endl;
	dbg(a * d - b * c);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
#include<math.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
    if(x<=599)       cout<<'8'<<endl;
    else if(x<=799)  cout<<'7'<<endl;
    else if(x<=999)  cout<<'6'<<endl;
    else if(x<=1199) cout<<'5'<<endl;
    else if(x<=1399) cout<<'4'<<endl;
    else if(x<=1599) cout<<'3'<<endl;
    else if(x<=1799) cout<<'2'<<endl;
    else cout<<'1'<<endl;
    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, M;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M;
    if(N & 1){
        for(int i = 0; i < M; i++){
            cout << i + 1 << " " << N - i << endl;
        }
    }else{
        for(int i = 0; i + 1 < M; i++){
            if(N - 2 * i - 1 <= N / 2) cout << i + 1 << " " << N - i - 1 << endl;
            else cout << i + 1 << " " << N - i << endl;
        }
        if(N != 4) cout << M << " " << M + 2 << endl;
        else cout << 1 << " " << 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		//??°????????????
		String line = sc.nextLine();
		String[] list = line.split(" ");

		//???????????????????????£?¨?
				int[] dice = new  int[6];
				//????????????????????????????´?
				for(int i = 0; i<list.length; i++){
					dice[i] = Integer.parseInt(list[i]);
					//System.out.println(dice[i]);
				}

		//??????????????????
		String operation  = sc.next();

		//????????????1?????????
		int Top =0;
		char ch = ' ';
		for(int j = 0; j<operation.length(); j++){
			ch = operation.charAt(j);
			Top = roll(ch , dice);
			//System.out.print(Top);
		}
		System.out.println(Top);
	}

		public static  int roll(char ch , int[] dice){
			//?????????????????¢??????
			int temp;
			switch(ch){
				case'N':
					temp = dice[0];
					dice[0]= dice[1];
					dice[1]=dice[5];
					dice[5]= dice[4];
					dice[4] = temp;
					break;
				case'W':
					temp = dice[0];
					dice[0]= dice[2];
					dice[2]= dice[5];
					dice[5]= dice[3];
					dice[3]= temp;
					break;
				case'E':
					temp = dice[0];
					dice[0]= dice[3];
					dice[3]= dice[5];
					dice[5]= dice[2];
					dice[2]= temp;
					break;
				case'S':
					temp = dice[0];
					dice[0]= dice[4];
					dice[4]= dice[5];
					dice[5]= dice[1];
					dice[1]= temp;
					break;
			}
			return dice[0];
		}
}

Measured memory_bytes: 26124
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

int n, m;
vector< vector<int> > s;
vector<int> p, k;

int ans;

void dfs(vector<int> &A){
    if(A.size() == n){
        bool exist = true;
        REP(i,m){  
            int ctr = 0;
            REP(j, k[i]){
                if(A[s[i][j]-1] == 1) ctr++;
            }
            if(ctr % 2 != p[i]) exist = false;
        }
        if(exist) ans += 1;
        return;
    }

    int tmp = 0;
    for(int bit = 0; bit <= 1; bit++){
        A.push_back(bit);
        dfs(A);
        A.pop_back();
    }
}

int main(void){
    cin >> n >> m;
    s.resize(m);
    p.resize(m);
    k.resize(n);
    REP(i,m){
        int a;
        cin >> a;
        k[i] = a;
        s[i].resize(a);
        REP(j,a) cin >> s[i][j];
    }

    REP(i,m) cin >> p[i];

    vector<int> A;
    dfs(A);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
import scala.io.{StdIn => in}

object Main extends App {
  val n = in.readInt
  val a = in.readLine.split(" ").map(_.toInt).sorted

  // def fact(n:Int):Int = {
  //   if(n == 1) 1
  //   else  n * fact(n-1)
  // }
  val p = a.last
  val d = a./:(Int.MaxValue, -1) {
    case ((min,r),i) => {
      val x = (i - (p-i)).abs
      if(x < min) (x, i)
      else (min, r)
    }
  }._2
  println(p + " " + d)
}

Measured memory_bytes: 47156
#include <iostream>
#include <array>

int main() {
    using rooms_t = std::array<int,10>;
    using floors_t = std::array<rooms_t,3>;
    using buildings_t = std::array<floors_t,4>;
    buildings_t buildings{};
    int n{};
    std::cin >> n;
    for(auto i=0; i<n; i++) {
        int b,f,r,v;
        std::cin >> b >> f >> r >> v;
        buildings[b-1][f-1][r-1] += v;
    }
    std::string hr(20, '#');
    for(auto i=0; i<4; i++) {
        for(auto j=0; j<3; j++) {
            std::cout << " ";
            for(auto k=0; k<9; k++) {
                std::cout << buildings[i][j][k] << " ";
            }
            std::cout << buildings[i][j][9] << std::endl;
        }
        if(i<3) std::cout << hr << std::endl;
    }
}



Measured memory_bytes: 3148
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define IFOR(i, a, b) for (int(i) = (a); (i) <= (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) >= (b); (i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    REP(i, n) { cin >> a[i]; }
    REP(i, n) { cin >> b[i]; }

    int ans = -1;
    RFOR(bit, (1 << n) - 1, 0) {
        vector<int> hanten(n, 0);
        REP(i, n)
        if ((bit >> i) & 1)
            hanten[i] = 1;
        vector<pii> newa(n);
        REP(i, n) {
            if (hanten[i] == 0)
                newa[i] = {a[i], i};
            else
                newa[i] = {b[i], i};
        }
        sort(newa.begin(), newa.end());

        bool ok = true;
        REP(i, n) {
            if (abs(newa[i].second - i) % 2 != hanten[newa[i].second]) {
                if (i == n-1 || newa[i].first != newa[i+1].first){
                    ok = false;
                    break;
                }
                else{
                    int j = i + 1;
                    int before = newa[i].second;

                    while(j < n && newa[j].first == newa[i].first && abs(newa[j].second - i) % 2 != hanten[newa[j].second]){
                        int tmp = newa[j].second;
                        newa[j].second = before;
                        before = tmp;
                        j++;
                    }
                    if(j == n || newa[i].first != newa[j].first){
                        ok = false;
                        break;
                    }
                    else{
                        newa[i] = newa[j];
                        newa[j].second = before;
                    }
                }
            }
        }
        if(!ok)
            continue;

        int cnt = 0;
        vector<int> to_sort(n);
        REP(i, n){
            to_sort[newa[i].second] = i;
        }
        // バブルソート
        REP(i, n - 1) {
            RFOR(j, n - 1, i+1) {
                if (to_sort[j] < to_sort[j - 1]) {
                    swap(to_sort[j], to_sort[j - 1]);
                    cnt++;
                }
            }
        }
        if(ans == -1)
            ans = cnt;
        else
            ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int n;
int a[123456];
vector<int>cas;

int main()
{
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", a + i);
		a[i] = a[i] ^ (i % 2);
	}
	int count = 1;
	for (int i = 1; i < n; ++i)
	{
		if (a[i - 1] != a[i])
		{
			cas.push_back(count);
			count = 0;
		}
		++count;
	}
	cas.push_back(count);
	int answer = 0;
	switch (cas.size())
	{
	case 1:answer = cas[0]; break;
	case 2:answer = cas[0] + cas[1]; break;
	default:
		for (int i = 2; i < cas.size(); ++i)
		{
			answer = max(answer, cas[i - 2] + cas[i - 1] + cas[i]);
		}
		break;
	}
	printf("%d\n", answer);
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#define REP(i, x, n) for(lli i = x; i < (lli)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> Pii;
const int INF = 193499;
int main(){
    // vector
    // vc.push_buck(x)
    // sort(vc.begin(),vc.end())
    // vc[i]
    vector<int> vc;
    // 
    lli n;
    
    cin >> n;
    lli f[n];
    rep(i,n){
        cin >> f[i];
    }
    lli dp[61];
    rep(i,61) dp[i] = 0;
    lli ans;
    ans = 0;
    rep(i,n){
        rep(j,60){
            if(f[i]&(1ll << 0)) dp[j] += 1;
            f[i] = f[i]>>1;
        }
    }
    lli k = 1000000007;
    lli t;
    rep(i,60){
      
        if (dp[i] != 0) {
            
            t = (1ll<<i) % k;

            ans = (ans + (((t*dp[i]))%k)*(n-dp[i])) % k ;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define PI atan(1)*4
typedef long long int ll;
using namespace std;
int main(){
	io;
    double r;
    scanf("%lf",&r);
    double ans = 2*PI*r;
    printf("%.20f",ans);
    return 0;
} 

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

#define int long long

template<typename T,T MOD,T B>
struct RollingHash{
  vector<T> hash,p;
  RollingHash(){}
  RollingHash(const string &s){
    int n=s.size();
    hash.assign(n+1,0);
    p.assign(n+1,1);
    for(int i=0;i<n;i++){
      hash[i+1]=(hash[i]*B+s[i])%MOD;
      p[i+1]=p[i]*B%MOD;
    }
  }
  //S[l, r)
  T find(int l,int r){
    T res=hash[r]+MOD-hash[l]*p[r-l]%MOD;
    return res>=MOD?res-MOD:res;
  }
};

using ll = long long;
const ll MOD = 1e9+7;
const ll B = 1777771;

string s, t;
int n, m;

const int MOD2 = 1e9+9;

bool check(int k) {
  int x = 2000000/n;
  string S = "", T = "";
  for ( int i = 0; i < x; i++ ) S += s;
  for ( int i = 0; i < k; i++ ) T += t;

  using RH = RollingHash<ll, MOD, B>;
  RH rt(S),rp(T);
  for(int i=0;i<(int)S.size()-(int)T.size()+1;i++){
    if(rt.find(i,i+T.size())==rp.find(0,T.size())) return true;
  }

  return false;
}
bool check2(int k) {
  int x = 2000000/n;
  string S = "", T = "";
  for ( int i = 0; i < x; i++ ) S += s;
  for ( int i = 0; i < k; i++ ) T += t;

  using RH = RollingHash<ll, MOD2, B>;  
  RH rt(S),rp(T);
  for(int i=0;i<(int)S.size()-(int)T.size()+1;i++){
    if(rt.find(i,i+T.size())==rp.find(0,T.size())) return true;
  }

  return false;
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin >> s >> t;
  n = s.size();
  m = t.size();
  int l = 0, r = 2000000/m;
  while ( r-l > 1 ) {
    int mid = (l+r)/2;
    if ( check(mid) ) l = mid;
    else r = mid;    
  }

  if ( l >= 2000000/m -1) cout << -1 << endl;
  else cout << l << endl;  
  
  return 0;
}


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

#define ll long long
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define MAX 1e9
#define MIN -1e9
#define MOD 1000000007
#define println(x) cout << "[" << #x << ":" << x << "]\n"; 
#define print(x) cout << "[" << #x << ":" << x << "] "; 

int main(){
	ios::sync_with_stdio(0); 
    cin.tie(0); 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	int x; cin >> x;
	if(x >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";
	return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<bool> X(N, false), Y(N, false);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    if (A == 1) X.at(B) = true;
    if (B == N) Y.at(A) = true;
  }
  string ans = "IMPOSSIBLE";
  for (int i = 2; i < N; i++) {
    if (X.at(i) && Y.at(i)) {
      ans = "POSSIBLE";
      break;
    }
  }
  cout << ans << endl;
}

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

int main(void){
        int n,i,j,c;
        int *p;
        while(scanf("%d",&n)!=EOF){
                c=0;
                if((p=(int *)malloc(sizeof(int)*(n+1)))==NULL){
                        return 1;
                }
                for(i=0;i<=n;i++){
                        p[i]=i;
                }
                for(i=2;i<=n;i++){
                        if(p[i]!=-1){
                                c++;
                                for(j=i;j<=n;j=j+i){
                                        p[j]=-1;
                                }
                        }
                }
                free(p);
                printf("%d\n",c);
        }
}

Measured memory_bytes: 5188
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

vector<int> tpsort(vector<vector<int>>& G) {
    int V = G.size();
    vector<int> sorted_vertices;
    queue<int> que;
    vector<int> indegree(V);
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < G[i].size(); j++) {
            indegree[G[i][j]]++;
        }
    }
    for (int i = 0; i < V; i++) {
        if (indegree[i] == 0) {
            que.push(i);
        }
    }
    while (que.empty() == false) {
        int v = que.front();
        que.pop();
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i];
            indegree[u] -= 1;
            if (indegree[u] == 0) que.push(u);
        }
        sorted_vertices.push_back(v);
    }
    return sorted_vertices;
}

int main() {
    int n,k;
    cin >> n >> k;
  if(n+k>=10)cout << "error" << endl;
  else cout << n+k << endl;
}

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

int main() {
    long long A, B, C;
    cin >> A >> B >> C;
    vector<long long> tmp{A, B, C};
    sort(tmp.begin(), tmp.end());
    long long ABC = A * B * C;
    if (ABC % 2 == 0) {
        cout << 0 << endl;
    } else {
        cout << abs((tmp[0] * tmp[1] * (tmp[2] / 2)) - (tmp[0] * tmp[1] * (tmp[2] / 2 + 1))) << endl;
    }

    return 0;
}

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

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void test_case() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> X(n, vector<int>(d));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < d; ++j) {
      cin >> X[i][j];
    }
  }
  int prs = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int tot = 0;
      for (int k = 0; k < d; ++k) {
        int to_add = X[i][k] - X[j][k];
        to_add *= to_add;
        tot += to_add;
      }
      int sq = sqrt(tot);
      if (sq * sq == tot) {
        ++prs;
      }
    }
  }
  cout << prs << "\n";
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
vector<int> h(N);
const int INF=1e9+5;
vector<int> dp(N,-1);
int n,k;
int f(int i){
    if(dp[i]!=-1) return dp[i];
    if(i==n) return 0;
    if(i>n) return INF;
    int p = INF;    
    for(int j=1;j<=k;++j){
        p=min(p,f(i+j)+abs(h[i]-h[i+j]));
    }
    return dp[i]=p;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;++i){
        scanf("%d",&h[i]);
    }
    cout<<f(1)<<'\n';
    // while(1);
    return 0;
}

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

int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);	

	string a,b;
	cin >> a >> b;

	string c = a+b;
	stringstream d(c);
	int x = 0;
	d >> x;
	
	for(int i = 1;i*i<=x;i++)
	{
		if(i*i == x) return cout << "Yes\n",0;
	}
	cout << "No\n";

	return 0;
}

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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll p[3];

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

    ll ans = LL_INF;
    for(int i = 0; i < 3; i++){
        for(int j = i+1; j < 3; j++){
            if(ans > p[i]+p[j])ans = p[i]+p[j];
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#define N 1000001
using namespace std;
int f[N],n,m,cnt[N];
int find(int k)
{
    if(k!=f[k]) f[k]=find(f[k]);
    return f[k];
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) f[i]=i;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        x=find(x);
        y=find(y);
        if(x!=y){
            f[x]=y;
        }
    }
    for(int i=1;i<=n;i++){
    	cnt[find(i)]++;
	}
	int maxv=0;
	for(int i=1;i<=n;i++){
		maxv=max(maxv,cnt[i]);
	}
	cout<<maxv;
    return 0;
}

Measured memory_bytes: 10700
#include "bits/stdc++.h"

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> a(N+2);
    for(int i = 1; i < N + 1; i++){
        cin >> a.at(i);
    }
    a.at(0) = 0;
    a.at(N+1) = 0;
    int sum = 0;
    for(int i = 1; i < N + 2; i++){
        sum += abs(a.at(i) - a.at(i - 1));
    }
    for(int i = 1; i < N + 1; i++){
        if((a.at(i) - a.at(i - 1)) *(a.at(i) - a.at(i + 1)) > 0){
            cout << sum - abs(a.at(i) - a.at(i - 1)) - abs(a.at(i) - a.at(i + 1)) + abs(a.at(i + 1) - a.at(i - 1)) << endl;
        }else{
            cout << sum << endl;
        }
    }
}

Measured memory_bytes: 1664
#include <cstdio>
#include <algorithm>
#include <queue>
#include <utility>

using namespace std;

typedef pair<int,int> mp;


int n,m,k;

int toatai[1005];

int todat[1005];
int tokekka[1005];

mp edg[100005];
int edgcon[100005][2];

int main(void){

int a,b;


while(1){

scanf("%d%d%d%d",&n,&m,&a,&k);
if(n==0)break;
for(int i=1;i<=n;i++){
  todat[i]=i;
}

for(int i=1;i<=n;i++){
  scanf("%d",&(toatai[i]));
}

for(int i=0;i<m;i++){
  scanf("%d%d",&(edg[i].second),&(edg[i].first));
}

sort(edg,edg+m);

int p,q;
for(int i=0;i<m;i++){
  p=edg[i].second;
  edgcon[i][0]=todat[p];
  edgcon[i][1]=todat[p+1];
  q=todat[p];
  todat[p]=todat[p+1];
  todat[p+1]=q;
}

for(int i=1;i<=n;i++){
  tokekka[todat[i]]=i;
}

/*
for(int i=1;i<=n;i++){
  printf("kek  %d\n",tokekka[i]);
}*/

int sum=0;
for(int i=1;i<=k;i++){
  sum+=toatai[tokekka[i]];
}
int ans=sum;

//printf("%d\n",sum);

for(int i=0;i<m;i++){
  int sa;
  if(edgcon[i][0]<=k && edgcon[i][1]>k){
    sa=toatai[tokekka[edgcon[i][1]]]-toatai[tokekka[edgcon[i][0]]];
  }
  else if(edgcon[i][1]<=k && edgcon[i][0]>k){
    sa=toatai[tokekka[edgcon[i][0]]]-toatai[tokekka[edgcon[i][1]]];
  }

  if(ans>sum+sa)ans=sum+sa;
}
printf("%d\n",ans);
}
return 0;
}

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

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

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

int main() {
  ll A,B,C,D;
  cin >> A>>B>>C>>D;
  ll c=B/C-(A+C-1)/C+1;
  ll d=B/D-(A+D-1)/D+1;
  ll CD=lcm(C,D);
  ll cd=B/CD-(A+CD-1)/CD+1;
  cout << B-A+1-(c + d -cd)<< endl;
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))

point_loop_list = [0 for _ in range(N)]
point_set = set()
loop_list = []
for i in range(N):
    if i in point_set:
        continue
    loop = [i]
    j = P[i] - 1
    while j != i:
        loop.append(j)
        point_set.add(j)
        j = P[j] - 1
    loop += loop
    loop_list.append(loop)

# print(loop_list)

loop_sum_list = [0 for _ in range(N)]

for loop in loop_list:
    loop_len = len(loop) // 2
    s = sum([C[j] for j in loop[:loop_len]])

    for i, p in enumerate(loop[:loop_len]):
        point_loop_list[p] = loop[i:i+loop_len]
        loop_sum_list[p] = s


ans = min(C)

for l, s in zip(point_loop_list, loop_sum_list):
    p = 0
    loop_len = len(l)
    if s > 0:
        num_loop = K // loop_len if K % loop_len != 0 else K // loop_len - 1
        p += s * num_loop
        m = 0
        cs = 0
        for i in range(K - loop_len * num_loop):
            cs += C[l[i]]
            m = max(m, cs)
        p += m
    else:
        m = C[l[0]]
        cs = m
        for i in range(1, loop_len):
            cs += C[l[i]]
            m = max(m, cs)
        p += m
    ans = max(p, ans)

print(ans)



Measured memory_bytes: 270312
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int L[2001][2001];
int R[2001][2001];
int D[2001][2001];
int U[2001][2001];

int main(){
    int h,w;
    cin >> h >> w;
    vector<string> vec(h);
    rep(i,h) cin >> vec[i];

    rep(i,2001){
        rep(j,2001){
            L[i][j] = 0;
            R[i][j] = 0;
            U[i][j] = 0;
            D[i][j] = 0;
        }
    }

    rep(i,h){
        rep(j,w){
            if(vec[i][j] == '.'){
                if(j == 0){
                    L[i][j] = 1;
                }else{
                    L[i][j] = L[i][j-1] + 1;
                }
            }else{
                L[i][j] = 0;
            }
        }
        for(int j = w-1;j >= 0; j--){
            if(vec[i][j] == '.'){
                if(j==w-1){
                    R[i][j] = 1;
                }else{
                    R[i][j] = R[i][j+1] + 1;
                }
            }else{
                R[i][j] = 0;
            }
        }
    }

    rep(i,w){
        rep(j,h){
            if(vec[j][i] == '.'){
                if(j == 0){
                    D[j][i] = 1;
                }else{
                    D[j][i] = D[j-1][i] + 1;
                }
            }else{
                D[j][i] = 0;
            }
        }

        for(int j = h-1; j >= 0; j--){
            if(vec[j][i] == '.'){
                if(j == h-1){
                    U[j][i] = 1;
                }else{
                    U[j][i] = U[j+1][i] + 1;
                }
            }else{
                U[j][i] = 0;
            }
        }
    }

    int m = 0;
    rep(i,h){
        rep(j,w){
            m = max(m,L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3);
        }
    }

    cout << m << endl;
    return 0;
}

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

int main() {
  ll a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  ll res=-1;
  for(int i=0;i<=x;i++){
    ll temp;
    if((x-i)<=y){
      temp=a*i+c*2*(x-i)+b*(y-x+i);
    }
    else temp=a*i+c*2*(x-i);
    if(res<0 || res>temp) res=temp;
  }
  for(int i=0;i<=y;i++){
    ll temp;
    if((y-i)<=x){
      temp=a*(x-y+i)+c*2*(y-i)+b*y;
    }
    else temp=b*i+c*2*(y-i);
    if(res>temp) res=temp;
  }  
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nikita Mikhailov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {

            int x = in.readInt();
            if (x % 10 == 7 || (x / 10) % 10 == 7 || (x / 100) % 10 == 7) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class FastScanner {
        private StringTokenizer st;
        private BufferedReader in;

        public FastScanner(final InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public String readToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (final IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int readInt() {
            return Integer.parseInt(readToken());
        }

    }
}



Measured memory_bytes: 32824
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A.sort(reverse=True)
    sum_a=0
    for i in range(n):
        sum_a+=A[2*i+1]
    print(sum_a)

if __name__=='__main__':
    main()

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

int main () {
  int n, q;

  cin >> n;
  vector<int> S(n);
  rep(i,n) cin >> S[i];

  cin >> q;
  vector<int> T(q);
  rep(i,q) cin >> T[i];

  int ans = 0;
  rep(i,q) {
    rep(j,n) {
      if(T[i] == S[j]) {
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3132
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int a, b;
	cin >> a >> b;
	cout << (a + b + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n, h, a, b, amax = 0, cnt = 0;
  priority_queue<int> pq;
  scanf("%d%d", &n, &h);
  for(int i = 0; i < n; i++){
    scanf("%d%d", &a, &b);
    if(amax < a) amax = a;
    pq.push(b);
  }
  while(h > 0 && !pq.empty()){
    b = pq.top(); pq.pop();
    if(b <= amax) break;
    h -= b;
    cnt++;
  }
  if(h > 0) cnt += (h-1)/amax + 1;
  printf("%d\n", cnt);
}


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

int main() {
  double n, k;
  cin >> n >> k;
  int count = 0;
  for(int i = 0; ; i++){
    n /= k;
    count++;
    if(n < 1){
      break;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int main()
{
	int N,K;
	cin>>N>>K;
	vector<int>T;
	for(int i=0;i<N;i++)
	{
		int t;
		cin>>t;
		T.push_back(t);
	}
	sort(T.begin(),T.end());
	int res=2000000000;
	for(int i=0;i+K-1<N;i++)
	{
		res=min(res,T[i+K-1]-T[i]);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 892
import bisect

A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [- INF] + [int(input()) for i in range(A)] + [INF]
t = [- INF] + [int(input()) for i in range(B)] + [INF]

for i in range(Q):
    x = int(input())
    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
    ans = INF
    for S in [s[b-1], s[b]]:
        for T in [t[d-1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            ans = min(ans, d1, d2)
    print(ans)

Measured memory_bytes: 77016
def run():
  N, M = map(int, input().split())
  if (M == 0) and (N == 1):
    print(0)
    exit()
  sc = [tuple(map(int, input().split())) for m in range(M)]
  ans = [10]*N
  for s, c in sc:
    if ans[s-1] == 10:
      ans[s-1] = c
    else:
      if ans[s-1] == c:
        continue
      else:
        print(-1)
        exit()
  if ans == [0]:
    print(0)
    exit()
  if ans[0] == 0:
    print(-1)
  else:
    for n in range(N):
      if ans[n] == 10:
        if n == 0:
          ans[0] = 1
        else:
          ans[n] = 0
    print(''.join(map(str, ans)))
    
if __name__ == '__main__':
  run()


Measured memory_bytes: 3064
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        String res = "No";
        if ((s.charAt(2) == s.charAt(3)) && (s.charAt(4) == s.charAt(5))) res = "Yes";
        
        System.out.println(res);
    }
}

Measured memory_bytes: 21844
// abc172_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (ll)(1e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll X = 0;
    REPN(i, 2, N) X ^= A[i];
    ll S = A[0] + A[1];
    ll D = (S - X) / 2;

    if ((D & X) > 0 || D < 0 || D > A[0] || (S - X) % 2){
        print(-1);
        return 0;
    }

    ll Y = 0;
    REP_REV(d, 50){
        ll y = X & (1ll << d);
        if ((D ^ (Y | y)) <= A[0]){
            Y |= y;
        }
    }
    ll a = D ^ Y;

    if (a == 0){
        print(-1);
        return 0;
    }

    ll ans = A[0] - a;
    print(ans);

    return 0;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> s(m), c(m);
  for (int i = 0; i < m; ++i) cin >> s[i] >> c[i];
  for (int x = 0; x <= 999; ++x) {
    vector<int> d;
    int xx = x;
    while (xx != 0) {
      d.push_back(xx % 10);
      xx /= 10;
    }
    if (d.empty()) d.push_back(0);
    if (d.size() != n) continue;
    reverse(d.begin(), d.end());
    bool ok = true;
    for (int i = 0; i < m; ++i) {
      if (d[s[i] - 1] != c[i]) ok = false;
    }
    if (ok) {
      cout << x << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}



Measured memory_bytes: 256
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(l[k-1])

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define mk(a,b) make_pair(a,b)
#define pii pair<int,int>
using namespace std;
inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=(X<<3)+(X<<1)+c-'0',c=getchar();
    return X*w;
}
typedef long long ll;
const int N = 1e5+5;
int num[55];
int main(){
    int n,m,k,x;
    n=read();m=read();
    for(int i=1;i<=n;i++){
        k=read();
        for(int j=1;j<=k;j++){
            x=read();
            num[x]++;
        }
    }
    int ans=0;
    for(int i=1;i<=m;i++){
        if(num[i]==n)
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    S = list(input())
    answer = ""
    right = 0
    left = 0
    for s in S:
        if s == "(":
            if right > 0:
                answer = "(" * right + answer
                answer += ")" * right
                right = 0
            left += 1
            answer += "("
        else:
            if left > 0:
                answer += ")"
                left -= 1
            else:
                right += 1
    if left > 0:
        answer += ")" * left
    if right > 0:
        answer = "(" * right + answer + ")" * right
    print(answer)


if __name__ == "__main__":
    main()


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

class Dice
{
private:
  int d[6];
public:
  Dice();
  void CreateDice(int n1, int n2, int n3, int n4, int n5, int n6);
  void disp();
  void Roll_The_Dice(int top, int front);
  void compare_dice(Dice dice);
};

Dice::Dice(){
  for(int i = 0; i < 6; i++){
    d[i] = 0;
  }
}

void Dice::CreateDice(int n1, int n2, int n3, int n4, int n5, int n6){
  d[0] = n1;
  d[1] = n2;
  d[2] = n3;
  d[3] = n4;
  d[4] = n5;
  d[5] = n6;
}

void Dice::disp(){
  for(int i = 0; i < 6; i++){
    cout << d[i] << " ";
  }
  cout << endl;
}

void Dice::Roll_The_Dice(int top, int front){
  int tmp;
  int i = 0, count = 0;
  while(true){
    for(i = 0; i < 4; i++){
      if(d[0] == top){
        break;
      }
      tmp  = d[0];
      d[0] = d[4];
      d[4] = d[5];
      d[5] = d[1];
      d[1] = tmp;
    }
    if(d[1] == front && d[0] == top){
      break;
    }
    tmp  = d[3];
    d[3] = d[1];
    d[1] = d[2];
    d[2] = d[4];
    d[4] = tmp;
    i = 0;
    count++;
    if(count >= 3){
      break;
    }
  }
}

void Dice::compare_dice(Dice dice){
  int count = 0;
  for(int i = 0; i < 6; i++){
    if(d[i] == dice.d[i]){
      count++;
    }
  }
  if(count == 6){
    cout << "Yes" << endl;
  } else if(count <= 5){
    cout << "No" << endl;
  }
}

int main(){
  int n[6] ,num;
  int top,front;
  string order;
  for(int i = 0; i < 6; i++){
    cin >> n[i];
  }
  Dice dice1;
  dice1.CreateDice(n[0],n[1],n[2],n[3],n[4],n[5]);

  for(int i = 0; i < 6; i++){
    cin >> n[i];
  }
  Dice dice2;
  dice2.CreateDice(n[0],n[1],n[2],n[3],n[4],n[5]);
  for(int i = 0; i < 5; i++){
    if(n[i] != n[i+1]){
      dice1.Roll_The_Dice(n[i],n[i+1]);
      dice2.Roll_The_Dice(n[i],n[i+1]);
    }
  }

  dice1.compare_dice(dice2);

}



Measured memory_bytes: 3108
N,A,B=map(int,input().split())
if (A+B)%2==0:
	P=(B-A)//2
else:
	P=float("inf")
if (A+B)%2==1:
	Q=A
	Q+=(B-Q-(B-Q+1)//2)
else:
	Q=float("inf")

if (A+B)%2==1:
	R=N-B+1
	B=N
	A+=R
	R+=B-(A+B)//2
else:
	R=float("inf")
print(min(P,Q,R))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;


int main(){
  ll N, A, B, C, D, E;
  cin >> N;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
  cin >> E;

  ll mi;
  mi = min(A, min(B, min(C, min(D, E))));

  ll temp;
  if ( N % mi == 0 )
    temp = N / mi;
  else
    temp = N / mi + 1;
  ll ans = temp + 4;

  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, m;
  cin >> n >> m;
  vi32 a(n);
  cin >> a;
  sort(all(a));
  vector<pair<int, int>> cards(m);
  rep(i, m) {
    cin >> cards[i].second >> cards[i].first;
  }
  sort(all(cards));
  reverse(all(cards));
  {
    int now = 0;
    rep(i, m) {
      int c = 0;
      while (c < cards[i].second) {
        if (now + c >= n) break;
        if (a[now + c] >= cards[i].first) break;
        a[now + c] = cards[i].first;
        c += 1;
      }
      now += c;
    }
  }
  i64 ans = 0;
  rep(i, n) {
    ans += a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include<stdio.h>
 
int main(void){
    int a,b,c,n,i,tem;

    scanf("%d",&n);

    for(i=0;i < n;i++){
        scanf("%d %d %d",&a,&b,&c);

        if(a < b){
            tem = a;
            a   = b;
            b   = tem;
        }
        if(b < c){
            tem = b;
            b   = c;
            c   = tem;
        }

        if(a < b){
            tem = a;
            a   = b;
            b   = tem;
        }

        if(a*a == b*b+c*c){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 580
# cf. https://atcoder.jp/contests/abc139/submissions/7298439
from collections import deque

N = int(input())
A = [deque(a - 1 for a in map(int, input().split())) for _ in range(N)]
matchAvailablePlayers = deque(range(N))  # 対戦可能な状態にある選手リスト 最初は全選手が対戦可能状態
daysPassedWhenPlayedMostRecentMatch = [0] * N
desiredOpponentIdx = [-1] * N  # i番目の選手が次に対戦を希望する相手の番号が[i]に入る

while matchAvailablePlayers:
    playerIdx = matchAvailablePlayers.popleft()
    matchesOrderForThisPlayer = A[playerIdx]  # 鏡像コピー！

    if not matchesOrderForThisPlayer:  # この選手はもう全ての相手と対戦した
        continue

    opponentIdx = matchesOrderForThisPlayer.popleft()  # 現時点で一番最後に対戦したい相手のindex

    if desiredOpponentIdx[opponentIdx] == playerIdx:  # 対戦成立
        daysPassedWhenPlayedMostRecentMatch[playerIdx] = daysPassedWhenPlayedMostRecentMatch[opponentIdx] = max(daysPassedWhenPlayedMostRecentMatch[playerIdx], daysPassedWhenPlayedMostRecentMatch[opponentIdx]) + 1  # 互いの「試合に至った日」をどちらか遅い方に合わせその翌日である今日に書き換える
        matchAvailablePlayers.append(playerIdx)  # 試合終了、対戦可能リストに加える
        matchAvailablePlayers.append(opponentIdx)
    else:  # 相手が自分との対戦を望んでいないので対戦できない、このプレイヤーは対戦待ちをする
        desiredOpponentIdx[playerIdx] = opponentIdx

if any(A):  # リストのリストなので、if A:だと空リストが中に存在しているだけでもTrueになってしまう
    print(-1)
else:
    print(max(daysPassedWhenPlayedMostRecentMatch))


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

constexpr int64_t mod = 1'000'000'007;

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

    static int64_t dp[100001][13];
    dp[0][0] = 1;
    for(int i=1;i<=s.size();++i){
        if(s[i-1] == '?'){
            for(int d=0;d<=9;++d){
                for(int j=0;j<13;++j){
                    dp[i][(j*10+d)%13] = (dp[i][(j*10+d)%13] + dp[i-1][j]) % mod;
                }
            }
        }else{
            int d = s[i-1] - '0';
            for(int j=0;j<13;++j){
                dp[i][(j*10+d)%13] = (dp[i][(j*10+d)%13]*10 + dp[i-1][j]) % mod;
            }
        }
    }
    cout << dp[s.size()][5] << endl;
    
    return 0;
}

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

int main(){
  int p,q,r;
  cin >> p >> q >> r;
  vector<int> vec(3);
  
  vec.at(0) = p;
  vec.at(1) = q;
  vec.at(2) = r;
  
  sort(vec.begin(),vec.end());
  
  cout << vec.at(0) + vec.at(1) << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())


def sum(a, b):
    return int((a+1)*a/2*b)


fizz_num = n//3
buzz_num = n//5
fizzbuzz_num = n//15


print(sum(n, 1)-sum(fizz_num, 3)-sum(buzz_num, 5)+sum(fizzbuzz_num, 15))

Measured memory_bytes: 9176