akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var PQR = ReadLine().Split().Select(int.Parse).ToArray();
        var sum = PQR.Sum();
        var ans = sum;
        ans=Min(ans, sum - PQR[0]);
        ans = Min(ans, sum - PQR[1]);
        ans = Min(ans, sum - PQR[2]);
        WriteLine(ans);
    }
}

Measured memory_bytes: 13396
/* Welcome to AtCoder */

#include <iostream>
#include <string>
using namespace std;

int main(){
  int n,m;
  int p[100000];
  string s[100000];
  int num[100001];
  int w[100001];
  int wa=0;
  int ac=0;
  cin >> n >> m;
  for(int i=0;i<m;i++){
    cin >> p[i] >> s[i];
    if(s[i]=="AC"){
      if(num[p[i]]==0){
	ac++;
	num[p[i]]=1;
	wa+=w[p[i]];
      } 
    }
    else{
      w[p[i]]++;
    }
  }
  cout << ac << " " << wa << endl; 
}


Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
int main() {
	string str;
	cin >> str;
	vector<char> v;
	if (str.size() % 2) {
		cout << "No" << endl;
		return 0;
	}
	for (int i = 0; i<str.size(); i++) {
		v.push_back(str[i]);
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < str.size()-1; i += 2) {
		if (v[i] != v[i + 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0,now=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        if(now!=0)cout<<endl;
        else now=1;
        for(int i=fiyear;i<=finyear;i++){
            if(i%4==0){
                co=1;
                if(i%100!=0||i%400==0)cout<<i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        co=0;
    }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        ll ans = 0;
        for (ll i = 1; i * i <= n; i++) {
            ans = i*i;
        }
        out << ans << '\n';
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define RALL(a)     (a).rbegin(),(a).rend()
#define PRINT(a)   cout << (a) << endl

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second

#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

using ll = long long int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

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

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

int main(){
  int h,w;
  cin >> h >> w;

  vector<vector<char>> s(h,vector<char>(w));
  REP(i,h)REP(j,w)cin >> s[i][j];

  vvi dp(h,vi(w,INF));
  if(s[0][0]=='#')dp[0][0]=1;
  else dp[0][0]=0;

  REP(i,h)REP(j,w){
    int di,dj;
    if(i+j==0)continue;

    if(i==0){
      dj = (s[i][j]!=s[i][j-1] ? 1 : 0);
      dp[i][j] = dp[i][j-1]+dj;
    }else if(j==0){
      di = (s[i][j]!=s[i-1][j] ? 1 : 0);
      dp[i][j] = dp[i-1][j]+di;
    }else{
      dj = (s[i][j]!=s[i][j-1] ? 1 : 0);
      di = (s[i][j]!=s[i-1][j] ? 1 : 0);
      dp[i][j] = min(dp[i-1][j]+di, dp[i][j-1]+dj);
    }
  }

  if(s[h-1][w-1]=='#')dp[h-1][w-1]++;

  // REP(i,h)REP(j,w){
  //   cout << dp[i][j] << (j==w-1 ? "\n" : " ");
  // }
  cout << dp[h-1][w-1]/2 << endl;

}



Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int N; cin >>N;
  pair<pair<string,int>,int>toshi[N];
  rep(i,N){
    string s;
    int a;
    cin>>s>>a;
    a=-1*a;
    toshi[i]=make_pair(make_pair(s,a),i);
  }
  sort(toshi,toshi+N);
  rep(i,N){
    cout<<toshi[i].second+1<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n;
		cin>>n;
		int a[n+1];
		rep(i,1,n+1) cin>>a[i];
		int dp[n+1][n+1][2];
		rep(gap,0,n){
			rep(x,1,n-gap+1){
				int l = x;
				int r = x+gap;
				if(l!=r){
					dp[l][r][0] = max(a[l]-dp[l+1][r][1],a[r]-dp[l][r-1][1]);
					dp[l][r][1] = max(a[l]-dp[l+1][r][0],a[r]-dp[l][r-1][1]);
				}
				else{
					dp[l][r][0] = a[l];
					dp[l][r][1] = a[l];
				}
			}
		}
		cout<<dp[1][n][0];
	}   
}     

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

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

    int checkY[8] = { -1, -1, -1, 0, 0, 1, 1, 1};
    int checkX[8] = { -1, 0, 1, -1, 1, -1, 0, 1};

    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++) {
      cin >> s[i];
    }

    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        // それぞれ数値を計算する
        if (s[i][j] == '#') continue;
        int n = 0;
        for (int k = 0; k < 8; k++) {
          int y = checkY[k] + i;
          if (y < 0 || h <= y) continue;

          int x = checkX[k] + j;
          if (x < 0 || w <= x) continue;

          if (s[y][x] == '#') n++;
        }
        s[i][j] = char(n + '0');
      }
    }

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

    return 0;
}

