akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    long long int a,b;
    long long int n;
    cin >> a >> b;
    long long int c = max(a,b);
    long long int d = min(a,b);
    for(int i=1;c*i<=a*b;i++){
        if(c*i%d == 0){
            n = c*i;
            break;
        }
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define INF 1000000000000ll
using namespace std;
signed main(){
  ll n,m,l,r,ma=0,mi=INF;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>l>>r;
    ma = max(l,ma);
    mi = min(r,mi);
  }
  if(mi<ma){
    mi = ma - 1;
  }
  cout<<mi-ma+1<<"\n";
  return(0);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#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 rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

vector<long long>listp(52, 0), listz(52, 0);
long long sum = 0;

//ll func(int n, int x, ll sum) {
ll func(ll n, ll x ) {

	//if (n != 0 &&x <= 0) {
	if (n == 0) {
		return 1;
	}
	else if ( x == 1) {
		return 0;
	}
	else if (n != 0 && x == 1) {
		return 0;
	}
	else if (x > 1 && x <= listz[n - 1] + 1) {
		
		//return sum += func(n - 1, x - 1);
		return  func(n - 1, x - 1);

	}
	else if (x == listz[n - 1] + 2) {
		
		return  listp[n - 1] + 1;
		//sum += listp[n - 1] + 1;

	}
	else if (x > listz[n - 1] + 2 && x < listz[n] ) {
		
		//return sum += listp[n - 1] + 1 + func(n - 1, x - listz[n - 1] - 2);
		//sum += listp[n - 1] + 1 + func(n - 1, x - listz[n - 1] - 2);
		//sum += listp[n - 1] + 1 + func(n - 1, x - listz[n - 1] - 2);
		return listp[n - 1] + 1 + func(n - 1, x - listz[n - 1] - 2);

	}
	else if (x == listz[n]) {
		
		//return 0;
		return listp[n];

	}





	return sum;
}

signed main() {
	int i, j;
	long long n, x;
	string s1, s2;
	vector<string>slist;
	
	cin >> n >> x;

	

	listp[0] = 1;
	listz[0] = 1;


	for (i = 1; i <= n; i++) {
		listp[i] = listp[i - 1] * 2 + 1;
	}

	for (i = 1; i <= n; i++) {
		listz[i] = listz[i - 1] * 2 + 3;
	}

	cout << func(n, x ) << endl;


	






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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int read() {
	int x; scanf("%d", &x); return x;	
}
const int maxn = 2e5 + 10;
const int INF = 1e9;
int mod = 1e9 + 7;
using namespace std;

int a[maxn], n;
int main() {
	#ifdef LOCAL
		freopen("1.in", "r", stdin);
	#endif
	n = read();
	for (int i = 1; i <= 100; ++i) {
		for (int j = 1; j <= 100; ++j) {
			for (int k = 1; k <= 100; ++k) {
				int tt = i * i + j * j + k * k + i * j + i * k + k * j;
				if (tt <= n) a[tt]++;
			}
		}
	}
	for (int i = 1; i <= n; ++i) {
		cout << a[i] << endl;	
	}
	return 0;	
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <string.h>
 
int main(){
 
    char divide[4][8] = {"dream", "dreamer", "erase", "eraser"};
    int dp[100010];
    int len;
    int i, j;
 
    char S[100010];
    scanf("%s", S);
    len = strlen(S);
 
    dp[0] = 1;
    
    for(i = 1; i < len; i++){
        dp[i] = 0;
    }
    
    for(i = 0; i < len; ++i){
        for(j = 0; j < 4; j++){
            if(!strncmp(S+i, divide[j], strlen(divide[j]))){
                dp[i + strlen(divide[j])] = dp[i]; 
            }
        }
    }
    
    if(dp[len]) printf("YES");
    else printf("NO");
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    ll n;
    cin >> n;
    auto wa = [](int i) {
        ll ret = 1;
        rep(j, i) ret *= 26;
        ret--;
        ret *= 26;
        ret /= 25;
        return ret;
    };
    int keta;
    rep(i, 20) {
        if (wa(i) < n && n <= wa(i + 1)) {
            keta = i + 1;
            n -= wa(i);
            break;
        }
    }
    n--;
    string ans;
    rep(i, keta) {
        ans += (char)('a' + n % 26);
        n /= 26;
    }
    reverse(all(ans));
    cout << ans << endl;
}

Measured memory_bytes: 3612
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,a,b = map(int, input().split())
hs = [None]*n
for i in range(n):
    hs[i] = int(input())
    
def sub(x):
    vs = [max(item - b*x, 0) for item in hs]
    return sum(v // (a-b) + bool(v % (a-b)) for v in vs) <= x

l = 0
r = 10**9

while l<r-1:
    m = (l+r)//2
    if sub(m):
        r = m
    else:
        l = m
print(r)

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

using namespace std;

#define MAX_N 20
#define MAX_C 10001
#define INF 1e9
#define EPS 1e-9
#define equal(a,b) (fabs(a-b) < EPS)
#define lt(a,b) (a-b < -EPS)
#define le(a,b) (equal(a,b) || lt(a,b))
#define PI acos(-1)

struct Point{
  double x,y;
  Point(){}
  Point(double x,double y) : x(x),y(y) {}
  
  Point operator + (const Point &p)const{
    return Point(x+p.x,y+p.y);
  }
  Point operator - (const Point &p)const{
    return Point(x-p.x,y-p.y);
  }
  Point operator * (double k)const{
    return Point(x*k,y*k);
  }
};

istream &operator >> (istream &is,Point &p){
  return is >> p.x >> p.y;
}

struct State{
  double d;
  int v,p,c;
  
  State(double d,int v,int p,int c) : 
    d(d),v(v),p(p),c(c) {}
  
  bool operator < (const State &s)const{
    return d > s.d;
  }
};

double dot(const Point &a,const Point &b){
  return a.x*b.x+a.y*b.y;
}

double norm(const Point &p){
  return dot(p,p);
}

double abs(const Point &p){
  return sqrt(norm(p));
}

typedef Point Vector;

inline double getAngle(const Vector &a,const Vector &b){
  return acos(dot(a,b)/abs(a)/abs(b))*180/PI;
}

double dist(const Point &a,const Point &b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

int N;
double r,th,d2[MAX_N][MAX_N];
bool can[MAX_N][MAX_N][MAX_N];
double d[MAX_N][MAX_N][MAX_C];

int solve(const vector<Point> &vec){
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < N ; j++){
      for(int k = 0 ; k < MAX_C ; k++){
	d[i][j][k] = INF;
      }
    }
  }
  priority_queue<State> Q;
  for(int i = 1 ; i < N ; i++){
    Q.push(State(dist(vec[0],vec[i]),i,0,1));
    d[i][0][1] = dist(vec[0],vec[i]);
  }
  while(!Q.empty()){
    State s = Q.top(); Q.pop();
    int v = s.v,p = s.p,c = s.c;
    if(lt(d[v][p][c],s.d)){ continue; }
    if(lt(r,s.d)){ continue; }
    for(int i = 0 ; i < N ; i++){
      if(i == v || i == p){ continue; }
      if(!can[p][v][i]){ continue; }
      if(c+1 < MAX_C && lt(d[v][p][c]+d2[v][i],d[i][v][c+1])){
	d[i][v][c+1] = d[v][p][c]+d2[v][i];
	Q.push(State(d[i][v][c+1],i,v,c+1));
      }
    }
  }
  int ans = 0;
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < N ; j++){
      if(i == j){ continue; }
      for(int k = MAX_C-1 ; k > 0 ; k--){
	if(le(d[i][j][k],r)){
	  ans = max(ans,k);
	  break;
	}
      }
    }
  }
  return ans;
}

int main(){
  cin >> N >> r >> th;
  vector<Point> v(N);
  for(int i = 0 ; i < N ; i++){
    cin >> v[i];
  }
  memset(can,false,sizeof(can));
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < N ; j++){
      if(i == j){ continue; }
      for(int k = 0 ; k < N ; k++){
	if(i == k || j == k){ continue; }
	Vector a = v[j]-v[i];
	Vector b = v[k]-v[j];
	double angle = getAngle(a,b);
	if(le(angle,th)){
	  can[i][j][k] = true;
	}
      }
    }
  }
  for(int i = 0 ; i < N ; i++){
    for(int j = 0 ; j < N ; j++){
      d2[i][j] = dist(v[i],v[j]);
    }
  }
  cout << solve(v) << endl;
  return 0;
}

