akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)


void f(vector<int>& x){

	int r=x.size();
    if(r<4) return;
    else{

    	int p;
        bool b=false;
    		REP(i,0,r-4){
    		if(x[i]==x[i+1] && x[i]==x[i+2] && x[i]==x[i+3]){
    			p=i; b=true; break;
    		}
    		}

            if(b){
                if((x[p]!=x[p+4] && p+4<r) || p+4==r){ x.erase(x.begin()+p,x.begin()+p+4); f(x);}
                else if(x[p]==x[p+4] && ((x[p]!=x[p+5] && p+5<r) || p+5==r)){ x.erase(x.begin()+p,x.begin()+p+5); f(x);}
                else if(x[p]==x[p+4] && x[p]==x[p+5] && ((x[p]!=x[p+6] && p+6<r) || p+6==r)){ x.erase(x.begin()+p,x.begin()+p+6); f(x);}
                else if(x[p]==x[p+4] && x[p]==x[p+5] && x[p]==x[p+6] && p+6<r){ x.erase(x.begin()+p,x.begin()+p+7); f(x);}

              }

            else return;

    }

	}

int main(){

	while(1){

		int N,a;
		vector<int>s;

		cin >> N;
		if(N==0) break;

		rep(i,N){
			cin >> a;
			s.push_back(a);
		}

		if(N<4){ cout << N << endl;}
		else{

			vector<pair<int,int> >v;

			REP(i,0,N-4){
				if(s[i]!=s[i+1] && s[i+1]==s[i+2] && s[i+1]==s[i+3])
				v.push_back(make_pair(i,s[i+1]));
			}

			REP(i,3,N-1){
				if(s[i]!=s[i-1] && s[i-1]==s[i-2] && s[i-1]==s[i-3])
				v.push_back(make_pair(i,s[i-1]));
			}

			REP(i,1,N-3){
				if(s[i]!=s[i-1] && s[i-1]==s[i+1] && s[i-1]==s[i+2])
				v.push_back(make_pair(i,s[i-1]));
			}

			REP(i,2,N-2){
				if(s[i]!=s[i-1] && s[i-1]==s[i-2] && s[i-1]==s[i+1])
				v.push_back(make_pair(i,s[i-1]));
			}

			sort(v.begin(),v.end());
			vector<pair<int,int> >::iterator it=unique(v.begin(),v.end());
			v.erase(it,v.end());

			vector<int>s1=s;
			if(v.empty()) cout << N << endl;
			else{
			int M=10000;
			rep(i,v.size()){
				s1[v[i].first]=v[i].second;
				f(s1);
				if(M>s1.size()) M=s1.size();
				s1=s;
			}

		     cout << M << endl;

	    }

		s.clear(); v.clear();

		}

	}

	return 0;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<lint>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int main() {
    int n;
    cin >> n;
    vec a(n);
    rep(i, n) cin >> a[i];

    sort(all(a));

    int res = 0;

    set<int> st;

    rep(i, n) {
        while (a[i] == a[i+1]) {
            st.insert(a[i]);
            i++;
        }

        bool f = true;

        for (int j = 1; j * j <= a[i]; j++) {
            if (st.empty()) break;
            if (a[i] % j == 0) {
                if (st.find(j) != st.end()) f = false;
                if (j * j != a[i]) {
                    if (st.find(a[i]/j) != st.end()) f = false;
                }
            }
        }

        if (f) {
            res++;
        }

        st.insert(a[i]);
    }

    cout << res << endl;
    return 0;
}

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


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


int main(){
  long long int N,K,Max_A=0,O;
  priority_queue<long long int> q;
  cin >> N >> K;
  long long int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
    Max_A = max(Max_A,A[i]);
  }
  long long int X,top=Max_A,btm=0;
  X=(top+btm+1)/2;
  while(top != X){
    O=0;
    for(int i=0;i<N;i++){
      O=O+(A[i]-1)/X;
    }
    if(O>K){
      btm=X;
      X=(top+btm+1)/2;
    }else{
      top=X;
      X=(top+btm+1)/2;
    }
  }
  
  cout << X <<endl;
  
  return 0;
}


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


Measured memory_bytes: 5156
using System;
using System.Linq;
using System.Collections.Generic;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Console.WriteLine(ab[0] < 10 && ab[1] < 10 ? ab[0] * ab[1] : -1);
        }
    }
}