Measured memory_bytes: 256
N, Q =map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N-1)]

g = [set() for _ in range(N+1)]
for a, b in ab:
    g[b].add(a)
    g[a].add(b)
cnt = [0]*(N+1)

for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p] += x

temp = [1]
visited = [0]*(N+1)
visited[1] = 1

while temp:
    q = temp.pop()   
    for i in g[q]:
        if visited[i] == 0:
            temp.append(i)
            visited[i] = 1
            cnt[i] += cnt[q]
print(*cnt[1:])


Measured memory_bytes: 118000
import numpy as np
N,M = map(int,input().split())
A = np.array([list(input()) for n in range(N)])
B = np.array([list(input()) for m in range(M)])
a = "No"

for i in range(N-M+1):
  for j in range(N-M+1):
    if (A[i:i+M,j:j+M]==B).all():
      a = "Yes"

print(a)

Measured memory_bytes: 27088
program heap_sort
      implicit none
      integer::n
      character(10),allocatable::s(:)
      integer::i,count

         read *, n
         allocate(s(n))
         do i=1,n
            read *,s(i)
         end do

         call heapsort(n,s)

         count=1
         do i=1,n-1
            if (s(i)/=s(i+1)) count=count+1
         end do

         print *,count
         stop

   contains
      subroutine heapsort(n,array)
         implicit none
         integer,intent(in)::n
         character(10),intent(inout)::array(1:n)
         integer::i,j,k,l
         character(10)::w

!            if(n.le.0)then
!               write(6,*)"Error, at heapsort"; stop
!            endif
            if(n.eq.1)return

            l=n/2+1
            k=n
            do while(k.ne.1)
               if(l.gt.1)then
                  l=l-1
                  w=array(l)
               else
                  w=array(k)
                  array(k)=array(1)
                  k=k-1
                 if(k.eq.1) then
                    array(1)=w
                    exit
                 end if
               end if
               i=l
               j=l+l
               do while(j.le.k)
                  if(j.lt.k)then
                     if(array(j).lt.array(j+1))j=j+1
                  end if
                  if (w.lt.array(j))then
                     array(i)=array(j)
                     i=j
                     j=j+j
                  else
                     j=k+1
                  end if
               end do
               array(i)=w
            end do

            return
      end subroutine heapsort

   end program heap_sort

Measured memory_bytes: 4772
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str[] = br.readLine().split(" ");
        double x1 = Double.parseDouble(str[0]);
        double y1 = Double.parseDouble(str[1]);
        double x2 = Double.parseDouble(str[2]);
        double y2 = Double.parseDouble(str[3]);
        double d = Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
        System.out.printf("%.8f\n",d);
    }
}

Measured memory_bytes: 24648
c = input()

al_list = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
next_char_idx = al_list.index(c) + 1
print(al_list[next_char_idx])

Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <numeric>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <thread>
#include <tuple>
#include <limits>

using namespace std;

constexpr int mod = 1'000'000'007;

long long mygcd(long long a, long long b) {
  while (b) {
    long long t = a%b;
    a = b;
    b = t;
  }
  return a;
}

long long powmod(long long n, long long k) {
  n %= mod;
  long long ret = 1;
  while (k) {
    if (k & 1) ret = (ret * n % mod);
    n = (n * n % mod);
    k >>= 1;
  }
  return ret;
}


long long solve(long long h, long long w) {
  if (h > w) swap(h, w);
  // h <= w
  long long ans = powmod(2, h) + powmod(2, w) - 1;
  ans += powmod(2, mygcd(h, w)) - 2;
  ans %= mod;
  ans += mod;
  ans %= mod;
  return ans;
}

int main() {
//  simulate();
  long long H, W, T;
  scanf("%lld%lld%lld", &H, &W, &T);
  long long a = mygcd(T, H);
  long long b = mygcd(T, W);
  long long ans = solve(H/a, W/b);
  ans %= mod;
  ans += mod;
  ans %= mod;
  long long ans3 = powmod(powmod(ans, a), b);
  ans3 %= mod;
  ans3 += mod;
  ans3 %= mod;
  printf("%lld\n", ans3);
  return 0;
}


Measured memory_bytes: 128
class DisjointSets:
    def __init__(self,n):
        self.parent = [i for i in range(n)]
        self.siz = [1]*n

    def root(self,x):
        if x != self.parent[x]: 
            self.parent[x] = self.root(self.parent[x])
        return self.parent[x]

    def same(self,x,y): 
        return self.root(x) == self.root(y)

    def unite(self,x,y): 
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self.siz[x] < self.siz[y]:
            x,y = y,x
        self.parent[y] = x
        self.siz[x] += self.siz[y]

    def size(self,x):
        return self.siz[self.root(x)]
        
n = int(input())
X = []
Y = []
for i in range(n):
    x,y = map(int,input().split())
    X.append((i,x))
    Y.append((i,y))
