akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
	int i,num[3000][2],x,y,s=0;
	for(i=0;i<3000;i++){
		scanf("%d %d",&x,&y);
		if(x==0&&y==0)
			break;
		if(x>=y){
			num[i][0]=y;
			num[i][1]=x;
		}
		else{
			num[i][0]=x;
			num[i][1]=y;
		}
		s++;
	}
	for(i=0;i<s;i++)
		printf("%d %d\n",num[i][0],num[i][1]);
	return 0;
}


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

int h, w;
char r[64][64];
char s[1024];

int pos[256][2];

int main(void) {
	while (scanf("%d%d", &h, &w) == 2 && (h|w) != 0) {
		int i, j;
		int mizuhasu = 0;
		for (i = 0; i < h; i++) {
			if (scanf("%63s", r[i]) != 1) return 1;
		}
		if (scanf("%1022s", s + 1) != 1) return 1;
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				int idx = (unsigned char)r[i][j];
				pos[idx][0] = i;
				pos[idx][1] = j;
			}
		}
		for (i = 1; s[i] != '\0'; i++) {
			int current = (unsigned char)s[i], prev = (unsigned char)s[i - 1];
			mizuhasu += abs(pos[current][0] - pos[prev][0]) + abs(pos[current][1] - pos[prev][1]) + 1;
		}
		printf("%d\n", mizuhasu);
	}
	return 0;
}



