akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int h, w, n, sr, sc;
    string s, t;

    cin >> h >> w >> n >> sr >> sc;
    cin >> s >> t;

    bool res = false;

    sc--;
    sr--;

    //R
    int p = sc;
    REP(i, n)
    {
        if (s[i] == 'R')
            p++;

        if (p >= w)
            res = true;

        if (t[i] == 'L' && p > 0)
            p--;
    }

    //L
    p = sc;
    REP(i, n)
    {
        if (s[i] == 'L')
            p--;

        if (p < 0)
            res = true;

        if (t[i] == 'R' && p < w - 1)
            p++;
    }

    //D
    p = sr;
    REP(i, n)
    {
        if (s[i] == 'D')
            p++;

        if (p >= h)
            res = true;

        if (t[i] == 'U' && p > 0)
            p--;
    }

    //U
    p = sr;
    REP(i, n)
    {
        if (s[i] == 'U')
            p--;

        if (p < 0)
            res = true;

        if (t[i] == 'D' && p < h - 1)
            p++;
    }

    cout << (res ? "NO" : "YES") << endl;

    return 0;
}

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

using namespace std;
using ll = long long;

int main()
{
    string s, t; cin >> s >> t;
    int n = s.size(), m = t.size();
    string ans = {127}, c = {127};

    for(int i = 0; i < n; i++) {
        if(i + m > n)continue;
        string nxt = s;
        bool res = true;
        for(int j = 0; j < m; j++) {
            if(s[i + j] != t[j] && s[i + j] != '?')res = false;
            else if(s[i + j] != t[j])nxt[i + j] = t[j];
        }
        if(!res)continue;
        for(auto &i: nxt)if(i == '?')i = 'a';
        ans = min(ans, nxt);
    }
    cout << (ans == c ? "UNRESTORABLE" : ans) << endl;
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (auto i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(c - (a - b), 0) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    ll t1,t2,a1,a2,b1,b2;
    scanf("%lld%lld%lld%lld%lld%lld", &t1, &t2, &a1, &a2, &b1, &b2);

    if(a1<b1) {
        swap(a1,b1);
        swap(a2,b2);
    }

    ll l1=t1*(a1-b1), l2=t2*(a2-b2);

    if(l1+l2>0) {
        printf("0\n");
    }
    else if(l1+l2==0) {
        printf("infinity\n");
    }
    else {
        ll tmp=-(l1+l2);
        ll ans=l1/tmp;
        ll ans2=l1%tmp;
        if(ans2==0) {
            printf("%lld\n", ans*2);
        }
        else {
            printf("%lld\n", ans*2+1);
        }
    }

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] st = new int[N];
		for(int i=0;i<N;i++) {
			st[i] = scan.nextInt();
		}
		int[] path = new int[N];
		path[0] = 0;
		path[1] = Math.abs(st[1]-st[0]);
		//En caso de que el arreglo solo tenga dos piedras se devuelve la diferencia absoluta entre estas dos, en caso
		//de tener mas de dos piedras se evalua la distancia mas corta para cada piedra empezando desde la mas cercana 
		//al inicio, se emplea el paradigma de greedy algorithms en la medida de que se busca cada sub-solucion mas 
		//eficiente y la DP ya que cada una de estas soluciones se conserva.
		if(N==2) {
			
		}else {
			
	    for(int i=2;i<N;i++) {
	    	path[i] = Math.min(path[i-2]+Math.abs(st[i]-st[i-2]), 
	    			path[i-1]+Math.abs(st[i]-st[i-1]));
	    	
	    }
		}
		 System.out.println(path[N-1]);
		scan.close(); 	
		}
		     
	    }
	


Measured memory_bytes: 51308
#include <stdio.h>
     
int main(){
   long n,x,a[100],i,j,t;
    
   scanf("%ld %ld",&n,&x);
   for (i=0;i<n;i++) scanf("%ld",&a[i]);
   for (i=0;i<n;i++) {
       for (j=i+1;j<n;j++)
          if (a[i]>a[j]) {
             t=a[i];a[i]=a[j];a[j]=t;
          }
       x-=a[i];
       if (x<0) break;
   }
   if (x>0 && i==n) printf("%ld\n",i-1);
   else             printf("%ld\n",i);
   return 0;
}


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