X.sort(key = lambda x:x[1])
Y.sort(key = lambda y:y[1])
edges = []
for i in range(1,n):
    a,x1 = X[i-1]
    b,x2 = X[i]
    edges.append((a,b,x2-x1))
    c,y1 = Y[i-1]
    d,y2 = Y[i]
    edges.append((c,d,y2-y1))
edges.sort(key = lambda y:y[2])

ans = 0
ds = DisjointSets(n)
for i in range(2*n-2):
    u,v,dist = edges[i]
    if ds.same(u,v): continue
    ds.unite(u,v)
    ans += dist
print(ans)


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)

void FIO()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

//Minimum ways to reach n from 1 if we can take i+1,i+2...,i+k steps
//(frog2)Atcoder

int n, k;
int a[100005];
int dp[100005];

int solve(int ind)
{
	if (ind >= n)//No of ways to reach last step when we are at last step
	{
		return 0;
	}
	if (dp[ind] != -1)
	{
		return dp[ind];
	}

	int val;
	for (int i = ind + 1; i <= min(n, ind + k); i++)
	{
		val = min(val, abs(a[ind] - a[i]) + solve(i));
	}

	return dp[ind] = val;
}

int32_t main()
{
	FIO();
	cin >> n >> k;

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

	memset(dp, -1, sizeof(dp));

	cout << solve(1) << '\n';
	return 0;
}

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

using lint = long long;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n,m;
    cin >> n >> m;
    int64_t sum = 0;
    for (int i = 0; i < m; ++i) {
    	int v;
    	cin >> v;
    	sum += v;
    }
    cout << (n < sum ? -1 : n-sum) << '\n';
}

Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr int MOD = 998244353;
constexpr double PI = 3.141592653589793238;

double a, b, x;


int main() {
  cin >> a >> b >> x;
  cout << fixed << setprecision(10);
  double half = a*a*b / 2;
  if(x == half) {
    cout << 45.00 << endl;
  } else if(x > half) {
    cout << atan((2*a*a*b-2*x)/(a*a*a)) * 180 / PI << endl;
  } else {
    cout << atan(a*b*b/(x*2)) * 180 / PI << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	double r,f,m;
	scanf("%lf", &r);
	f = 3.14159265359*(r*r);
	m = 3.14159265359*(2 * r);
	printf("%lf %lf\n", f, m);

	return 0;
}


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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;

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

int main(void)
{
  int n, a, b;
  int cnt = 0;
  cin >> n >> a >> b;
  int t;

  REP(i, n){
    cin >> t;
    if (t >= a && t < b){
      //何もしない
    }
    else{
      cnt++;
    }
  }
  cout << cnt << endl;

  return (0);
}


Measured memory_bytes: 256
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
from fractions import gcd
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    # # 到達していないところはFalseにしとこう
    # h,w = readInts()
    # Field = [[0] * w for _ in range(h)]
    # d = deque()
    # # 最初左上にいるらしい
    # # 移動方向 diagonaaaaaaal!
    # dx = [-1,-1,1,1]
    # dy = [-1,1,-1,1]
    # # dfsしたい
    # d.append([0,0]) # 初期値を入れる
    # cnt = 0
    # while d:
    #     x,y = d.pop()
    #     Field[y][x] = 1
    #     #cnt += 1
    #     for i in range(4):
    #         nx = x + dx[i]
    #         ny = y + dy[i]
    #         if nx < 0 or w <= nx or ny < 0 or h <= ny:
    #             continue
    #         if Field[ny][nx] == 0:
    #             continue
    #         # 探索済みならいかない
    #         d.append([nx,ny])
    # for x in range(w):
    #     for y in range(h):
    #         if Field[y][x] == 1:
    #             cnt += 1
    # print(cnt)
    h,w = readInts()
    mul = h * w # multiplication
    if h == 1 or w == 1:
        print(1)
    elif mul % 2 == 0:
        print(mul // 2)
    else:
        print((mul+1)//2)
if __name__ == '__main__':
  main()


Measured memory_bytes: 5276
#include<stdio.h>

int main(void){
    int N,M;
    scanf("%d %d", &N, &M);
    int L[M], R[M];
    for(int i = 0; i < M; i++){
        scanf("%d %d", &L[i], &R[i]);
    }
    int min = R[0], max = L[0];

    for(int i = 1; i < M; i++){
        if(min > R[i]) min = R[i];
        if(max < L[i]) max = L[i];
    }
    // printf("max %d min %d\n", max, min);

    int sum = 0;

    for(int i = 1; i <= N; i++){
        // for(int j = 0; j < M; j++){
        //     printf("L: %d, i: %d, R: %d\n", L[j], i, R[j]);
        //     if(L[j] <= i  && i <= R[j]){flag = 1;}
        //     else{flag = 0; break;}
        // }
        // printf("i : %d\n",i);
        if(max <= i && i <= min)sum++; 
    }
    printf("%d\n", sum);

    return 0;
}

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// // Declaring ordered_set
// typedef tree<ll, null_type, less<ll>, rb_tree_tag,
//             tree_order_statistics_node_update>
//    ordered_set;

#define _start_ auto __start__ = high_resolution_clock::now();
#define _stop_ cerr << "\n" \
                    << duration_cast<microseconds>(high_resolution_clock::now() - __start__).count() / (double)1000000 << " sec\n";
#define mod 998244353
#define _                             \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define ideb \
    int _p_; \
    cin >> _p_;
typedef long long int ll;
typedef unsigned long long int ull;
long long power(long long x, long long n)
{
    long long result = 1;
    while (n > 0)
    {
        if (n % 2 == 1)
            result = (result % mod * x % mod) % mod;
        x = (x % mod * x % mod) % mod;
        n = n / 2;
    }
    return result % mod;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b)
{
    return (double)a.second / (double)a.first > (double)b.second / (double)b.first;
}

int main()
{
    ll n, m;
    cin >> n >> m;

    pair<ll, ll> p[n + 1];

    for (ll i = 1; i <= n; i++)
    {
        cin >> p[i].first >> p[i].second;
    }

    ll dp[n + 1][100008];
    //  memset(dp, 0, sizeof(dp));

    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= 100000; j++)
            dp[i][j] = INT_MAX;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= 100000; j++)
        {
            if (p[i].second >= j)
            {
                dp[i][j] = min(p[i].first, dp[i - 1][j]);
            }
            else
            {
                dp[i][j] = min(dp[i - 1][j], p[i].first + dp[i - 1][j - p[i].second]);
            }
        }
    }

    ll ans = 0;
    for (ll i = 1; i <= 100000; i++)
    {
        if (dp[n][i] <= m)
        {
            ans = i;
        }
    }
    cout << ans;
}


