akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
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; }



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

  int n;
  cin >> n;
  vi a(n+1), b(n);
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll ans = 0;
  rep(i,n) {
    ans += min(a[i],b[i]);
    b[i] -= min(a[i],b[i]);
    ans += min(a[i+1],b[i]);
    a[i+1] -= min(a[i+1],b[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;


int N;
int main() {

	cin >> N;
	long long sum = 0;
	long long hu = 0;
	long long minnum = 1000000000;
	for (int i = 0; i < N; i++) {
		long long a;
		cin >> a;

		sum += abs(a);
		if (a < 0) hu++;

		minnum = min(minnum, abs(a));
	}

	cout << sum - minnum*(hu % 2)*2 << endl;


	return 0;
}


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

int main(){
  string s;
  cin >> s;
  map<char,int> M;
  for(auto c : s){
    ++M[c];
  }
  int t = 0;
  for(auto e : M){
    t += e.second%2;
  }
  if(s.length()%2 != t){
    cout << 0 << endl;
    return 0;
  }
  vector<int> A;
  for(auto e : M){
    A.push_back(e.second/2);
  }
  unsigned long long ans = 1;
  vector<unsigned long long> F(21,1);
  for(unsigned long long i = 1; i < 21; ++i){
    F[i] = F[i-1]*i;
  }
  t = s.length()/2;
  for(auto a : A){
    ans *= F[t]/F[t-a]/F[a];
    t -= a;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3212
A, B, K = map(int, input().split())

for i in range(K):
	if i % 2 == 0:
		if A % 2 == 1: A -= 1
		B += A // 2
		A = A // 2
	else:
		if B % 2 == 1: B -= 1
		A += B // 2
		B = B // 2

print(A, B)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (int)1e9 //10^9:∞
#define LLINF (long long)1e12
#define MOD (int)1e9+7 //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	// w <= E=>　を向いている
	int N;cin>>N;
	string S; cin>>S;
	VI W(N,0),E(N,0);  //w[i]:=自分より左のｗの数  E[i]:=自分より右のEの数

	FOR(i,1,N-1){
		if(S[i-1]=='W')W[i]+=W[i-1]+1;
		else W[i]+=W[i-1];
	}
	for(int i=N-2;0<=i;i--){
		if(S[i+1]=='E')E[i]+=E[i+1]+1;	
		else E[i]+=E[i+1];
	}
	int ans=INF;
	REP(i,N){
		ans=min(ans,W[i]+E[i]);
	}
	cout<<ans<<endl;




	return 0;
}


Measured memory_bytes: 6116
#include <stdio.h>


int bubbleSort(int A[], int N) {
	int i, v, roopCount = 0, t = 0, flg;


	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	flg = 1;

	while (flg) {
		flg = 0;
		for (i = N - 1; i > roopCount; i--) {
			if (A[i] < A[i - 1]) {
				v = A[i]; A[i] = A[i - 1]; A[i - 1] = v;
				t++;
				flg = 1;
			}
		}
		roopCount++;
	}

	for (i = 0; i < N; i++){
		printf("%d", A[i]);
		if (i < N - 1) {
			printf(" ");
		}
		else {
			printf("\n");
		}
	}

	return t;
}


int main() {
	int A[100], N;

	scanf("%d", &N);
	printf("%d\n", bubbleSort(A, N));

	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  double a, b;
  cin >> a >> b;
  cout << setprecision(10) << a / b << "\n";
}


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

namespace aoj
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string a = "";
                string b = "";
                string c = "";
                int d = 0;
                string k = Console.ReadLine();
                if (k == null) break;
                for (int i = 0; i <= k.Length - 1; i++)
                {
                    if (k.Substring(i, 1) == " ") d += 1;
                }
                if (d >= 2)
                {
                    if (k == null) break;
                    for (int i = 0; i <= k.Length - 1; i++)
                    {
                        if (k.Substring(i, 1) == " ") d += 1;
                        if (d == 2 && k.Substring(i, 1) != " ") a = a + k.Substring(i, 1);
                        if (d == 3 && k.Substring(i, 1) != " ") b = b + k.Substring(i, 1);
                        if (d == 4 && k.Substring(i, 1) != " ") c = c + k.Substring(i, 1);
                    }
                    int x = int.Parse(a) * int.Parse(a);
                    int y = int.Parse(b) * int.Parse(b);
                    int z = int.Parse(c) * int.Parse(c);
                    if (x + y == z || y + z == x || x + z == y)
                    {
                        Console.WriteLine("YES");
                    }
                    else
                    {
                        Console.WriteLine("NO");
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 5400
#include <iostream>

using namespace std;

int main(){
  int a[3][3];
  int n;
  int b[10];
  int flag;
  
  for(int i=0;i<3;i++){
  	for(int j=0;j<3;j++) cin>>a[i][j];
  }

  cin>> n;
  for(int i=0;i<n;i++) cin>>b[i];
  
  for(int i=0;i<3;i++){
  	for(int j=0;j<3;j++){
  	  for(int k=0;k<n;k++){
  		if(b[k]==a[i][j]) a[i][j]=-1;
  	  }
  	}
  }
  
  for(int i=0;i<3;i++){
  	flag=1;
  	for(int j=0;j<3;j++){
  	  if(a[i][j]!=-1) flag=0;
  	}
  	if(flag){
      cout<< "Yes" <<endl;
      return 0;
  	}
  }
  
  for(int i=0;i<3;i++){
  	flag=1;
  	for(int j=0;j<3;j++){
  	  if(a[j][i]!=-1) flag=0;
  	}
  	if(flag){
      cout<< "Yes" <<endl;
      return 0;
  	}
  }
  
  flag=1;
  for(int i=0;i<3;i++){
  	if(a[i][i]!=-1) flag=0;
  }
  if(flag){
    cout<< "Yes" <<endl;
    return 0;
  }
  
  flag=1;
  for(int i=0;i<3;i++){
  	if(a[i][2-i]!=-1) flag=0;
  }
  if(flag){
    cout<< "Yes" <<endl;
    return 0;
  }
  
  cout<< "No" <<endl;

  return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
  s <- qs <$> getLine
  t <- reverse . qs <$> getLine
  putStrLn $ if t > s then "Yes" else "No"
 
qs :: String -> String
qs [] = []
qs [x] = [x]
qs (x:xs) =
  qs (filter (<x) xs) ++ [x] ++ qs (filter (>=x) xs)

Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int n, t[100000], x[100000], y[100000], i;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    for(i=0;i<n;i++){
        if(i==0){
            if((t[i]-x[i]-y[i])%2!=0 || t[i]<x[i]+y[i]) {
                cout << "No" <<endl;
                return 0;
            }
        }
        else if((t[i]-t[i-1]-abs(x[i]-x[i-1])-abs(y[i]-y[i-1]))%2!=0
                || t[i]-t[i-1]<abs(x[i]-x[i-1])+abs(y[i]-y[i-1])){
            cout << "No" <<endl;
            return 0;
        }
    }
    cout << "Yes" <<endl;
    return 0;
}


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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for(int i = s; i < (e); ++i)
#define FASTIO                                                                                     \
	ios_base::sync_with_stdio(false);                                                              \
	cin.tie(NULL);
#define FILEIO                                                                                     \
	freopen("./input.txt", "r", stdin);                                                            \
	freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                                                  \
	for(auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); blockTime.second;  \
		debug("%s : %lld ms\n ",                                                                   \
			  d,                                                                                   \
			  chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() -   \
														  blockTime.first)                         \
				  .count()),                                                                       \
			 blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T& x) {
	return x > 0 ? x : -x;
}
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }
ll ceil2(ll a, ll b) { return (a + b - 1) / b; }

const int N = 2 * 1e5 + 10;
int arr[N];
int n;
inline bool can(int ans, int k) {
	for(int i = 0; i < n; ++i) { k -= (arr[i] + ans - 1) / ans - 1; }
	return k >= 0;
}

int main() {
	FASTIO
#ifdef LOCAL
	FILEIO
#endif
	int k;
	cin >> n >> k;
	forn(i, 0, n) cin >> arr[i];
	int min = 1, max = (int)1e9 + 10;
	while(min != max) {

		int mid = min + (max - min) / 2;
		if(can(mid, k)) { max = mid; }
		else {
			min = mid + 1;
		}
	}
	cout << min << endl;
	return 0;
}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		




int main() {

	int l;
	cin >> l;
	int a = l;
	int n = 0;
	while (a) {
		n++;
		a /= 2;
	}


	n--;

	int c = 0;
	vector<pair<int, pair<int, int>>> v;

	REP(i, n) {
		c += pow(2, i);
		v.push_back({ i + 1,{i + 2,0} });
		v.push_back({ i + 1,{i + 2,pow(2,i)} });
	}

	
	if (2 * c + 2 == l) {
		cout << n + 2 << ' ';
		cout << v.size() + 2 << endl;
		REP(i, v.size()) {
			cout << v[i].first << ' ' << v[i].second.first << ' ' << v[i].second.second << endl;
		}
		cout << n + 1 << ' ' << n + 2 << ' ' << 0 << endl;
		cout << n + 1 << ' ' << n + 2 << ' ' << c + 1 << endl;
		return 0;
	}

	cout << n + 1 << ' ';

	int d = c;
	d++;

	while (d != l) {
		for (int i = n; i >= 0; i--) {
			if (pow(2, i) - 1 + d < l) {
				v.push_back({ i + 1,{n + 1,d} });
				d += pow(2, i);
				break;
			}
		}
	}

	cout << v.size() << endl;

	REP(i, v.size()) {
		cout << v[i].first << ' ' << v[i].second.first << ' ' << v[i].second.second << endl;
	}
}



Measured memory_bytes: 256
N, A, B = map(int, input().split())
if N == 0 or A > B:
    print(0)
    quit()
if N == 1 and A != B:
    print(0)
    quit()
minSum = A * (N-1) + B
maxSum = A + B * (N-1)
print(maxSum-minSum+1)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	static char[] line = new char[100000];
	static int n;
	static int k;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = Integer.parseInt(sc.next());
		k = Integer.parseInt(sc.next());
		line = sc.next().toCharArray();
		int count = 0;
		for (int i = 0; i < n - 1; i++) {
			if (line[i] != line[i + 1])
				count++;
		}

		int ans = n - 1 - count + k * 2;
		System.out.println(Math.min(n - 1, ans));

	}
}

Measured memory_bytes: 25948
#include<bits/stdc++.h>
using namespace std;typedef long l;
#define rep(i,n) for(l i=0;i<n;i++)
l s(l a,l n,l m){l x=1;while (n>0){if(n&1)x=x*a%m;a=a*a%m;n=n/2;}return x;}l t(l a,l m){return s(a,m-2,m);}l c(l x,l n,l m){l c=1;rep(i,x){c=c*(n-i)%m;c=c*t(i+1,m)%m;}return c;}int main(){l m=1000000007;l n,a,b;cin>>n>>a>>b;cout<<(s(2,n,m)-1-c(a,n,m)-c(b,n,m)+3*m)%m;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

ll divisors(ll n) {
  ll res;
  for(ll i = 1; i*i <= n; ++i) {
    if(n % i != 0) continue;
    res=i;
    if(n/i == i) continue; // 上の行で追加済み。
    res=n/i;
  }
  return res;
}


void Main(){

  ll N;
  cin>>N;

  ll x=divisors(N);
  int ans=0;
  while(x){
    x/=10;
    ++ans;
  }
  cout<< ans<<"\n";
}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key) return u;
  if(k < u->key) return treeSearch(u->left,k);
  else  return treeSearch(u->right,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y!=NIL && x==y->right){
    x = y;
    y = y->parent;
  }
    return y;
  
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  
  if(z->left == NIL || z->right == NIL) y=z;
  else y=treeSuccessor(z);
  if(y->left != NIL) x=y->right;
  else x=y->right;
  if(x != NIL) x->parent=y->parent;
  if(y->parent == NIL) root=x;
  else if(y == y->parent->left) y->parent->left=x;
  else y->parent->right=x;
  if(y != z) z->key=y->key;
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x != NIL){
    y=x;
    if(z->key < x->key) x=x->left;
    else x=x->right;
  }
    z->parent=y;
    if(y == NIL) root = z;
    else if(z->key < y->key) y->left=z;
    else y->right=z;
  
}

