akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
#define int long long
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


signed main(void) {
  string s, t;

  cin >> s >> t;
  
  vector<set<int>> ai(26, set<int>());
  int N;
  N = s.size();
  
  rep(i, N) {
    ai[s[i] - 'a'].emplace(i);
  }
  
  int cycle = 0;
  int curi = 0;
  rep(i, t.size()) {
    int idx = t[i] - 'a';
    if(ai[idx].empty()) {
      fin("-1");
      return 0;
    }
    
    //curi以上で最初のインデックスを返す
    auto itr = ai[idx].lower_bound(curi);
    if(itr == ai[idx].end()) {
      //見つからない
      ++cycle;
      curi = *ai[idx].begin() + 1;
    } else {
      curi = *itr + 1;
    }
  }
  
  ll res = cycle * N + curi;
  fin(res);
}

Measured memory_bytes: 5120
#define _USE_MATH_DEFINES
#include  <iostream>
#include  <algorithm>
#include  <climits>
#include  <vector>
#include  <string>
#include  <cstring>
#include  <stack>
#include  <queue>
#include  <cmath>
#include  <iomanip>
#include  <set>
#include  <map>
#include  <new>
#include <cstdint>
#include <cctype>
#include  <cstdio>
#include  <sstream>
#include  <bitset>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define lrep(i,n,m)  for(int i = n; i < m; i++)

using ll = long long;
using ld = long double;
using Vii = vector<vector<int> >;
using Gjudge = vector<vector<bool>>;
using Vi = vector<int>;
using Vl = vector<ll>;
using Vd = vector<double>;
using Vld = vector<long double>;
using Vll = vector<vector<ll> >;
using Vldd = vector<vector<ld> >;
using Vs = vector<string>;
using Vb = vector<bool>;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Pli = pair<ll, int>;
using VPi = vector<Pi>;
using VPl = vector<Pl>;
using VPli = vector<Pli>;
using Ti = tuple<int, int, int>;
using Tl = tuple<ll, ll, ll>;

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 int Mod = static_cast<int>(1e9 + 7);
const int INF = INT_MAX;
const ll LINF = LLONG_MAX;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };


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

	bool rw = true;
	if (s[n - 1] == 'R') rw = false;
	int numR = 0, numW = 0;

	for (int i = n - 1; i >= 0; i--) {
		if (rw && s[i] == 'W') continue;
		if (rw) {
			if (s[i] == 'R') rw = false;
		}
		if (s[i] == 'R') numR++;
		else numW++;

	}

	if (numR == 0 || numW == 0) {
		cout << 0 << endl;
		return 0;
	}

	int numR2 = 0;
	for (int i = 0; i < numR; i++) {
		if (s[i] == 'R') numR2++;
	}
	cout << numR - numR2 << endl;
}


Measured memory_bytes: 3712
#include <stdio.h>

int D[35][35];
int c[505][505];