Measured memory_bytes: 79104
x=int(input())
ab=[]
for i in range(1000):
    ab.append(i**5)
found=0
for a in ab:
    for b in ab:
        if found==1:
            break
        if a-b==x:
            print(int(a**0.2),int((b**0.2)))
            found=1
        elif a+b==x:
            print(int(a**0.2),int(-(b**0.2)))
            found=1
        else:
            continue

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

#define int long long

struct Combination
{
  int mod;
  vector<int> fact;
  vector<int> invf;
  vector<vector<int> > part;  

  /*
    constructor : O(sz+log(mod))    
  */
  Combination(int sz, int mod) : fact(sz+1), invf(sz+1), mod(mod) {
    fact[0] = 1;
    for ( int i = 1; i < (int)fact.size(); i++ ) {
      fact[i] = fact[i-1]*i % mod;
    }
    invf[sz] = inv(fact[sz]);
    for ( int i = sz-1; i >= 0; i-- ) {
      invf[i] = invf[i+1]*(i+1) % mod;
    }
  }

  int pow(int x, int n) const {
    int ret = 1;
    while ( n > 0 ) {
      if ( n & 1 ) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int inv(int x) const {
    return (pow(x, mod - 2));
  }

  /*
    permutation
  */
  int P(int n, int r) const {
    if ( r < 0 || n < r ) return (0);
    return (fact[n]*invf[n-r] % mod);    
  }

  /*
    combination
  */
  int C(int n, int r) const {
    if ( r < 0 || n < r ) return (0);    
    return (fact[n]*invf[r]%mod * invf[n-r] % mod);    
  }  

  /*
    combination with repetition
  */
  int H(int n, int r) const {
    if ( n < 0 || r < 0 ) return 0;
    if ( n == 0 && r == 0 ) return 1;
    return C(n+r-1, n);    
  }

  /*
    stirling number
  */
  int S(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      int add = C(r, i)*pow(i, n)%mod;      
      if ( (r-i)&1 ) ret += mod-add;
      else ret += add;
      ret %= mod;      
    }
    (ret *= invf[r]) %= mod;
    return ret;
  }

  /*
    bell number
  */
  int B(int n, int r) const {
    int ret = 0;
    for ( int i = 1; i <= r; i++ ) {
      (ret += S(n, i)) %= mod;      
    }
    return ret;
  }

  /*
    calc partition number
    return partition number table
  */
  vector<vector<int> > built_part(int n, int r) {
    part = vector<vector<int> >(n+1, vector<int>(r+1, 0));
    part[0][0] = 1;
    for ( int i = 0; i <= n; i++ ) {
      for ( int j = 1; j <= r; j++ ) {
	if ( i-j >= 0 ) {
	  (part[i][j] = part[i][j-1]+part[i-j][j]) %= mod;	  
	} else {
	  part[i][j] = part[i][j-1];
	}
      }
    }
    return part;    
  }  
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, k;
  cin >> n >> k;

  if ( n > k ) cout << 0 << endl;
  else cout << 1 << endl;
  
  return 0;
}



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

int main()
{
  int W, Q;
  while (cin >> W >> Q && !(W == 0 && Q == 0)) {
    vector<pair<int,int> > cats(Q);
    vector<bool> used(W, false);
    for (int i = 0; i < Q; i++) {
      char sw;
      int id;
      cin >> sw >> id;
      if (sw == 's') {
        int w;
        cin >> w;

        int b = -1, c = 0;
        for (int j = 0; j < W; j++) {
          if (used[j]) {
            c = 0;
          } else {
            c++;
            if (c == w) {
              b = j - w + 1;
              break;
            }
          }
        }
        if (b == -1) {
          cout << "impossible" << endl;
        } else {
          for (int j = 0; j < w; j++) {
            used[b+j] = true;
          }
          cats[id] = make_pair(b, w);
          cout << b << endl;
        }
      } else {
        int b = cats[id].first;
        int w = cats[id].second;
        for (int j = 0; j < w; j++) {
          used[b+j] = false;
        }
      }
    }
    cout << "END" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define INF (1<<31)

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int max_n = 512;
int heap[max_n];

int main()
{
	rep (i, max_n ) heap[i] = INF;

	int n; scanf ("%d", &n );
	rep (i, n ) scanf ("%d",  &heap[i] );

	rep (i, n ){
		printf ("node %d: key = %d, ", i+1, heap[i] );
		if (i != 0 ){
			printf ("parent key = %d, ", heap[(i-1)/2] );
		} // end if

		if (heap[2*i+1] != INF ){
			printf ("left key = %d, ", heap[2*i+1] );
		} // end if
		if (heap[2*i+2] != INF ){
			printf ("right key = %d, ", heap[2*i+2] );
		} // end if
		printf ("\n" );
	} // end rep
		
	return 0;
}

Measured memory_bytes: 1192
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  string s;
  int n, k;
  cin >> k >> s;
  n = s.length();
  if(n <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "...\n";
  }
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
	int n;
	scanf("%d", &n);
	int a[n];
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int j = n -1; j >= 0; j--) {
		printf("%d", a[j]);
		if (j > 0) {
			printf(" ");
		}
	}
	printf("\n");
}



Measured memory_bytes: 2100
import java.util.Scanner;

class Main{
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		sc.close();
		