void inorder(Node u){
  if(u != NIL){
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
  }  
}
void preorder(Node u){
  if(u != NIL){
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
  }
}
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}



Measured memory_bytes: 20608
n, x, m = map(int, input().split())
a = [x]
if n == 1:
    print(x)
    exit()
for i in range(n-1):
    ad = (a[-1]**2) % m
    if ad in a:
        roop_s = a.index(ad)
        roop_e = len(a)
        break
    else:
        a.append(ad)
    if i == n-2:
        print(sum(a))
        exit()
roop_t = (n-roop_s) // (roop_e - roop_s)
left = n - roop_t*(roop_e - roop_s) - roop_s
ans = sum(a[:roop_s]) + roop_t*sum(a[roop_s : roop_e]) + sum(a[roop_s:roop_s+left])
print(ans)

Measured memory_bytes: 68772
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    int ans=0;
    while(n--) {
        int l,r;
        scanf("%d%d",&l,&r);
        ans += r-l+1;
    }
    printf("%d",ans);
    return 0;
}


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

#define INF 1234567890
#define ll long long

int N;
int A[1010101];
bool isp[1010101];
vector<int> p;
bool chk[1010101];

int gcd(int a, int b)
{
	return a ? gcd(b%a, a) : b;
}

void Sieve()
{
	for(int i=2; i<=1000; i++)
		isp[i] = true;
	for(ll i=2; i<=1000; i++)
	{
		if (isp[i])
		{
			p.push_back(i);
			for(ll j=i*i; j<=1000; j+=i)
				isp[j] = false;
		}
	}
}