int main()
{
	int n,l;
	cin>>n>>l;
	string str;
	vector<string> list;
	for(int i=0;i<n;i++)
	{
		cin>>str;
		list.push_back(str);
	}
	sort(list.begin(), list.end());
	  for (int it=0; it<n; ++it)
    cout << list[it];
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define N 200000
#define nl "\n"
#define f first
#define s second
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back

typedef long long ll;
typedef double db;

using namespace std;

int a[N+5];
int main()
{
    io;
    //freopen("in.txt" , "r" , stdin);
    //freopen("out.txt" , "w" , stdout);

    ///Let the showdown begin


        int n,temp;
        cin >> n;

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

        ll s =0;
        for(int i = 1; i < n; i++)
        {
            if(a[i-1] > a[i]){
                s += a[i-1] - a[i];
                a[i] = a[i-1];
            }
        }
        cout << s << nl;

    ///Happily DONE
    return 0;
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
       
        static void SolveA()
        {
            var ab = ReadAndParseIntArr();
            int a = ab[0];
            int b = ab[1];
            int num = int.Parse(a.ToString() + b.ToString());
            int sqrt =(int) Math.Sqrt(num);
            if(sqrt * sqrt == num)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        
        
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }

        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11092
from collections import deque

class MyDeque:
    def __init__(self):
        self.data = deque()

    def push(self, d, x):
        if d == 0:
            self.data.appendleft(x)
        elif d == 1:
            self.data.append(x)

    def random_access(self, p):
        print(self.data[p])

    def pop(self, d):
        if d == 0:
            self.data.popleft()
        elif d == 1:
            self.data.pop()

my_deque = MyDeque()
q = int(input())

for _ in range(q):
    args = input().split(' ')
    if args[0] == '0':
        d = int(args[1])
        x = int(args[2])
        my_deque.push(d, x)

    elif args[0] == '1':
        p = int(args[1])
        my_deque.random_access(p)

    elif args[0] == '2':
        d = int(args[1])
        my_deque.pop(d)



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

using namespace std;

int main(){
	
	while(1){
		int a, b;
		int ans;
		char op;
	
		cin >> a >> op >> b;
		if(op=='?') break;
		else if(op=='+') ans=/*cout<<*/a+b/*<<endl*/;
		else if(op=='-') ans=/*cout<<*/a-b/*<<endl*/;
		else if(op=='*') ans=/*cout<<*/a*b/*<<endl*/;
		else if(op=='/') ans=/*cout<<*/a/b/*<<endl*/;
		
		cout << ans << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n, k;
  cin >> n >> k;
  vll x(n);
  rep(i,n) cin >> x.at(i);
  ll ans = LLONG_MAX;
  rep(i,n-k+1) {
    ll l, r;
    l = x.at(i);
    r = x.at(i+k-1);
    ll ans1 = abs(l) + abs(r-l);
    ll ans2 = abs(r) + abs(r-l);
    ans = min(ans, min(ans1,ans2));
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

using ld=long double;

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

    string d[4]={"R","L","U","D"};
    ll maxx[4]={-INF,-INF,-INF,-INF};
    ll minx[4]={INF,INF,INF,INF};
    ll maxy[4]={-INF,-INF,-INF,-INF};
    ll miny[4]={INF,INF,INF,INF};

    REP(i,n){
        ll x,y;string dd;
        cin>>x>>y>>dd;
        REP(j,4){
            if(d[j]!=dd) continue;
            chmax(maxx[j],x);
            chmin(minx[j],x);
            chmax(maxy[j],y);
            chmin(miny[j],y);
        }
    }

    auto f=[&](ld t)->ld{
        ld x1 = max({(ld)maxx[0]+t,(ld)maxx[1]-t,(ld)maxx[2],(ld)maxx[3]});
        ld x2 = min({(ld)minx[0]+t,(ld)minx[1]-t,(ld)minx[2],(ld)minx[3]});
        ld y1 = max({(ld)maxy[0],(ld)maxy[1],(ld)maxy[2]+t,(ld)maxy[3]-t});
        ld y2 = min({(ld)miny[0],(ld)miny[1],(ld)miny[2]+t,(ld)miny[3]-t});
        return (x1-x2)*(y1-y2);
    };

    ld l=0;
    ld r=1e9;
    REP(i,200){
        ld left=(l*2.0L+r)/3.0L;
        ld right=(l+r*2.0L)/3.0L;
        if(f(left)<f(right)) r=right;
        else l=left;
    }
    cout<<fixed<<setprecision(12)<<min(f(l),f(r))<<en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int n;
	long long k;
	cin >> n>>k;
	int a[1000];
	vector<long long> v;

	rep(i, n)cin >> a[i];
	
	rep(i,n) {
		long long s = 0;
		for (int j = i; j < n; j++) {
			s += a[j];
			v.push_back(s);
		}
	}
	

	long long ans = 0;
	for (int i = 60; i >= 0; i--) {
		int cnt = 0;

		for (auto x : v) {
			if (x >> i & 1) {
				cnt++;
			}
		}
		if (cnt >=k) {
			ans |= 1LL << i;
 			for (auto &x : v) {
				if ((x >> i & 1)== 0) {
					x = 0;
				}
			}
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 6128
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long double n;
  cin >> n;
  long double k=n/3;
  cout << fixed << setprecision(10);
  cout << k*k*k << endl;
}


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

int main() {
	char c;
  	cin >> c ;
  	if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
    	cout << "vowel" << endl;
    }else{
    	cout << "consonant" << endl;
    }
}


Measured memory_bytes: 384
using System;
using System.Linq;

namespace ITP1_11_A {
    class Dice {
        private int[] _dice;

        public int Top {
            get {
                return _dice[0];
            }
        }

        public Dice(int[] dice) {
            _dice = dice;
        }

        public void Move(string dir) {
            foreach (var d in dir) {
                Move(d);
            }
        }

        public void Move(char dir) {
            int temp = _dice[0];
            switch (dir) {
                case 'E':
                    _dice[0] = _dice[3];
                    _dice[3] = _dice[5];
                    _dice[5] = _dice[2];
                    _dice[2] = temp;
                    break;
                case 'W':
                    _dice[0] = _dice[2];
                    _dice[2] = _dice[5];
                    _dice[5] = _dice[3];
                    _dice[3] = temp;
                    break;
                case 'N':
                    _dice[0] = _dice[1];
                    _dice[1] = _dice[5];
                    _dice[5] = _dice[4];
                    _dice[4] = temp;
                    break;
                case 'S':
                    _dice[0] = _dice[4];
                    _dice[4] = _dice[5];
                    _dice[5] = _dice[1];
                    _dice[1] = temp;
                    break;
            }
        }
    }

    class Program {
        static void Main(string[] args) {
            int[] nums = Console.ReadLine().Split(' ')
                .Select(s => int.Parse(s))
                .ToArray();
            string dir = Console.ReadLine();
            Dice dice = new Dice(nums);
            dice.Move(dir);
            Console.WriteLine(dice.Top);
        }
    }
}

Measured memory_bytes: 9576
<?php

$stdin = preg_split('/ /', trim(fgets(STDIN)));
$a = intval($stdin[0]);
$b = intval($stdin[1]);

$d = intval($a / $b);
$r = $a % $b;
$f = $a / $b;

printf("%d %d %f\n", $d, $r, $f);

Measured memory_bytes: 6632
#include <stdio.h>
#include <iostream>

int main(void){
    int A, B, C, D;

    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &D);

    int sum = 0;
    if (A < B){
        sum += A;
    }else{
        sum += B;
    }
    if(C < D){
        sum += C;
    }else{
        sum += D;
    }

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

    return 0;
}


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

#define mod 1000000007
#define maxn 100005

typedef pair<int, int> P;

int main()
{
    //freopen("monotonic.in", "r", stdin);
    //freopen("monotonic.out", "w", stdout);
    string s;
    cin >> s;
    if (s == "SUN")
        cout << 7 << endl;
    if (s == "MON")
        cout << 6 << endl;
    if (s == "TUE")
        cout << 5 << endl;
    if (s == "WED")
        cout << 4 << endl;
    if (s == "THU")
        cout << 3 << endl;
    if (s == "FRI")
        cout << 2 << endl;
    if (s == "SAT")
        cout << 1 << endl;

    return 0;
}

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

int main(){
	int height[10] = {0};

	for(int i = 0; i < 10; i++){
		cin >> height[i];
	}
	
	int temp = 0;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 9-i; j++){
			if(height[j] > height[j+1]){
				temp = height[j];
				height[j] = height[j+1];
				height[j+1] = temp;
			}
		}
	}
	
	cout << height[9] << endl;
	cout << height[8] << endl;
	cout << height[7] << endl;
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <sstream>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#include <ctype.h>
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, char> pic;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}


void solv() {
	
	ll n;
	cin >> n;
	int a[100100];
	for (size_t i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int q;
	cin >> q;
	int res = 0;
	for (size_t i = 0; i < q; i++)
	{
		int p;
		cin >> p;
		int *v = lower_bound(a, a + n, p);
		if (*v == p) res++;
	}
	cout << res << endl;
}
int main() {
	//	COMinit();
	solv();
	return 0;
}



Measured memory_bytes: 3492
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
    int a;
    cin >> a ;
    cout << (1+a)*a/2 << endl;
}

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

int main() {
    int64_t N, K;
    cin >> N >> K;

    constexpr int64_t MOD = 1e9 + 7;
    int64_t ans = 0;
    for (int64_t k = K; k <= N; k++) {
        int64_t max_value = (N + N - (k - 1)) * k / 2;
        int64_t min_value = (k - 1) * k / 2;
        (ans += (max_value - min_value + 1) % MOD) %= MOD;
    }

    cout << (ans + 1) % MOD << endl;
}

Measured memory_bytes: 3636
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

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

void solution(){
  ll k, n;
  cin >> k >> n;
  vector<ll> a(n);

  ll ans = 0;
  ll start = -1;
  loop(i, n){
    ll tmp;
    cin >> a[i];
  }

  ll maxval = a[0] + k-a[n-1];
  for(int i = 0; i < n-1; i++){
    maxval = max(maxval, abs(a[i]-a[i+1]));
  }

  cout << k - maxval << endl;
}     

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

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll x;
    cin >> x;
    ll sum = 0;
    for (ll i = 1; i <= x; i++)
    {
        sum += i;
        if (sum >= x)
        {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
lis = list(map(int,input().split()))
lis.sort()
a = lis[0];fir=0;sec=0;torf=False
for i in range(N-1):
    if torf:
        torf = False
    elif a == lis[i+1]:
        if a > fir:
            sec = fir
            fir = a
            torf = True
        elif a > sec:
            sec = a
            torf = True
    a = lis[i+1]

print(fir*sec)

Measured memory_bytes: 14244
//raja1999

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string> 
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define int ll

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

//std::ios::sync_with_stdio(false);

main(){
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	string s;
	int i;
	cin>>s;
	f(i,1,s.length()){
		if(s[i]==s[i-1]){
			cout<<"Bad"<<endl;
			return 0;
		}
	}	
	cout<<"Good"<<endl;
	return 0;
	return 0;
} 
	

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

#define SIZE 100005
#define MOD 1000000007
#define INF 100000000

using namespace std;

class EGluttony {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        long long int n, k;
        cin >> n >> k;
        vector<long long int> a_vec(n);
        vector<long long int> f_vec(n);
        for (int i = 0; i < n; ++i)
            cin >> a_vec[i];
        sort(a_vec.begin(), a_vec.end());
        for (int i = 0; i < n; ++i)
            cin >> f_vec[i];
        sort(f_vec.begin(), f_vec.end(), greater<>());
        long long int k_min = -1;
        long long int k_max = 10000000000000;
        long long int ans = 10000000000000;
        while (k_min + 1 < k_max) {
            long long int mid = (k_min + k_max) / 2;
            long long int tmp_cost = 0;
            for (int j = 0; j < n; ++j) {
                if (mid > f_vec[j] * a_vec[j]) {
                    continue;
                } else {
                    long long int tmp = f_vec[j] * a_vec[j] - mid;
                    tmp_cost += ceil(static_cast<double>(tmp) / static_cast<double>(f_vec[j]));
                }
            }
            if (tmp_cost <= k) {
                k_max = mid;
            } else {
                k_min = mid;
            }
        }
        cout << ((accumulate(a_vec.begin(), a_vec.end(), 0ll) <= k) ? 0 : k_max) << endl;
    }
};


int main() {
    EGluttony solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
    
int main(){
    int n,k;
    cin >> n >> k;

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

    sort(all(p));

    int ans=0;

    for(int i=0; i<k; i++){
        ans += p[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 3588
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    #[allow(dead_code)]
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    #[allow(dead_code)]
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    #[allow(dead_code)]
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: usize = sc.read();
    let k: usize = sc.read();
    let mut l: Vec<i32> = vec![0; n];
    for i in 0..n {
        l[i] = sc.read();
    }
    l.sort();
    l.reverse();
    let mut ans = 0;
    for i in 0..k {
        ans += l[i];
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	float A, B;
	cin >> A >> B;

	for (float i = 10.0; i < 1250.0; i += 1.0)
	{
		int value1 = i * 0.08;
		int value2 = i * 0.1;

		if (value1 == A && value2 == B)
		{
			cout << (int)i;
			return 0;
		}
	}

	cout << -1;

	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>

using namespace std;

const int mod = 100007;
const int maxn = 3310;
char a[maxn];
char b[maxn];
int dp[maxn][maxn];
int fa[mod];
int na, nb;

int main() {
    // freopen("in", "r", stdin);
    scanf("%s %s", a, b);
        na = strlen(a);
        nb = strlen(b);
        for(int i = 0; i < na; i++) {
            for(int j = 0; j < nb; j++) {
                if(a[i] == b[j]) {
                    if(dp[i][j] + 1 > max(dp[i][j+1], dp[i+1][j])) {
                        dp[i+1][j+1] = dp[i][j] + 1;
                        // int cur = (((i + 1) * 59) % mod + ((j + 1) * 61) % mod) % mod;
                        // int pre = ((i * 59) % mod + (j * 61) % mod) % mod;
                        // fa[cur][0] = pre;
                        // fa[cur][1] = i;
                        // ii = cur;
                    }
                    else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
                }
                else {
                    dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
                }
            }
        }
        int ii = na;
        int jj = nb;
        char st[maxn];
        int top = 0;
        while(dp[ii][jj]) {
            if(dp[ii][jj] == dp[ii-1][jj]) ii--;
            else if(dp[ii][jj] == dp[ii][jj-1]) jj--;
            else {
                ii--, jj--;
                st[top++] = a[ii];
            }

        }
        while(top) printf("%c", st[--top]);
        printf("\n");

    return 0;
}

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

const int N = 1e4 + 5;
int n, x;
int l[N];
int main() {
    while (cin >> n >> x) {
        for (int i = 1; i <= n; ++i) cin >> l[i];

        int t = 0, cnt = 0, d = 0, j = 1;
        while (d <= x && t < n + 1) {
            cnt ++; t++;
            d = d + l[j++];
            if (d > x) break;
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD_CONST = 1000000007;



int main()
{
	int n, maxC;
	cin >> n >> maxC;
	vector<vector<int>> d(maxC, vector<int>(maxC));
	for (int i = 0; i < maxC; i++) {
		for (int j = 0; j < maxC; j++) {
			cin >> d[i][j];
		}
	}



	vector<vector<int>> c(n, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> c[i][j];
			c[i][j]--;
		}
	}


	vector<map<int, int>> maps(3, map<int, int>());
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			maps[(i + j) % 3][c[i][j]]++;
		}
	}

	ll ans = 10000000000;
	for (int i = 0; i < maxC; i++) {
		for (int j = 0; j < maxC; j++) {
			for (int k = 0; k < maxC; k++) {
				if (i != j && i != k && j != k) {
					ll cost = 0;
					
					for (auto it = maps[0].begin(); it != maps[0].end(); it++) {
						cost += d[it->first][i] * it->second;
					}
					for (auto it = maps[1].begin(); it != maps[1].end(); it++) {
						cost += d[it->first][j] * it->second;
					}
					for (auto it = maps[2].begin(); it != maps[2].end(); it++) {
						cost += d[it->first][k] * it->second;
					}
					if (cost < ans) {
						ans = cost;
					}
				}

			}
		}
	}

	cout << ans << endl;

}  



Measured memory_bytes: 1280
#[test]
fn test_solve() {
    assert_eq!(solve("contest\nson\n"), "10\n");
    assert_eq!(solve("contest\nprogramming\n"), "-1\n");
    assert_eq!(solve("contest\nsentence\n"), "33\n");
    assert_eq!(solve("abcdeee\neeeabc\n"), "10\n");
    assert_eq!(solve("abcde\neeeeeabceeeee"), "50\n");
    assert_eq!(solve("ababa\nabba\n"), "5\n");
}
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let s: Vec<_> = sc.get().chars().collect();
    let t: Vec<_> = sc.get().chars().collect();

    let n = s.len();

    const CODE_A: usize = 'a' as usize;
    let cod = |c: char| c as usize - CODE_A;

    let mut cid = vec![Vec::new(); 26];
    for (i,&c) in s.iter().enumerate() {
        cid[cod(c)].push(i)
    }
    let mut nxt = vec![vec![None; n]; 26];
    for i in 0..26 {
        if !cid[i].is_empty() {
            let mut inx = 0;
            let mut over = false;
            for j in 0..n {
                if !over && j > cid[i][inx] {
                    inx += 1;
                    if inx > cid[i].len() - 1 {
                        inx = 0;
                        over = true;
                    }
                }
                nxt[i][j] = Some(cid[i][inx]);
            }
        }
    }

    let mut lp = 0;
    let mut idx = 0;
    for &c in &t {
        if let Some(i) = nxt[cod(c)][idx] {
            if i < idx {
                lp += 1;
            } 
            idx = i + 1;
            if idx == n {
                lp += 1;
                idx = 0;
            }
        } else {
            return "-1\n".to_string()
        }
    }

    format!("{}\n", lp * n + idx)
}
fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
}


Measured memory_bytes: 59644
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    string S;
    cin >> S;
    char c = S[0];
    int cnt = 0;
    for(int i = 0; i < S.length();i++){
        if(S[i] == c)continue;
        cnt++;
        c = S[i];
    }
    
    c =  S[S.length() - 1];
    int cnt2 = 0;
    for(int i = S.length() - 1; i >= 0; i--){
        if(S[i] == c)continue;
        cnt2++;
        c = S[i];
    }
    
    cout << min(cnt,cnt2) << endl;
    return 0;
}


Measured memory_bytes: 512
# coding: utf-8
from queue import Queue

N, M = tuple(map(int, input().split()))

graph = [ [] for i in range(N+1)]
for i in range(M):
    a, b = tuple(map(int, input().split()))
    graph[a].append(b)
    graph[b].append(a)

def is_reach(n):
    dist = [0 for i in range(N+1)]
    is_visit = [False for i in range(N+1)]
    is_visit[1] = True
    q = Queue()
    q.put(1)
    while not q.empty():
        v = q.get()
        for u in graph[v]:
            if not is_visit[u]:
                is_visit[u] = True
                q.put(u)
                dist[u] = dist[v] + 1
                if u == n and dist[u] == 2:
                    return True
                if dist[u] > 2:
                    return False
    return False

print("POSSIBLE" if is_reach(N) else "IMPOSSIBLE")


Measured memory_bytes: 42676
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

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

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;

// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { std::cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { std::cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



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

  ll N, M;
  cin >> N >> M;
  vector<ll> s(M), c(M);
  REP(i,M){
    cin >> s[i] >> c[i];
  }

  vector<ll> ansv(N,-1);
  REP(i,M){
    ll d = s[i]-1;
    if (ansv[d] != -1 && ansv[d] != c[i]){
      cout << -1 << "\n";
      return 0;
    }
    ansv[d] = c[i];
  }

  if (ansv[0] == 0 && N > 1) {
    cout << -1 << "\n";
    return 0;
  } else if (ansv[0] == -1){
    if (N > 1){
      ansv[0] = 1;
    } else {
      ansv[0] = 0;
    }
  }
  ll ans = 0;
  REP(i,N){
    ans *= 10;
    if (ansv[i] > -1){
      ans += ansv[i];
    }
  }
  cout << ans << "\n";

  return 0;
}


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


int main(void){
	std::string O,E;
	std::cin>>O>>E;

	for(int i=0;i<E.size();i++){
		std::cout<<O.at(i)<<E.at(i);
	}

	if(O.size() > E.size()){
		std::cout<<O.at(O.size()-1);
	}

	return 0;
}



Measured memory_bytes: 256
n, k = map(int,input().split())
ws = []
for _ in range(n):
    t = int(input())
    ws.append(t)

def check(m):
    need = 1
    sm = 0
    for w in ws:
        if w > m:
            return False
        if sm + w > m:
            need += 1
            sm = w
        else:
            sm += w
    return need <= k

lw = 0
hi = 10**10
ans = hi
while lw <= hi:
    mid = (lw + hi) // 2
    if check(mid):
        ans = mid
        hi = mid - 1
    else:
        lw = mid + 1

print(ans)




Measured memory_bytes: 9556
N = int(input())

total = 0
for num in range(1, N + 1):
    if num % 2 == 0:
        continue
    divisors = 0
    for i in range(1, num + 1):
        if num % (i + 1) == 0:
            num = num / (i + 1)
            divisors += 1
    if divisors == 3:
        total += 1

print(total)

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<ll>
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m )%m)

using namespace std;
void OJ();

#define ld long double
void solve(){
    int a , b , c;
    cin >> a >> b >> c;
    cout << ( a + b >= c ? "Yes" : "No");
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); //OJ();

    int t = 1;
    //cin >> t;
    while ( t-- ){
        solve();
    }
    return  0;
}

void OJ(){
#ifndef ONLINE_JUDGE
    freopen( "C:\\Users\\ehab\\Desktop\\Code Forces\\CF\\in.txt" , "r" , stdin  );
   // freopen( "C:\\Users\\ehab\\Desktop\\Code Forces\\CF\\out.txt", "w" , stdout );
#endif // ONLINE_JUDGE
}



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

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

int main() {
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    vector<long long> a(x);
    vector<long long> b(y);
    vector<long long> c(z);

    for (int i = 0; i < x; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<long long>());
    for (int i = 0; i < y; i++) {
        cin >> b[i];
    }
    sort(b.begin(), b.end(), greater<long long>());
    for (int i = 0; i < z; i++) {
        cin >> c[i];
    }
    sort(c.begin(), c.end(), greater<long long>());

    set<vector<int>> memo;
    auto comp = [](pair<long long, vector<int>> src, pair<long long, vector<int>> dst) { return src.first < dst.first; };
    priority_queue<pair<long long, vector<int>>, vector<pair<long long, vector<int>>>, decltype(comp)> q(comp);
    q.emplace(a[0] + b[0] + c[0], vector<int>({0, 0, 0}));
    for (int i = 0; i < k; i++) {
        auto v = q.top(); q.pop();
        
        cout << v.first << endl;

        int d = v.second[0];
        int e = v.second[1];
        int f = v.second[2];

        vector<int> v1{d + 1, e, f};
        if (d < x - 1 && memo.count(v1) == 0) {
            q.emplace(a[d + 1] + b[e] + c[f], v1);
            memo.insert(v1);
        }
        vector<int> v2{d, e + 1, f};
        if (e < y - 1 && memo.count(v2) == 0) {
            q.emplace(a[d] + b[e + 1] + c[f], v2);
            memo.insert(v2);
        }
        vector<int> v3{d, e, f + 1};
        if (f < z - 1 && memo.count(v3) == 0) {
            q.emplace(a[d] + b[e] + c[f + 1], v3);
            memo.insert(v3);
        }
    }
}


Measured memory_bytes: 1152
using System;
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            if (input.IndexOf("C") < 0) Console.Write("No");                
            else
            if (input.IndexOf("C") >= input.LastIndexOf("F"))
            {
                Console.Write("No");
            }
            else Console.Write("Yes");
        }
    }