		S = S.replaceAll("eraser",  "-");
        S = S.replaceAll("erase",   "-");
        S = S.replaceAll("dreamer", "-");
        S = S.replaceAll("dream",   "-");
        S = S.replaceAll("-", "");
        if (S.length() == 0) {
        	System.out.println("YES");
        }else {
            System.out.println("NO");
        }
	}
}

Measured memory_bytes: 30492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define all(n) n.begin(),n.end()
#define yn(x) cout << (x ? "Yes":"No") << endl;

int main() {
  ll n,m;
  cin >> n >> m;
  vector<ll>h(n),a(m),b(m),good(n);
  rep(i,n){
    cin >> h[i];
    good[i] = 1;
  }
  rep(i,m) cin >> a[i] >> b[i];
  rep(i,m){
    if(h[a[i]-1] >= h[b[i]-1]) good[b[i]-1] = 0;
    if(h[a[i]-1] <= h[b[i]-1]) good[a[i]-1] = 0;
  }
  ll ans = 0;
  rep(i,n){
    if(good[i] == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6428
#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
#define PI  acos(-1)
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(){
  int N,T;cin>>N>>T;
  vector<int> arr(T);
  REP(i,0,T)cin>>arr[i];
  if(N==1){
    print(arr[0]-1);
    re 0;
  }
  sort(ALL(arr));
  int sum_=0;
  REP(i,0,T-1){
    sum_+=arr[i];
  }
  print(max(0LL,arr[T-1]-sum_-1LL));
}


Measured memory_bytes: 256
import java.util.*;
import java.math.BigDecimal;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int H = sc.nextInt();
    int M = sc.nextInt();
    BigDecimal AA = new BigDecimal(A);
    BigDecimal BB = new BigDecimal(B);
    BigDecimal HH = new BigDecimal(H);
    BigDecimal MM = new BigDecimal(M);
    BigDecimal ans2;
    BigDecimal kaku;
    BigDecimal mkaku;
    BigDecimal hkaku;
    BigDecimal AA2;
    BigDecimal BB2;
    BigDecimal CC;
    BigDecimal DD;
    double dkaku;
    double dans2;
    mkaku = MM.multiply(BigDecimal.valueOf(6)); 
    hkaku = HH.multiply(BigDecimal.valueOf(30));
    hkaku = hkaku.add(BigDecimal.valueOf((double)M / 2));
    kaku = mkaku.subtract(hkaku);
    dkaku = Math.abs(Math.toRadians(kaku.doubleValue()));
    AA2 = AA.multiply(AA);
    BB2 = BB.multiply(BB);
    CC = AA2.add(BB2);
    DD = BigDecimal.valueOf(Math.cos(dkaku));
    DD = DD.multiply(BigDecimal.valueOf(2));
    DD = DD.multiply(AA);
    DD = DD.multiply(BB);
    ans2 = CC.subtract(DD); 
    dans2 = ans2.doubleValue();
    double ans = Math.sqrt(dans2);
    System.out.println(ans);
  }
}

Measured memory_bytes: 36112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,d,h,i,j,k,l,m,n,v,w,x,y,z;
	ll		ans = 0;
	string	s;
	cin >> n;
	a = 0;
	for(i=0;i<n;i++) {
		cin >> b >> c;
		if (b == c) {
			a++;
		} else {
			ans = max(ans , a);
			a = 0;
		}
	}
	ans = max(ans , a);
	if (ans >= 3) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3588
#include <stdio.h>
int main(){
    
    int n,i,j;
    
    scanf("%d",&n);
    
    for(i=3;j=i,i<=n;i++){
        if(i%3==0) printf(" %d",i);
        else {
            while(j){
                if(j%10==3) break;
                j/=10;
            }
            if(j) printf(" %d",i);
        }
    }
    printf("\n");
    return 0;
}

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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
int A[110000];
signed main() {
    cin >> N;
    for (int i = 0; i < N; i++) { cin >> A[i]; }
    int ans = A[0];
    for (int i = 1; i < N; i++) { ans = gcd(ans, A[i]); }
    cout << ans << endl;
}


Measured memory_bytes: 1024
a, b, m = map(int, input().split())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

tickets = []
for _ in range(m):
  tickets.append(map(int, input().split()))
  
m = min(A) + min(B)

for x, y, c in tickets:
  tmp_m = A[x-1] + B[y-1] - c
  if tmp_m < m:
    m = tmp_m
    
print(m)

Measured memory_bytes: 62376
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n, q, sum = 0, num = 0;
		int[] time, end;
		String[] name;
		
		n = scan.nextInt();
		q = scan.nextInt();

		time = new int[n];
		end = new int[n];
		name = new String[n];
		
		for(int i = 0; i < n; i++) {
			name[i] = scan.next();
			time[i] = scan.nextInt();
		}
		
		while(num < n) {
			for(int i = 0; i < n; i++) {
				if(time[i] > 0) {
					if(time[i] <= q) {
						sum += time[i];
						end[num] = i;
						num++;
						time[i] = -sum;
						
					} else {
						time[i] -= q;
						sum += q;
						
					}
				}
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.println(name[end[i]] + " " + -time[end[i]]);
		}
		
		scan.close();
	}
}