Measured memory_bytes: 13396
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {

    int N, M;

    cin >> N >> M;
    P ab[100000];
    int a, b;
    REP(i, M) {
        cin >> a >> b;
        if(a > b) swap(a, b);
        ab[i].first = a;
        ab[i].second = b;
    }
    sort(ab, ab + M);
    int ans = 0;
    REP(i, M) {
        int t_min = ab[i].second;
        int j;
        for(j = i + 1; j < M; j++) {
            if(ab[j].first < t_min) {
                if(ab[j].second < t_min) t_min = ab[j].second;
            } else {
                break;
            }
        }
        i = j - 1;
        ans += 1;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n, W;
    cin>>n>>W;
    int w[n+1], v[n+1];
    for(int i=1;i<=n;i++) cin>>w[i]>>v[i];
    long dp[n+2][W+2];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=W;j++){
            dp[i][j] = 0;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=W;j++){
            if(j<w[i]) dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
            else{
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
                dp[i][j] = max(dp[i][j], dp[i-1][j]);
            }
        }
    }
    cout<<dp[n][W];
    return 0;
}

Measured memory_bytes: 82384
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;


int main()
{
	long long int n, cnt = 0;

	cin >> n;

	vector<int> p(n);

	for (int i = 0; i < n; i++)
		cin >> p[i];

	for (int i = 0; i < n; i++) {
		if (p[i] != i + 1) {
			cnt++;
			if (cnt > 2)
				break;
		}
	}
	if(cnt <= 2)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;

}

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

struct node{
  int key;
  struct node *r;
  struct node *l;
  struct node *p;
    };
typedef struct node  Node;
void insert(int);
void inorder(Node *);
void preorder(Node *);


Node *root,*NIL;
int main()
{
  int n,i,x;
  char A[20],b[20]="insert",c[20]="print";
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",A);
      if(strcmp(A,b)==0){
	scanf("%d",&x);
	insert(x);
      }
      else if(strcmp(A,c)==0){
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
      }
    }

 
  return 0;
}

void insert(int a)
{
  
 Node  *y=NIL;
 Node *x=root;
 Node *z;
 z=(Node *)malloc(sizeof(Node));
 z->key =a;
 z->l=NIL;
 z->r=NIL;
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->l;
      else x=x->r;
    }
  z->p=y;
  if( y==NIL){
    root=z;
  }
  else if(z->key <y->key) y->l=z;
  else y->r=z;
  
}
void inorder(Node *a)
{
  if(a==NIL) return ;
  inorder(a->l);
  printf(" %d",a->key);
  
  inorder(a->r);
}
void preorder(Node *a)
{
  if(a==NIL) return ;
  printf(" %d",a->key);
  preorder(a->l);
  preorder(a->r);
  
}



Measured memory_bytes: 25236
#include<cstdint>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<iterator>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>
#include<utility>
#include<initializer_list>


#define repi(i,start,end)for(int64_t (i)=(start);(i)<(end);++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x, v) for(auto& (x) : (v))
#define iterate(itr, v) for(auto (itr)=(v).begin();(itr)!=(v).end();++(itr))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vin(v) rep(i,(v).size()) cin >> (v)[i];
#define vpin(v) rep(i,(v).size()) cin >> (v)[i].first >> (v)[i].second

using namespace std;
using Int = int64_t;
using pint = pair<Int, Int>;
using vint = vector<Int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
using vstr = vector<string>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;  } return 0;  }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;  } return 0;  }
template<class T>void put_double(T a){cout<<setprecision(12);cout<<a<<"\n";}
template<class T>void println(T a){cout << a << "\n";}
template<class T>void put_line(T &v){iterate(itr,v){cout<<*itr<<((itr==--v.end())?"\n":" ");}}
// auto [x, y] = make_tuple(3, 4); => let (x, y) = (3, 4);

