akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;

const long long INF = 1e18; 
const long long mod = 998244353;//200003;786433;1e9 + 7;
const double Pi = acos(-1);
  
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, ans = 0;
int a[1 << 18];
multiset <int> DP[1 << 18]; 

signed main()
{
	cin >> n;
	for(int i = 0; i < 1 << n; i++)
	{
		cin >> a[i];
		DP[i].insert(a[i]);
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < 1 << n; j++)
		{
			if(j & (1 << i))
			{
				continue;
			}
			for(auto x : DP[j])
			{
				DP[j ^ (1 << i)].insert(x);
			}
			while(DP[j ^ (1 << i)].size() > 2)
			{
				DP[j ^ (1 << i)].erase(DP[j ^ (1 << i)].begin());
			}
		}
	}
	for(int i = 1; i < 1 << n; i++)
	{
		int sum = 0;
		if(DP[i].size() == 2)
		{
			for(auto x : DP[i])
			{
				sum += x;
			}
		}
		ans = max(ans, sum);
		cout << ans << '\n';
	}
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

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

  in(int, x);
  int ans = 1;
  for (int b = 2; b * b <= x; ++b) {
    for (int c = b * b; c <= x; c *= b) {
      ans = max(ans, c);
    }
  }
  out(ans);
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
int inf=100000000;
ll INF=100000000000000000;

int main() {
    vector<int> a={2};
    for (int i=3;i<301;i++){
        int t=0;
        rep (j,a.size()) if (i%a.at(j)==0) t=1;
        if (t==0) a.push_back(i);
    }
    //rep(i,a.size()) cout << a.at(i) << endl;
    int n;
    cin >> n;
    int u=0;
    int l=6;
    vector<int> q(0);
    while (true){
        int y=0;
        rep(i,a.size()){
            if (l%a.at(i)==0) y=1;
            if (l==a.at(i)){
                q.push_back(l);
                u++;
                break;
            }
            
        }
        if (y==0) {q.push_back(l);u++;}
        l+=5;
        if (u==n) break;
    }
    rep(i,q.size()-1) cout << q.at(i) << " " << endl;
    cout << q.at(n-1) << endl;
}


Measured memory_bytes: 256
import numpy as np
import sys

N = int(input())
if N == 1:
    print(0)
    sys.exit()

d = int(N ** .5)

def eratosthenes(N):
	is_prime = [True] * (N + 1)
	is_prime[0], is_prime[1] = False, False
	for i in range(2, int(N**(1/2)) + 1):
		if is_prime[i]:
			for j in range(i * 2, N + 1, i):
				is_prime[j] = False
	return [i for i in range(N+1) if is_prime[i]]

p_num = eratosthenes(d+1)
MAX_p = p_num[-1]
ans = 0
used = []
for p in p_num:
    t_p = p
    while N % p == 0:
        N //= p
        ans += 1
        p *= t_p
    if p != t_p:
        used.append(t_p)

for p in used:
    while N % p == 0:
        N //= p

if N > MAX_p:
    dd = int(N ** .5)
    cond = 1
    for i in range(2, dd+1):
        if N % i == 0:
            cond = 0
            break
    if cond:
        ans += 1
    
print(ans)

Measured memory_bytes: 38044
// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable mod = 10^^9 + 7;
immutable inf = 10^^9 + 7;

void main() {
    int n;
    int[] p;
    scan(n);
    p = readln.split.to!(int[]);
    p[] -= 1;

    auto s = new char[](n);

    foreach (i ; 0 .. n) {
        s[i] = (i == p[i] ? 'o' : 'x');
    }

    debug {
        writeln(s);
    }

    long ans = s.split('x').map!(w => (w.length.to!int + 1) / 2).sum(0L);

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
} 