Measured memory_bytes: 76244
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i = 0; i < n; i++)
#define pb push_back
#define all(c) c.begin(),c.end()



int main()
{
    int a, b;
    cin >> a >> b;
    int c, d;
    cin >> c >> d;
    while(1)
    {
        c -= b;
        if(c<=0)
        {
            cout << "Yes";
            return 0;
        }
        a -=d;
        if(a<=0)
        {
            cout << "No";
            return 0;
        }

    }
}



Measured memory_bytes: 3624
def examA():
    X, Y, Z = LI()
    X, Y = Y,X
    X,Z = Z, X
    print(X,Y,Z)
    return

def examB():
    N, M = LI()
    A = LI()
    need = (sum(A)-1)//(4*M) + 1
    ans = 0
    #print(need)
    for a in A:
        if a>=need:
            ans += 1
    if ans>=M:
        print("Yes")
    else:
        print("No")
    return

def examC():
    N, K = LI()
    ans = N%K
    if K-ans<ans:
        ans = K-ans
    print(ans)
    return

def examD():
    def bfs(n):
        # 点の数、スタートの点、有向グラフ
        W = [""] * n
        # 各点の状態量、最短距離とか,見たかどうかとか
        que = deque()
        for i in range(1,10):
            que.append(str(i))
            W[i-1] = str(i)
        i = 9
        while(i<n):
            now = que.popleft()
            end = now[-1]
            for j in [-1,0,1]:
                ne = int(end)+j
                if 0<=ne<=9:
                    W[i] = now + str(ne)
                    que.append(W[i])
                    i += 1
                    if i==n:
                        break
        return W
    K = I()
    if K<=12:
        ans = K
        print(ans)
        return
    ans = bfs(K)[-1]
    print(ans)
    return

def examE():
    N, K, C = LI()
    S = SI()
    L = set()
    R = set()
    prev = -inf
    for i,s in enumerate(S):
        if s=="x":
            continue
        if prev+C>=i:
            continue
        L.add(i)
        prev = i
    if len(L)>K:
        print()
        return
    prev = inf
    for i in range(N)[::-1]:
        s = S[i]
        if s=="x":
            continue
        if prev-C<=i:
            continue
        R.add(i)
        prev = i
    #print(L,R)
    ans = []
    for i in L:
        if i in R:
            ans.append(i+1)
    if not ans:
        print()
        return
    ans.sort()
    for v in ans:
        print(v)
    return