int main(void) {
    int n, sum; cin >> n >> sum;
    rep(x, n + 1) {
        rep(y, n + 1) {
            int z = n - x - y;
            if(z < 0) continue;
            if(x * 10000 + y * 5000 + z * 1000 == sum) {
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    println("-1 -1 -1");

    return 0;
}


Measured memory_bytes: 256
n,l=map(int,input().split())
a=[]
for i in range(n):
    a.append(input())
for j in range(n):
    for i in range(j):
        if a[i]>a[j]:
            b=a[i]
            a[i]=a[j]
            a[j]=b
for i in range(1,n):
    a[0] += a[i]
print(a[0])

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main ( void )
{
 int n;
 while (cin >> n)
 {
  int count = 0;
  for (int a = 0; a <= 9; ++a)
   for (int b = 0; b <= 9; ++b)
    for (int c = 0; c <= 9; ++c)
    {
      int d = n - ( a + b + c );
      if ( 0 <= d && d <= 9 ) ++count;
    }
  cout << count << endl;
 }
 return 0;
}

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

ll knapsack(ll wt[],ll val[],ll n,ll capacity){
	
	ll dp[n+1][capacity+1];
	memset(dp,-1,sizeof(dp));

	for(int i=0;i<n+1;i++){
		for(int j=0;j<capacity+1;j++){
			if(i==0 || j==0){
				dp[i][j]=0;
			}
		}
	}
	
	for(int i=1;i<n+1;i++){
		for(int j=1;j<capacity+1;j++){
			if(wt[i-1]<=j){
				dp[i][j] = max(val[i-1] + dp[i-1][j-wt[i-1]], dp[i-1][j]);
			}
			else{
				dp[i][j] = dp[i-1][j];
			}
		}
	}
	
	ll ans = dp[n][capacity];
	return ans;
}

int main()
{
	
	ll n;
	cin>>n;
	ll capacity;
	cin>>capacity;
	ll w[n],val[n];
	for(int i=0;i<=n;i++){
		cin>>w[i]>>val[i];
	}
	cout<<knapsack(w,val,n,capacity);
}

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

using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n;
std::string s;
int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> n;

    int l = 0, r = n - 1;
    int lval = 0, rval = 0;

    std::cout << 0 << std::endl;
    std::cin >> s;
    if (s == "Vacant") {
        return 0;
    }
    else if (s == "Male")
        lval = 0;
    else
        lval = 1;

    std::cout << n - 1 << std::endl;
    std::cin >> s;
    if (s == "Vacant") {
        return 0;
    }
    else if (s == "Male")
        rval = 0;
    else
        rval = 1;

    while (true) {
        int mid = (l + r) / 2;

        std::cout << mid << std::endl;
        std::cin >> s;

        int midval = 0;
        if (s == "Vacant")
            return 0;
        else if (s == "Male")
            midval = 0;
        else
            midval = 1;

        if ((lval + mid - l) % 2 == midval) {
            l = mid;
            lval = midval;
        }
        else {
            r = mid;
            rval = midval;
        }
    }

    return 0;
}


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

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n);
    vector<int> b(m);

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

    ll t = 0;
    for (int i = 0; i < m; i++) t += b[i];

    int j = m;
    int ans = 0;
    for (int i = 0; i < n+1; i++) {
        while (j > 0 && t > k) {
            --j;
            t -= b[j];
        }
        if (t > k) break;
        ans = max(ans, i+j);
        if (i == n) break;
        t += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4832
#include <bits/stdc++.h>
using namespace std;
struct Vec {
        int x, y, n, t;
        bool operator < (const Vec &temp) const {
                return x < temp.x;
        }
};
int n, a[19][2], ans = 2e9;
int main() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cin >> n;
        for(int k = 0; k <= 1; ++k)
                for(int i = 1; i <= n; ++i) cin >> a[i][k];
        for(int mask = 0; mask < (1 << n); ++mask) {
                vector<Vec> v(n + 1);
                int moves = 0, step = n;
                for(int i = 1; i <= n; ++i) v[i] = {a[i][0], a[i][1], 0, ((mask >> (i - 1)) & 1)};
                while(step > 0) {
                        int mx = 0, pos = 0;
                        for(int i = 1; i <= step; ++i) {
                                int after = ((step - i) % 2) ^ v[i].n;
                                if(after != v[i].t) continue;
                                int destval = (after == v[i].n ? v[i].x : v[i].y);
                                if(destval >= mx) mx = destval, pos = i;
                        }
                        if(pos == 0) {
                                moves = 2e9;
                                break;
                        }
                        for(int i = pos; i < step; ++i, ++moves) {
                                swap(v[i].x, v[i].y);
                                v[i].n ^= 1;
                                swap(v[i + 1].x, v[i + 1].y);
                                v[i + 1].n ^= 1;
                                swap(v[i], v[i + 1]);
                        }
                        --step;
                }
                if(is_sorted(v.begin() + 1, v.end())) ans = min(ans, moves);
        }
        cout << (ans == 2e9 ? -1 : ans);
        return 0;
}


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

int main() {
  string S,T;
  cin >> S >> T;
  
  int ans = 0;
  if (S[0] == T[0]) ans++;
  if (S[1] == T[1]) ans++;
  if (S[2] == T[2]) ans++;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_150A
{
    class Program
    {
        static void Main(string[] args)
        {
            int K, X;
            var word = Console.ReadLine().Split(' ');
            K = int.Parse(word[0]);
            X = int.Parse(word[1]);

            if(500*K>=X)
                Console.Write("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
bool digits[10];
int main()
{
int n,k,i;
scanf("%d %d",&n,&k);
for(i=0;i<k;++i){
    int num;
    scanf("%d",&num);
    digits[num]=true;
}
for(i=n;i<1000000;++i){
    int flag=0;
    int m=i;
    while(m){
        if(digits[m%10]){
            flag=1;
            break;
        }
        m/=10;
    }
    if(flag==0){
        printf("%d",i);
        break;
    }
}


    return 0;
}


Measured memory_bytes: 256
def multiply(A, B):                                                  
    ret = 0
    for i in range(len(A)):                                          
        ret += A[i]*B[i]                                             
    
    return ret                                                       
                                                                     

def can_you_solve_this(A, B, C):
    return multiply(A, B) + C > 0                                    
                                                                     

if __name__ == "__main__":
    N, M, C = map(int, input().split())                              
    
    B = list(map(int, input().split()))                              
    
    count = 0
    for i in range(N):
        A = list(map(int, input().split()))                          
        if can_you_solve_this(A, B, C):                              
            count += 1                                               
    
    print(count)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define endl			"\n"
#define ll				long long
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define vi				vector <int>
#define vl				vector <ll>
#define ii				pair <ll,ll>
#define vii				vector <ii>
#define ull				unsigned long long
const double PI = 2 * acos(0.0);
void run() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
}

int main() {

	run();
	ll n;
	cin >> n;
	if (n & 1)
		return cout << 0, 0;
	ll k = 10, cnt = 0;
	while (n >= k) {
		cnt += n / k;
		k *= 5;
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B___Bishop
{
    class Program
    {
        static void Main(string[] args)
        {
            var H_W = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long H = H_W[0], W = H_W[1];

            Console.WriteLine(H_W.Any(x => x == 1) ? 1 : (W / 2 + W % 2) * (H / 2 + H % 2) + (W / 2) * (H / 2));
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <bitset>
#include <string>
#include <array>

using namespace std;

int main()
{
    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; ++i){
        cin >> a[i];
    }
    cin >> m;
    vector<int> b(m);
    for (int i=0; i<m; ++i){
        cin >> b[i];
    }

    // solve
    int ans = -1;
    for (int i=0; i<=1000; ++i){
        if(i == m || i == n){
            if(m > n){
                ans = 1;
                break;
            }
            else {
                ans = 0;
                break;
            }
        }
        else {
            if(a[i] < b[i]){
                ans = 1;
                break;
            }
            else if(a[i] > b[i]){
                ans = 0;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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


namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            if(a > b) {
                Console.WriteLine("a > b");
            }else if(a == b)
            {
                Console.WriteLine("a == b");
            }
            else
            {
                Console.WriteLine("a < b");
            }
        }
    }
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int w,h;
    cin>>h>>w;
    vector<string> g(h);

    rep(i,h)cin>>g[i];

    vector<vector<bool>> vis(h,vector<bool>(w,false));

    rep(i,h)rep(j,w){

        if(g[i][j] == '#' && !vis[i][j] ){
            P now = P(i,j);

            stack<P> st;
            st.push(now);
            vis[i][j] = true;

            ll bl=0,wh=0;

            while(!st.empty()){
                P cur = st.top();st.pop();
                
                int ci = cur.fi;
                int cj = cur.se;

                //db3(ci,cj,g[ci][cj]);ln;

                if(g[ci][cj]=='#'){
                    bl++;
                }else{
                    wh++;
                }

                rep(k,4){
                    int ni = ci+dy[k];
                    int nj = cj+dx[k];

                    if(!(0<=ni && ni<h && 0<=nj && nj<w))continue;

                    //db2(k,st.size());db2(ni,nj)ln;

                    if(g[ni][nj]!=g[ci][cj] && !vis[ni][nj]){
                        P nx = P(ni,nj);
                        st.push(nx);
                        vis[ni][nj] = true;
                    }
                }

                //cout<<ci<<" "<<cj;ln;
            }

            //db2(bl,wh);ln;
            ans += bl*wh;
        }
    }

    cout<<ans<<endl;
    //cout <<fixed<<setprecision(16)<< << endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 1152
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let s:Vec<char> = iter.next().unwrap().chars().collect();
    let t:Vec<char> = iter.next().unwrap().chars().collect();
    let mut ans = 0 ;
    for i in 0..3 {
        if s[i] == t[i] {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

// Shortcut

#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, inf = 1e9 + 7;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = 1;
    while (1){
        x *= 2;
        if (x > y) break;
        ans++;
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()

int main()
{
    ll i,j,s;
    cin>>s;
    ll mod = 1e9+7;
    vector<ll> dp(s+1,0);
    dp[0] = 1;
    for(i=3;i<=s;i++)
    {
        for(j=i-3;j>=0;j--)
        {
            dp[i] = (dp[i] + dp[j])%mod;
        }
    }
    cout<<dp[s];
}

Measured memory_bytes: 3544
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int main() {
  int A, B; cin >> A >> B;
  if (A == B) cout << 0 << endl;
  else if ((A+B) % 2 == 0) cout << (A+B) / 2 << endl;
  else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 256
n;main(r,i){
scanf("%d",&n);r=n;
for(i=2;i*i<=n;i++)if(n%i==0)for(r=1LL*r*(i-1)/i;n%i==0;n/=i);
if(n!=1)r=1LL*r*(n-1)/n;
n=!printf("%d\n",r);
}

Measured memory_bytes: 592
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};



//#define int ll
signed main(){
    int a,b;
    cin>>a>>b;
    a--,b--;
    char s[100][100];
    rep(i,0,50){
        rep(j,0,100){
            s[i][j]='.';
        }
    }
    for(int i=50;i<100;i++){
        rep(j,0,100){
            s[i][j]='#';
        }
    }
    for(int i=0;i<50&&b;i+=2)
		for(int j=0;j<=99&&b;j+=2){
			s[i][j]='#',b--;}
	for(int i=99;i>=50&&a;i-=2)
		for(int j=0;j<=99&&a;j+=2){
			s[i][j]='.',a--;}
    cout<<"100 100"<<endl;
    rep(i,0,100){
        rep(j,0,100){
        cout<<s[i][j];
    }
    cout<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int N, Y;
	cin >> N >> Y;
	int k;
	bool flag = 0;

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N - i; j++) {
			k = N - i - j;
			if (i * 10000 + j * 5000 + k * 1000 == Y) {
				cout << i << " " << j << " " << k << endl;
				flag = 1;
				break;
			}
		}
		if (flag) break;
	}

	if (!flag) cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
    result = 0
    a = list(map(int,input().split()))
    for j in range(m):
        result += a[j]*b[j]

    if result > -c:
        cnt += 1

print(cnt)

Measured memory_bytes: 9100
using System;

class MainClass
{

    static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);

        if(a==b)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#include <sstream>
#include <iterator>
#include <sstream>
#include <iomanip>
#include <istream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
    int N;
    vector<int> A;
    cin >> N;
    for(int i=0; i<N; i++) {
        int x;
        cin >> x;
        A.push_back(x);
    }

    int B[N];
    int c = 0;
    if(N%2 != 0) {
        for(int i=N-1; i>1; i--) {
            if(i%2==0) {
                B[c] = A[i];
                c++;
            }
        }
        for(int i=0; i<N; i++) {
            if(i%2 != 0 || i==0) {
                B[c] = A[i];
                c++;
            }
        }
    } else {
        for(int i=N-1; i>=1; i--) {
            if(i%2!=0) {
                B[c] = A[i];
                c++;
            }
        }
        for(int i=0; i<N; i++) {
            if(i%2 == 0 || i==0) {
                B[c] = A[i];
                c++;
            }
        }
    }

    for(int i=0; i<N-1; i++) {
        cout << B[i] << " ";
    }
    cout << B[N-1] << endl;
}


Measured memory_bytes: 3828
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T3;

int main(){
	int h,w;
	cin >> h >> w;
	vector<string> grid(h);
	for(int i = 0;i < h;i++)cin >> grid[i];

	vector<vector<char>> ans(h,vector<char>(w));

	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			if(grid[i][j] == '#'){
				ans[i][j] = '#';
				continue;
			}
			int dx[8] = {0,1,0,-1,1,1,-1,-1};
			int dy[8] = {1,0,-1,0,1,-1,1,-1};
			int cnt = 0;
			for(int k = 0;k < 8;k++){
				int nx = j + dx[k];
				int ny = i + dy[k];
				if(0 <= nx && nx < w && 0 <= ny && ny < h){
					if(grid[ny][nx] == '#')cnt++;
				}
			}

			ans[i][j] = (char)('0'+cnt);
		}
	}

	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			cout << ans[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using System.Runtime.CompilerServices;
using static MyUtil;

class MyUtil
{
    public static int[] ReadIntArray()
    {
	return ReadLine().Split().Select(x => int.Parse(x)).ToArray();
    }
}

class Program
{
    public static void Main()
    {
	var tmp = ReadIntArray();
	int a = tmp[0], b = tmp[1];
	int nsock = 1;
	int ans = 0;
	while (nsock < b)
	{
	    ans++;
	    nsock += (a-1);
	}
	WriteLine(ans);
    }
}
	


Measured memory_bytes: 13396
#include <stdio.h>

int neighbors[105][105];
int times[105][2];
int n;

int dfs(int curTime, int node) {
  int i, j;

  times[node][0] = curTime;
  neighbors[node][0] = 0;

  for (i = 1; i < n + 1; i++) {
    if (neighbors[node][i] && neighbors[i][0]) {
      for (j = 0; j < n; j++)
        neighbors[j][i] = 0;
      curTime = dfs(curTime + 1, i);
    }
  }

  times[node][1] = ++curTime;
  return curTime;
}

int main() {
  int i, u, k, j, num, timestamp = 0;

  memset(neighbors, 0, sizeof(neighbors));
  memset(times, 0, sizeof(times));

  scanf("%d", &n);

  for (i = 1; i < n + 1; i++) {
    neighbors[i][0] = 1;
  }


  for (i = 1; i < n + 1; i++) {
    scanf("%d %d", &u, &k);

    for (j = 0; j < k; j++) {
      scanf("%d", &num);
      neighbors[i][num] = 1;
    }
  }

  for (i = 1; i < n + 1; i++) {
    if (neighbors[i][0])
      timestamp = dfs(timestamp + 1, i);
  }

  for (i = 1; i < n + 1; i++)
    printf("%d %d %d\n", i, times[i][0], times[i][1]);
}



Measured memory_bytes: 2100
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, w int
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &w)

	vs := make([]int, n)
	ws := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &vs[i])
		fmt.Fscan(r, &ws[i])
	}

	dp := make([][]int, n+1)
	for i := 0; i < n+1; i++ {
		dp[i] = make([]int, w+1)
	}

	for i := n - 1; i >= 0; i-- {
		for j := 0; j <= w; j++ {
			if j < ws[i] {
				dp[i][j] = dp[i+1][j]
			} else {
				dp[i][j] = max(dp[i+1][j], dp[i+1][j-ws[i]]+vs[i])
			}
		}
	}

	fmt.Println(dp[0][w])

}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}



Measured memory_bytes: 9672
#include <cstdio>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

const int N(410), Mod(1e9 + 7);
int n, C, A[N], B[N], f[N][N], g[N], Pow[N][N];

void Mul(int *f, int *g, int *h)
{
	static int c[N];
	for (int i = 0; i <= C; i++) c[i] = 0;
	for (int i = 0; i <= C; i++)
		for (int j = 0; i + j <= C; j++)
			c[i + j] = (c[i + j] + 1ll * f[i] * g[j]) % Mod;
	for (int i = 0; i <= C; i++) h[i] = c[i];
}

int main()
{
	scanf("%d%d", &n, &C), g[0] = 1;
	for (int i = 1; i <= 400; i++) Pow[i][0] = 1;
	for (int i = 1; i <= 400; i++)
		for (int j = 1; j <= 400; j++)
			Pow[i][j] = 1ll * Pow[i][j - 1] * i % Mod;
	for (int i = 1; i <= n; i++) scanf("%d", A + i);
	for (int i = 1; i <= n; i++) scanf("%d", B + i);
	for (int i = 1; i <= n; i++)
		for (int j = 0; j <= C; j++)
			for (int k = A[i]; k <= B[i]; k++)
				f[i][j] = (f[i][j] + Pow[k][j]) % Mod;
	for (int i = 1; i <= n; i++) Mul(f[i], g, g);
	printf("%d\n", g[C]);
	return 0;
}


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

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

int main() {
  int H,W; cin>>H>>W;
  pair<int, int> start,goal;
  cin>>start.first>>start.second;
  cin>>goal.first>>goal.second;
  start.first--;start.second--;goal.first--;goal.second--;
  vector<string> S(H);
  for(int i=0; i<H; ++i) cin>>S[i];
  // 二度塗りでどうだ
  // 最初に歩きパターンを見てから、次にワープパターンを見る
  vector<vector<int>> Graph(H,vector<int>(W,-1));
  vector<vector<bool>> isSeen(H,vector<bool>(W,false));
  int count = 0;
  queue<pair<int,int>> que,que2;
  Graph[start.first][start.second]=count;
  que.push(start);
  que2.push(start);
  isSeen[start.first][start.second]=true;
  while(!que.empty() || !que2.empty()) {
    while(!que.empty()) {
      auto v = que.front();
      que.pop();
      que2.push(v);
      for(int dir=0; dir<4; ++dir) {
        int nh=v.first+dx[dir];
        int nw=v.second+dy[dir];
        if(nh<0||nh>=H||nw<0||nw>=W) continue;
        if(S[nh][nw]=='#') continue;
        if(!isSeen[nh][nw]) {
          isSeen[nh][nw]=true;
          Graph[nh][nw]=count;
          que.push({nh,nw});
        }
      }
    }
    count++;
    while(!que2.empty()) {
      auto v = que2.front();
      que2.pop();
      for(int i=-2; i<=2; ++i) {
        for(int j=-2; j<=2; ++j) {
          int nh=v.first+i;
          int nw=v.second+j;
          if((abs(i)<=1 && j==0) || (abs(j)<=1 && i==0)) continue;
          else {
            if(nh<0||nh>=H||nw<0||nw>=W) continue;
            if(S[nh][nw]=='#') continue;
            if(!isSeen[nh][nw]) {
              Graph[nh][nw]=count;
              isSeen[nh][nw]=true;
              que.push({nh,nw});
            }
          }
        }
      }
    }
  }
  cout << Graph[goal.first][goal.second] << endl;
}


Measured memory_bytes: 9688
import sys
def input():
    return sys.stdin.readline().strip()
 
def main():
    nk=list(map(int,input().split()))
    h=list(map(int,input().split()))
    n=nk[0]
    k=nk[1]
    dp=[10**9]*n
    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i))
        # for j in range(max(0,i-k),i):
        #     dp[i]=min(dp[j]+abs(h[i]-h[j]),dp[i])
 
    print (dp[-1])
 
if __name__ == "__main__":
    main()

Measured memory_bytes: 13976
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#define N 2020
#define M 4000020
#define MOD 1000000007
using namespace std;
 
int Power(int, int);
 
namespace Comb
{
    int f[M], g[M];
 
    void InitComb(void)
    {
        int i;
 
        for(i = f[0] = 1; i < M; i ++)
            f[i] = (long long)f[i - 1] * i % MOD;
        g[M - 1] = Power(f[M - 1], MOD - 2);
        for(i = M - 2; i > -1; i --)
            g[i] = (long long)g[i + 1] * (i + 1) % MOD;
 
        return;
    }
 
    int C(int n, int m)
    {
        return m < 0 || m > n ? 0 : (long long)f[n] * g[n - m] % MOD * g[m] % MOD;
    }
}
 
int f[N][N];
 
inline int Mod(int x)
{
    return x + ((x >> 31) & MOD);
}
 
int Power(int x, int y)
{
    int o;
 
    for(o = 1; y; y >>= 1)
    {
        if(y & 1)
            o = (long long)o * x % MOD;
        x = (long long)x * x % MOD;
    }
 
    return o;
}
 
int main(void)
{
    int n, k;
    int i, j;
 
    Comb::InitComb();
    scanf("%d %d", &n, &k);
    if(k == 1)
    {
        printf("1\n");
 
        return 0;
    }

    f[0][0] = 1;
    for(i = 1; i <= n; i ++)
        for(j = 0; j <= i; j ++)
        {
            f[i][j] = f[i - 1][j];
            if(j)
                f[i][j] = Mod(f[i][j] + (long long)f[i][j - 1] * (n - j + 1) % MOD * Comb::C(n * k - i - (j - 1) * (k - 1) - 1, k - 2) % MOD - MOD);
        }
    printf("%d\n", f[n][n]);

    return 0;
}


Measured memory_bytes: 46592
package main

import (
	"fmt"
	"unicode"
)

func main() {
	var s string
	fmt.Scan(&s)
	var res bool = true
	c1, c2 := 0, 0
	for i, x := range s {
		switch {
		case x == 'A':
			c1++
			if i != 0 {
				res = false
				break
			}
		case x == 'C':
			c2++
			if i < 2 || i == len(s)-1 {
				res = false
				break
			}
		case unicode.IsUpper(x):
			res = false
			break
		}
	}
	if c1 != 1 || c2 != 1 {
		res = false
	}
	if res {
		fmt.Println("AC")
	} else {
		fmt.Println("WA")
	}
}


Measured memory_bytes: 640
#include<cmath>
#include<iostream>

using namespace std;
typedef long long ll;

int main(){
    int n,d;
    
    int cnt = 0;

    cin >> n >> d;

    ll D2 = (ll)d * d;

    for(int i = 0;i < n;i++){
        int x,y;
        cin >> x >> y;
        if((ll)x * x + (ll)y * y <= D2){cnt++;}
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3132
N=int(input())
A=[int(input()) for _ in range(N)]
max_rem=0
ans=0
for a in A:
    if a >= max_rem+2:
        h = max_rem+1
        if a%h == 0:
            ans += (a//h-1)
            if max_rem==0:
                max_rem=1
        else:
            ans += (a//h)
    else:
        max_rem = max(max_rem, a)
print(ans)


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

int main()
{
    int n, c=0;
    string s;
    stack<int> st;

    cin >> n >> s;

    for(int i=0; i < n; i++){
        switch(s[i]) {
            case '(':
                st.push(i);
                break;
            case ')':
                if(st.empty())
                    c++;
                else
                    st.pop();
                break;
        }
    }

 
    string ans;
    for(int i=0; i < c; i++)
        ans.push_back('(');
    for(int i=0; i < s.size(); i++)
        ans.push_back(s[i]);
    for(int i=0; i < st.size(); i++)
        ans.push_back(')');
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	d := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&d[i])
	}
	p := make(map[int]int)
	for v := range d {
		p[d[v]]++
	}
	fmt.Println(len(p))
}


Measured memory_bytes: 512
N, K = map(int, input().split())
H = [float('inf')] + list(map(int, input().split()))
DP = [float('inf')] * (N+1)
DP[0] = 0
DP[1] = 0

for i, h in enumerate(H[1:], 1):
    for k in range(1, K+1):
        if i + k > N:
            break
        DP[i + k] = min(DP[i+k], DP[i] + abs(H[i + k] - h))
print(DP[N])




Measured memory_bytes: 88220
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main() {
    int a,b,n;
    
    while(cin>>a>>b>>n){
        int sum=0;
        
        a-=( b*(int)(a/b) );
        
        rep(i,n){
            a*=10;
            sum+=( (int)(a/b) );
            a-=b*( (int)(a/b) );
        }
        
        cout<<sum<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

    class Main{
	public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

    int r, c, i, j, sum1 = 0, sum2 = 0;
    int data[][] = new int[150][150];
    //scanf("%d%d", &r, &c);
    r = scan.nextInt();
    c = scan.nextInt();
    for (i = 0; i < r; i++) {
        for (j = 0; j < c; j++) {
            //scanf("%d", &data[i][j]);
        	data[i][j] = scan.nextInt();
            sum1 += data[i][j];
        }
        data[i][c] = sum1;
        sum1 = 0;
    }
    for (j = 0; j <= c; j++) {
        for (i = 0; i < r; i++) {
            sum2 += data[i][j];
        }
        data[r][j] = sum2;
        sum2 = 0;
    }
    for (i = 0; i <= r; i++) {
        for (j = 0; j < c; j++) {
            //printf("%d ", data[i][j]);
        	System.out.print(data[i][j] + " ");
        }
        //printf("%d\n", data[i][c]);
        System.out.println(data[i][c]);
    }


	}
}

Measured memory_bytes: 41524
#include <iostream>
#include <math.h>
#include <algorithm>
#include <stdio.h>

using namespace std;

int n;
long long a[100100], f[100100];

int main () {
    cin >> n;
    for ( int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    f[1] = 0; f[2] = abs(a[2] - a[1]);
    for ( int i = 3; i <= n; i++) {
        f[i] = min(f[i - 2] + abs(a[i] - a[i - 2]), f[i - 1] + abs(a[i] - a[i - 1]));
    }
    cout << f[n];
}


Measured memory_bytes: 1792
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var N int
	con.Scan(&N)
	T := 1
	A := 1
	for i := 0; i < N; i++ {
		var t, a int
		con.Scan(&t, &a)
		nt := (T + t - 1) / t
		na := (A + a - 1) / a
		n := nt
		if nt < na {
			n = na
		}
		T = t * n
		A = a * n
	}
	con.Println(T + A)
	return nil
}


Measured memory_bytes: 640