Measured memory_bytes: 3032
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define int long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second

    using namespace std;
int power(int base, int exp)
{
    if (exp == 0)
       return 1;
    else if (exp == 1)
       return base;
    else
    {
       int calc;
       if (exp % 2 == 0)
       {
         calc = power(base, exp/2);
         calc =(calc* calc)%mod;
       }
       else
       {
         calc = (base*power(base, exp-1))%mod;
       }
       return calc%mod;
    }
}
    int32_t main()
    {
        std::ios::sync_with_stdio(false);
        int n;
        cin>>n;
        int x=1000;
        while(n>1000)
        {
            n-=1000;
        }
        cout<<1000-n<<endl;

        return 0;
    }


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

using namespace std;

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

    int n, sum = 0;
    cin >> n;
    int arr[n + 2];
    arr[0] = arr[n + 1] = 0;

    for (int i = 1; i <= n; i++)
        cin >> arr[i], sum += abs(arr[i] - arr[i - 1]);
    sum += abs(0 - arr[n]);

    for (int i = 1; i <= n; i++) {
        int diff = abs(arr[i] - arr[i - 1]) + abs(arr[i + 1] - arr[i]) - abs(arr[i + 1] - arr[i - 1]);
        cout << sum - diff << '\n';
    }

    return 0;
}

Measured memory_bytes: 1664