Measured memory_bytes: 32700
#include <iostream>                                          
#include <iomanip>                                           
#include <cmath>                                             
#define _USE_MATH_DEFINES                                    
using namespace std;                                         
                                                             
int main(void) {                                             
  double r;                                                  
  cin >> r;                                                  
  double S = M_PI*pow(r,2);                                  
  double R = 2*M_PI*r;                                       
  cout << fixed << setprecision(6) << S << " " << R << endl; 
  return 0;                                                  
}                                                            
                                                             
                                                             
                                                             
                                                             
                                     

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

int main() {

  string  n;  cin >> n;
  int num = n.size();//文字数数える
  //cout << num << endl;
  //10101~ に変換する場合
  int cnt1=0,cnt2=0;
  for(int i=0;i<num;i++){
    if(i%2==0 && n[i] == (char)('1')) cnt1++;
    if(i%2!=0 && n[i] == (char)('0')) cnt1++;
  }
  //01010~ に変換する場合
  for(int i=0;i<num;i++){
    if(i%2==0 && n[i] == (char)('0')) cnt2++;
    if(i%2!=0 && n[i] == (char)('1')) cnt2++;
  }

  int ans = min(cnt1,cnt2);

  cout << ans << endl;    

}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;
typedef vector<vl> v2;
typedef vector<v2> v3;
typedef vector<v3> v4;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

string s,t;
ll ans;