Measured memory_bytes: 2052
/*
*----------------------------------------------
*   Saurabh Srivastava - SAURASS - andha_koder
*----------------------------------------------
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef long double ld;

ld dist(pair<int, int> a, pair<int, int> b) {
    ll x1 = a.first;
    ll y1 = a.second;
    ll x2 = b.first;
    ll y2 = b.second;

    ll x = abs(x2 - x1);
    ll y = abs(y2 - y1);

    return sqrt(x*x + y*y);
}

int main() {
	
    vector<pair<int, int> > d;
    ll n;
    cin >> n;

    for(int i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        d.push_back(make_pair(x, y));
    }

    ld s = 0;
    for(int i = 0; i < n -1; i++) {
        for(int j = i + 1; j < n; j++) {
            s += dist(d[i], d[j]);
        }
    }
	
    cout << setprecision(20) << (s * 2) / n;

	return 0;
}


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

#define ll long long
#define f(i,a,n) for (int i=a;i<n;i++)
typedef pair<ll, ll> pa;
const ll mod=1000000007;
int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    double in[n];
    f (i, 0, n) {
        cin >> in[i];
    }
    sort(in, in + n);

    f(i, 1, n) {
        in[i] = (in[i - 1] + in[i])/2;
    }

    cout << setprecision(11) << in[n - 1];
    return 0;
}

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

// ABC132B - Bite Eating
// 
void ABC132B() {
	int N, L;
	cin >> N >> L;

	int aji = 0;
	for (int i = 1; i <= N; i++)
	{
		aji += L + i - 1;
	}


	int diff = INT_MAX; //味の差の絶対値
	int no = 0; //りんごのNo
	for (int i = 1; i <= N; i++)
	{
		//N番目のりんごをたべたときのアップルパイの味
		int aji2 = aji - (L + i - 1); 

		//味の差の絶対値を更新
		if (diff > abs(aji - aji2)) { 
			diff = abs(aji - aji2); 
			no = i; //何番目のりんごなのかを記録
		}
	}

	//味の計算
	cout << aji - (L + no - 1);
	
}

int main() {
	ABC132B();

	return 0;
}


Measured memory_bytes: 256
def main():
    n, m, c = map(int, input().split())

    b_list = list(map(int, input().split()))

    num_list = []
    for _ in range(n):
        num_list.append(list(map(int,input().split())))

    count = 0

    for i in range(n):
        tmp = 0
        for j in range(m):
            tmp += num_list[i][j] * b_list[j]
        if tmp + c > 0:
            count += 1

    print(count)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#pragma GCC optimize ("O3")
using namespace std;
int main () {
    ios::sync_with_stdio(false);
    cin.tie (0);    
    ll n, MAX=0, two=0; cin>>n;
    vector <ll> a (n);
    for (ll i=0;i<n;++i) {
        cin>>a[i];
        if (a[i]>MAX) {
            two=MAX;
            MAX=a[i];
        }
        else if (a[i]>two) two=a[i];
    }
    for (ll i=0;i<n;++i) {
        if (a[i]!=MAX) cout<<MAX<<'\n';
        else cout<<two<<'\n';
    }
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
typedef long long ll;
const int INF = 100000000, mod = 1000000007;
const double pi = 3.14159265;
const ll LLINF = 1LL << 50;
using namespace std;


int main() {
    string n;
    int s;
    int ans = 0;
    cin >> s >> n;
    for (int i = 1; i <= n.length(); i++) {
        int a = 0;
        string t = n.substr(0, i);
        string tt = n.substr(i, n.length() - i);
        for (char j = 'a'; j <= 'z'; j++) {
            if (t.find(j)+1 && tt.find(j)+1)a++;
        }
        ans = max(ans, a);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

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

  int n; cin >> n;
  vector<ll> t(n);
  rep(i, n) cin >> t[i];

  ll LCM = t[0];
  for(int i = 1; i < n; ++i) {
    // t[i]*t[i-1]を先にするとオーバーフロー
    LCM = LCM/gcd(LCM, t[i])*t[i];
  }
  cout << LCM << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N;
  cin >> N;
  deque<ll> deq;
  if(N % 2 == 0){
    for(int i = 0; i < N; i++){
      ll a;
      cin >> a;
      if(i % 2 == 0) deq.push_back(a);
      else deq.push_front(a);
    }
  }
  else{
    for(int i = 0; i < N; i++){
      ll a;
      cin >> a;
      if(i % 2 == 1) deq.push_back(a);
      else deq.push_front(a);
    }
  }
  while(!deq.empty()){
    cout << deq.front();
    deq.pop_front();
    if(deq.empty()) cout << endl;
    else cout << ' ';
  }

}

Measured memory_bytes: 3840
K = int(input())
hoge = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(hoge[K-1])

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

class Program{

  static int n, x, kosuu, minx, a, answer;

  static int Main() {
    string[] nyu = new string[2];

    nyu = Console.ReadLine().Split(' ');
    n = int.Parse(nyu[0]);
    x = int.Parse(nyu[1]);
    kosuu = n;

    int[] m = new int[n];

    for (int i=0; i<=n-1; i++) {
      m[i] =int.Parse( Console.ReadLine()) ;
    }
    minx = m.Min();

    a = x- m.Sum();
    kosuu += a / minx;

    Console.Write(" {0} ", kosuu);
    return 0;
  }

}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m;
  cin >> n >> m;
  ll ans = min(n,m/2);
  if(m-2*ans>=4) ans += (m-2*ans)/4;
  cout << ans << '\n';
  return 0;
}


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

using namespace std;

int main ()
{
  string k, n;
  cin >> k >> n;
  int p = 0;
  for (int i = 0; i < k.size(); i++)
    if (k[i] != n[i])
      p++;
  cout << p;
  return 0;
}

Measured memory_bytes: 3824
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

template <class T>
inline void read(T &x)
{
    x = 0;
    int f = 0;
    char ch = getchar();
    while (!isdigit(ch))    { f |= ch == '-'; ch = getchar(); }
    while (isdigit(ch))     { x = (x << 1) + (x << 3) + (ch ^ 48); ch = getchar(); }
    x = f ? -x : x;
    return;
}

int a[5][5];
int n, b;
bool map[5][5];
bool flag;

int main()
{
    for (int i = 1; i <= 3; ++i)
        for (int j = 1; j <= 3; ++j)
            read(a[i][j]);
    read(n);
    for (int i = 1; i <= n; ++i)
    {
        read(b);
        for (int j = 1; j <= 3; ++j)
            for (int k = 1; k <= 3; ++k)
                if (a[j][k] == b)
                    map[j][k] = true;
    }
    if (map[1][1] && map[2][2] && map[3][3])    flag = true;
    if (map[1][3] && map[2][2] && map[3][1])    flag = true;
    if (map[1][1] && map[1][2] && map[1][3])    flag = true;
    if (map[2][1] && map[2][2] && map[2][3])    flag = true;
    if (map[3][1] && map[3][2] && map[3][3])    flag = true;
    if (map[1][1] && map[2][1] && map[3][1])    flag = true;
    if (map[1][2] && map[2][2] && map[3][2])    flag = true;
    if (map[1][3] && map[2][3] && map[3][3])    flag = true;
    puts(flag ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
n = int(input())
AB = [list(map(int, input().split())) for _ in range(n)]
A, B = zip(*AB)
A = sorted(A)
B = sorted(B)
if n%2:
    a_m = A[(n-1)//2]
    b_m = B[(n-1)//2]
else:
    a_m = A[n//2] + A[n//2 - 1]
    b_m = B[n//2] + B[n//2 - 1]
ans = b_m - a_m + 1
print(ans)

Measured memory_bytes: 61080
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

template <int M> class ModInt {
    int x;

  public:
    constexpr ModInt() : x(0) {}
    constexpr ModInt(int64_t y) : x(y >= 0 ? y % M : (M - (-y) % M) % M) {}
    constexpr ModInt &operator+=(const ModInt p) {
        if((x += p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator-=(const ModInt p) {
        if((x += M - p.x) >= M) x -= M;
        return *this;
    }
    constexpr ModInt &operator*=(const ModInt p) {
        x = (int)(1LL * x * p.x % M);
        return *this;
    }
    constexpr ModInt &operator/=(const ModInt p) {
        *this *= p.inverse();
        return *this;
    }
    constexpr ModInt operator-() const { return ModInt(-x); }
    constexpr ModInt operator+(const ModInt p) const {
        return ModInt(*this) += p;
    }
    constexpr ModInt operator-(const ModInt p) const {
        return ModInt(*this) -= p;
    }
    constexpr ModInt operator*(const ModInt p) const {
        return ModInt(*this) *= p;
    }
    constexpr ModInt operator/(const ModInt p) const {
        return ModInt(*this) /= p;
    }
    constexpr bool operator==(const ModInt p) const { return x == p.x; }
    constexpr bool operator!=(const ModInt p) const { return x != p.x; }
    constexpr ModInt inverse() const {
        int a = x, b = M, u = 1, v = 0, t = 0;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    constexpr ModInt pow(int64_t k) const {
        ModInt ret(1), mul(x);
        while(k > 0) {
            if(k & 1) ret *= mul;
            mul *= mul;
            k >>= 1;
        }
        return ret;
    }
    constexpr friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
    constexpr friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t = 0;
        is >> t;
        a = ModInt(t);
        return (is);
    }
};
using mint = ModInt<mod>;

int n, m;
mint dp[2][5009];

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

    cin >> n;
    char c[5009];
    cin >> c;
    m = strlen(c);

    dp[0][0] = 1;
    rep(i, n) {
        rep(j, i + 1) {
            dp[i + 1 & 1][max(0LL, j - 1)] += dp[i & 1][j];
            dp[i + 1 & 1][j + 1] += dp[i & 1][j] * 2;
            dp[i & 1][j] = 0;
        }
    }
    cout << dp[n & 1][m] / mint(2).pow(m) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char * argv[])
{
    int x[1000];
    int x2[1000];
    int y[1000];
    int y2[1000];
    int n;
    double a=0,b=0,c=0,d=0;
    double a2=0,b2=0,c2=0,max=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
//        x2[i] = abs(x[i]);
    }
    for(int i=0;i<n;i++){
        scanf("%d",&y[i]);
//        y2[i] = abs(y[i]);
    }
    for(int i=0;i<n;i++){
        a = abs(x[i]-y[i]);
        a2 += a;
        b = pow(abs(x[i]-y[i]),2);
        b2 += b;
        c = pow(abs(x[i]-y[i]),3);
        c2 +=c;
        d = abs(x[i]-y[i]);
        if(max<d){
            max = d;
        }
       
    }
    b2 = sqrt(b2);
    c2 = pow(c2,1.0/3.0);
    printf("%f\n",a2);
    printf("%f\n",b2);
    printf("%f\n",c2);
    printf("%f\n",max);
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<int> P;
const int MAX_N = 9;

int N, f[MAX_N][MAX_N];
int my[] = {0, 0, 1, -1};
int mx[] = {1, -1, 0, 0};

void dfs(int y, int x, int sum, int tar, vector<P> &r, vector< vector<P> > &rs, vector< vector<bool> > &used){
  if(sum == tar) { rs.push_back(r); return ; }
  REP(i, 4){
    int ny = y + my[i], nx = x + mx[i];
    if(ny >= 0 && nx >= 0 && ny < N && nx < N && !used[ny][nx] && f[ny][nx] >= 0 && sum + f[ny][nx] <= tar){
      vector<P> nr = r;
      nr.push_back(P(ny, nx));
      used[ny][nx] = 1;
      dfs(ny, nx, sum + f[ny][nx], tar, nr, rs, used);
      used[ny][nx] = 0;
    }
  }
}

bool isValid(vector<P> &v, vector< vector<bool> > &used){
  REP(i, v.size()){
    int y = v[i].real(), x = v[i].imag();
    if(used[y][x]) return false;
  }
  return true;
}

bool check(int now, vector< vector< vector<P> > > &v, vector< vector<bool> > &used, vector<int> &rs){
  if(now >= v.size()){
    bool res = true;
    REP(i, N) REP(j, N) if(!used[i][j]) res = false;
    return res;
  }
  bool ret = false;
  REP(i, v[now].size()){
    if(isValid(v[now][i], used)){
      REP(j, v[now][i].size()) {
        int y = v[now][i][j].real(), x = v[now][i][j].imag();
        used[y][x] = true;
      }
      rs.push_back(i);
      ret = max(ret, check(now + 1, v, used, rs));
      rs.pop_back();
      REP(j, v[now][i].size()) {
        int y = v[now][i][j].real(), x = v[now][i][j].imag();
        used[y][x] = false;
      }
    }
  }
  return ret;
}

int main() {
  while(cin >>N && N){
    vector< vector< vector<P> > > v;
    REP(i, N) REP(j, N) cin >>f[i][j];
    //REP(i, N){
    //  REP(j, N) printf("%5d", f[i][j]);
    //  cout <<endl;
    //}
    REP(i, N){
      REP(j, N){
        if(f[i][j] >= 0) continue;
        vector< vector<bool> > used(N, vector<bool>(N, 0));
        vector< vector<P> > rs;
        vector<P> r;
        dfs(i, j, 0, abs(f[i][j]), r, rs, used);
        v.push_back(rs);
        //cout <<i <<", " <<j <<", " <<abs(f[i][j]) <<endl;
        //REP(i, rs.size()){ REP(j, rs[i].size()) cout <<rs[i][j] <<"( " <<f[rs[i][j].real()][rs[i][j].imag()] <<" ) , "; cout <<endl; }
      }
    }
    vector< vector<bool> > used(N, vector<bool>(N, 0));
    REP(i, N) REP(j, N) if(f[i][j] < 0) used[i][j] = true;
    vector<int> rs;
    int ans = check(0, v, used, rs);
    cout <<(ans ? "YES" : "NO") <<endl;
  }
  return 0;
}

Measured memory_bytes: 1780
program sample
implicit none
integer(8) :: i,j,maxdivision
integer(8) :: x,y,z
real(8),allocatable :: a(:),b(:)

read(*,*) x,y,z

do i=1,100
if (mod(x,i)==0 .and. mod(y,i)==0) then
maxdivision=i
end if
end do

if (mod(z,maxdivision)==0) then
write(*,*) 'YES'
else
write(*,*) 'NO'
end if

end program sample

Measured memory_bytes: 2768
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 4e5 + 5;
int n, m;
string s;
char tmp[maxn];
vector<int> g[maxn];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  scanf("%s", tmp);
  s = tmp;
  for (int i = 0; i < 2 * n; i++) {
    g[i].clear();
  }
  for (int i = 0; i < m; i++) {
    int v, u;
    scanf("%d%d", &v, &u);
    v--;
    u--;
    if (s[v] == s[u]) {
      g[2 * v].push_back(2 * u + 1);
      g[2 * u].push_back(2 * v + 1);
    } else {
      g[2 * v + 1].push_back(2 * u);
      g[2 * u + 1].push_back(2 * v);
    }
  }
  return true;
}

int used[maxn];

bool dfs(int v) {
  used[v] = 1;
  for (int i = 0; i < sz(g[v]); i++) {
    int u = g[v][i];
    if (used[u] == 1) {
      return true;
    }
    if (used[u] == 2) {
      continue;
    }
    if (dfs(u)) {
      return true;
    }
  }
  used[v] = 2;
  return false;
}

void solve() {
  for (int i = 0; i < 2 * n; i++) {
    used[i] = 0;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (!used[i] && dfs(i)) {
      printf("Yes\n");
      return;
    }
  }
  printf("No\n");
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll ans = 1LL;
	sort(all(a));
	rep(i, n) {
		if(a[i]==0) {
			cout << 0 << endl;
			return 0;
		}
	}
	rep(i, n) {
		
		// cout << ans << endl;
		if (ans > 1000000000000000000LL/a[i]) {
			cout << -1 << endl;
			return 0;
		}
		ans *= a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4048
from collections import deque
n=int(input())
s = input()
cnt = [0]
ans = deque(list(s))
for i in range(n):
  if s[i]=="(":
    cnt.append(cnt[-1]+1)
  else:
    cnt.append(cnt[-1]-1)
rt = min(cnt)
if rt<0:
  ans.extendleft("("*(-rt))
if cnt[-1]-rt>0:
  ans.extend(")"*(cnt[-1]-rt))
print(*ans,sep="")

Measured memory_bytes: 3828
#include <iostream>

using namespace std;

static int cnt = 0;
int main() {
  int x, y, s;
  while(cin >> x >> y >> s, x || y || s) {
    int res = 0;
    for(int a = 1; a < s; a++) {
      for(int b = 1; b < s; b++) {
        if(((int)(a*(100.0+x)/100.0) + (int)(b*(100.0+x)/100.0)) == s) {
          res = max(((int)(a*(100.0+y)/100.0)+(int)(b*(100.0+y)/100.0)), res);
        }
      }
    }
    cout << res << endl;
  }

  return 0;
}

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



string S;
string a = "bdpq";
string b = "dbqp";
//-----------------------------------------------------------------
bool solve() {
	if (S.length() % 2) return false;

	rep(i, 0, S.length()) {
		int j = S.length() - 1 - i;
		rep(k, 0, 4) {
			if (S[i] == a[k] && S[j] != b[k]) return false;
		}
	}

	return true;
}
//-----------------------------------------------------------------
int main() {
	cin >> S;
	
	if (solve())
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

# define INF (int)10e9

int gcd(int a,int b){

    if(a<b){
        int tmp=a;
        a=b;
        b=tmp;
    }

    int r=a%b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main()
{

    int n;cin >> n;

    int g;cin >> g;
    for(int i=0;i<n-1;i++){
        int a;cin >> a;
        g =gcd(a,g);
    }
    p(g)
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n,k;

int judge(ll l,ll r,pll edge){
    r%=2*n;
    ll cnt=0;
    if(l<r){
        if(l<=edge.F && edge.F<=r){cnt++;}
        if(l<=edge.S && edge.S<=r){cnt++;}
    }
    else{
        if(l<=edge.F || edge.F<=r){cnt++;}
        if(l<=edge.S || edge.S<=r){cnt++;}
    }
    if(cnt==1){return 0;}
    else if(cnt==2){return 1;}
    return 2;
}


int main(){
    cin>>n>>k;
    if(n==1){cout<<1<<endl; return 0;}
    vector<pll> A(k);
    for(auto &I:A){cin>>I.F>>I.S; I.F--; I.S--;}
    vector<ll> a(2*n+1,0);
    a[0]=1;
    for(ll i=2;i<=2*n;i++){a[i]=a[i-2]*(i-1)%MOD;}
    vector<vector<ll>> dp(2*n,vector<ll>(2*n+1,0));
    for(int i=0;i<2*n;i++){
        dp[i][0]=1;
        for(int t=2;t<=2*n;t+=2){
            ll cnt=t;
            ll k=1;
            for(auto &I:A){
                int ret=judge(i,i+t-1,I);
                if(ret==0){k=0;}
                else if(ret==1){cnt-=2;}
            }
            dp[i][t]=k*a[cnt];
        }
    }
    ll ans=0;
    vector<vector<ll>> dp2(2*n,vector<ll>(2*n+1,0));
    for(int i=0;i<2*n;i++){
        for(int t=2;t<=2*n;t+=2){
            dp2[i][t]=dp[i][t];
            for(int h=2;h<t;h+=2){
                dp2[i][t]-=dp2[i][h]*dp[(i+h)%(2*n)][t-h]%MOD;
            }
            dp2[i][t]%=MOD;
            if(i+t-1<2*n){
                ans+=dp2[i][t]*dp[(i+t)%(2*n)][2*n-t]%MOD;
                ans%=MOD;
            }
        }
    }
    //cout<<ans<<endl;
    ans%=MOD;
    if(ans<0){ans+=MOD;}
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li long
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pii pair<int,int>
#define pli pair<li,li>
#define pll pair<ll,ll>
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define tc int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define inf INT_MAX
#define ninf INT_MIN
#define W(x) cout<<x<<endl
#define WW(x,y) cout<<x<<' '<<y<<endl;
#define in(x) cin>>x
const ll mod1 = 998244353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

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

ll power(ll x,ll y){
    ll res = 1;
    
    while(y>0){
        if(y&1)res = (res*x);
        y>>=1;
        x = (x*x);
    }
    return res;
}

ll power(ll x,ll y,ll p){
    ll res = 1;
    x%=p;
    while(y>0){
        if(y&1)res = (res*x)%p;
        y>>=1;
        x = (x*x)%p;
    }
    return res;
}
int n,m,x;
vector<int> M;
vector<int> cost;
vector<vector<int>> a(12,vector<int>(12));
bool check(vector<int> &m,int &x){
	for(int i = 0; i<m.size(); i++){
		if(m[i]<x)return false;
	}
	return true;
}
void solve(int ind,bool &ok,ll &tcost,ll cst,int &x){
	if(ind == n){
		if(check(M,x)){
			tcost = min(tcost,cst);
			ok|=1;
		}
		return;
	}
	else if(check(M,x)){
		ok|=1;
		tcost = min(tcost,cst);
		return;
	}
	for(int j = 0; j<m; j++)M[j]+=a[ind][j];
	solve(ind+1,ok,tcost,cst+cost[ind],x);
	for(int j = 0; j<m; j++)M[j]-=a[ind][j];
	solve(ind+1,ok,tcost,cst,x);
}
int main(){
	fastio();
	cin>>n>>m>>x;
	M.resize(m);
	M.assign(m,0);
	cost.resize(n);
	for(int i = 0; i<n; i++){
		cin>>cost[i];
		for(int j = 0; j<m; j++)cin>>a[i][j];
	}
	ll tcost = INT_MAX;
	ll cost = 0;
	bool ok = false;
	//cout<<1<<endl;
	solve(0,ok,tcost,0,x);
	if(ok)cout<<tcost<<"\n";
	else cout<<-1<<"\n";
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(I,n) for (int I = 0; I < (n); ++I)
#define FOR(I,k,n) for(int I=(k);I<(n);++I)
using namespace std;
typedef long long ll;
 
int main() {

    string s;
    string t;
    cin >> s;
    cin >> t;

    t.pop_back();
    if(s==t) {
        cout << "Yes"<< endl;
    }
    else
    {
        cout << "No"  << endl;
    }
    
    
  
  
  return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
 #define ll  long long int
 //ll ans=INT_MAX,x=INT_MAX,y=INT_MAX;
 ll n,k;
 ll dp[100001][3];

int main(){

//int n;
cin>>n; 
ll a[n][3];
for(ll i=0; i<n; i++)
cin>>a[i][0]>>a[i][1]>>a[i][2];
for(ll i=0; i<=n; i++)
{dp[i][0]=-1;
 dp[i][1]=-1;
    dp[i][2]=-1;
    
}
dp[0][1]=a[0][1],dp[0][0]=a[0][0],dp[0][2]=a[0][2];
for(int i=1; i<n; i++)
{
   dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
    dp[i][1]=max(dp[i-1][2],dp[i-1][0])+a[i][1];
     dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];
}
ll ans=0;
ans=max(ans,dp[n-1][0]);
ans=max(ans,dp[n-1][1]);
ans=max(ans,dp[n-1][2]);
cout<<ans;
}

Measured memory_bytes: 4992
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
string S[100005];
map<string, ll> mp;
ll ans = 0;
map<string, ll> :: iterator itr;
 
int main() {
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		cin >> S[i];
		sort(S[i].begin(), S[i].end());
		mp[S[i]]++;
	}
	for(itr = mp.begin(); itr != mp.end(); itr++) {
		ll val = itr->second;
		ans += (val) * (val - 1) / 2;
	}
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 18176
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>

using namespace std;
template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}

#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define REV(v) reverse(v.begin(),v.end())
#define SRTV(v) sort(v.begin(),v.end())
#define SRTAG(a,n) sort(a,a+n,greater<>())
#define MOD 1000000007

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int gcd(int a,int b){
    int r;
    if(a<b) swap(a,b);
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int atcoder(){
    //入力
    int a,b;
    cin >> a >> b;
    
    //処理

    //出力
	cout << (a+b)%24 << ENT;
    return 0;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
ld PI = 3.1415926535;

int main(){
  int N,M;cin >> N >> M;
  if(N==M){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

n,k=map(int,input().split())
A=list(map(int,input().split()))
c=collections.Counter(A)
s=sorted(c.values())
for i in range(max(0,len(s)-k)):
    # print(i)
    count+=s[i]
print(count)
# print(s)


Measured memory_bytes: 31984
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const ll INF=2*1e18;
const ld PI=3.14159265358979323846;
ll fpow(ll a,ll b,ll m)
{
    if(b==0) return 1;
    if(b==1) return a;
    ll t=fpow(a,b/2,m)%m,ans=t*t%m;
    if(b&1) ans=ans*a%m;
    return ans;
}
int main()
{
    string s;
    cin>>s;
    map<ll,ll> m;
    ll n=s.size(),ans=0;
    vector<ll> v(n+1,0);
    for(int i=n-1;i>=0;i--)
    {
        v[i]=(v[i+1]+fpow(10,n-i-1,2019)*(s[i]-'0')%2019)%2019;
        m[v[i]]++;
    }
    m[0]++;
    rep(i,2019) if(m[i]>0) ans+=m[i]*(m[i]-1)/2;
    cout<<ans;
}


Measured memory_bytes: 5172
#include<cstdio>
double x[4],y[4];
void solve(){
	double x1m0 = x[1]-x[0];
	double x3m2 = x[3]-x[2];
	double k1, k2, b1, b2, xx, yy;
	if(x1m0){ 
		k1 = (y[1]-y[0])/x1m0;
		b1 = y[0]-k1*x[0];
	}
	if(x3m2){
		k2 = (y[3]-y[2])/x3m2;
		b2 = y[2]-k2*x[2];
	}
	if(x1m0&&x3m2){
		xx = (b2-b1)/(k1-k2);
		yy = k1*xx+b1;
	}else if(x1m0){
		xx = x[3];
		yy = k1 *xx +b1;
	}else{
		xx = x[0];
		yy = k2* xx +b2;
	}
	printf("%.10lf %.10lf\n", xx, yy);
}
int main(){
	short q;
	scanf("%hd", &q);
	while(q--){
		for(int i=0;i<4;i++)
			scanf("%lf%lf", &x[i], &y[i]);
		solve();
	}
	return 0;
}


Measured memory_bytes: 2720
use std::cmp::max;
use std::collections::BTreeSet;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn solve(s: String, k: usize) {
    let mut substrs = BTreeSet::new();

    for p in 1..6 {
        for i in 0..(max(s.len() as i32 - p as i32 + 1, 0) as usize) {
            substrs.insert(&s[i..i+p]);
        }
    }

    println!("{}", substrs.iter().nth(k-1).unwrap());
}

fn main() {
    input!{
        s: String,
        k: usize,
    }

    solve(s,k);
}



Measured memory_bytes: 4352
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
        
def lcm(a,b):
    return a*b//gcd(a,b)
    
N = int(input())
A = list(map(int, input().split()))

lcm_A = 1
for i in range(N):
    lcm_A = lcm(lcm_A, A[i])
    
ans = 0
for i in range(N):
    ans += lcm_A // A[i]

mod = 10**9+7
print(ans % mod)


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define P pair<int,int>
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
	int n, a, b;
	string s;
	cin >> n >> a >> b >> s;
	int cnt = 0, CNT = 0;
	for (int i = 0; i < (int)s.size(); i++) {
		if (s[i] == 'c') {
			cout << "No" << endl;
		} else if (s[i] == 'a') {
			if (cnt < a + b) {
				cout << "Yes" << endl;
				cnt++;
			} else {
				cout << "No" << endl;
			}
		} else {
			CNT++;
			if (cnt < a + b) {
				if (CNT <= b) {
					cout << "Yes" << endl;
					cnt++;
				} else {
					cout << "No" << endl;
				}
			} else {
				cout << "No" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 896
n,k = map(int,input().split())
p = list(map(int,input().split()))

num = sum(p[:k])
ans = num/2 + 0.5*k
for i in range(k,n):
    num += p[i] - p[i-k]
    ans = max(ans,num/2 + 0.5*k)
print(ans)

Measured memory_bytes: 25060
/*  ex4-1
    kosaq       */