int main() {

	int N,C;

	scanf("%d %d",&N,&C);

	int i,j,k;

	for(i=1;i<=C;i++){
		for(j=1;j<=C;j++){
			scanf(" %d",&D[i][j]);
		}
	}

	for(i=1;i<=N;i++){
		for(j=1;j<=N;j++){
			scanf(" %d",&c[i][j]);
		}
	}

	int mod0[35]={0};
	int mod1[35]={0};
	int mod2[35]={0};

	for(k=1;k<=C;k++){
		for(i=1;i<=N;i++){
			for(j=1;j<=N;j++){
				if((i+j)%3==0){
					mod0[k]+=D[c[i][j]][k];
				}
				else if((i+j)%3==1){
					mod1[k]+=D[c[i][j]][k];
				}
				else if((i+j)%3==2){
					mod2[k]+=D[c[i][j]][k];
				}
			}
		}
	}

	int ans=1<<30;

	for(i=1;i<=C;i++){
		for(j=1;j<=C;j++){
			for(k=1;k<=C;k++){
				if(i!=j&&i!=k&&j!=k){
					if(ans>mod0[i]+mod1[j]+mod2[k]){
					ans=mod0[i]+mod1[j]+mod2[k];
					}
				}
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String t= sc.next();
		char []s =t.toCharArray(); 
		int ans =0;
	
		for(int i = 0; i <= n - 3; i++) {
			
			if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
import sys
n,m=map(int,input().split())
a=set(map(int,sys.stdin))
dp=[0]*(n+1)
dp[0]=1
if 1 not in a:dp[1]=1
for i in range(2,n+1):
    if i in a:continue
    if dp[i-1]==dp[i-2]==0:break
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])

Measured memory_bytes: 11884
# include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

# define pb push_back
# define fr first
# define sc second
# define mk make_pair

using namespace std;

const long long linf = 1e18 + 7;
const int inf = 1e9 + 7;
const int N = 1e5 + 5;

typedef long long ll;

long long n, h, a[N], b[N], mx;
int ans;

int main(){
      cin >> n >> h;

      for(int i = 1; i <= n; i ++)
            cin >> a[i] >> b[i], mx = max(mx, a[i]);

      sort(b + 1, b + n + 1);

      for(int i = n; i >= 1; i --){
            h -= max(mx, b[i]);
            ans ++;
            if(h <= 0){
                  cout << ans << endl;
                  return 0;
            }
      }

      int lo = 0, hi = inf;

      while(hi - lo > 1){
            long long md = (lo + hi) >> 1;
            if(md * mx >= h)
                  hi = md;
            else
                  lo = md;
      }

      if(lo * mx >= h) hi = lo;
      ans += hi;

      cout << ans << endl;
}


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

char a[22][22];

int n,m;

struct pos
{
	int x;
	int y;
	int step;
};

pos make_pos(int a,int b,int c)
{
	pos ret;
	ret.x=a;
	ret.y=b;
	ret.step=c;
	return ret;
}

int bfs(int sx,int sy,int ex,int ey)
{
	bool vis[n+2][m+2];
	for(int i=0;i<=n+1;i++)
		for(int j=0;j<=m+1;j++)
			if(a[i][j]=='#')
				vis[i][j]=true;
			else
				vis[i][j]=false;
				
	queue<pos> q;
	q.push(make_pos(sx,sy,0));
	vis[sx][sy]=true;
	
	int move[2][4]={{0,0,-1,1},
				   {-1,1,0,0}};
	
	while(!q.empty()){
		pos fr=q.front();
		q.pop();
		if(fr.x==ex && fr.y==ey)
			return fr.step;
			
		pos newpos;
		for(int i=0;i<4;++i){
			int nx=fr.x+move[0][i];
			int ny=fr.y+move[1][i];
			if(vis[nx][ny])
				continue;
			vis[nx][ny]=true;
			newpos=make_pos(nx,ny,fr.step+1);
			q.push(newpos);
		}
	}
	return 0;
	
}

int main()
{
	for(int i=0;i<22;i++)
		for(int j=0;j<22;j++)
			a[i][j]='#';
	cin>>n>>m;
	
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	
	int maxv=0;
	
	for(int i1=1;i1<=n;i1++)
		for(int j1=1;j1<=m;j1++)
		{
			if(a[i1][j1]=='#')
				continue;
			for(int i2=1;i2<=n;i2++)
					for(int j2=1;j2<=m;j2++)
					{
						if(a[i2][j2]=='#')
							continue;
						if(i1==i2 && j1==j2)
							continue;
						maxv=max(maxv,bfs(i1,j1,i2,j2));
					}
		}
	cout<<maxv<<endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  vector<long long> cnt(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    A.at(i)--;
    cnt.at(A.at(i))++;
  }
  
  long long total = 0;
  for (int i = 0; i < N; i++) {
    total += cnt.at(i) * (cnt.at(i)-1) / 2;
    
  }
  for(int i=0;i<N;i++){
    cout << total - cnt.at(A.at(i)) + 1 << endl;
  } 
}

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

int main ()
{
  std::array<char, 3> S;
  for(int i = 0; i < 3; i++){
    std::cin >> S.at(i);
  }
  if(S.at(0) != S.at(1) && S.at(1) != S.at(2)
     && S.at(2) != S.at(0)){
    std::cout << "Yes";
  }else{
    std::cout << "No";
  }
  return 0;
}

Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def ppp(a,b):
	while b >= 1:
		a,b = b, a % b
	return a

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	ret = 1
	for _ in range(n):
		v = int(input())
		ret = (ret*v) //ppp(ret, v)
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 62648
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 1e9
using namespace std;
typedef long long ll;
static const ll MOD = 1000000007LL;

signed main() {
  // std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
  int n;
  cin >> n;
  
  vector<int> nums(n + 1);
  REPS(i, n){
    cin >> nums.at(i);
  }
  
  vector<int> ans(n + 1, 0);
  RREPS(i, n){
    int sum = 0;
    // cout << i << "について計算している。" << endl;
    // cout << "対象は、" ;
    for(int j = 1; j * i <= n; j++){
      // cout << j * i << ",";
      sum += ans.at(j * i);
    }
    if (sum % 2 != nums.at(i)){
      ans.at(i) = abs(1 - ans.at(i));
    }
    // cout << endl;
  }

  int cnt;
  REPS(i, n){
    if (ans.at(i) == 1) cnt++;
  }
  cout << cnt << endl;
  if (cnt == 0) {
  }
  else if (cnt == 1){
    REPS(i, n){
      if (ans.at(i) == 1){
        cout << i << endl;
      }
    }
  }
  else {
    int flg = 0;
    REPS(i, n){
      if (ans.at(i) == 1){
        if (flg == 0){
          cout << i;
          flg++;
        }
        else {
          cout << " " << i;
        }
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  ll a,b,k;
  cin >> a >> b >> k;
  if(a>k){
    cout << a-k << " " << b << endl;
  }else if(a+b>k){
    cout << 0 << " " << a+b-k << endl;
  }else{
    cout << 0 << " " << 0 << endl;
  }
}

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

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


int main(){
  long long int X;
  cin >> X;
  long long int A[X+1];
  long long int O=0;
  
  for(long long int i=0;i<X+1;i++){
    A[i]=0;
  }
  
  for(long long int i=1;i<X+1;i++){
    for(long long int j=1;i*j<X+1;j++){
      A[i*j]++;
    }
  }
  
  for(long long int i=0;i<X+1;i++){
    O=O+i*A[i];
  }
  
  cout << O;
  
  return 0;
}


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


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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  string s, t;
  cin >> s >> t;
  string s1(t.begin(), t.begin() + s.length());

  cout << ((s1 == s) ? "Yes" : "No") << endl;


  return 0;
}


Measured memory_bytes: 3660
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iostream>
#define maxn 150
using namespace std;
int n, a[maxn];
int dp[maxn][11];
const int INF = 1e9;
int main(){
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	dp[0][0] = 0;
	for(int i = 1; i < 10; i++)
		dp[0][i] = -INF;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 10; j++)
			dp[i + 1][j] = -INF;
		for(int j = 0; j < 10; j++){
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
			dp[i + 1][(j + a[i + 1]) % 10] = max(dp[i + 1][(j + a[i + 1]) % 10], dp[i][j] + a[i + 1]);
		}
	}
	int ans = 0;
	for(int j = 1; j < 10; j++)
		ans = max(ans, dp[n][j]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N=sc.nextInt();
        boolean ans=false;
        lavel:for(int i=0;i<=25;i++){
            for(int j=0;j<=14;j++){
                if(i*4+j*7==N){
                    ans=true;
                    break lavel;
                }
            }
        }
        if(ans)
        System.out.println("Yes");
        else
            System.out.println("No");
    }
}

Measured memory_bytes: 21972
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N;
LL dp[1234567];
LL tag[1234567];

int main() {
	cin >> N;
	set<LL>S;
	map<LL, vector<LL>>mp;
	map<LL, LL>inv;
	for (int i = 0; i < N; ++i) {
		LL X, L;
		cin >> X >> L;
		mp[X + L].push_back(X - L);
		S.insert(X + L);
		S.insert(X - L);
	}
	LL num = 0;
	for (LL elm : S) {
		inv[elm] = num;
		tag[num] = elm;
		++num;
	}
	LL ans = 0;
	for (LL i = 0; i < num; ++i) {
		if (i != 0) {
			dp[i] = dp[i - 1];
		}
		if (mp.count(tag[i])) {
			for (int elm : mp[tag[i]]) {
				LL x = dp[inv[elm]] + 1;
				dp[i] = max(dp[i], x);
			}
		}
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 38656
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B;
    cin >> A >> B;
    
    if (A == 1 && A != B){
        cout << "Alice" << endl; 
    }
    else if (B == 1 && A != B){
        cout << "Bob" << endl;
    }
    else if (A == B){
        cout << "Draw" << endl;
    }
    else if (A > B){
        cout << "Alice" << endl; 
    }
    else {
        cout << "Bob" << endl;
    }
}

Measured memory_bytes: 256
def main():
	N, K = map(int, input().split())
	total = ((N-1)*(N-2)//2)
	if K > total:
		print(-1)
		return
	dif = total - K
	M = N-1+dif
	print(M)
	for i in range(N-1):
		print(" ".join([str(i+1), str(N)]))

	cur = 1
	add = 0
	for _ in range(dif):
		add += 1
		pair = cur+add
		if pair > N-1:
			cur += 1
			add = 1
			pair = cur+1
		print(" ".join([str(cur), str(pair)]))


if __name__ == '__main__':
	main()

Measured memory_bytes: 3336
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int R;
  cin >> R;
  string ans;
  if (R < 1200) {
    ans = "ABC";
  }
  else if (R < 2800) {
    ans = "ARC";
  }
  else {
    ans = "AGC";
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
int n;
vector<int>graph[200004];
typedef pair<int, int>p;
p dfs(int now, int par) {
	p ans = p(0, now);
	for (int i = 0; i < graph[now].size(); i++) {
		int to = graph[now][i];
		if (to != par) {
			p tmp = dfs(to, now);
			if (tmp.first+1 > ans.first)ans =p(tmp.first+1,tmp.second);
		}
	}
	return ans;
}
int d[200004];
int dp(int now) {
	if (d[now] != -1)return d[now];
	if (dp(now - 2) == 0 || dp(now - 1) == 0) {
		d[now] = 1;
	}
	else {
		d[now] = 0;
	}
	return d[now];
}
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	if (n == 1) {
		cout << "First";
		return 0;
	}
	int a, b;
	for (int i = 0; i < n - 1; i++) {
		cin >> a >> b;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	int x, y;
	x = dfs(1, -1).second;
	int dist = dfs(x, -1).first;
	for (int i = 0; i < 200004; i++) {
		d[i] = -1;
	}
	d[0] = 0;
	d[1] = 0;
	if (dp(dist) == 0)cout << "Second";
	else cout << "First";
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) cin >> H[i];
    sort(H.begin(), H.end());

    ll ans = 0;
    rep(i, N - K) ans += H[i];
    cout << ans << endl;
}

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

int main()
{
    double n;
    cin>>n;
    double x=1.08;
    double f=floor(n/x);
    if(f!=double(n/x))f++;
    if(int(n)==int(f*x))cout<<int(f);
    else
     cout<<":(";
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int x;
	cin >> x;
	if (x < 1200) cout << "ABC\n";
	else cout << "ARC\n";
}

Measured memory_bytes: 256
import numpy as np

N, A = map(int,input().split())
X = [int(x) for x in input().split()]
 
dp = np.zeros((N+1,N*A+1),dtype=np.int64)
dp[0,0] = 1
 
for x in X:
    dp[1:,x:] += dp[:-1,:-x].copy()
  
ans = 0
for n in range(1,N+1):
    ans += dp[n,n*A]

print(ans)

Measured memory_bytes: 14520
#include<bits/stdc++.h>
#define mod 1000000007

using namespace std;

using ll = long long;

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

 	ll n;
 	cin >> n;

 	ll sum = 0;
 	vector<bool>v(n+1,0);

 	for(ll i=3;i<=n;i=i+3){
 		v[i] = 1;
 	}  
 	for(ll i=5;i<=n;i=i+5){
 		v[i] = 1;
 	}   

 	for(ll i=1;i<=n;i++){
 		if(v[i] == 0){
 			sum = (sum + i);
 		}
 	}

 	cout << sum << "\n";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(int argc, char **argv) {
	int n, k;
	cin >> n >> k;
	int res = k;
	REP(i, n - 1) res *= k - 1;
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 1; i < n - 1; i++)
    {
        if (p[i - 1] < p[i] && p[i] < p[i + 1])
            ans++;
        else if (p[i - 1] > p[i] && p[i] > p[i + 1])
            ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
n,q = map(int,input().split())


edge = [[] for _ in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

used = [True]*n
used[0] = False

new = [0]
tank = []

s = [[] for _ in range(n)]

while len(new) != 0:
    tank = []
    for e in new:
        for p in edge[e]:
            if used[p]:
                s[e].append(p)
                tank.append(p)
                used[p] = False 

    new = tank


res = [0]*n
for _ in range(q):
    p,x = map(int,input().split())
    res[p-1] += x

new = [0]
tank = []
while len(new) != 0:
    tank = []
    for e in new:
        for p in s[e]:
            res[p] += res[e]
            tank.append(p)
    new = tank
for ans in res:
    print(ans,end = ' ')


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

using namespace std;
typedef long long ll;
const int N = 200010;
const int MOD = 998244353;
int _w;

void add_mod( int &a, int b ) {
	a += b;
	a -= a >= MOD ? MOD : 0;
}

void sub_mod( int &a, int b ) {
	a -= b;
	a += a < 0 ? MOD : 0;
}

int mu[N];

int calc_mu( int x ) {
	int ans = 1;
	for( int i = 2; i*i <= x; ++i )
		if( x % i == 0 ) {
			x /= i;
			ans = -ans;
			if( x % i == 0 ) return 0;
		}
	if( x != 1 ) ans = -ans;
	return ans;
}

void init_mu() {
	for( int i = 1; i < N; ++i )
		mu[i] = calc_mu(i);
}

int n, a[N];
char str[N];

vector<int> fac;

void factor( int x ) {
	for( int i = 1; i <= x; i += 2 )
		if( x % i == 0 )
			fac.push_back(x/i);
	sort(fac.begin(), fac.end());
}

int get_num( int len ) {
	int x = 0;
	for( int i = 1; i <= len; ++i ) {
		x = (x * 2 + a[i]) % MOD;
	}
	return x;
}

int chk[N];

int check( int len ) {
	for( int i = 1; i <= len; ++i ) {
		chk[i] = a[i];
		for( int j = len+i; j <= n; j += len )
			chk[j] = 1 - chk[j-len];
	}
	for( int i = 1; i <= n; ++i ) {
		if( chk[i] < a[i] )
			return 1;
		else if( chk[i] > a[i] )
			return 0;
	}
	return 1;
}

int calc( int len ) {
	int rtn = get_num(len);
	add_mod(rtn, check(len));
	return rtn;
}

int ans[N];

void solve() {
	for( int len : fac ) {
		int tmp = calc(len);
		// printf( "calc(%d) = %d\n", len, tmp );
		add_mod( ans[len], tmp );
		for( int j = len+len; j <= n; j += len ) {
			if( mu[j/len] == 1 ) {
				add_mod( ans[j], tmp );
			} else if( mu[j/len] == -1 ) {
				sub_mod( ans[j], tmp );
			}
		}
	}
	int tot = 0;
	for( int i : fac ) {
		add_mod( tot, int(1LL * ans[i] * i * 2 % MOD) );
		// printf( "ans[%d] = %d\n", i, ans[i] );
	}
	cout << tot << endl;
}

int main() {
	_w = scanf( "%d", &n );
	_w = scanf( "%s", str+1 );
	for( int i = 1; i <= n; ++i )
		a[i] = str[i] - '0';
	factor(n);
	init_mu();
	solve();
	return 0;
}


Measured memory_bytes: 7036
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

pre_T = [[None,False] for _ in range(K)]

ans = 0
for i in range(N):
    if pre_T[i%K][0] == T[i] and pre_T[i%K][1]:
        pre_T[i%K] = T[i], False
    else:
        pre_T[i%K] = T[i], True

        if T[i] == "r":
            ans += P
        elif T[i] == "s":
            ans += R
        else:
            ans += S

print(ans)

Measured memory_bytes: 12020
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[200007],finv[200007],inv[200007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<200007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    string s;
    ll k;
    cin>>s>>k;
    ll n=s.length();
    ll ans=0;
    if(n<k){
        cout << 0<<endl;
        return 0;
    }
    /*ans+=com(n-1,k)*pow(9LL,k);
    ll num=(s[0]-'0');
    for(int i=1;i<num;i++){
        ans+=com(n,k)*pow(9LL,k-1);
    }
    k--;
    n--;
    */
    /*bool maki=true;
    for(int i=1;i<k;i++){
        if(s[i]=='0')maki=false;
    }
    if(!maki)ans--;*/
    while(k&&n){
        if(s[0]!='0'){
        ans+=com(n-1,k)*pow(9LL,k);
    ll num=(s[0]-'0');
    for(int i=1;i<num;i++){
        ans+=com(n-1,k-1)*pow(9LL,k-1);
    }
    if(n==k&&n==1)ans++;
    k--;
}
    n--;

    s=s.substr(1,n);
    }
    if(n>k)ans++;
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
using System;
//using System.Collections;
using System.Collections.Generic;
//using System.Linq;

namespace problem
{
  class Test
  {
    static void Main()
    {
      int i = int.Parse(Console.ReadLine());
      string[] s = new string[i];

      for (int a = 0; a < i; a++)
      {
        s[a] = Console.ReadLine();
      }

      var t = new List<int>();

      for (int b = 0; b < i; b++)
      {
        for (int c = 0; c < i; c++)
        {
          if (c == b) continue;
          t.Add(int.Parse((s[b] + s[c])));
        }
      }

      t.Sort();
      Console.WriteLine(t[2]);
    }
  }
}


Measured memory_bytes: 577860
N = int(input())
a = [int(x) for x in input().split()]

if(N==1):
    print(a[0])
elif(N%2==0):
    for i in range(N-1,-1,-2):
        print(a[i],end=' ')
    for i in range(0,N-2,+2):
        print(a[i],end=' ')
    print(a[N-2])
else:
    for i in range(N-1,-1,-2):
        print(a[i],end=' ')
    for i in range(1,N-2,+2):
        print(a[i],end=' ')
    print(a[N-2])
    

Measured memory_bytes: 26180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define pb push_back
#define fi first
#define se second
#define Mod 1000000007


int main(){
    int i,j;
    int n,q;
    string s;
    cin>>n>>s>>q;
    int k[q];

    int l=s.size();
    int a[l];

    for(i=0;i<l;i++){
        if(s[i]=='D') a[i]=1;
        else if(s[i]=='M') a[i]=2;
        else if(s[i]=='C') a[i]=3;
        else a[i]=0;
    }

    for(i=0;i<q;i++){
        ll ans=0;
        ll ans0=0;
        int k;
        cin>>k;

        int tx=0;
        int ty=0;
        int tz=0;
        for(j=0;j<k;j++){
            if(a[j]==2) ty++;
            if(a[j]==3) {
                tz++;
                ans0+=ty;
                if(a[0]==1) ans+=ty;
            }
        }
        for(j=k;j<l;j++){
            int h=j-k+1;
            if(a[h-1]==2) {
                ty--;
                ans0-=tz;
            }
            if(a[h-1]==3) {
                tz--;
            }
            if(a[j]==2){
                ty++;
            }
            if(a[j]==3){
                tz++;
                ans0+=ty;
            }
            if(a[h]==1){
                ans+=ans0;
            }
        }

        for(j=l;j<l+k-1;j++){
            int h=j-k+1;
            if(a[h-1]==2) {
                ty--;
                ans0-=tz;
            }
            if(a[h-1]==3) {
                tz--;
            }
            if(a[h]==1){
                ans+=ans0;
            }
        }
        
        
    

        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 5252
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        A, B, C, X = [int(input()) for _ in range(4)]
        ans = 0
        for a in range(A + 1):
            for b in range(B + 1):
                for c in range(C + 1):
                    if 500 * a + 100 * b + 50 * c == X:
                        ans += 1
        print(ans)


# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>//头文件
using namespace std;//使用名字空间
int main()//主程序
{
    int a,b;
    char fh;
    cin>>a>>fh>>b;//读入
    if(fh=='+')
        cout<<a+b<<endl;//pd
    else
        cout<<a-b<<endl;//pd
    return 0;//华丽结束！
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
constexpr int n = 1e5 + 5;
int N, M;
vector<vector<int>>edges(n);
vector<int> dp(n, 0);
vector<int> vis(n, 0);
int dfs(int x) {
	if (!x) {
		return 0;
	}
	int ans = 0;
	for (int& nb : edges[x]) {
		if (!vis[nb]) {
			ans = max(dfs(nb)+1,ans);
		}
		else {
			ans= max(dp[nb] + 1, ans);
		}
		
	}
	vis[x] = 1;
	dp[x] = ans;
	return dp[x];
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x, y;
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		edges[i].push_back(0);
	}
	for (int i = 0; i < M; i++) {
		cin >> x >> y;
		edges[y].push_back(x);
	}
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		if (!vis[i])
		{
			ans = max(dfs(i), ans);
		}
		else {
			ans=max(dp[i],ans);
		}
	}
	cout << ans-1;
	return 0;
}

Measured memory_bytes: 11008
import java.util.Scanner;

public class Main {

	static int num,n,s;
	
	static void dfs(int depth,int begin,int sum)
	{
		if(depth==n)
		{
			if(sum==s)++num;
			return;
		}
		for(int i=begin;i<=9;++i)
		{
			if(sum+i<=s)
			{
				dfs(depth+1,i+1,sum+i);
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		
		while(true)
		{
			n=sc.nextInt();
			s=sc.nextInt();
			if(n==0&&s==0)break;
			num=0;
			dfs(0,0,0);
			System.out.println(num);
		}
		
		sc.close();
	}

}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 1e5 + 2;
ll i,j,a,b,ans;
vi v;
ll p[N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>a>>b;
    a = __gcd(a, b);
    for(i = 1;i <= sqrt(a);i += 1) if(a % i == 0){
        v.pb(i);
        if(a / i != i)
            v.pb(a / i);
    }
    sort(all(v));
    ans = 1;
    for(i = 1;i < v.size();i += 1) if(p[i] == 0){
        ans += 1;
        for(j = i + 1;j < v.size();j += 1) if(v[j] % v[i] == 0)
            p[j] = 1;
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

const int maxn=2e5+10;

int main()
{
	string s1,s2;
	int ans=0;
	cin>>s1>>s2;
	for( int i=0;i<s1.size();i++ )
	{
		ans+=( s1[i]!=s2[i] );
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int n;
  cin >> n;
  set<string> S;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    S.insert(s);
  }
  cout << S.size() << endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int ts[N+1];
  pair<int, int> p[N+1];
  ts[0] = 0;
  p[0].first = 0;
  p[0].second = 0;
  for(int i=1; i<N+1; i++){
    cin >> ts[i] >> p[i].first >> p[i].second;
  }

  for(int i=1; i<N+1; i++){
    int t = ts[i];
    int x = p[i].first;
    int y = p[i].second;

    int dis = abs(p[i-1].first - x) + abs(p[i-1].second - y);
    if(t - ts[i-1] < dis || (t - ts[i-1] - dis)%2 != 0){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v){
    if(v.empty()){
        os<<"{ }";
        return os;
    }
    os<<"{"<<v.front();
    for(auto itr=++v.begin();itr!=v.end();itr++){
        os<<", "<<*itr;
    }
    os<<"}";
    return os;
}

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    ll n; cin>>n;
    ll sl=INF,sr=-INF,tl=INF,tr=-INF;
    rep(i,n){
        ll x,y; cin>>x>>y;
        sl=min(sl,x+y);
        sr=max(sr,x+y);
        tl=min(tl,x-y);
        tr=max(tr,x-y);
    }
    cout<<max(sr-sl,tr-tl)<<endl;
}

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

int main()
{
    string s;
    cin >> s;
    for(char i = 'a'; i <= 'z'; i++)
    {
        int count = 0;
        for(int j = 0; j < s.size(); j++)
        {
            if(s[j] == i)
                count++;
        }
        if(count%2 != 0)
        {
            cout << "No";
            return 0;;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
key_inputs = input()


h, w = key_inputs.split(' ')
h, w = int(h), int(w)
while not (h==0 and w ==0):
    for i in range(h):
        for j in range(w):
            if i%2 == 0 and j%2 == 0:
                print("#", end='')
            if i%2 == 0 and j%2 == 1:
                print(".", end='')
            if i%2 == 1 and j%2 == 0:
                print(".", end='')
            if i%2 == 1 and j%2 == 1:
                print("#", end='')
        print('')
    print('')
    key_inputs = input()
    h, w = key_inputs.split(' ')
    h, w = int(h), int(w)      
        


Measured memory_bytes: 7020
n = int(input())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(x[i]-y[i])
    b.append(x[i]+y[i])
c = max(a) - min(a)
d = max(b) - min(b)
print(max(c,d))

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

int main() {
  cin >> N;
  int t=N, c=0;
  
  while(t > 0) c += t%10, t /= 10;
  if(N%c == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}

int main (){
    int n,m;
    cin >> n >> m;
    bool flag=false;
    vector<int>A(n,0);
    vector<int>B(n,0);
    vector<int>C(n,0);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        if(a==1){
            A[b-1]++;
        }
        else if(b==n){
            B[a-1]++;
        }
    }
    rep(i,n){
        C[i]=A[i]+B[i];
        if(C[i]==2)flag=true;
    }
    if(flag) cout << "POSSIBLE" <<endl;
    else cout << "IMPOSSIBLE" <<endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n; 
  for (int i = 0; i <= 100; i++) {
    int c = n - 4 * i;
    if (c >= 0 && c % 7 == 0) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

typedef long long ll;

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

const long long INF = 1LL << 60;

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll a,b; cin>>a>>b;
    
  ll res =a / euclidean_gcd(a, b) * b;
  cout<<res;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int main(){

    int X,a1,a2;
    cin>>X;

    a1=ceil(X/1.08);
    a2=floor(X/1.08);

    if(floor(a1*1.08)==X){
        cout << a1<<endl;
    }else if(floor(a2*1.08)==X){
        cout <<a2<<endl;
    }else{
        cout<<":("<<endl;
    }
    
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n;
    cin >> n;
    long N=n;
    int sum=0;
    
    while(n!=0){
        sum=sum+n%10;
        n=n/10;
    }
    //cout << sum << endl;

    if(N%sum==0)cout << "Yes" << endl;
    else cout << "No" <<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        int length = S.length();
        char[] d = S.toCharArray();
        int limit = pow(2, length-1);
        long answer = 0;
        for (int i = 0; i < limit; i++) {
            int[] position = position(length-1, i);
            long current = 0;
            for (int j = 0; j < length; j++) {
                current *= 10;
                current += d[j] - '0';
                if (j == length - 1 || position[j] == 1) {
                    answer += current;
                    current = 0;
                }
            }
        }
        System.out.println(answer);
    }
    public int[] position(int length, int target) {
        int[] position = new int[length];
        if (target == 0) {
            return position;
        }
        int index = 0;
        while (target > 0) {
            if (target % 2 == 1) {
                position[index] = 1;
            }
            target /= 2;
            index += 1;
        }
        return position;
    }
    public int pow(int m, int n) {
        if (n == 0) {
            return 1;
        }
        if (n % 2 == 1) {
            return m*pow(m, n-1);
        }
        int x = pow(m, n/2);
        return x * x;
    }
}


Measured memory_bytes: 23764
# coding: utf-8

(n,m) = map(int, input().rstrip().split(" "))
shop_list = list(sorted([[int(i) for i in input().rstrip().split(" ")] for j in range(n)]))

remain = m
ans = 0

for i in shop_list:
    if remain == 0:
        break
    tmp = min(remain, i[1])
    ans += i[0] * tmp
    remain -= tmp

print(ans)



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

const int maxn = 5010, P = 1000000007;
int n, A, B, ans, pw[maxn], f[maxn][maxn][2], pre[maxn][maxn][2], h[maxn];

int main() {
    scanf("%d %d %d", &n, &A, &B);
    if (A < B) swap(A, B);
    pw[0] = pw[1] = 1;
    for (int i = 2; i <= n; i++) {
        pw[i] = (pw[i - 1] + pw[i - 1]) % P;
    }
    f[0][0][0] = f[0][0][1] = 1, h[0] = 1;
    pre[0][0][0] = pre[0][0][1] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= i; j++) {
            (f[i][j][0] += pre[i - 1][i - j][1]) %= P;
            if (i >= B) (f[i][j][1] += pre[i - B][i - j][0]) %= P;
        }
        for (int j = max(0, i - B + 1); j < i; j++) {
            (f[i][0][1] += h[j]) %= P;
        }
        for (int j = A; j <= i; j++) {
            int s = 1LL * (f[i][j][0] + f[i][j][1]) * pw[n - i] % P;
            (ans += s) %= P, f[i][j][0] = f[i][j][1] = 0;
        }
        for (int j = 0; j <= i; j++) {
            (h[i] += f[i][j][0]) %= P;
            pre[i][i - j][0] = (pre[i - 1][i - j][0] + f[i][j][0]) % P;
            pre[i][i - j][1] = (pre[i - 1][i - j][1] + f[i][j][1]) % P;
        }
    }
    printf("%d\n", (ans + P) % P);
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    string s;cin >> s;
    int cnt = 0;
    inc(i, 0, n){
        if(s[i] == 'R'){
            cnt++;
        }else{
            cnt--;
        }
    }
    if(cnt > 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		sc.close();

		if (k <= 10_000_000_000_000_000L) {
			System.out.println(2);
			if (k % 3 == 0) {
				System.out.println(k + 1 + " 1");
			} else if (k % 3 == 1) {
				System.out.println(k + 2 + " 0");
			} else {
				System.out.println(k + " 2");
			}
		} else {
			System.out.println(50);
			long[] a = new long[50];
			Arrays.fill(a, k / 50);
			for (int i = 0; i < a.length; i++) {
				a[i] += i;
			}
			long b = k % 50;
			for (int i = 0; i < b; i++) {
				a[49 - i]++;
			}
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < a.length; i++) {
				sb.append(a[i]).append(' ');
			}
			sb.deleteCharAt(sb.length() - 1);
			System.out.println(sb.toString());
		}
	}
}


Measured memory_bytes: 23764
N, SUM = map(int,input().split())
X = 10000
Y = 5000
Z = 1000
ans = [-1, -1, -1]
for x in range(N+1):
    for y in range(N+1):
        z = N-x-y
        if z<0:
            break
        if X*x+Y*y+Z*z==SUM:
            ans = [x,y,z]
            break
                
print(*ans)


Measured memory_bytes: 67704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; edge(ll f, ll t, ll c) : from(f), to(t), cost(c) { } };
// struct edge{ ll to, cost; edge(ll t, ll c) : to(t), cost(c) { } };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//cout << fixed << setprecision(10);

const ll MAX_V = 10;  // 最大頂点数(制約に従う)
ll d[MAX_V][MAX_V];  // 全体をINF、d[i][i]を0に初期化(d[i][j]:=iからjへの最短距離)
// 初期化
// FILL(d, INF);
// rep(i, V) d[i][i] = 0;  // V: 実際の頂点数


// 0-basedに注意
void warshall_floyd(ll V){  // 実際の頂点数
    // 経由頂点, 始点, 終点
    rep(k, V) rep(i, V) rep(j, V) chmin(d[i][j], d[i][k] + d[k][j]);
}


int main(){
    ll h, w; cin >> h >> w;
    FILL(d, INF);
    rep(i, 10) d[i][i] = 0;
    rep(i, 10) rep(j, 10) cin >> d[i][j];
    warshall_floyd(10);

    ll ans = 0;
    rep(i, h){
        rep(j, w){
            ll a; cin >> a;
            if(a == -1) continue;
            ans += d[a][1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	inputs := scanIntNums()
	N := inputs[0]
	A := inputs[1]
	B := inputs[2]

	rep := N / (A + B)
	rem := N % (A + B)

	var result int
	if rep == 0 {
		if N < A {
			result = N
		} else {
			result = A
		}
	} else {
		if rem < A {
			result = A*rep + rem
		} else {
			result = A*rep + A
		}
	}
	fmt.Println(result)
}

func scanIntNums() (nums []int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	nums = make([]int, len(numString))
	var err error

	for i := 0; i < len(nums); i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}


Measured memory_bytes: 640