int main()
{
	Sieve();
	scanf("%d", &N);
	int res = 1, res2 = 0;
	for(int i=1; i<=N; i++)
	{
		scanf("%d", &A[i]);
		res2 = gcd(res2, A[i]);

		for(int d : p)
		{
			if (d*d > A[i]) break;
			if (A[i]%d == 0)
			{
				if (chk[d]) res = 0;
				else chk[d] = true;
			}
			while(A[i]%d==0) A[i]/=d;
		}
		if (A[i] > 1)
		{
			int d = A[i];
			if (chk[d]) res = 0;
			else chk[d] = true;
		}
	}
	if (res) printf("pairwise coprime");
	else if (res2 == 1) printf("setwise coprime");
	else printf("not coprime");
	return 0;
}

Measured memory_bytes: 8496
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] str = s.toCharArray();
        int count = 0;
        for(int i = 0;i < s.length();i++){
            if(str[i] == 'A'){
                for(int j = s.length()-1;j > 0;j--){
                    if(str[j] == 'Z'){
                        System.out.println(j - i + 1);
                        return;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 27576
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define MX 10000000000
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power( ll a, ll b, ll m )
{
	 if (b == 0)
		  return( 1 );
	 ll sol = power( a, b / 2, m );
	 sol = ( sol * sol ) % m;
	 if (b % 2 == 1)
		  sol = ( sol * a ) % m;
	 return( sol );
}

ll gcd( ll a, ll b )
{
	 if (b == 0)
		  return a;
	 else
	 {
		  return gcd( b, a % b );
	 }
}
void solve()
{
	ll a, b;
	cin >> a >> b;
	ll g = gcd(a, b);
	ll sol = (a * b) / g;
	cout << sol;
}
int main()
{
	 int t = 1;
	 //cin >> t;
	 while (t--)
	 {
		  solve();
	 }
	 return 0;
}

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

using namespace std;

template<typename T>
void in(T &a)
{
    for (int i = 0; i < sizeof(a)/sizeof(int); i++) {
        cin >> a[i];
    }
}

int main()
{
    string s;
    int ans = 0;
    int ans2 = 0;

    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        ans += s[i] - '0';
    }

    for (int i = 0; i < s.size(); i++) {
        if (i) {
            ans2 += 9;
        }
        else {
            ans2 += s[i] - '0' - 1;
        }
    }

    cout << max(ans, ans2) << endl;
}



Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, m) = get!(usize, usize);
    let mut g = vec![Vec::new(); n];
    for _ in 0..m {
        let (a, b) = get!(usize, usize);
        g[a-1].push(b-1);
        g[b-1].push(a-1);
    }

    let mut memo = vec![false; n];
    memo[0] = true;
    let mut q = Vec::new();
    for &i in g[0].iter() {
        memo[i] = true;
        q.push(i);
    }
    for i in q.into_iter() {
        for &j in g[i].iter() {
            memo[j] = true;
        }
    }
    println!("{}", if memo[n-1] {
        "POSSIBLE"
    } else {
        "IMPOSSIBLE"
    });
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, m;
  cin >> n >> m;

  int ans;
  for (ans = m / n; ans > 1; --ans) {
    if (m % ans == 0) {
      cout << ans << "\n";
      return 0;
    }
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
#define ld long double
using namespace std;
const int mod = 998244353;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int divceil(int a, int b){
    return (a+b-1)/b;
}

int main(){
    long long k, q;
    cin >> k >>q;

    vector<long long> d(k);
    for(int i=0; i<k; ++i) cin >> d[i];

    for(int _=0; _<q; ++_){
        int n, x , m;
        cin >> n >> x >> m;
        //最後の項
        long long last = x;
        //0が何個なのか
        long long eq = 0;
        //diが何回たされるか
        for(int i=0; i<k; ++i){
            long long num = divceil(n-1-i, k);
            last += (d[i]%m)*num;
            if(d[i]%m == 0) eq += num;
        }
        //答え 全体 - (>)
        long long ans = (n-1) - (last/m -x/m);
        //イコールの場合も引く
        ans -= eq;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <queue>
#include<vector>
#include <algorithm>
using namespace std;
int main()
{
    long long a[100005],b[100005],n;
    cin>>n;
    long long sum=0;
    int cis=0;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        if(a[i]<0)
            cis++;
        b[i]=abs(a[i]);
        sum+=b[i];
    }
    sort(b,b+n);
    if(cis%2==0)
        cout<<sum<<endl;
    else
        cout<<sum-b[0]-b[0]<<endl;
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair <ll,ll> P;
#define REP(i, n) for(ll i = 0LL; i < (ll)(n); i++)
#define REPR(i, n) for(ll i = n-1; i >= 0LL; i--)
#define FOR(i, n, m) for(ll i = n; i < (ll)(m); i++)
#define PRINT(x) cout << x << endl
#define ALL(v) v.begin(), v.end()
#define INF (ll)1e18
#define INFD 1e18
#define PI 3.14159265358979
#define MOD 1000000007
// #define MOD 998244353
#define VL vector<ll>

vector<ll> dx = {-1, 1, 0, 0};
vector<ll> dy = {0, 0, 1, -1};

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

int main()
{
	ll N;
	cin >> N;

	vector<vector<ll>> mat(N, vector<ll>(N, 0));
	REP(i, N) {
		string s;
		cin >> s;
		REP(j, N) {
			mat[i][j] = s[j] - 'a';
		}
	}
	ll ans = 0;
	REP(i, N) {
		bool flag = true;
		REP(j, N) {
			FOR(k, j+1, N) {
				flag &= mat[j][(k+i)%N] == mat[k][(j+i)%N];
			}
		}
		if (flag) ans += N;
	}
	PRINT(ans);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <set>
#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    string s;
    int s_size;
    cin >> s;

    s_size = s.size();



    cout << s[0] << s_size -2 << s[ s_size - 1 ] << endl;
    return 0;
}

Measured memory_bytes: 888
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    havePair = [False] * N
    rightN = 0
    leftLeft = 0
    ri = deque()
    for i in range(N):
        if S[i] == "(": 
            rightN += 1
            ri.append(i)
        else:
            if ri:
                rmin = ri.popleft()
                rightN -= 1
            else: leftLeft += 1

    Ans = ["(" * leftLeft, S, ")" * rightN]
    print("".join(Ans))
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3316
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <tuple>
using namespace std;
typedef long long ll;
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll (i)=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll (i)=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)
#define STRING(str) #str
#define DEBUG 0
#if DEBUG
    #define dump(var) dump2(STRING(var), var)
#else
    #define dump(var)
#endif

template <typename T>
void dump2(const string& name, const T& value)
{
    cerr << name << ": " << value << endl;
}
void dump2(const string& name, const tuple<ll,ll,ll>& value)
{
    ll a,b,c;
    tie(a,b,c) = value;
    cerr << name << ": (" << a << ", " << b << ", " << c << ")" << endl;
}

ll A[100005];

void solve()
{
    ll ans = 0;
    ll N;
    cin >> N;
    for1(i,N) {
        cin >> A[i];
    }

    map<ll,ll> cnt;
    for1(i,N) {
        cnt[A[i]] += 1;
    }

    vector<ll> num;
    ll kind = 0;
    for (auto p : cnt) {
        ++kind;
        num.push_back(p.first);
    }
    if (kind == 1) {
        if (num[0] == 0) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
        return;
    }
    else if (kind == 2) {
        if (N % 3 != 0) {
            cout << "No" << endl;
            return;
        }
        if (num[0] == 0) {
            if (cnt[num[0]] == N/3 && cnt[num[1]] == N/3*2) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
        else if (num[1] == 0) {
            if (cnt[num[1]] == N/3 && cnt[num[0]] == N/3*2) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
        return;
    }
    else if (kind > 3) {
        cout << "No" << endl;
        return;
    }

    if (N % 3 != 0) {
        cout << "No" << endl;
        return;
    }

    dump(cnt[num[0]]);
    dump(cnt[num[1]]);
    dump(cnt[num[2]]);

    if (cnt[num[0]] != N/3 || cnt[num[1]] != N/3 || cnt[num[2]] != N/3) {
        cout << "No" << endl;
        return;
    }

    if (((num[0] ^ num[1]) != num[2])
    &&  ((num[0] ^ num[2]) != num[1])
    &&  ((num[1] ^ num[2]) != num[0])) {
        cout << "No" << endl;
        return;
    }

    dump(num[0]);
    dump(num[1]);
    dump(num[2]);
    dump(num[0]^num[1]);
    dump(num[1]^num[2]);
    dump(num[2]^num[0]);

    cout << "Yes" << endl;
}

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


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

int main(){
    int H,W;
    while (1){
        int i,t;
        cin >> H >> W;
        if (H==0 && W==0) break;

        for (i=1; i<=H; i+=1){
            for (t=1; t<=W; t+=1){
                cout << '#';
                }
            cout << "\n";
        }
        cout << "\n"; 
    }

    return 0;
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n,a,b;
  string s;
  cin >> n >> a >> b >> s;
  int cnts = 0, cntf = 0;
  rep(i,n) {
    if (s[i] == 'a') {
      if (a+b > cnts+cntf) {
        cout << "Yes\n";
        cnts++;
      }
      else cout << "No\n";
    }
    else if (s[i] == 'b') {
      if (a+b > cnts+cntf && b >= cntf+1) {
        cout << "Yes\n";
        cntf++;
      }
      else cout << "No\n";
    }
    else cout << "No\n";
  }
  return 0;
}

Measured memory_bytes: 848
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()
    result = ''
    for s in list(S):
        if (ord(s) + N) % 91 < 65:
            c = (ord(s) + N) % 91 + 65
        else:
            c = (ord(s) + N)
        result += chr(c)
    print(''.join(result))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

// vars
string s;

void input(){
    cin >> s;
}

void solve(){
    if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3616
N = int(input())
A = list(map(int,input().split()))


diff = 2020202020 * 200000 + 1
tot = sum(A)

temp1 = 0

for i in range(N):
    temp1 += A[i]
    # temp2 = A[i+1:]
    temp3 = abs(tot - 2 * temp1)
    if temp3 <= diff:
        # mid = i
        diff = temp3
    else:
        break

print(diff)


Measured memory_bytes: 26092
import re

n, m = map(int, input().split())
a = [input().strip() for _ in range(n)]
b = [input().strip() for _ in range(m)]
for idx_a, arow in enumerate(a[:n-m+1]):
  for idx_obj in re.finditer(b[0], arow):
    falg = True
    for i in range(1,m):
      if b[i] != a[idx_a+i][idx_obj.start():idx_obj.end()]:
        falg = False
    if falg is True:
      print('Yes')
      exit()
print('No')

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
ll mod=1000000000+7;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll lensum(ll n){
    ll res=n*(n+1);
    return(((res%mod)*modinv(2,mod))%mod);
}
int main(){
    int n,k;
    ll ans=0LL;
   
    cin >>n>>k;
    vector<int>a(n,0);
    vector<pair<int,int>>touth(n,pair<int,int>(0,0));
    rep(i,n){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i] >a[j]){
                touth[i].F++;
            }else if(a[i] <a[j]){
                touth[j].S++;
            }
        }
    }
    //rep(i,n){
  //      clog <<touth[i].F <<" "<<touth[i].S<<endl;
//    }
    for(int i=0;i<n;i++){
        ans+=(touth[i].F*lensum(k));
        ans%=mod;
        ans += (touth[i].S * lensum(k-1));
        ans %= mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack> 
#include <set>
using namespace std;

const int MAX=1e5+5;
int n,k,a,ans;

int main(){
	int i,flag;
	
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++){
		scanf("%d",&a);
		if(a==1) flag=i;
	}
	ans=ceil((double)(flag-1)/(k-1));
	int tmp=(flag-1)%(k-1);
	flag+=(k-tmp-1)%(k-1);
	ans+=ceil((double)(n-flag)/(k-1));
	printf("%d\n",ans);
	
	return 0;
}

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

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

  int len = s.size();
  int count = 0;

  for(int i = 0; i < len; ++i)
    if(s[i] != t[i])
      ++count;

  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 3912
#include <iostream>
#include <string>

int main()
{
	using namespace std;
	int a, b;
	cin >> a;
	cin >> b;
	if (a == 1 && a != b) {
		cout << "Alice";
	}
	else if (b == 1 && a != b) {
		cout << "Bob";
	}
	else if (a > b && b != 1) {
		cout << "Alice";
	}
	else if (a < b && a != 1) {
		cout << "Bob";
	}
	if (a == b) {
		cout << "Draw";
	}
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val ps = (0 until n).map {
        val (x, y, h) = readLine()!!.split(' ').map { it.toInt() }
        Triple(x, y, h)
    }

    val p = ps.filter { it.third >= 1 }.first()

    for (x in 0..100)
        for (y in 0..100) {
            val h = p.third + Math.abs(p.first - x) + Math.abs(p.second - y)
            if (ps.all { it.third == Math.max(h - Math.abs(it.first - x) - Math.abs(it.second - y), 0) }) {
                println("$x $y $h")
                return
            }
        }

}


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

int main()
{	
	ios_base::sync_with_stdio(0);
	int n,m,x;
	while(cin>>n>>m>>x){
		vector< vector<int> > table(n);
		vector<int> cost(n);
		for(int i=0; i<n; i++){
			table[i].resize(m);
			cin>>cost[i];
			for(int j=0; j<m; j++)
				cin>>table[i][j];
		}
		int ans = 1000000000;
		for(int mask=(1<<n)-1; mask>=0; mask--){
			vector<int> level(m,0);
			int pay = 0;
			for(int i=0; i<n; i++){
				if(mask&(1<<i)){
					pay+=cost[i];
					for(int j=0; j<m; j++)
						level[j]+=table[i][j];
				}
			}
			int ok = 1;
			for(int i=0; i<m; i++){
				if(level[i]<x) ok = 0;
			}
			if(ok) ans = min(ans, pay);
		}
		if(ans==1000000000) ans = -1;
		cout<<ans<<endl;
	}
	
}

Measured memory_bytes: 3640
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      mut aa: [usize; 3*n]
    }
    aa.sort();
    let mut l = 0;
    let mut r = 3*n-1;

    let mut ans = 0;
    for i in 0..n {
        ans += aa[r-1];
        r -= 2;
    }
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
const ll inf = 1e9;
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> c(m), coin(n+1, 0);
    rep(i,m)cin >> c[i];
    sort(all(c));
    REP(i,1,n+1){
        int mi = inf;
        rep(j,m)if(i >= c[j])mi = min(mi, coin[i - c[j]] + 1);
        coin[i] = mi;
    }
    cout << coin[n] << endl;
    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    string s;
    cin >> s;
    if(s[0]=='A'){
        int count = 0;
        int capitalC = 0;
        for(int i=2; i<s.size()-1; i++){
            if(s[i]=='C'){
                count++;
                capitalC++;
            }
        }
        if(capitalC==1){
            bool ans = true;
            for(int i=0; i<s.size(); i++){
                if(s[i]!='A' && s[i]!='C'){
                    if(islower(s[i])==false){
                        cout << "WA" <<endl;
                        return 0;
                    }else{
                        ans = false; 
                    }
                }
            }
            if(ans==false){
                cout << "AC" <<endl;
            }
        }else{
            cout <<"WA" <<endl;
        }
    }else{
        cout << "WA" <<endl;
    }
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  ll n; cin >> n;
  ll x = std::numeric_limits<ll>::max();
  rep(i, 5) {
    ll y; cin >> y;
    x = min(x, y);
  }
  cout << 4 + (n + x - 1) / x << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <limits>
#include <algorithm>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <tuple>
#include <cassert>

#ifndef IO_H
#define IO_H

#include <cstdio>
#include <limits>

namespace {

class TokenizeReader {
public:
  TokenizeReader() = delete;
  TokenizeReader(FILE* file, int buffer_len);
  ~TokenizeReader();
  void Read(char* s, size_t& len, int max_len = std::numeric_limits<int>::max());
  bool HasNext();
  int NextInt();
private:
  bool EnsureRead();
  bool IsInValidCharacter(int c);

  FILE* file_;
  char* buffer_;
  int buffer_len_, pos_, read_n_;
  bool end_ = false;
};

TokenizeReader::TokenizeReader(FILE* file, int buffer_len)
  : file_(file), buffer_len_(buffer_len), pos_(0), read_n_(0) {
  buffer_ = new char[buffer_len_];
}

TokenizeReader::~TokenizeReader() {
  delete buffer_;
}

void TokenizeReader::Read(char *s, size_t &len, int max_len) {
  len = 0;
  while (EnsureRead() && IsInValidCharacter(buffer_[pos_])) pos_++;
  while ((int) len < max_len && EnsureRead()
      && !IsInValidCharacter(buffer_[pos_])) {
    s[len++] = buffer_[pos_++];
  }
}

bool TokenizeReader::HasNext() {
  static size_t unused;
  Read(nullptr, unused, 0);
  return EnsureRead();
}

int TokenizeReader::NextInt() {
  static char buf[21];
  size_t len;
  int value;
  Read(buf, len, 20);
  if (len == 0) throw -1;
  buf[len] = 0;
  sscanf(buf, "%d", &value);
  return value;
}

bool TokenizeReader::EnsureRead() {
  if (pos_ < read_n_) {
    return true;
  } else if (end_) {
    return false;
  }
  read_n_ = ::fread(buffer_, 1 /* size */, buffer_len_, file_);
  pos_ = 0;
  end_ = read_n_ == 0;
  return !end_;
}

bool TokenizeReader::IsInValidCharacter(int c) {
  return c == ' ' || c == '\t' || c == '\n' || c == EOF;
}

}

#endif  // IO_H

namespace {

#define for_each_test_cases(T, BUFFSIZE)            \
  TokenizeReader reader(::stdin, BUFFSIZE);         \
  int T;                                            \
  scanf("%d", &T);                                  \
  for (int cas = 1; cas <= T; cas++)

}  // namesapce

char s[5][5];

int main() {
  while (scanf("%s%s", s[0], s[1]) == 2) {
    std::reverse(s[1], s[1] + 3);
    puts(strcmp(s[0], s[1]) == 0 ? "YES" : "NO");
  }
  return 0;
}



Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break

    w, h = map(int, input().split())
    field = [[False for y in range(h)] for x in range(w)]
    for i in range(n):
        x, y = map(int, input().split())
        field[x - 1][y - 1] = True

    s, t = map(int, input().split())
    ans = 0
    for x0 in range(w - s + 1):
        for y0 in range(h - t + 1):
            cnt = 0
            for dx in range(s):
                for dy in range(t):
                    if field[x0 + dx][y0 + dy]:
                        cnt += 1
            ans = max(ans, cnt)
    print(ans)


Measured memory_bytes: 5788
#include<iostream>
#include<string>
using namespace std;
int main (void){

    int n, k, p, a, ni = 0;
    int s[100];

    cin >> n >> k;

    for(int i = 0;i < n;i++){
        s[i] = 0;
    }

    for(int j = 0;j < k;j++){

            cin >> p;
         for(int z = 0;z < p;z++){

                 cin >> a;
                s[a- 1] = 1;
        }

    }
    for(int i = 0;i < n;i++){
     if(s[i] == 0)
        ni++;
    }
        cout << ni << endl; 

    return 0;
}

Measured memory_bytes: 3160
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

  int result = 0;
  rep(i, s.size()) { result += (s[i] == t[i] ? 0 : 1); }
  cout << result << endl;
  return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<n;++(i));
#define SORT(s) sort((s).begin(),(s).end());
#define SORTR(s) sort((s).begin(),(s).end(),greater<int>());

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const double PI=acos(-1.0);

int W,H,x,y;
int input()
{  
    cin>>W>>H>>x>>y;
}

int solve()
{
    double ans1=W/2.0*H;
    int ans2=0;
    if(x*2==W && y*2==H) ans2=1;
    cout<<fixed<<setprecision(10)<<ans1<<" "<<ans2<<endl;
}

int main(){
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
T = list(map(int,input().split()))
M = int(input())
base = sum(T)
result = []
for i in range(M):
    P,X = map(int, input().split())
    result.append(base - T[P-1] + X)
print("\n".join([str(x) for x in result]))

Measured memory_bytes: 3064
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let input:Vec<i32> = s.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect();
    let mut state = 0;
    if input[0]+ input[1]>=input[2]{ state = 1 }
    let ans = vec!["No","Yes"];
    println!("{}", ans[state]);
}


Measured memory_bytes: 4352