#include <stdio.h>
#include <math.h>

int main(void){
    double n_tree;//N本の林檎の木をn_treeで定義
    double d_range;//一人は、D本先までを監視できるのでDをd_rangeで定義
    double one_observe;//一人が監視できる林檎の木の数
    int people_number;//N本の林檎の木を監視するために必要な人数の最小値

    scanf("%lf %lf", &n_tree, &d_range);//NとDを入力

    one_observe = d_range * 2 + 1;//一人が監視できる林檎の木の数
    people_number = ceil(n_tree / one_observe);//N本の林檎の木を監視するために必要な人数の最小値は(n_tree / one_observ)eの小数値を切り上げた整数
    printf("%d\n", people_number);//N本の林檎の木を監視するために必要な人数の最小値を出力

    return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define mp make_pair
ll mod = 10e9+7;
ll mod2 = 998244353;

int main(){
    string s; cin>>s;
    int a = 10*(s[0]-'0')+(s[1]-'0');
    int b = 10*(s[2]-'0')+(s[3]-'0');
    if (0<a&&a<=12 && 0<b&&b<=12){
        cout<<"AMBIGUOUS"<<endl;
    }else if(!(0<a&&a<=12) && !(0<b&&b<=12)){
        cout<<"NA"<<endl;
    }else if(0<a&&a<=12){
        cout<<"MMYY"<<endl;
    }else if(0<b&&b<=12){
        cout<<"YYMM"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  string a,b;cin>>a>>b;
  sort(ALL(a));
  sort(ALL(b),greater<int>());
  if(a<b)print("Yes");
  else print("No");

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
const long int NMAX = 200024;
const long int IMAX = 2147483647;
using namespace std;

long int n, dat[2 * NMAX - 1];

void init(long int n_) {
  n = 1;
  while (n < n_) n *= 2;

  REP(i, 2 * n - 1) dat[i] = IMAX;
}

void update(long int k, long int a) {
  k += n - 1;
  dat[k] = a;

  while (k > 0) {
    k = (k - 1) / 2;
    dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
}

long int query(long int a, long int b, 
    long int k, long int l, long int r) {
  if (r <= a or b <= l) return IMAX;

  if (a <= l and r <= b) return dat[k];
  else {
    long int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    long int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return min(vl, vr);
  }
}

long int find(long int s, long int t) {
  return query(s, t + 1, 0, 0, n);
}

int main() {
  long int N, Q;
  cin >> N >> Q;
  init(N);
  REP(i, Q) {
    long int com, x, y;
    cin >> com >> x >> y;
    if (com == 0) {
      update(x, y);
    } else {
      cout << find(x, y) << endl;
    }
  }
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

int main()
{
    int a, b;
    cin >> a >> b;
    int mi8 = (a * 100 + 7) / 8;
    int mx8 = ((a + 1) * 100 + 7) / 8;
    int mi10 = b * 10;
    int mx10 = (b + 1) * 10;
    if (mi10 >= mx8 || mi8 >= mx10) {
        cout << -1 << "\n"; return 0;
    }
    cout << max(mi8, mi10) << "\n";
    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var a = parseInt(input[0], 10);
    var b = parseInt(input[1], 10);

    console.log(Math.max(Math.max(a + b, a - b), a * b));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

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

int main()
{
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n>>m;
    long long a[m+5];
    for(i=0;i<m;i++){
        cin>>a[i];
    }
    if(n>=m){
        cout<<0<<endl;
        return 0;
    }
    sort(a,a+m);
    vector<long long>v;
    for(i=0;i<m;i++){
        y=abs(a[i]-a[i+1]);
        v.push_back(y);
    }
    sort(v.begin(),v.end());
    for(i=0;i<m-n;i++){
        x=x+v[i];
    }
    cout<<x<<endl;
}


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

#define INF 100000000
#define MOD9(a) (a%1000000009)
#define MOD7(a) (a%1000000007)
#define ABS(a) (a<0?-(a):a)
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define REP(i,a) for(int i=0;i<a;i++) 

using namespace std;
int main(){
  int H,W;
  cin >> H >> W;
  char c[H][W];
  REP(i, H){
    cin >> c[i];
  }

  REP(i, H){
    REP(k, 2){
      REP(j, W){
        cout << c[i][j];
      }
      cout << endl;
    }
  }
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <utility>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include <deque>

using namespace std;

#define REP(i,n,m) for( long long int i = (n); i < (m); i++ )
#define REV(v) for (auto itr = v.rbegin(); itr != v.rend(); itr++)
#define ll long long
#define ALL(a) (a).begin(), (a).end()
#define SORT(v) sort( ALL(v) );
#define LAST(v) v[v.size()-1]
#define ZERO(a) memset(a,0,sizeof(a));
#define MINUS(a) memset(a,-1,sizeof(a));
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pi pair<int, int>
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define IIN(a) int a; cin >> a;
#define LIN(a) ll a; cin >> a;
#define SIN(a) string a; cin >> a;
#define VL(v,n) vector<ll> v(n);
#define Read_VL(v,n) vector<ll> v(n);REP(i,0,n)cin>>v[i];
#define sumV(v,n) Vl(acm,n) REP(i,0,n) acm[i] = v[i] + ( i == 0 ? 0 : acm[i - 1]);
#define EPS (1e-10)
#define INF 1000000000000LL

void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}


template<class T=ll>struct Graph{
	int n;
	vector<vector<tuple<ll,T>>>edge;
	Graph(int N=1):n(N){edge.resize(n);}
	void add(ll f,ll t,T c,bool d=false){
		edge[f].emplace_back(t,c);
		if(!d)edge[t].emplace_back(f,c);
	}
	void view(){
		REP(i,0,n)for(auto&e:edge[i])
			puta(i,"=>",get<0>(e),", cost :",get<1>(e));
	}
};


bool length_cmp( string &a, string &b ){
  return a.size() < b.size();
}

ll StoLL( string s )
{
	ll num=0;
  REP( i, 0, s.size() ){
    num = num * 10 + ( s[i] ^ 48 );
  }
  return num;
}

ll CtoLL( char c )
{
	if( 'a' <= c && c <= 'z'){
		return (ll)( c ^ 96 ) ;
	}
	else if( 'A' <= c && c <= 'Z'){
		return (ll)( c ^ 64 );
	}
  return 0;
}

ll MOD=1000000007;
ll dx[4] = { 1, 0, -1, 0 };
ll dy[4] = { 0, 1, 0, -1 };
//I ASCII code: '0' = 48; 'A' = 65; 'a' = 97

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    LIN(n)
    ll o,e;
    e = n / 2;
    o = ( (n%2==0)?e:e+1);
    puta( e * o );
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
/*AtCoder Beginner Contest 108 (๑•﹏•๑｀)*/

int main(){
    int K; SCD(K);
    if (K%2 == 0) PRINTD((K/2) * (K/2));
    else PRINTD(((K/2)+1) * (K/2));
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<string> vstr;
typedef pair<ll, ll> pll;
typedef vector<pll> vp;
typedef map<ll, ll> mll;
typedef map<string, ll> mstrll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fir first
#define sec second
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
#define out(x) cout << (x)
#define indent() cout << '\n'
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
ll gcd(ll a, ll b){return b != 0 ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ll N = 200005;
const ll M = 100005;
ll n, m, x, y, z, w, h, ans, cnt, mx, mn;
string s, t, alphabet = "abcdefghijklmnopqrstuvwxyz";
ll a[N] = {}, b[N] = {}, dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
vll v;
//vll dx = {-1, 0, 1, -1, 1, -1, 0, 1}, dy = {-1, -1, -1, 0, 0, 1, 1, 1};

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n >> m){
        ll dp[n + 1][n + 1][n * 50 + 1] = {}; //i番目まででj枚選んでkにする通り数
        rep(i, n){
            cin >> a[i];
        }
        dp[0][0][0] = 1;
        rep(i, n){
            rep(j, n){
                rep(k, n * 50 + 1){
                    dp[i + 1][j][k] += dp[i][j][k];
                    if(k + a[i] <= n * 50){
                        dp[i + 1][j + 1][k + a[i]] += dp[i][j][k];
                    }
                }
            }
        }
        ans = 0;
        rep(i, 1, n + 1){
            ans += dp[n][i][m * i];
        }
        print(ans);
    }
}


Measured memory_bytes: 51072
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    ll x=0,y=0;
    while(n--){
        ll a,b;
        cin>>a>>b;
        ll k=1;
        if(x!=0)
            k=max(x/a,y/b);
        for(ll i=k;;i++){
            if((a*i>=x) && (b*i>=y)){
                x=a*i;
                y=b*i;
                break;
            }
        }
    }
    cout<<x+y<<endl;
}


Measured memory_bytes: 256
def main():
    input()
    s=input()
    import collections
    c = collections.Counter(s)
    # print(c)
    ans = 1
    MOD = 10**9 + 7
    for n in c.values():
        ans *= (n+1)
        ans %= MOD
    ans -= 1
    ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444