int main(){
  cin >> s >> t;
  for(ll i = 0;i < 3;i++) if(s[i] == t[i]) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[3];
		a[0] = n / 100;
		a[1] = (n - n / 100 * 100) / 10;
		a[2] = n % 10;

		for (int i = 0; i < a.length; i++) {
			if (a[i] == 1) {
				a[i] = 9;
			} else {
				a[i] = 1;
			}
		}

		System.out.println(a[0] * 100 + a[1] * 10 + a[2]);

	}
}

Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)


//C++で提出



// string s="AAA";    s.size() =3    (sのサイズ) ...1
// vector <int> a;    配列a(サイズは0) ...2
// a.push_back(10);   配列のサイズが一つ増えて一番後ろに10を代入 ...2
// A.pop_back();   最後の要素が消去される
// sort(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)より前までを小さい順に並び替えてa[0]から代入していく...3
// reverse(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)までを逆の順にしてa[0]から代入していく
// s.substr(3,2)   配列s[3]から2個の文字を抜き出した文字列 (s[3]とs[4]) ...4
// strcmp(s1,s2)  文字列が等しければ0を出力　s1>s2なら1 s1<s2なら-1を出力　C言語用なので配列は、s1[100]にする...5




/*
const int MAX = 100;
int main() {
	int N, M;
	string s, t;
	map<string, int> m;
	m["apple"] = 10;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> s;
		m[s]++;
	}
	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> t;
		m[t]--;
	}
	
	int max=0;

	for (map<string, int>::iterator i = m.begin(); i != m.end(); ++i) {
		if (max < (i->second)) max = i->second;
	}

	if (max < 0) cout << "0";
	else cout << max;

	return 0;
}

*/

int main() {
	
	string s;
	int i;

	cin >> s;

	for (i = 0; i < s.size(); i++) {
		if (s[i] != '\0') {
			s[i] = 'x';
		}
	}

	cout << s;

	return 0;
}

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

#define ll long long
#define mod 1000000007

using namespace std;

inline int read(){
    int x=0,f=0;

char c=getchar();

while (c<'0'||c>'9') {
      if (c=='-') f=1;
       c=getchar();

}

while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();

if (f) x=-x;

return x;
}

bitset <4000005> t;

int a[2005],n;

int main (){

	int i,s=0;

	scanf ("%d",&n);

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

	t[0]=1;

	for (int i=1;i<=n;i++){
              t|=(t<<a[i]);}
	for (int i=(s+1)/2;i<=s;i++){
          if (t[i]) {
         printf ("%d\n",i);

return 0;
}
	}
}

Measured memory_bytes: 1664
import math
a,b=input().split()
a=int(a)
L=list(b)
if "." in L and L[0]==0:
  c=L[2]+L[3]
  c=int(c)
  print(c*a//100)
elif  "." in L and L[0]!=0:
  c=L[0]+L[2]+L[3]
  c=int(c)
  print(c*a//100)

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

int main(){
  int N;
  cin >> N;
  vector<int> va(N);
  vector<int> vb(N);
  vector<int> vc(N);
  for (int i=0;i<N;i++){
    cin >> va.at(i);
  }
  int ans=0;
  for (int i=0;i<N;i++){
    cin >> vb.at(i);
    ans+=vb.at(i);
  }
  for (int i=0;i<N-1;i++){
    cin >> vc.at(i);
  }
  for (int i=0;i<N-1;i++){
    if(va.at(i+1)==va.at(i)+1)
      ans+=vc.at(va.at(i)-1);
  }
  cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define fi first
#define se second
#define mod 1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
map<ll,ll> mp;
ll a[200005];
ll b[200005];
int main()
{
	ios;
	ll n,i,f=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=i-a[i];
		mp[a[i]+i]++;
	}
	for(i=1;i<=n;i++)
	{
		f+=mp[b[i]];
	}
	cout<<f<<endl;
}


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

using namespace std;

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

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

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, r;
    cin >> n >> r;
    if(n >= 10)
        cout << r << endl;
    else
        cout << r + 100*(10-n) << endl;
    return 0;
}

Measured memory_bytes: 256
a,b,c,d=map(int, input().split())
count = 0
ablist = []
cdlist = []
for i in range(a, b+1):
    ablist.append(i)
for i in range(c, d+1):
    cdlist.append(i)
# print(ablist)
# print(cdlist)
for i in ablist:
    # print(i)
    if i in cdlist:
        count += 1

if count == 0:
    print(0)
else:
    print(count-1)

Measured memory_bytes: 3064
n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a)
max1 = a_s[-1]
max2 = a_s[-2]
if max1 == max2:
    for i in range(n):
        print(max1)
else:
    for i in range(n):
        if a[i] == max1:
            print(max2)
        else:
            print(max1)

Measured memory_bytes: 14112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=2e9;