def examF():
    N = I()

    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examE()

"""

"""

Measured memory_bytes: 74068
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

win = []

for i in range(n):
   if i >= k:
      if t[i-k] == t[i]:
         if win[i-k] == 1:
            win.append(0)
         else:
            win.append(1)
      else:
         win.append(1)
   else:
      win.append(1)
   
ans = 0
for w,tt in zip(win, t):
   if w == 1:
      if tt == "r":
         ans += p
      if tt == "s":
         ans += r
      if tt == "p":
         ans += s
print(ans)

Measured memory_bytes: 4212
/*************************************************************************
    > File Name: C.cpp
    > Author: Drinkwater-cnyali
    > Created Time: 2017/7/29 20:07:41
************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>

using namespace std;

#define REP(i, a, b) for(register int i = (a), i##_end_ = (b); i <= i##_end_; ++ i)
#define DREP(i, a, b) for(register int i = (a), i##_end_ = (b); i >= i##_end_; -- i)
#define mem(a, b) memset((a), b, sizeof(a))

int read()
{
	int sum = 0, fg = 1; char c = getchar();
	while(c < '0' || c > '9') { if (c == '-') fg = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { sum = sum * 10 + c - '0'; c = getchar(); }
	return sum * fg;
}

const int maxn = 400000+10;
int n,m;
int be[maxn],ne[maxn],to[maxn],e;

void add(int x,int y)
{
	to[++e] = y;
	ne[e] = be[x];
	be[x] = e;
}

struct T
{
	int x,s;
};

int vis[maxn];

bool bfs()
{
	queue<T>q;
	q.push((T){1,0});
	vis[1] = 1;
	while(!q.empty())
	{
		T ls = q.front();q.pop();
		int x = ls.x;
		if(x == n)
		{
			if(ls.s == 2)return 1;
			return 0;
		}
		for(int i = be[x]; i; i = ne[i])
		{
			int v = to[i];
			if(!vis[v])
			{
				q.push((T){v,ls.s+1});
				vis[v] = 1;
			}
		}
	}
	return 0;
}

int main()
{
	n = read(),m = read();
	REP(i,1,m) { int x = read(),y = read(); add(x,y); }
	if(bfs())puts("POSSIBLE");
	else puts("IMPOSSIBLE");
    return 0;
}


Measured memory_bytes: 6400
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b, c = map(int, input().split())
    print(min(a + b, a + c, b + c))


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
B = MAP()

# always B[i] >= MAX(A[i],A[i+1])

A = [0] * (N)
A[0] = B[0]

for idx,b in enumerate(B):
	A[idx+1] = b

for i in range(N-1):
	#print(B[i], A[i], A[i+1], B[i]>=max(A[i],A[i+1]))
	if B[i]<max(A[i],A[i+1]):
		if A[i]>A[i+1]: A[i] = B[i]
		else : A[i+1] = B[i]

for i in range(N-1):
	#print(B[i], A[i], A[i+1], B[i]>=max(A[i],A[i+1]))
	if B[i]<max(A[i],A[i+1]):
		if A[i]>A[i+1]: A[i] = B[i]
		else : A[i+1] = B[i]

#print(A)
print(sum(A))

Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  long long N, A, B, C, D, E;
  cin >> N >> A >> B >> C >> D >> E;
  
  long long a = (N + (A - 1)) / A;
  long long b = (N + (B - 1)) / B;
  long long c = (N + (C - 1)) / C;
  long long d = (N + (D - 1)) / D;
  long long e = (N + (E - 1)) / E;
  
  cout << max({ a, b, c, d, e }) + 4;
  
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
a, b, c, x, y = map(int, input().split())

cost = a * x + b * y
for i in range(0, max(x, y) + 1):
    tmp = 2 * c * i
    tmp += a * max(0, x - i) + b * max(0, y - i)
    cost = min(cost, tmp)

print(cost)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((a+b) > (c+d)) cout << "Left" << endl;
    else if ((a+b) < (c+d)) cout << "Right" << endl;
    else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python3

def qsum(n, q):
    t = n // q
    return t * (q + q * t) // 2

n = int(input())

s = n * (n + 1) // 2
s -= qsum(n, 3)
s -= qsum(n, 5)
s += qsum(n, 15)

print(s)


Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int n, w;
pii a[105];
ll dp[105][N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    cin>>n>>w;
    rep(i, 1, n) cin>>a[i].first>>a[i].second;
    rep(i, 1, n){
        int u = a[i].first, v = a[i].second;
        rep(j, 1, w){
            dp[i][j] = dp[i - 1][j];
            if(j - u >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j - u] + v);
        }
    }
    cout<<dp[n][w];
    return 0;
}

Measured memory_bytes: 79488
#include <iostream>
#include <cstdlib>
#include <string>
#include <map>

using namespace std;

int main()
{
    map<string,int> word_count;// empty

    string word;
	int n,m;
	cin>>n;
    for(int i=0;i<n;i++)
    {
    	cin >> word;
        ++word_count[word];                      // 用下标访问
    }
    cin>>m;
	for(int i=0;i<m;i++)
    {
    	cin >> word;
        --word_count[word];                      // 用下标访问
    }
    map<string, int>::iterator iter;             // iter 为pair 类型(value_type)
    int max=-1;
    for(iter = word_count.begin(); iter != word_count.end(); iter++)
    {
        if(iter->second>max){
        	max=iter->second;
		}
    }
	if(max<=0){
			cout<<0<<endl;
		}
	else{
		cout<<max<<endl;
	}
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0039
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> Ps = new List<int>();

            int N = int.Parse(Console.ReadLine());

            int i = 0;
            while (i < N )
            {
                Ps.Add(int.Parse(Console.ReadLine()));
                i++;
            }
            
            int result = Ps.Sum() - Ps.Max() / 2;

            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 27984
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])


if a+b+c+d == 7:s = s[0]+'+'+s[1]+'+'+s[2]+'+'+s[3]+'=7'
elif a+b+c-d == 7:s = s[0]+'+'+s[1]+'+'+s[2]+'-'+s[3]+'=7'
elif a+b-c+d == 7:s = s[0]+'+'+s[1]+'-'+s[2]+'+'+s[3]+'=7'
elif a+b-c-d == 7:s = s[0]+'+'+s[1]+'-'+s[2]+'-'+s[3]+'=7'
elif a-b-c-d == 7:s = s[0]+'-'+s[1]+'-'+s[2]+'-'+s[3]+'=7'
elif a-b-c+d == 7:s = s[0]+'-'+s[1]+'-'+s[2]+'+'+s[3]+'=7'
elif a-b+c-d == 7:s = s[0]+'-'+s[1]+'+'+s[2]+'-'+s[3]+'=7'
elif a-b+c+d == 7:s = s[0]+'-'+s[1]+'+'+s[2]+'+'+s[3]+'=7'

print(s)

Measured memory_bytes: 3064
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    int n = s.Length;

    if(s[n-1] == 's')
    {
      Console.WriteLine(s+"es");
    }else
    {
      Console.WriteLine(s+"s");
    }
	}
}

Measured memory_bytes: 25800
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

ll nCr(ll n, ll m) {
    // cout << n << " - " << m << endl;
    m = min(m, n-m);
    if (m == 0) return 1;
    ll num = 1, dem = 1;
    for(ll i = 1; i <= m; i++) {
        num = (num*(n+1-i));
        num = num / i;
    }
    return num;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    unordered_map<ll, int> cnt;
    vector<ll> arr(n, 0);
    for(auto& val: arr) {
        cin >> val;
        cnt[val] += 1;
    }
    sort(arr.begin(), arr.end());
    reverse(arr.begin(), arr.end());
    ll S = accumulate(arr.begin(), arr.begin()+a, 0LL);
    cout << fixed << setprecision(12) << double(S)/double(a) << endl;
    int larger_cnt = 0;
    for(int i = 0; i < n; i++)
        if (arr[i] > arr[a-1])
            larger_cnt += 1;
    ll ans = 0, last = arr[a-1];
    if (arr[a-1] == arr[0]) {
        for(int k = a; k <= b && arr[k-1] == last; k++) {
            ans += nCr(cnt[last], k-larger_cnt);
        }
        cout << ans << endl;
    } else {
        cout << nCr(cnt[last], a-larger_cnt) << endl;
    }
    return 0;
}




Measured memory_bytes: 256
def main():
    Q = int(input())
    LENGTH = 1 + 10**5

    primes = [True] * LENGTH 
    primes[0] = False
    primes[1] = False
    for i in range(2, int(LENGTH ** 0.5 + 1)):
        if primes[i] == False:
            continue
        for j in range(i*2, LENGTH, i):
            primes[j] = False

    sol = [0] * LENGTH

    cnt = 0
    for i in range(3,len(sol)):
        if not primes[i]:
            sol[i] = cnt
            continue
        cnt += 1 if primes[i] and primes[(i+1)//2] else 0
        sol[i] = cnt

    for _ in range(Q):
        l,r = map(int, input().split())
        print(sol[r] - sol[l-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 5212
import math

a, b, h, m = map(int, input().split())
angle_m = m * 6
angle_h = h * 30 + m / 2
angle = abs(angle_h - angle_m)
angle = min(angle, 360 - angle)
angle *= math.pi / 180
dist = math.sqrt(a*a + b*b - 2*a*b*math.cos(angle))

print(dist)

Measured memory_bytes: 9580