Measured memory_bytes: 7868
#include <bits/stdc++.h>
using namespace std;
int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    
    vector<int> vc1(N);
    for( auto& x : vc1 ){
        cin >> x;
    }
    
    int Q;
    cin >> Q;
    
    vector<int> vc2(Q);
    for( auto& x : vc2 ){
        cin >> x;
    }
    set<int> st;
    for( auto&& x : vc2 ){
        for( auto&& y : vc1 ){
            if( x == y ){
                st.insert(x);
            }
        }
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 3216
#include<iostream>



using namespace std;

int main(){

int a=0;
int b = 0;
int t = 0;

double temp_t = 0;
double limit_time = 0;
int num_bis = 0;
int count = 1;


cin >> a >> b >> t;

limit_time = t+0.5;


while(1){
  
  temp_t = limit_time/(a*count);

  if(temp_t<1){
   break;
  }
  
  else{
 num_bis = count*b;
 count++;
 }
}
 cout << num_bis;

return 0;
}




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

#include <fstream>
#include <iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long int ll;
typedef double ld;

class t {
public:
	void solve(std::istream& in, std::ostream& out) {

	    int a,b,c;
	    in>>a>>b;
	    out<<6-(a+b)<<endl;

	}
};


int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(nullptr);
	t solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;

typedef long long ll;

//operation1 -> nodeのデータ同士の統合の演算
template <class Monoid> struct SegTree {
	int N;
	vector<Monoid> node;
	std::function<Monoid(Monoid, Monoid)> operation;
	Monoid unit;//単位元

	std::function<bool(Monoid, Monoid)> comp;
	Monoid not_find_sgn;

	SegTree(vector<Monoid>& data, std::function<Monoid(Monoid, Monoid)> op, Monoid U) {
		//データ　演算　単位元
		operation = op;
		unit = U;
		int size = data.size();
		N = 1;
		while (N < size)N <<= 1;
		node.resize(2 * N - 1, unit);

		for (int i = 0; i < size; i++) {
			node[i + N - 1] = data[i];
		}

		for (int i = N - 2; i >= 0; i--) {
			node[i] = operation(node[i * 2 + 1], node[i * 2 + 2]);
		}
	}

	SegTree() = default;

	void update(int pos, Monoid val) {
		pos += N - 1;
		node[pos] = val;
		while (pos > 0) {
			pos = (pos - 1) / 2;
			node[pos] = operation(node[pos * 2 + 1], node[pos * 2 + 2]);
		}
	}

	Monoid getval(int a, int b, int idx, int l, int r = -1) {
		//[a, b)を求める。　使い方はgetval(a, b, 0, 0, -1);
		if (r == -1)r = N;
		if (b <= l || r <= a)return unit;
		if (a <= l && r <= b)return node[idx];
		Monoid left = getval(a, b, idx * 2 + 1, l, (l + r) / 2);
		Monoid right = getval(a, b, idx * 2 + 2, (l + r) / 2, r);
		return operation(left, right);
	}

	Monoid getval(int a, int b) {
		//ラッパー。
		return getval(a, b, 0, 0, -1);
	}

};

int N, K;
ll A[300000 + 10];

int main() {
	
	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> A[i];
	
	vector<int> dp_nakami(300000 + 10, 0);
	const int A_MIN = 0;
	const int A_MAX = 300000;
	SegTree<int> dp(dp_nakami, [](int a, int b) {return max(a, b); }, -114514);
	
	for (int i = 0; i < N; i++) {
		int l = A[i] - K, u = A[i] + K;//[l, u]
		if (l < 0) l = 0;
		if (u > 300000) u = 300000;
		int best = dp.getval(l, u + 1);
		dp.update(A[i], best + 1);
	}
	int ans = 0;
	for (int i = 0; i <= 300000; i++) {
		ans = max(ans, dp.node[dp.node.size() / 2 + i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10840
#include <stdio.h>

int main(){
  int n,a,b,d;
  scanf("%d %d %d",&n,&a,&b);
  d=n*a;
  if (d>b){
    printf("%d\n",b);
  }else{
    printf("%d\n",d);
  }
  
  return 0;
}

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

struct Unionfind {
  vector<int> par, rank;
  vector<long> size;

  Unionfind(int n) : par(n), rank(n), size(n){
    for(int i=0;i<n;i++){
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  int find(int x){
    if(par[x] == x){
      return x;
    }
    return par[x] = find(par[x]);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(rank[x] < rank[y]){
      par[x] = par[y];
      size[y] += size[x];
    }else{
      par[y] = par[x];
      size[x] += size[y];
      if(par[x] == par[y]) rank[x]++;
    }
  }

  long get_size(int x) {
    return size[find(x)];
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
};

int main(){
  int n, a,b;
  long m;
  cin >> m >> n;
  Unionfind tree(m+1);
  stack<long> s;
  stack<int> dum;
  s.push((m*(m-1))/2);
  for(int i=0;i<n;i++){
    cin >> a >> b;
    dum.push(a);
    dum.push(b);
  }
  
  for(int i=0;i<n;i++){
    a = dum.top();
    dum.pop();
    b = dum.top();
    dum.pop();
    if(tree.same(a,b)) {
      s.push(s.top());
    }else{
      s.push(s.top()-tree.get_size(a)*tree.get_size(b));
      tree.unite(a,b);
    }
  }
  s.pop();
  while(!s.empty()){
    cout << s.top() << endl;
    s.pop();
  }
}

Measured memory_bytes: 3712
-- ABC124 C problem
import Control.Monad

-- sub switching function
subf :: Char -> Char
subf '0' = '1'
subf '1' = '0'

-- main processing function
abc124c :: Char -> String -> Int
abc124c c [] = 0
abc124c c (x:xs) = (if x==c then 0 else 1) + (abc124c (subf c) xs)

-- main function
main :: IO ()
main = do
  str <- getLine
  let l = length str
  let p = abc124c '0' str
  print (min (l-p) p)

Measured memory_bytes: 7548
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

ll rui(ll a,ll n){
  ll ans=1;
  while(n>0){
    if(n&1) ans=ans*a;
    a=a*a;
    n/=2;
  }
  return ans;
}

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans;
  if(k%2==1){
    ans=rui(n/k,3);
  }
  else{
    ll ans1=rui(n/k,3);
    ll ans2=rui(n/(k/2)-n/k,3);
    ans=ans1+ans2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();

        for(int i=1; i<10;i++){
            if(n % i == 0){
                if(n/i < 10) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");

    }
}

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

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    vector<pair<int, int>> xy(N);
    for(int i = 0; i < N; i++){
        cin >> xy[i].first >> xy[i].second;
    }

    vector<pair<int, int>> sub_xy;
    sort(xy.begin(), xy.end(), greater<pair<int, int>>());

    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            pair<int, int> tx;
            pair<int, int> ty;
            tx.first = xy[i].first;
            tx.second = xy[i].second;
            ty.first = xy[j].first;
            ty.second = xy[j].second;
            if(tx.first == ty.first && tx.second == ty.second)
                continue;
            pair<int, int> tp;
            tp.first = tx.first - ty.first;
            tp.second = tx.second - ty.second;
            sub_xy.push_back(tp);
        }
    }

    int len_xy = sub_xy.size();
    int min1 = 51;
    for(int i = 0; i < len_xy; i++){
        int p = sub_xy[i].first;
        int q = sub_xy[i].second;
        int max1 = 0;
        //cout << p << " " << q << endl;
        vector<bool> fmap(N, true);
        int cnt = 0;
        for(int j = 0; j < N; j++){
            int x1 = xy[j].first;
            int y1 = xy[j].second;
            for(int k = 0; k < N; k++){
                if(j == k) continue;
                int x2 = xy[k].first;
                int y2 = xy[k].second;
                if(fmap[k] && x1-p == x2 && y1 - q == y2){
                    cnt++;
                    fmap[k] = false;
                    break;
                }
                //cout <<( x - x2) % p << " " << (y - y2) % q << endl;  
            }
            if(max1 < cnt){
                max1 = cnt;
            }
        }
        if(min1 > (N - max1)){
            min1 = N - max1;
        }
    }
    if(min1 == 51){
        min1 = 1;
    }

    cout << min1 << endl;
    return 0;
}

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

using ll = long long;
static const int MAX = 50;
static const int INF = 1e9;

// 隣接リストを用いた幅優先探索 O(|V|+|E|)
vector<int> d(MAX, INF); // d[i]:始点sから頂点iまでの最短距離

void bfs(const vector<vector<pair<int, ll>>> &G, int s) {
  queue<int> q;
  q.push(s);
  d[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < G[u].size(); i++) {
      if (d[G[u][i].first] == INF) {
        d[G[u][i].first] = d[u] + 1;
        q.push(G[u][i].first);
      }
    }
  }
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  // 重み付き無向(有向)グラフの隣接リスト
  int n; // n:頂点数
  cin >> n;
  
  vector<vector<pair<int, ll>>> G(n); // G:頂点数nのグラフの隣接リスト
  
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G[u].emplace_back(make_pair(v, i));
    G[v].emplace_back(make_pair(u, i)); // 有向グラフではコメントアウト
  }
  
  int m;
  cin >> m;
  
  vector<vector<int>> road(m);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    d = vector<int>(n, INF);
    bfs(G, u);
    int now = v;
    while (u != now) {
      for (int j = 0; j < G[now].size(); j++) {
        if (d[G[now][j].first] == d[now] - 1) {
          road[i].emplace_back(G[now][j].second);
          now = G[now][j].first;
          break;
        }
      }
    }
  }
  
  ll ans = pow<ll>(2, n - 1);
  for (int bit = 1; bit < (1 << m); bit++) {
    set<int> s;
    for (int i = 0; i < m; i++) {
      if ((1 << i) & bit) {
        for (int j = 0; j < road[i].size(); j++) {
          s.insert(road[i][j]);
        }
      }
    }
    int keep = __builtin_popcount(bit);
    if (keep % 2 == 1) {
      ans -= pow(2, n - 1 - s.size());
    }
    else {
      ans += pow(2, n - 1 - s.size());
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int n,m;
int p[100010];
vector<int> graf[100010];
int mark[100010];
int flag=1;

void bfs(int c)
{
    if(mark[c]==0)
        mark[c]=flag;
    else
        return;
    for(int i=0;i<graf[c].size();i++)
        if(mark[graf[c][i]]==0)
            bfs(graf[c][i]);
}

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

    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>p[i];
    int x,y;
    for(int i=0;i<m;i++)
    {
        cin>>x>>y;
        graf[x].push_back(y);
        graf[y].push_back(x);
    }

    int sol=0;
    for(int i=1;i<=n;i++)
    {
        if(mark[i]==0)
            bfs(i), flag++;
    }
    for(int i=1;i<=n;i++)
        if(mark[p[i]]==mark[i])
            sol++;
    cout<<sol;
	return 0;
}


Measured memory_bytes: 8576
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define ROOP(i,n) for(i=0;i<n;i++)

//prototype declaration
int getint();
long long getllint();
double getdint();
char getch();
void setstring(char *s);
void showint(int i);
void showllint(long long i);
void showdouble(double i);
void showchar(char c);
void showstring(char *s);

int myPower(int a, int n) { // aのn乗の計算
	int x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

int min(int a, int b) {
	return a < b ? a : b;
}

int main(void) {
	int n, i, j;
	n = getint();
	int h[n];
	ROOP(i, n) {
		h[i] = getint();
	}
	int dp[n];
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for(i = 2; i < n; i++) {
		dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]), dp[i-2] + abs(h[i-2] - h[i]));
	}
	printf("%d\n", dp[n-1]);
	return 0;
}

int getint() {
	int i;
	scanf("%d", &i);
	return i;
}

long long getllint() {
	long long i;
	scanf("%lld", &i);
	return i;
}

double getdint() {
	double i;
	scanf("%lf", &i);
	return i;
}

char getch() {
	char c;
	scanf("%c", &c);
	return c;
}

void setstring(char *s) {
	scanf("%s", s);
}

void showint(int i) {
	printf("%d\n", i);
}

void showllint(long long i) {
	printf("%lld\n", i);
}

void showdouble(double i) {
	printf("%lf\n", i);
}

void showchar(char c) {
	printf("%c\n", c);
}

void showstring(char *s) {
	printf("%s\n", s);
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{ 
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var k = Input.numL;
        var ar = Enumerable.Range(0, 50).Select(v => v + k / 50).ToArray();
        k %= 50;
        for (var i = 0; i < k; i++)
            for (var j = 0; j < 50; j++)
                if (i == j) ar[i] += 50;
                else ar[j]--;
        WriteLine($"50\n{string.Join(" ", ar)}");
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 13524
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	int a[4],b[4],i,j,h,r;
	while( cin >> a[0] ){
		h=0;
		r=0;
		for(i=1;i<4;i++){
			cin >> a[i] ;
		}
		for(i=0;i<4;i++){
			cin >> b[i] ;
		}
		
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i] == b[j]){
					r++;
				}
			}
			if(a[i] == b[i]){
				h++;
				r--;
			}
		}
		cout << h << " " << r << "\n" ;
	}
return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define ff first
#define ss second

using namespace std;
using pii=pair<int,int>;
using ll=long long;

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    
    ll n;
    cin>>n;
    cout<<n*(n+1)/2-((n/3)*(n/3+1)/2*3+(n/5)*(n/5+1)/2*5-(n/15)*(n/15+1)/2*15);

    return 0;
}


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