struct SegmentTree{
private:
    int n;
    vector<int> node;
public:
    SegmentTree(int sz){
        n=1;
        while(n<sz)n*=2;
        node.resize(2*n-1,INF);
    }
    void update(int a,int b,int x,int k=0,int l=0,int r=-1){
        if(r==-1)r=n;
        if(b<=l||r<=a)return;
        if(a<=l&&r<=b){
            node[k]=min(node[k],x);
        }
        else{
            update(a,b,x,2*k+1,l,(l+r)/2);
            update(a,b,x,2*k+2,(l+r)/2,r);
        }
    }
    int get(int a){
        a+=n-1;
        int mn=node[a];
        while(a>0){
            a=(a-1)/2;
            mn=min(mn,node[a]);
        }
        if(mn==INF)return -1;
        else return mn;
    }
};

int main(){
    int n,q;
    cin>>n>>q;
    int s[n],t[n],x[n];
    for(int i=0;i<n;i++){
        cin>>s[i]>>t[i]>>x[i];
    }
    vector<int> d(q);
    for(int i=0;i<q;i++){
        cin>>d[i];
    }
    SegmentTree segtree(q);
    for(int i=0;i<n;i++){
        auto l=lower_bound(d.begin(),d.end(),s[i]-x[i]);
        auto r=lower_bound(d.begin(),d.end(),t[i]-x[i]);
        if(l==r)continue;
        segtree.update(l-d.begin(),r-d.begin(),x[i]);
    }
    for(int i=0;i<q;i++){
        cout<<segtree.get(i)<<endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  int t = 1000000;
  
  vector<int> vec(N);
  for(int i=0;i<N;++i){
    cin >> vec.at(i);
  }
  for(int i=0;i<100;++i){
      int sum = 0;
    for(int j = 0;j<N;++j){
      sum += pow(vec.at(j) - (i+1),2);
    }
    if(sum < t){
      t = sum;
    }
  }
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007LL;

bool cmp (const pair<int,ll> &a, const pair<int,ll> &b) {
    if (a.second > b.second) return true;
    else if (a.second == b.second && a.first > b.first) return true;
    else return false;
}

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<ll> A(N,0);
    for (int i=0;i<N;i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
#ifdef DEBUG
    for (int i=0;i<N;i++) {
        cout << A[i] << " ";
    }
    cout << endl;
#endif
    vector<pair<int,ll>> Q(M);
    for (int j=0;j<M;j++) {
        int b; ll c;
        cin >> b >> c;
        Q.push_back(make_pair(b,c));
    }
    sort(Q.begin(), Q.end(), cmp);
#ifdef DEBUG
    for (int j=0;j<M;j++) {
        cout << Q[j].first << " " << Q[j].second << endl;
    }
#endif
    auto itr = A.begin();
    for (int j=0;j<M && itr != A.end();j++) {
        if (*itr >= Q[j].second) break;
        for (int i=0;i<Q[j].first && itr != A.end();itr++,i++) if (*itr < Q[j].second) *itr = Q[j].second;
    }

    ll Y = accumulate(A.begin(), A.end(), 0LL);
    cout << Y << endl;

    return 0;
}


Measured memory_bytes: 5504
def examA():
    abc = LI()
    abc = set(abc)
    print(len(abc))


import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 3060
import java.io.*;
import java.util.regex.*;

public class Main {
	public static void main(String[] args) throws IOException {
		Pattern pattern = Pattern.compile("([0-9]+) *([0-9]+)");
		String str = "";
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		while((str=bf.readLine())!=null){
			Matcher matcher = pattern.matcher(str);
			if(!matcher.matches())break;
			int a,b,c,d,e,f;
			a=c=Integer.parseInt(matcher.group(1));
			b=d=Integer.parseInt(matcher.group(2));
			while((c*d)!=0){
				if(c>d)
					c%=d;
				else
					d%=c;
			}
			e=c+d;
			f=a/e*b/e*e;
			System.out.println(""+e+" "+f);
		}
		bf.close();
	}
}

Measured memory_bytes: 9340
#include<stdio.h>

int main(){

int i,j,k;
int n,x;
int count;

while(1){

scanf("%d %d",&n,&x);

if(n==0&&x==0)

break;
count=0;

for(i=1;3*i+3<=x;i++){

for(j=i+1;i+2*j+1<=x;j++){

for(k=n;k>j;k--){

if(x==i+j+k){

count++;
break;

}else if(x>=i+j+k){

break;

}

}

}

}

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

}

return 0;

}

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

using namespace std;
typedef long long LL;
const double pi = acos(-1.0);
const double eps = 1e-7;
const LL N = 10001;

LL T,n,m,i,j,k,a[N],t,ans=0;

int main()
{
    scanf("%lld",&k);
    if(k==0){
        printf("2\n1 1\n");
    }else{
        j=k%50;
        k/=50;
        for(i=0;i<50;i++)a[i]=i+k;
        for(i=0;i<j;i++){
            a[i]+=51;
            for(t=0;t<50;t++){
                a[t]--;
            }
        }
        printf("50\n%lld",a[0]);
        for(i=1;i<50;i++)printf(" %lld",a[i]);
    }
    //system("pause");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
typedef long long ll;
ll k,a,b,x;
int m,ans = 0;

template<typename T>
inline void read(T &x){
    x = 0; char ch = getchar();
    for(;ch < '0' || ch > '9'; ch = getchar()) ;
    for(;ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}

int main(){
    read(m); read(k); x = k * k;
    for(int i = 1;i <= m; i++){
        read(a); read(b);
        if(a * a + b * b <= x) ans++;
    }
    printf("%d\n",ans);
    return 0;
}
/*

*/

Measured memory_bytes: 1592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<cmath>
using namespace std;
typedef unsigned long long ll;
ll mod = (10e+8)+ 7;


int main(){
	int a;
	cin>>a;
	string s;
	cin>>s;
	
	if(a>=3200){
		cout<<s<<endl;
	}else{
		cout<<"red"<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD=998244353;
int main(){
    int n;scanf("%d %d",&n);
    map<string,int> a;
    for(int i=0;i<n;i++){
        string S;cin>>S;
        a[S]++;
    }
    int m;scanf("%d",&m);
    for(int i=0;i<m;i++){
        string S;cin>>S;
        a[S]--;
    }
    int ans=0;
    for(auto p:a){
        ans=max(ans,p.second);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 384
use proconio::input;

#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::ops::*;

#[derive(Clone, Debug, Default)]
struct Struct;

//#[proconio::fastout]
fn main() {
    input! {
        n: usize,
        a:[usize;n],
    }

    let mut h = vec![0i64; n + 1];
    for &val in &a {
        h[val] += 1;
    }

    fn f(x: i64) -> i64 {
        x * (x - 1) / 2
    };

    let ans: i64 = h.iter().map(|&x| f(x)).sum();
    for i in 0..n {
        let ct = h[a[i]];
        println!("{}", ans - f(ct) + f(ct - 1));
    }
}


Measured memory_bytes: 6352
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if (a+b>c+d){
    cout << "Left" << endl;
  }
  else if (a+b<c+d){
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

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

using ll=long long;
int main(){
    int n,m,l;
    cin>>n>>m>>l;
    vector<int> k(n);
    for(int i=0;i<n;i++){
        cin>>k[i];
        k[i]--;
    }
    sort(k.begin(),k.end());
    vector<ll> s(m);
    for(int i=0;i<m;i++){
        cin>>s[i];
    }
    vector<ll> ssum(m+1);
    ssum[0]=0;
    for(int i=0;i<m;i++){
        ssum[i+1]=ssum[i]+s[i];
    }
    
    auto cost=[&](int i,int j){
        return (ssum[k[j]+1]-ssum[k[i]])/l;
    };

    const ll INF=1e12;
    vector<vector<ll>> dp(n,vector<ll>(n,INF));
    dp[0][0]=0;
    for(int k=0;k<n;k++){
        for(int r=0;r<=k;r++){
            int i=k;
            int j=r;
            if(j+1<n && i<j+1){
                dp[j+1][j]=min(dp[j+1][j],dp[i][j]+cost(i,j+1));
                dp[i][j+1]=min(dp[i][j+1],dp[i][j]+cost(j,j+1));
            }
            if(i+1<n && j<i+1){
                dp[i+1][j]=min(dp[i+1][j],dp[i][j]+cost(i,i+1));
                dp[i][i+1]=min(dp[i][i+1],dp[i][j]+cost(j,i+1));
            }
            i=r;
            j=k;
            if(j+1<n && i<j+1){
                dp[j+1][j]=min(dp[j+1][j],dp[i][j]+cost(i,j+1));
                dp[i][j+1]=min(dp[i][j+1],dp[i][j]+cost(j,j+1));
            }
            if(i+1<n && j<i+1){
                dp[i+1][j]=min(dp[i+1][j],dp[i][j]+cost(i,i+1));
                dp[i][i+1]=min(dp[i][i+1],dp[i][j]+cost(j,i+1));
            }
        }
    }
    
    ll ans=INF;
    for(int i=0;i<n;i++){
        ans=min(ans,dp[i][n-1]+cost(i,n-1));
        ans=min(ans,dp[n-1][i]+cost(i,n-1));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 35896
#include <bits/stdc++.h>
using namespace std;
int main()
{    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.size()>k)
    {
        for(int i=0;i<k;i++){cout<<s[i];}
        cout<<"...";
    }
    else
    {
        cout<<s;
    }
}
    


Measured memory_bytes: 3604
s=input()
s1=int(s[:2])
s2=int(s[2:])

if 1<=s1<=12 and 1<=s2<=12:
  print("AMBIGUOUS")
elif 0<=s1<=99 and 1<=s2<=12:
  print("YYMM")
elif 1<=s1<=12 and 0<=s2<=99:
  print("MMYY")
else:
  print("NA")

Measured memory_bytes: 3060
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n = input.next().parse::<usize>().unwrap() + 1;
    let m = input.next().parse::<usize>().unwrap() + 1;
    let q = input.next().parse::<usize>().unwrap();
    let mut s = vec![0; n * m];
    for i in 1..n {
        let t: Vec<_> = input.next().chars().collect();
        for j in 1..m {
            s[i + j * n] = if t[j - 1] == '1' { 1 } else { 0 };
        }
    }
    let mut bit = vec![0; n * m];
    let mut sid = vec![0; n * m];
    let mut ver = vec![0; n * m];
    for i in 1..n {
        for j in 1..m {
            bit[i + j * n] = bit[i - 1 + j * n] + bit[i + (j - 1) * n] -
                             bit[i - 1 + (j - 1) * n] + s[i + j * n];
            sid[i + j * n] = sid[i - 1 + j * n] + sid[i + (j - 1) * n] - sid[i - 1 + (j - 1) * n] +
                             if s[i + j * n] == 1 && s[i + (j - 1) * n] == 1 {
                                 1
                             } else {
                                 0
                             };
            ver[i + j * n] = ver[i - 1 + j * n] + ver[i + (j - 1) * n] - ver[i - 1 + (j - 1) * n] +
                             if s[i + j * n] == 1 && s[i - 1 + j * n] == 1 {
                                 1
                             } else {
                                 0
                             };
        }
    }
    for _ in 0..q {
        let x1 = input.next().parse::<usize>().unwrap() - 1;
        let y1 = input.next().parse::<usize>().unwrap() - 1;
        let x2 = input.next().parse::<usize>().unwrap();
        let y2 = input.next().parse::<usize>().unwrap();
        let a = bit[x2 + y2 * n] - bit[x2 + y1 * n] - bit[x1 + y2 * n] + bit[x1 + y1 * n];
        let b = sid[x2 + y2 * n] - sid[x2 + (y1 + 1) * n] - sid[x1 + y2 * n] +
                sid[x1 + (y1 + 1) * n];
        let c = ver[x2 + y2 * n] - ver[x2 + y1 * n] - ver[x1 + 1 + y2 * n] + ver[x1 + 1 + y1 * n];
        println!("{}", a - b - c);
    }
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next(&mut self) -> String {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap();
    }
}



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

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

    if (s.at(2) == s.at(3) && s.at(4) == s.at(5)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

struct student {
	int num;
	int order;

	bool operator<(const student & another) const {
		return num < another.num;
	}
};

void solve() {
	int N; cin >> N;
	vector<student> A(N+1);
	rep(i, N) {
		int tmp; scanf("%d", &tmp);
		A[i].order = i;
		A[i].num = tmp;
	}

	sort(A.begin(), A.end());

	rep(i, N) {
		if (i != 1) printf(" ");
		printf("%d", A[i].order);
	}
	cout << endl;
}

int main(void) {
	solve();

	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#define D(i,a,b) for(int i=a;i>=b;--i)
const int M = 1e9+7;
int f[2005],n,k;
int main(){
	std::cin>>n>>k;f[n+1]=1;
	D(i,n,n-k+1){D(j,n,i+1)f[j]=0;D(j,i,1)f[j]=(f[j]+f[j+1])%M;}
	D(i,n-k-1,1)f[1]=f[1]*2%M;
	std::cout<<f[1];
}

Measured memory_bytes: 256
n = int(input())
a = sorted(list(map(int, input().split())))
j = a[0]
c = 1
ans = 0
for i in a[1:]:
    if j != i:
        if j > c:
            ans += c
        elif j < c:
            ans += c - j
        c = 1
    else:
        c += 1
    j = i
if j > c:
    ans += c
elif j < c:
    ans += c - j
print(ans)

Measured memory_bytes: 14396
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int K;
    cin >> K;
    vector<ll> A(K);
    rep(i, K) cin >> A[i];
    ll mi = A[K - 1], ma = A[K - 1] * 2 - 1;
    for (int i = K - 2; i >= 0; i--) {
        if (mi < A[i]) mi = A[i];
        else {
            mi = A[i] * ((mi + A[i] - 1) / A[i]);
        }
    }

    for (int i = K - 2; i >= 0; i--) {
        ma = A[i] * ((ma / A[i]) + 1) - 1;
    }

    ll gmi = mi, gma = ma;
    rep(i, K) {
        gmi -= (gmi % A[i]);
        gma -= (gma % A[i]);
    }

    if (gmi == 2 && gma != 2) {
        ma = mi;
    }
    else if (gmi != 2 && gma == 2) {
        mi = ma;
    } 
    else if (gmi != 2 && gma != 2) {
        cout << -1 << endl;
        return 0;
    }

    cout << mi << " " << ma << endl;
    return 0;
}

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

int main() {
	int N, count = 0, max = 0;
	string S;
	cin >> N >> S;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'I') count++;
		else count--;
		if (max < count) max = count;
	}
	cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	string a,b,ans="";
	ll n,m;
	cin>>a>>b;
	n=a.length();
	m=b.length();
	if(n-m==0){
		for(int i=0;i<2*n;i++){
			if(i%2==0){
				ans+=a[i/2];
			}
			else{
				ans+=b[i/2];
			}
		}
	}
	else{
		for(int i=0;i<2*n-1;i++){
			if(i%2==0){
				ans+=a[i/2];
			}
			else{
				ans+=b[i/2];
			}
		}
	}
	cout << ans<<endl;
	return 0;
}

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

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os << "]";
    }
    template<class T> istream& operator>>(istream& is, vector<T>& vs) {
        for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
        return is;
    }

    int N;
    vector<int> D;
    void input() {
        cin >> N;
        D.resize(N); cin >> D;
    }

    string to_s(int n) {
        ostringstream os;
        os << n;
        return os.str();
    }

    void solve() {
        for (int k = 0; ; k++) {
            string s = to_s(k);
            int n = s.size();
            bool found = false;
            for (int i = 0; i + n <= N; i++) {
                for (int j = 0; j < n; j++) {
                    if (D[i + j] != s[j] - '0') {
                        goto next;
                    }
                }
                found = true;
                break;
                next:;
            }
            if (!found) {
                cout << k << endl;
                return;
            }
        }
    }
}

int main() {
    input(); solve();
    return 0;
}

Measured memory_bytes: 3220
#include <iostream>
#include <stdio.h>
using namespace std;
 
int main () {
  long long x;
  while (scanf("%lld",&x) != EOF) {
    if (x<=6) puts("1");
    else if (x%11==0) printf("%lld\n",2*(x/11));
    else if (x%11 <= 6) printf("%lld\n",(x/11)*2+1);
    else printf("%lld\n",(x/11)*2+2);
  }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product


def solve():
    n = II()
    A = LI()
    box = [-1] * n
    ans = deque([])
    for i in range(n, 0, -1):
        sm = 0
        for j in range(i+i, n+1, i):
            # print(sm, box[j-1])
            sm ^= box[j-1]
        # print(A[i-1], sm)
        box[i-1] = A[i-1] ^ sm
        if box[i-1]:
            ans.appendleft(i)

    # print(box)
    print(sum(box))
    if sum(box):
        printlist(ans, ' ')

if __name__ == '__main__':
    solve()


Measured memory_bytes: 20680
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mt make_tuple
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vd> vvd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-7;
const int inf=1e8;
const ll INF=1e16;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vs in(n);
	rep(i,n)cin>>in[i];
	string t;
	cin>>t;
	int a=0,b=0;
	rep(i,n){
		string S="",T="";
		rep(j,in[i].size()){
			if(in[i][j]=='?'){
				S+="a";
				T+="z";
			}else{
				S+=in[i][j];
				T+=in[i][j];
			}
		}
		if(S<=t)a++;
		if(t<=T)b++;
	}
	loop(i,n-b+1,a+1)cout<<i<<" ";
	cout<<a+1<<endl;
}











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

int main()
{
    int N, c;
    cin >> N;

    vector<int> vec(N);

    for (int i = 0; i < N; i++)
    {
        cin >> c;
        vec.at(i) = c - 1;
    }

    int b = 0;
    for (int i = 0; i < N; i++)
    {
        b = vec.at(b);
        if (b == 1)
        {
            cout << i + 1 << endl;
            break;
        }
    }

    if (b != 1)
        cout << -1 << endl;
}


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

int main()
{
    ll a, b, c, k, max;
    cin >> a >> b >> c >> k;
    if(a>k){
        max = k;
    }else if(a+b>k){
        max = a;
    }else{
        max = a - (k - a - b);
    }
    cout << max;
    return 0;
}

Measured memory_bytes: 3680
use std::cmp::{max, min};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{stdin, Read};
use std::os::raw::{c_double, c_float};
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let hh = (0..n).map(|_| read::<usize>()).collect::<Vec<_>>();

    let prev = 0; //usize::max_value();
    let mut ans = 0;
    let mut current = 0;

    for i in 1..n {
        if hh[i - 1] >= hh[i] {
            current += 1;
        } else {
            ans = max(ans, current);
            current = 0;
        }
    }
    ans = max(ans, current);
    println!("{}", ans);
}


Measured memory_bytes: 4352
INF = 2 ** 62
n, m = gets.strip.split.map(&:to_i)
  l = Array.new(n){[]}
  ab = []
  m.times do |i|
    a, b = gets.strip.split.map(&:to_i)
    ab.append [a, b]
    l[a-1].append b-1
    l[b-1].append a-1
  end
  
  ans = Array.new(n){[INF,0]} # distance, prev
  q = [[0,0]] # node, distance
  while q.size != 0
    a = q.shift
    t = a[1]+1
    l[a[0]].each do |v|
      next if ans[v][0] < INF
      ans[v] = [t, a[0]]
      q.append [v, t]
    end
  end
  puts "Yes"
  ans.shift
  ans.each do |e|
    p e[1]+1
  end


Measured memory_bytes: 67672
import math
N,D=map(int,input().split())
L=[]
for i in range(N):
    A=list(map(int,input().split()))
    L.append(A)

ans=0
for i in range(1,N):
    for j in range(i+1,N+1):
        dis=0
        for k in range(D):
            dis+=(L[i-1][k]-L[j-1][k])**2
        if math.sqrt(dis).is_integer():
            ans+=1
            
print(ans)

Measured memory_bytes: 3064
n, m = gets.split.map(&:to_i)
tops = gets.split.map(&:to_i).sort
diff = []
(0..tops.size-2).each do |i|
  diff << tops[i+1] - tops[i]
end

if n >= m
  puts 0
else
  puts diff.sort[0..(m-n-1)].inject(:+)
end

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

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	void main() {
		byte[] cc = sc.next().getBytes();
		println(cc[0] == cc[1] && cc[1] == cc[2] ? "No" : "Yes");
	}
}


Measured memory_bytes: 22740
n = int(input())
s = input()
lis = list(s)

ans = s.count("R") * s.count("B") * s.count("G")

for i in range(n):
    if lis[i] == "R":
        lis[i] = 1
    elif lis[i] == "G":
        lis[i] = 2
    else:
        lis[i] = 4

for i in range(n):
    for j in range(i+1, n):
        k = 2*j -i
        if k >= n:
            continue
        if lis[i] + lis[j] + lis[k] == 7:
            ans -= 1
        
print(ans)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std;
int main()
{int a[65],b[65],c[65],d[65];
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>c[i]>>d[i];
    }

    for(int i=1;i<=n;i++)
    {
        int ans=1000000000;
        int k;
        for(int j=1;j<=m;j++)
        {
            int t=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(t<ans)
			{
                ans=t;
                k=j;
            }
        }
        cout<<k<<endl;
    }
    return 0;
} 

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

int n;
void printout(vector<char> v, char c, int letters) {
    v.push_back(c);
    if(v.size() == n) {
        for (int i = 0; i < n; ++i)
            cout << v[i];
        cout << '\n';
    }
    else {
        for (int i = 0; i <= letters; ++i) {
            if(i == letters)
                printout(v, 'a' + i, letters + 1);
            else
                printout(v, 'a' + i, letters);
        } 
    }
}
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    vector<char> v;
    cin >> n;

    printout(v, 'a', 1);
    return 0;
}

Measured memory_bytes: 1536
#!/usr/bin/env python3

def EvenCheck(array):
    Even = True

    for i in array:
        if i % 2 != 0:
            Even = False

    return Even


def main():
    #N = map(int, open(0).read().split())

    N = int(input())
    array = list(map(int,input().split()))
    cnt = 0

    while True:
        #print(array)
        #print(cnt)
        Check = EvenCheck(array)

        if Check == False:
            break

        cnt += 1
        for i in range(N):
            array[i] = int(array[i]/2)

    print(cnt)

main()


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

int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> v(N, 0);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    v[a - 1]++;
    v[b - 1]++;
  }
  for (int i = 0; i < N; i++) {
    cout << v[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = Cin();
        Dictionary<string, int> Dic = new Dictionary<string, int>();
        for (int i = 0; i < N; i++)
        {
            string s = Console.ReadLine();
            if (!Dic.ContainsKey(s)) Dic.Add(s, 1);
            else Dic[s]++;
        }
        int M = Cin();
        for (int i = 0; i < M; i++)
        {
            string s = Console.ReadLine();
            if (Dic.ContainsKey(s)) Dic[s]--;
            else Dic.Add(s, -1);
        }
        var sorted = Dic.OrderByDescending((x) => x.Value);
        Console.WriteLine((sorted.First().Value < 0 ? "0" : sorted.First().Value.ToString()));
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1000000007;
const int N = 150555;
const int M = 1155;

void solve() {
    int a,b,c;
    cin >> a >> b >> c;
    set <int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);

    if (SZ(s) == 2){
        cout << "Yes";
    } else cout << "No";

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

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

    return 0;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
abc = [list(li()) for _ in range(n)]

dp = [[0]*3 for _ in range(n+1)]

for day in range(n):
    ai,bi,ci = abc[day]
    dp[day+1][0] = max(dp[day][1], dp[day][2]) + ai
    dp[day+1][1] = max(dp[day][2], dp[day][0]) + bi
    dp[day+1][2] = max(dp[day][0], dp[day][1]) + ci
    
print(max(dp[n]))

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

int main() {
  ll n,h;
  cin >> n >> h;
  vector<ll> a(n);
  vector<ll> b(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i] >> b[i];
  }
  ll ans=0;
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  for(ll i=0;i<n;i++) {
    if(b[i]>a[0]&&h>0) {
      h-=b[i];
      ans++;
    }
  }
  if(h<0) {
    h=0;
  }
  ans+=(h+a[0]-1)/a[0];
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N;
vector<int> a;

int main()
{
    cin >> N;
    a.resize(N * 3);
    cin >> a;
    sort(a.begin(), a.end(), greater<int>());
    lint ans = 0;
    REP(i, N) ans += a[2 * i + 1];
    cout << ans << endl;
}


Measured memory_bytes: 1408