const int MOD = 1000000007;

int main() {
    int n, i = 1;
    string s1, s2;
    cin >> n >> s1 >> s2;
    bool isPair = false;
    ll ans = 3;
    if (s1[0] != s2[0]) {
        // AA
        // BB
        isPair = true;
        ans = 6;
        i = 2;
    }
    for (; i < n; i++) {
        if (isPair) {
            if (s1[i] != s2[i]) {
                ans = ans * 3 % MOD;
            }
        } else {
            ans = ans * 2 % MOD;
        }
        if (s1[i] == s2[i]) {
            isPair = false;
        } else {
            isPair = true;
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<utility>

typedef pair<double, double> point;
typedef point* data;

double dist(const point &p1, const point &p2)
{
    double dx = p1.first - p2.first;
    double dy = p1.second - p2.second;
    return sqrt(dx * dx + dy * dy);
}

bool sort_y(const point &p1, const point &p2){ return p1.second < p2.second; }

double closest(data X, data Y, int n)
{
    if(n <= 3){
        double d = dist(X[0], X[1]);
        for(int i = 0; i < n; i++){ Y[i] = X[i]; }
        sort(Y, Y + n, sort_y);
 
        if(n < 3){ return d; }
        return min(d, min(dist(X[0], X[2]), dist(X[1], X[2])));
    }
    int m = (n >> 1);
    double median = X[m].first;
    double d = min(closest(X, Y, m), closest(X + m, Y + m, n - m));
 
    data Z; int size = 0;
    Z = new point [n];
    int i = 0, j = m;
    while(1){
        if(i < m && j < n){
            if(Y[i].second < Y[j].second){
                Z[size] = Y[i]; size++; i++;
            }else{
                Z[size] = Y[j]; size++; j++;
            }
        }
        if(i == m){ while(j < n){ Z[size] = Y[j]; size++; j++; }; break; }
        if(j == n){ while(i < m){ Z[size] = Y[i]; size++; i++; }; break; }
    };

    for(i = 0; i < n; i++){ Y[i] = Z[i]; }

    int resize = 0;
    for(i = 0; i < size; i++){
        if(fabs(Z[i].first - median) <= d){ Z[resize] = Z[i]; resize++; }
    }

    int a = 0;
    for(i = 1; i < resize; i++){
        for(j = a; j < i; j++){
            if(Z[i].second - Z[j].second > d){ a++; }
            else{
                d = min(d, dist(Z[i], Z[j]));
            }
        }
    }
    delete [] Z;
    return d;
}

int main()
{
    data X, Y;
    int i, n;
    scanf("%d", &n);
    X = new point [n];
    Y = new point [n];

    double co_x, co_y;
    for(i = 0; i < n; i++){
        scanf("%lf %lf", &co_x, &co_y);
        X[i] = make_pair(co_x, co_y);
    }
    sort(X, X + n);

    double d = closest(X, Y, n);
    printf("%.12f\n", d);

    delete [] X;
    delete [] Y;

    return 0;
}

Measured memory_bytes: 6524
import java.util.Scanner;

public class Main {
	static long c, d;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		c = sc.nextLong();
		d = sc.nextLong();
		sc.close();

		System.out.println(f(b) - f(a - 1));
	}

	static long f(long a) {
		long x = a / c;
		long y = a / d;
		long z = a / (c * d / gcd(c, d));
		return a - x - y + z;
	}

	static long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}


Measured memory_bytes: 21716
import math
N = int(input())
A = list(map(int, input().split()))
ans1 = "pairwise coprime"
ans2 = "setwise coprime"
ans3 = "not coprime"

a = math.gcd(A[0], A[1])
for i in range(2, N):
    a = math.gcd(a, A[i])

if a==1:
    b = True
    l = [0]*(10**6+1)
    x = [0]*(10**6+1)
    x[0]=1
    x[1]=1
    for i in range(2, 10**6+1):
        if x[i]==0:
            for j in range(i, 10**6+1, i):
                x[j]=i

    for y in A:
        s=set()
        if y==1:
            continue
        elif y==x[y]:
            s |= {y}        #素因数のリスト
        else:
            while y!=x[y]: #素数になるまで
                s|={x[y]}  
                y//=x[y]
                if y==x[y]:
                    s|={x[y]}
                    break
        for i in s:
            l[i]+=1
            if l[i]>=2:
                b=False
                break
                
        
    if b:
        print(ans1)
    else:
        print(ans2)
        
        
    
else:
    print(ans3)



Measured memory_bytes: 197568
n, m, k = map(int, input().split())
import sys
if n == 1 or m == 1:
    print('Yes')
    sys.exit()
if k%m == 0 or k%n==0:
    print('Yes')
    sys.exit()
for i in range(1,m):
    for j in range(1,n):
        if k == i*n + j*m - 2*i*j:
            print('Yes')
            sys.exit()
print('No')

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

char s[5];
int cc[26];
int main(void)
{
    scanf("%s",s);

    for(int i=0;i<4;i++) cc[s[i]-'A']++;
    for(int i=0;i<26;i++)
    {
        if(cc[i]!=0 && cc[i]!=2)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s.length() ==  2){
        cout<<s;
    }else{
        for(int i = s.length() -1; i >= 0  ;i--){
            cout<<s[i];
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
//in progress
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fr(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define forn(i,n) for(int i =0; i < (int)(n); i++)
#define rfr(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define PI 3.14159265
ll a[105],dp[105][100005],n;
ll mod=1000000007;
ll solve(int ind,int count)
{
    if(dp[ind][count]!=-1)
        return dp[ind][count];
    if(count<0)
        return 0;
    if(count==0)
        return 1;
    if(ind >=n)
        return 0;
    dp[ind][count]=solve(ind,count-1)+solve(ind+1,count)-solve(ind+1,count-1-a[ind]);
    dp[ind][count]=(dp[ind][count]+mod)%mod;
    return dp[ind][count];
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  //freopen("a.in", "r", stdin);
  //freopen("a.out", "w", stdout);
    ll k;
    cin>>n>>k;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)
        cin>>a[i];
    cout<<solve(0,k)<<"\n";
  return 0;
}


Measured memory_bytes: 88576
/*
 * a.cc:
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
#include<iomanip>

using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main(){
  int N,M=0;
  cin>>N;

  

  

  for (int i=1;i<=9;i++){
    for (int j=1;j<=9;j++){

      if (i*j==N){
        M=1;
        break;
        
      }
    }
  }
  if (M==1){
    cout<<"Yes"<<endl;
    
  }
  else {
    cout<<"No"<<endl;
    
  }
  return 0;
  
}













Measured memory_bytes: 3624
import bisect
x, n = map(int,input().split())
p = list(map(int,input().split()))
if n == 0:
	print(x)
	exit()
p.sort()
a = bisect.bisect_left(p, x)
a = p[a]
cnt = 0
while True:
	if not a-cnt in p:
		ans = a-cnt
		break
	if not a+cnt in p:
		ans = a+cnt
		break
	cnt += 1
print(ans)

Measured memory_bytes: 9204
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#pragma warning (disable: 4996)
using namespace std;

long long N, A[1 << 18];
map<long long, int> Map;
vector<long long> B;
long long M, X[1 << 18], Y[1 << 18];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i]; Map[A[i]]++;
		B.push_back(A[i]);
	}
	sort(B.begin(), B.end());
	B.erase(unique(B.begin(), B.end()), B.end());

	M = B.size();
	for (int i = 0; i < B.size(); i++) {
		X[i + 1] = B[i];
		Y[i + 1] = Map[B[i]];
	}

	long long ans = 0;
	for (int i = M; i >= 1; i--) {
		long long val = 0;
		for (int j = 0; j <= 60; j++) {
			if ((1LL << j) > X[i]) { val = (1LL << j) - X[i]; break; }
		}
		if (val == X[i]) {
			ans += (Y[i] / 2);
			Y[i] %= 2;
		}
		else {
			int pos1 = lower_bound(X + 1, X + M + 1, val) - X;
			if (X[pos1] == val) {
				long long ret = min(Y[pos1], Y[i]);
				Y[pos1] -= ret;
				Y[i] -= ret;
				ans += ret;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19952
#include<stdio.h>

int main(void){
    int H,N,i;
    int A[100000];

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

    for(i=0; i<N; i++){
        H = H - A[i];
    }

    if(H>0)
        printf("No\n");
    else
        printf("Yes\n");

    return 0;
    
}


Measured memory_bytes: 512
using System;


namespace ITP1_1C
{
    class Program
    {
        static void Main()
        {

            int a, b, c, d;
            //a,b,c,d?????´??°??¨???????????????

            string[] str = Console.ReadLine().Split(' ');
            //????????????str?????\?????????????????°?????£??\?????\???????????????????????§?????????(''????????????)

            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            //???????????¢????????°???(??????????¬¬???????¬¬???)?????´??°??????????????????a,b?????£??\

            c = a * b;
            d = 2 * a + 2 * b;
            //c,d???????????£??\

            Console.WriteLine(c+" "+d);
            //(""??????????????\???????????????)
        }
    }
}

Measured memory_bytes: 9120
#include<iostream>

using namespace std;
int main()
{
    int y;
    cin>>y;
    if(1<=y<=9)
    {
      if(y==5 or y==3 or y==7 )
      {
          cout<<"YES";
      }
      else
      {
          cout<<"NO";
      }
    }
    return 0;
}

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

typedef long long ll;

int main() {
	ll N, M;
	std::cin >> N >> M;

	if(N > M) std::swap(N, M);

	ll ans;
	if(N >= 2) ans = (N - 2) * (M - 2);
	else if (M == 1) {
		ans = 1;
	} else {
		ans = M - 2;
	}

	std::cout << ans << std::endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>
#include <ios>
#include <iomanip>

#define INF 200000000
#define MOD 1000000007

using namespace std;

int main()
{
    int a,b,t;
    cin >> a >> b >> t;
    cout << (t/a)*b << endl ;
    return 0;
}


Measured memory_bytes: 256
def solve(n, s):
    total = s.count(".")
    ans = total
    cnt = 0
    for i in range(n):
        if s[i] == "#":
            cnt += 1
        else:
            cnt -= 1
        ans = min(ans, total+cnt)
    return ans

assert solve(3, "#.#") == 1
assert solve(5, "#.##.") == 2
assert solve(9, ".........") == 0

n = int(input())
s = input()
print(solve(n, s))

Measured memory_bytes: 3500
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        for(int i=N; i > 0;i--){
            if(i == (int)Math.sqrt(i)*(int)Math.sqrt(i)){
                System.out.println(i);
                break;
            }
        }
    }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,r;
	cin>>l>>r;
	int dis=min(r-l,2019);
	l%=2019;
	r=l+dis;
	int ans=999999999;
	for(int i=l;i<=r;i++)
	for(int j=i+1;j<=r;j++)
	ans=min(ans,(i*j)%2019);
	cout<<ans;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef double db;

#define mp make_pair
#define pb push_back
#define pt(i) printf("%lld\n",(ll)i)
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1.0)

ll in() { ll a;scanf("%lld",&a); return a;}
db din(){ db a;scanf("%lf",&a); return a; }
ll bigmod(ll b, ll p,ll md){if(p==0) return 1;if(p%2==1){ return ((b%md)*bigmod(b,p-1,md))%md;} else {ll y=bigmod(b,p/2,md);return (y*y)%md;}}
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b);}

long long getRandom(long long a,long long b){
    long long ret = (long long)rand()*(long long)rand();
    ret %= (b - a + 1);
    ret += a;
    return ret;
}

ll dp[105][100005],n,w,ar[105],var[105];

ll solve(int pos,int lav)
{
	if(lav<=0)
		return 0;
	if(pos==n)
		return INT_MAX;
	if(dp[pos][lav]!=-1)
		return dp[pos][lav];
	return dp[pos][lav]=min(solve(pos+1,lav-var[pos])+ar[pos],solve(pos+1,lav));
}

int main()
{
	//freopen("in.c","r",stdin);
	//freopen("out.c","w",stdout);
	n=in(),w=in();
	for(int i=0;i<n;i++)
		ar[i]=in(),var[i]=in();
	memset(dp,-1,sizeof dp);
	solve(0,0);
	for(int i=100000;i>=0;i--)
	{
		if(solve(0,i)<=w)
			pt(i),exit(0);
	}
}

Measured memory_bytes: 82304
import sys


from inspect import currentframe


def debug_print(s):
    # print(s)
    return 


def debug_key(*args):
    names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    debug_print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))


def solve(x, y, s):
    debug_print("\n-----solve-----")
    ans = 0
    for first in range(1, s // 2 + 1):
        second = s - first
        first_nuki = (first + 1) / (x + 100) * 100
        second_nuki = (second + 1) / (x + 100) * 100

        if first_nuki.is_integer():
            first_nuki -= 1
        else:
            first_nuki = int(first_nuki)

        if second_nuki.is_integer():
            second_nuki -= 1
        else:
            second_nuki = int(second_nuki)

        if (int((first_nuki * (100 + x)) / 100) + int((second_nuki * (100 + x)) / 100)) != s:

            continue

        sum_y = int((first_nuki * (100 + y)) / 100) + int((second_nuki * (100 + y)) / 100)
        ans = max(ans, sum_y)

        # debug_key(sum_y)
        # debug_key(first_nuki)
        # debug_key(second_nuki)
        # debug_key((first_nuki * (100 + y)) // 100)
        # debug_key((second_nuki * (100 + y)) // 100)
        # debug((first_nuki * (100 + y)) // 100 + (second_nuki * (100 + y)) // 100)

    print(ans)
    return


if __name__ == '__main__':

    # a = [int(input()) for _ in range(244)]
    # b = [int(input()) for _ in range(244)]
    #
    # if a == b:
    #     debug("ok")
    # else:
    #     debug("(●・▽・●)")

    while True:
        x_input, y_input, s_input = map(int, input().split())
        # a += 1
        if x_input == y_input == s_input == 0:
            break

        solve(x_input, y_input, s_input)




Measured memory_bytes: 7436
#include <cstdio>
#include <cmath>

#define FOR( i, l, r) for(int i = (l)    ; i <  (r); i++)
#define FOR1(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define REV( i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define REV1(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define INC( i, n) FOR( i, 0, n)
#define INC1(i, n) FOR1(i, 1, n)
#define DEC( i, n) REV( i, 0, n)
#define DEC1(i, n) REV1(i, 1, n)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int t, n, d;

void solve() {
	int ans = 0;
	ans += 127 * (n - 1);
	ans += ((n - 1) % 2 == 0 ? d : 127 - d);
	
	printf("%d\n", ans);
}

int main() {
	scanf("%d", &t);
	INC(i, t) { scanf("%d%d", &n, &d); solve(); }
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
    
    public static void main(String[]args){
                
    	int high;
		int low;
    	int sa[] ={0,0,0,0,0,0,0};
		
		Scanner sc = new Scanner(System.in);
		
		for(int i=0; i<7;i++){
			high = sc.nextInt();
			low = sc.nextInt();
			sa[i] = high - low;
		}
		
		for(int n=0;n<7;n++){
			System.out.println(sa[n]);
		}
    }
}

Measured memory_bytes: 17172
#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<vector>
using namespace std;
string s;
int k,n;
vector<string> v;
int main()
{
	cin>>s>>k;
	n=s.size();
	for (int i=0;i<n;i++)
		for (int j=1;j<=5;j++)
			if (i+j<=n) v.push_back(s.substr(i,j));
	sort(v.begin(),v.end());
	v.erase(unique(v.begin(),v.end()),v.end());
	cout<<v[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+7, LINF = 1e18;


int main()
{
    ll a,b,mi=INF;
    cin>>a>>b;
    if(b-a>=2019 || b%2019<=a%2019) cout<<"0\n",exit(0);
    a%=2019,b%=2019;
    for(ll i=a;i<b;i++)for(ll j=i+1;j<=b;j++) mi=min((i*j)%2019,mi);
    cout<<mi<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  string s1, s2;
  cin >> s1 >> s2;
  vector<vector<int>> dp(s1.length() + 1, vector<int>(s2.length() + 1, INF));
  for (int i = 0; i < s1.length() + 1; i++) {
    dp[i][0] = i;
  }
  for (int i = 0; i < s2.length() + 1; i++) {
    dp[0][i] = i;
  }

  for (int i = 0; i < s1.length(); i++) {
    for (int j = 0; j < s2.length(); j++) {
      if (s1[i] == s2[j]) {
        dp[i + 1][j + 1] = dp[i][j];
      } else {
        dp[i + 1][j + 1] = min(dp[i + 1][j], min(dp[i][j + 1], dp[i][j])) + 1;
      }
    }
  }
  // for (int i = 0; i <= s1.length(); i++) {
  //   for (int j = 0; j <= s2.length(); j++) {
  //     cout << dp[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  cout << dp[s1.length()][s2.length()] << endl;
}


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

class P
{
    static void Main()
    {
        //int[] N = Console.ReadLine().Split().Select(int.Parse).ToArray();
        string s = Console.ReadLine();

        Console.WriteLine($"{s[0]}{s.Length - 2}{s[s.Length - 1]}");
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	sort(all(s));
	ll n=sz(s);
	if(s[0]==s[n-1])
		cout<<"No\n";
	else
		cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gpu_hash_map<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 200001;
ll n, k;
ll arr[mxN];
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>k;
    owo(i, 0, n) {
        cin>>arr[i];
    }
    ll l = 1;
    ll r = INF;
    while(l<r) {
        ll mid = (l+r)/2;
        ll need = 0;
        owo(i, 0, n) {
            need+=((arr[i]+mid-1)/mid)-1;
        }
        if(need<=k)r = mid;
        else l =mid+1;
    }
    cout<<l<<"\n";
    return 0;
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
#define N 200010
#define INF 10000000000000000
#define ll long long
using namespace std;
ll n,a[N],sum=0,pos=0,ans=INF;
int main(){
	ll i;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	for(i=n-1;i>0;i--)
	{
		sum-=a[i];
		pos+=a[i];
		ans=min(ans,abs(sum-pos));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
import std.stdio;

string solve (int a, int b)
{
	if (a * b == 15)
	{
		return "*";
	}
	if (a + b == 15)
	{
		return "+";
	}
	return "x";
}

void main ()
{
	int a, b;
	while (readf (" %s %s", &a, &b) > 0)
	{
		writeln (solve (a, b));
	}
}


Measured memory_bytes: 256
def GCD(a, b):
    return a if b == 0 else GCD(b, a % b)


k = int(input())

ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        ab = GCD(a, b)
        if ab == 1:
            ans += k
            continue
        for c in range(1, k + 1):
            ans += GCD(ab, c)

print(ans)


Measured memory_bytes: 81032
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin>>n>>m;
	vi in(n);
	rep(i,n)cin>>in[i];
	sort(all(in));
	int out=0;
	rep(i,max(0ll,n-m))out+=in[i];
	cout<<out<<endl;
	
}









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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        int c = sc.NextInt();

        int answer = Math.Min(c, b / a);

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

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

#define INX(x) (cin >> x)
#define OUTX(x) (cout << x << endl)

#define ADD emplace_back
#define MP make_pair
#define VVEC(type) vector<vector<type>>

#define maxlen 100001

int main()
{
    ll N;
    cin >> N;
    
    ll arr[maxlen];
    for (ll i = 0; i < maxlen; i++)
    {
        arr[i] = 0;
    }

    ll S = 0;
    for (ll i = 0; i < N; i++)
    {
        ll tmp;
        cin >> tmp;
        arr[tmp]++;
        S += tmp;
    }

    ll Q;
    cin >> Q;
    for (ll i = 0; i < Q; i++)
    {
        ll B, C;
        cin >> B >> C;

        S += arr[B] * (C - B);
        arr[C] += arr[B];
        arr[B] = 0;
        
        cout << S << endl;
    }
    
    

    return 0;
}


Measured memory_bytes: 4416
array = ['L','R','U','D']
s = input()
c = 0
for i in range(len(s)):
  if i%2 == 1:
    if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
      continue
    else:
      c = 1
  if i%2 == 0:
    if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
      continue
    else:
      c = 1
if c== 0:
  print('Yes')
else:
  print('No')



Measured memory_bytes: 3060