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

using namespace std;

using ll = long long;

const long long MOD = 1e9+7;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

class Mll
{
    public:
    ll x;

    Mll() : x(0){}
    Mll(ll x=0) : x((x%MOD+MOD)%MOD){}

    Mll operator-() const
    {
        return Mll(-x);
    }

    Mll& operator+=(const Mll& A)
    {
        if((x += A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator-=(const Mll& A)
    {
        if((x += MOD - A.x) >= MOD) x -= MOD;
        return *this;
    }
    Mll& operator*=(const Mll& A)
    {
        (x *= A.x) %= MOD;
        return *this;
    }
    
    Mll operator+(const Mll& A)
    {
        Mll res(*this);
        return res+=A;
    }
    Mll operator-(const Mll& A)
    {
        Mll res(*this);
        return res-=A;
    }
    Mll operator*(const Mll& A)
    {
        Mll res(*this);
        return res*=A;
    }
    
    Mll pow(ll t) const // t乗
    {
        if(t==0) return 1;
        Mll A = pow(t>>1);
        A *= A;
        if(t&1) A *= *this;
        return A;
    }

    // for prime mod
    Mll inv() const
    {
        return pow(MOD-2);
    }
    Mll& operator/=(const Mll& A)
    {
        return (*this) *= A.inv();
    }
    Mll operator/(const Mll& A) const
    {
        Mll res(*this);
        return res/=A;
    }

    friend ostream& operator<<(ostream& os, const Mll& M)
    {
        os << M.x;
        return os;
    }
};

vector<Mll> ALLIN_MLL(ll N)
{
    vector<ll> numbers_ll(N);
    ALLIN1_NUMBER(numbers_ll);

    vector<Mll> numbers_Mll;
    for(ll i=0;i<N;i++)
    {
        Mll add(numbers_ll[i]);
        numbers_Mll.push_back(add);
    }

    return numbers_Mll;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

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

    if(400<=X && X<600) cout << 8;
    if(600<=X && X<800) cout << 7;
    if(800<=X && X<1000) cout << 6;
    if(1000<=X && X<1200) cout << 5;
    if(1200<=X && X<1400) cout << 4;
    if(1400<=X && X<1600) cout << 3;
    if(1600<=X && X<1800) cout << 2;
    if(1800<=X && X<2000) cout << 1;

    cout << endl;

    return 0;
}

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

typedef long long int ll;

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
    }

    ll tentou_1 = 0;
    for(ll i = 0;i < n - 1;i++){
        for(ll j = i + 1;j < n;j++){
            if(a[i] > a[j]){
                tentou_1++;
            }
        }
    }
    ll tentou_2 = 0;
    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < n;j++){
            if(a[i] > a[j]){
                tentou_2++;
            }
        }
    }
    
    ll ans = tentou_1 * k % 1000000007;
    ans += tentou_2 * (((k - 1) * k) / 2 % 1000000007) % 1000000007;
    ans %= 1000000007;
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
ll c[55][55];
ll com(int n,int k){
  if(c[n][k]>0){
    return c[n][k];
  }
  if(n<k||n<0||k<0){
    return 0;
  }
  if(k==0||k==n){
    return 1;
  }
  return c[n][k]=com(n-1,k-1)+com(n-1,k);
}
int main(){
  ld n,a,b;
  cin >> n >> a >> b;
  vector<ld> v(n);
  map<ld,ll> mp1;
  map<ld,ll> mp2;
  for(int i=0;i<n;i++){
    cin >> v[i];
    mp1[v[i]]++;
  }
  sort(v.begin(),v.end(),greater<ld>());
  ld ans=0;
  for(int i=0;i<a;i++){
    ans+=v[i];
    mp2[v[i]]++;
  }
  cout << fixed << setprecision(15) << ans/a << endl;
  ll res;
  if(v[0]!=v[a-1]){
    res=com(mp1[v[a-1]],mp2[v[a-1]]);
  }
  else{
    res=0;
    int t=min(mp1[v[a-1]],(ll)b);
    for(int i=a-1;i<t;i++){
      if(i!=a-1){
        mp2[v[a-1]]++;
      }
      res+=com(mp1[v[a-1]],mp2[v[a-1]]);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        sc.close();
        long money = 100;
        int cnt = 0;
        while (money < x) {
            cnt++;
            money = money + (long) Math.floor(money * 0.01);
        }
        System.out.println(cnt);   
    }
}

Measured memory_bytes: 27124
import sys
sys.setrecursionlimit(10**9)

N= int(input())

G = [[] for i in range(N)]

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

ans = [0]*(N-1)

def func(prt, col):
    cnt = 1
    for cld, org in G[prt]:
        if cnt==col:
            cnt += 1
        ans[org] = cnt
        func(cld, cnt)
        cnt += 1

func(0, 0)

print(max(ans))
for i in range(N-1):
    print(ans[i])

Measured memory_bytes: 71008
package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		in := stdin.Text()
		out, _ := do(in)
		fmt.Println(out)
	}
}

func do(in string) (string, error) {
	s := strings.Split(in, " ")
	n0, err := strconv.Atoi(s[0])
	if err != nil {
		return "", err
	}
	n1, err := strconv.Atoi(s[1])
	if err != nil {
		return "", err
	}

	if n0%2 == 0 {
		return "Even", nil
	}

	if n1%2 == 0 {
		return "Even", nil
	}
	return "Odd", nil
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 60);

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n,y,m,d,ans;
   cin>>n;
   int sum[2];
   sum[0]=195;
   sum[1]=200;
   while(n--)
 {
   cin>>y>>m>>d;
   ans=0;
   for(int i=y+1;i<=999;i++)
   {
    if(i%3==0)    ans+=sum[1];
    else
     ans+=sum[0];
   }
   if(y%3==0) 
   {
     ans+=(10-m)*20;
     ans+=20-d;
   }
   else
   {
     for(int i=m+1;i<=10;i++)
     {
      if(i%2!=0) ans+=20;
      else
      ans+=19;
     } 
     if(m%2!=0) ans+=20-d;
     else
      ans+=19-d;
   }
   cout<<ans+1<<endl;
  }
  return 0;
}
   

Measured memory_bytes: 0
import collections
n, k, q = map(int,input().split())
a=[]
for i in range(q):
    a.append(int(input()))

c = collections.Counter(a)

sa = k-q

for i in range(n):
    if sa+c[i+1]>0:
        print("Yes")
    else:
        print("No")

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

#define INF 1e9
using namespace std;

#define REPR(i, n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

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

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

typedef long long ll;

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


int main() {
    ll N, H;
    cin >> N >> H;
    vector<ll> nageAtks(N), a(N);
    REP(i, N) cin >> a[i] >> nageAtks[i];
    ll maxHuruAtk = *max_element(ALL(a));
    ll count = 0;
    sort(ALL(nageAtks));
    reverse(ALL(nageAtks));
    REP(i, N) {
        if (nageAtks[i] > maxHuruAtk) {
            H -= nageAtks[i];
            count++;
            if (H <= 0) break;
        }
    }
    if (H > 0) {
        count += (H + maxHuruAtk - 1) / maxHuruAtk;
    }

    cout << count << endl;

    return 0;
}


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

int main() {
    int n, a, b, c[105], ans = 0, sum;
    cin >> n >> a >> b >> sum;
    for(int i=0;i<n;i++){
        cin >> c[i];
    }
    sort(c,c+n);
    reverse(c,c+n);
    for(int i=0;i<n;i++){
        sum += c[i];
        ans = max(ans, sum/(a+b*(i+1)));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ll long long
#define pb push_back
#define F first
#define S second
#define ld long double
#define rep(i,n) for (int i =0;i < (n); ++i)
#define vi vector<ll>
#define all(v) (v).begin(),(v).end()
const int inf = 1e9 + 10;

void solve() {
	string s, t;
	cin >> s >> t;

	ll n = s.size();
	bool ok = true;
	for (ll i = 0; i < n; i++) {
		if (s[i] != t[i]) ok = false;
		//cout << s[i] << t[i];
	}

	if (ok) cout << "Yes";
	else cout << "No";
}

int main() {

	FASTIO;



	int t = 1;

	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>

typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main()
{
   int l,sum=0;

   char n[200000];
   scanf("%s", n);
l=strlen(n);
l--;
while (l>=0)
{
  sum+=n[l]-'0';
  l--;
}
if (sum%9==0)
{
 printf("Yes");
}
else
{
   printf("No");

}


   return 0;
}


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

int main(){
  int n,d;
  cin >> n >> d;
  int ans=0;
  int64_t p,q,z,D;
  D=(int64_t)d*d;
  for(int i=0;i<n;i++){
    cin >> p >> q;
    /*if(p<0)
      p=(-1)*p;
    if(q<0)
      q=(-1)*q;*/
    z=p*p+q*q;
    //cout << z << endl;
    if(z<=D)
      ans++;
  }
  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 3596
if __name__ == "__main__":
    H, W, D = list(map(int, (input().split(' '))))
    A = []
    for i in range(H):
        A.append(list(map(int, (input().split(' ')))))
    Q = int(input())
    LR = []
    for i in range(Q):
        LR.append(list(map(int, (input().split(' ')))))

#    def check_val(H, W, A, target):
#        for i in range(H):
#            for j in range(W):
#                if target == A[i][j]:
#                    x = i
#                    y = j
#                    return x, y
#        return -1, -1

#    check_list = []
#    for i in range(Q):
#        stat_LR = LR[i]
#        for j in range(stat_LR[0], stat_LR[1]+D, D):
#            check_list.append(j)
#    check_list = list(set(check_list))

#    buf = H * W
    dict_buf = {}
#    for i in check_list:
#        x, y = check_val(H, W, A, i)
#        if x != -1 and y != -1:
#            dict_buf[str(i)] = [x, y]
    for i in range(H):
        for j in range(W):
            dict_buf[str(A[i][j])] = [i, j]

    d = {}
    for i in range(1, D+1):
        d[str(i)] = 0
    for i in range(D+1, H*W+1):
        d[str(i)] = d[str(i-D)] + \
                    abs(dict_buf[str(i)][0] - dict_buf[str(i-D)][0]) + \
                    abs(dict_buf[str(i)][1] - dict_buf[str(i-D)][1])

    for i in range(Q):
#        mp = 0
#        stat_LR = LR[i]
#        if stat_LR[0] == stat_LR[1]:
#            print(mp)
#            continue
#        stat_x, stat_y = dict_buf[str(stat_LR[0])]
#        next = stat_LR[0]
#        while next != stat_LR[1]:
#            next += D
#            x, y = dict_buf[str(next)]
#            mp += abs(x - stat_x) + abs(y - stat_y)
#            stat_x = x
#            stat_y = y
#        print(mp)
        print(d[str(LR[i][1])] - d[str(LR[i][0])])

Measured memory_bytes: 68192
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){
  
  int n,i,a,b,m,h,w,k;
  scanf("%d %d %d",&n,&a,&b);
  int p[n];
  m=0;
  h=0;
  w=0;
  
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
    if(p[i]<=a)
      m=m+1;
    else if(p[i]>b)
      w=w+1;
    else 
      h=h+1;
  }
  
  if(m<=h && m<=w)
    k=m;
  else if(h<=m && h<=w)
    k=h;
  else k=w;
  
  printf("%d",k);
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> a(n), b(m);
    string ans = "No";
    for(auto& e : a) cin >> e;
    for(auto& e : b) cin >> e;
    for(int i = 0; i < n - m + 1; i++){
        for(int j = 0; j < n - m + 1; j++){
            bool flag = true;
            for(int k = 0; k < m; k++){
                for(int l = 0; l < m; l++){
                    if(a[i+k][j+l] != b[k][l]){
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                ans = "Yes";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

ll gcd(ll a, ll b){
    ll r;
    while(r=a%b){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    ll A,B;
    cin >> A >> B;
    ll val = gcd(A,B);
    ll ans = 1;
    ll tmp = val;
    ll end = ceil(sqrt(val));
    for(ll i=2;i<=1000000;i++){
        if(tmp%i==0){
            ans++;
            tmp/=i;
            while(tmp%i==0){
                tmp/=i;
            }
        }
    }
    if(tmp>1){
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, h[200009], k;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    sort(h, h + n);
    long long ans = 0;
    for (int i = 0; i < n - k; i++) {
        ans += h[i];
    }
    cout << ans << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 1024
// Aizu Vol-1 0160: Delivery Fee
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int t[] = { 600, 800, 1000, 1200, 1400, 1600 };

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

int main()
{
	int i, n, s, w, fee, k1, k2;
	
	while (1) {
		gets(p = buf);
		if (!(n = getInt())) break;
		for (i = 0, fee = 0; i < n; i++) {
			gets(p = buf);
			s = getInt() + getInt() + getInt(), w = getInt();
			if (s <= 160 && w <= 25) {
				if (s <= 60) k1 = 0;
				else k1 = (s - 61) / 20 + 1;
				if (w <= 2) k2 = 0;
				else k2 = (w - 1) / 5 + 1;
				if (k1 < k2) k1 = k2;
				fee += t[k1];
			}
		}
		printf("%d\n", fee);
	}
	return 0;
}

Measured memory_bytes: 524
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
struct edge{int to,fee,cost;};
struct state{
  int cost,pos,cash;
  bool operator < (const state &s)const{
    return cost>s.cost;
  }
};

#define MAX_V 100
#define INF (1<<24)
vector<edge> G[MAX_V];
int V,E,L;

void init();
int dijkstra(int,int);

int main(){
  int a,b,c,d;
  while(1){
    cin>>V>>E>>L;
    if(V==0&&E==0&&L==0)break;
    init();
    for(int i=0;i<E;i++){
      cin>>a>>b>>c>>d;
      a--;b--;
      G[a].push_back( (edge){b,c,d} );
      G[b].push_back( (edge){a,c,d} );
    }
    cout<<dijkstra(0,V-1)<<endl;
  }
  return 0;
}

int dijkstra(int si,int ti){
  int d[MAX_V][200];
  fill(d[0],d[0]+MAX_V*200,INF);
  d[si][L]=0;
  priority_queue<state> Q;
  Q.push( (state){0,si,L} );

  while(!Q.empty()){
    state now=Q.top();Q.pop();
    for(int i=0;i<(int)G[now.pos].size();i++){
      edge e=G[now.pos][i];
      if(now.cost+e.cost < d[e.to][now.cash]){
	d[e.to][now.cash]=now.cost+e.cost;
	Q.push( (state){now.cost+e.cost,e.to,now.cash} );
      }
      if(now.cash-e.fee<0)continue;
      int ncash=now.cash-e.fee;
      if(now.cost < d[e.to][ncash]){
	d[e.to][ncash]=now.cost;
	Q.push( (state){now.cost,e.to,ncash} );
      }
    }
  }

  int res=INF;
  for(int i=0;i<200;i++)
    res=min(res,d[ti][i]);
  return res;
}

void init(){
  for(int i=0;i<MAX_V;i++)G[i].clear();
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int main()
{
	int n, k;
	LL ans = 0LL;
	scanf("%d%d", &n, &k);
	rep1(b, n) {
		if(b <= k) continue;
		if(k == 0) ans += n;
		else ans += n / b * (b - k) + max(n % b - k + 1, 0);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int C[30];

int main(){
  ll N,now=1;
  cin>>N;
  while(now*(now+1)/2<N){
    now++;
  }
  while(N!=0){
    if(now*(now+1)/2>=N && (now-1)*now/2<N){
      cout<<now<<endl;
      N-=now;
    }
    now--; 
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000000000000000
#define ll long long int
//ll a[2000100];
//ll number[20],used[20];
int main()
{
   ll  a,sum;
   cin>> a;
   sum=a+a*a+a*a*a;
   cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
#define MOD 1000000007
int main()
{
    int h,w; cin>>h>>w;
    char a[10001][10001];
    for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin>>a[i][j];
    long long int dp[1001][1001]={0}; dp[0][0]=1;
    for(int i=1;i<w;i++)
    {
        if(a[0][i]=='#') break;
        else dp[0][i]=1;
    }
    for(int i=1;i<h;i++)
    {
        if(a[i][0]=='#') break;
        else dp[i][0]=1;
    }
    for(int r=1;r<h;r++)
    {
        for(int c=1;c<w;c++)
        {
            if(a[r][c]=='#') dp[r][c]=0;
            else dp[r][c] = (dp[r-1][c]+dp[r][c-1])%MOD;
        }
    }
    
    cout<<dp[h-1][w-1]<<endl;
    
}





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

int main() {
    int p1, p2, p3, j1, j2; cin >> p1 >> p2 >> p3 >> j1 >> j2;
    const int p_min = min({p1, p2, p3});  // C++14
    const int j_min = min(j1, j2);
    cout << p_min + j_min - 50 << endl;
}


Measured memory_bytes: 3088
using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		var line0 = Console.ReadLine().Split(new char[]{' '}).Select(c => Int32.Parse(c)).ToArray();
		var x = line0[0];
		var y = line0[1];
		var found = false;
		for(var i = 0; i <= x; i++)
		{
			if (!found)
			{
				var abc = 2 * i + 4 * (x - i);
				if (y == abc)
				{
					found = true;
					Console.WriteLine("Yes");
				}
			}
		}
		if (!found)
		{
			Console.WriteLine("No");
		}
	}
}


Measured memory_bytes: 19112
function main()
    N = parse(Int, readline())
    L = parse.(Int, split(readline()))
    ans = 0
    for i in 1:N-2
        for j in i+1:N-1
            for k in j+1:N
                if L[i] != L[j] && L[j] != L[k] && L[i] != L[k]
                    if L[i] +L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]
                        ans += 1
                    end
                end
            end
        end
    end
    println(ans) 
end

main()

Measured memory_bytes: 173116
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] base = getCharCount(sc.next());
		for (int i = 1; i < n; i++) {
		    base = mearge(base, getCharCount(sc.next()));
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < 26; i++) {
		    for (int j = 0; j < base[i]; j++) {
		        sb.append((char)(i + 'a'));
		    }
		}
		System.out.println(sb);
	}
	
	static int[] mearge(int[] arr1, int[] arr2) {
	    for (int i = 0; i < arr1.length; i++) {
	        arr1[i] = Math.min(arr1[i], arr2[i]);
	    }
	    return arr1;
	}
	
	static int[] getCharCount(String s) {
	    char[] arr = s.toCharArray();
	    int[] ans = new int[26];
	    for (char c : arr) {
	        ans[c - 'a']++;
	    }
	    return ans;
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(int a, int b) {
	return a > b;
}

int main() {
	llint n, k;
	cin >> n >> k;
	vector<llint>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	llint tmp;
	llint min = 500000010;
	llint x, y;
	rep(i, n - k + 1) {
		tmp = 0;
		x = a[i];
		y = a[i + k - 1];
		if (x < 0 && y < 0) {
			tmp = abs(x);
		}
		else if (x > 0 && y > 0) {
			tmp = abs(y);
		}
		else {
			tmp = abs(x) + abs(y);
			if (abs(x) < abs(y)) {
				tmp += abs(x);
			}
			else {
				tmp += abs(y);
			}
		}
		if (tmp < min) {
			min = tmp;
		}
	}
	cout << min << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
  int s,i,j,N,a[100],b[100],count=0;
  scanf("%d",&N);
  for(i=0;i<N;i++){
     scanf("%d ",&a[i]); scanf("%d",&b[i]);
  }
  for(j=2;j<N;j++){
    if(a[j-2]==b[j-2]&&a[j-1]==b[j-1]&&a[j]==b[j])
      count=1;
  }
  if(count)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;

}
     
  

Measured memory_bytes: 2072
from sys import stdin
from itertools import repeat
def main():
    h, w, n = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = [[] for i in xrange(w)]
    for i in xrange(n):
        x, y = dat[i*2], dat[i*2+1]
        a[y-1].append(x-1)
    ans = 0
    for i in xrange(1, w):
        b = []
        l = 0
        for x in sorted(a[i]):
            if l < x:
                b.append((l, x))
            l = x + 1
        if l < h:
            b.append((l, h))
        a[i] = b
    q = []
    if not a[0]:
        q.append((0, h))
    else:
        a[0].sort()
        q.append((0, a[0][0]))
    ans = q[0][1]
    for i in xrange(1, w):
        j = 0
        nq = []
        for l, r in a[i]:
            while j < len(q) and q[j][1] <= l:
                if ans > q[j][1]:
                    ans = q[j][1]
                j += 1
            if j < len(q):
                x = q[j][0] + 1
                if x < q[j][1] and x < r:
                    nq.append((max(x, l), r))
        while j < len(q):
            if ans > q[j][1]:
                ans = q[j][1]
            j += 1
        q = nq
    for l, r in q:
        if ans > r:
            ans = r
    print ans
main()


Measured memory_bytes: 78024
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>A>>B>>C;
    cout<<(C >= A && C <= B ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())

ans = 0
if X == 3:
    ans += 100000
if Y == 3:
    ans += 100000
if X == 2:
    ans += 200000
if Y == 2:
    ans += 200000
if X == 1:
    ans += 300000
if Y == 1:
    ans += 300000
if X == 1 and Y == 1:
    ans += 400000

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
lli root(vlli &arr ,lli i)
{
    while(arr[ i ] != i)
    {
        arr[ i ] = arr[ arr[ i ] ] ; 
		i = arr[ i ]; 
    }
	return i;
}
void weightedunion(vlli &arr,vlli &size,lli A,lli B)
{
    lli root_A = root(arr,A);
    lli root_B = root(arr,B);
    if(size[root_A] < size[root_B ])
    {
		arr[ root_A ] = arr[root_B];
		size[root_B] += size[root_A];
	}
    else
    {
		arr[ root_B ] = arr[root_A];
		size[root_A] += size[root_B];
	}
}
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    lli n,m;cin>>n>>m;
    vlli arr(n+1);
    flli(i,1,n)arr[i]=i;
    vlli size(n+1,1);
    while(m--)
    {
    	lli t1,t2;cin>>t1>>t2;
    	if(root(arr,t1)==root(arr,t2))continue;
    	weightedunion(arr,size,t1,t2);
    }
    lli ans=0;
    flli(i,1,n)
    {
    	ans=max(ans,size[i]);
    }
    cout<<ans;
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 6364
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<int> Zalgo(const string &S) {
    int N = (int)S.size();
    vector<int> res(N);
    res[0] = N;
    int i = 1, j = 0;
    while (i < N) {
        while (i+j < N && S[j] == S[i+j]) ++j;
        res[i] = j;
        if (j == 0) {++i; continue;}
        int k = 1;
        while (i+k < N && k+res[k] < j) res[i+k] = res[k], ++k;
        i += k, j -= k;
    }
    return res;
}



int main() { 
    int N;
    string S;
    cin >> N >> S;

    int res = 0;
    for (int i = 0; i < N; ++i) {
        string T = S.substr(i);
        auto lcp = Zalgo(T);

        for (int j = 0; j < T.size(); ++j) {
            int l = min(lcp[j], j);
            res = max(res, l);
        }
    }
        
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

int aa[1000000],bb[1000000],cc[1000000];
 
void t(){
  aa[0]=aa[1]=1;
  bb[0]=bb[1]=1;
  cc[1]=1;
  repi(i,2,1000000){
    aa[i]=aa[i-1]*i%MOD;
    cc[i]=MOD-cc[MOD%i]*(MOD/i)%MOD;
    bb[i]=bb[i-1]*cc[i]%MOD;
  }
}
 
int calc(int n,int k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return aa[n]*(bb[k]*bb[n-k]%MOD)%MOD;
}
 


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  t();
  int x,y;
  cin>>x>>y;
  if((x+y)%3 != 0) cout<<0<<endl;
  else{
    int num=x+y;
    num/=3;
    //cout<<num<<endl;
    cout<<calc(num,(num*2)-x)<<endl;
  }

  return 0;
}


Measured memory_bytes: 23808
N,K = map(int,input().split())
sumA = 0
lastA = 0
lastsumA = 0
A = []
i = 0
for a in list(map(int,input().split())):
  A.append(a)
  i += 1
  sumA += a
  if i > K:
    sumA -= A[i - K - 1]
    if sumA > lastsumA:
      print('Yes')
    else:
      print('No')
  lastsumA = sumA
  

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

int main() {
	int m,n,i,j,k,x,y,mx,my,sx,sy,pc[100][100],p[4][50][50];
	while(cin >> n >> m && m!=0) {
		mx=my=999;
		for (i=0;i<n;i++) for (j=0;j<n;j++) cin >> pc[i][j];
		for (i=0;i<m;i++) for (j=0;j<m;j++) cin >> p[0][i][j];
		for (k=1;k<4;k++) for (i=0;i<m;i++) for (j=0;j<m;j++) p[k][j][m-i-1]=p[k-1][i][j];
		for (k=0;k<4;k++) {
			for (y=0;y<=n-m;y++) {
				if (y>my) break;
			  for (x=0;x<=n-m;x++) {
				   sx=sy=999;
				for (i=0;i<m;i++) for (j=0;j<m;j++) {
					if (p[k][i][j]>-1 && pc[y+i][x+j]!=p[k][i][j]) { i=j=999; }
					    else if (sx==999 && pc[y+i][x+j]==p[k][i][j]) { sx=x+j; sy=y+i;}
				   }
				if (j<999) {
					if (sy==my && mx>sx) mx=sx;
					if (sy<my) { my=sy; mx=sx;}
					x=y=999;
				}
			}
		}
	}	
	if (mx<999) cout << mx+1 << ' ' << my+1 << endl; else cout << "NA" << endl;
  }
	return 0;
}

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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
   string N; cin >> N;
   int K; cin >> K;
   vector<char> D(K);
   rep(i,K) cin >> D[i];

   while(true){
      bool ok = true;
      rep(i,N.size()){
         rep(j,K){
            if(N[i] == D[j]) ok = false;
         }
      }
      if(ok) break;
      else{
         int i = stoi(N);
         i++;
         N = to_string(i);
      }
   }
   cout << N << endl;

}



Measured memory_bytes: 256
#include<cstdio>
#define Z int
#define C char
#define L long long
#define S(s) scanf("%s",s+1)
#define P(n) printf("%lld",(n+p)%p)
#define F(i,a,b) for(L i=a;i<=b;i++)
#define D(i,a,b) for(L i=a;i>=b;i--)
#define W while
#define I if
#define R return
#define nx 100001
#define p (L)(1e9+7)
C s[nx];
L n,g,a[nx],pre[nx],nxt[nx][3],f[nx],ans;
Z main(){
	S(s);
	W(s[n+1])n++;
	F(i,1,n)pre[i]=pre[i-1]+(a[i]=s[i]-'`');
	F(i,1,n-1)I(a[i]==a[i+1])g=1;
	I(!g){P(1);R 0;}
	D(i,n-1,0)F(o,1,2)nxt[i][(pre[i]+o)%3]=
	a[i+1]==o?i+1:nxt[i+1][(pre[i]+o)%3];
	f[0]=1;
	F(i,0,n-1)F(o,1,2)(f[nxt[i][(pre[i]+o)%3]]+=f[i])%=p;
	F(i,1,n)I((pre[n]-pre[i])%3==0)(ans+=f[i])%=p;
	P(ans);
}

Measured memory_bytes: 6508
from sys import stdin
# import math
import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = stdin.readline().rstrip().split()[0]

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]

AC = A-C
BC = B-C

abc = AC*BC
if abc>=0:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 21644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

//greatest common divisor
unsigned long  gcd(unsigned long x, unsigned long y){
    if (y == 0){ 
        return x;
    }else if (x > y){
        return gcd(y, x % y);
    }else{
        return gcd(x, y % x);
    }
}



long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}

/*
int struct_ascending_compare(const void *p, const void *q) {
    return ((struct_name*)p)->member_name - ((struct_name*)q)->member_name;
}*/
char s[100100];

int main(void){
    scanf("%s", s);
    char now = s[0];
    int cnt = 1;
    int len = strlen(s);
    for (int i = 0; i < len; i++){
        if (now != s[i]){
            cnt++;
            now = s[i];
        }
    }
    printf("%d\n", cnt-1);
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}

void solution() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int time = (h2 - h1) * 60;
  time += (m2 - m1);
  cout << max(0LL, time - k) << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  solution();
}


Measured memory_bytes: 3648
N = int(input())

S = input()

def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

li = []

for s in S:
    num = alpha2num(s)
    num += N
    num %= 26
    if num==0:
        num = 26
    ap = num2alpha(num)
    li.append(ap)


print("".join(li))

Measured memory_bytes: 73924
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if( abs(c-a) <= d || ( abs(c-b) <= d && abs(a-b) <= d ) ){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    ll x, y;
    cin >> x >> y;

    if (x%y == 0) {
        cout << -1 << endl;
    }
    else {
        cout << x << endl;
    }
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> l;
  int p6=1,p9=1;
  for(int i=1;i<8;i++){
      p6 *= 6;
      p9 *= 9;
      l.push_back(p6);
      l.push_back(p9);
  }
  vector<int> dp;
  for(int i=0;i<n+1;i++){
    dp.push_back(i);
  }
  for(int i=0;i<l.size();i++){
    int x = l[i];
    if(x>n){
      continue;
    }
    for(int j=0;j<n-x+1;j++){
      dp[j+x] = min(dp[j+x], dp[j]+1);
    }
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    char bother;
    int ans1 = 0, ans2 = 0;
    while(cin >> a >> bother >> b >> bother >> c)
    {
        if(a * a + b * b == c * c) ans1++;
        if(a == b) ans2++;
    }
    cout << ans1 << "\n" << ans2 << endl;
    return 0;
}




Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    int ans1=0,ans2=0;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i%2==0 && s[i]=='0'){
            ans1++;
        }
        if(i%2==1 && s[i]=='1'){
            ans1++;
        }
    }
    for(int i=0;i<s.size();i++){
        if(i%2==1 && s[i]=='0'){
            ans2++;
        }
        if(i%2==0 && s[i]=='1'){
            ans2++;
        }
    }
    cout<<min(ans1,ans2)<<endl;
    return(0);
}


Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
int main(){
  int n,m;
  cin>>n;
  int p[n];
  rep(i,n)cin>>p[i];
  m=0;
  rep(i,n){
    if(p[i]!=i+1)m++;
  }
  if(m<=2) cout<<"YES"<<endl;
  else cout <<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  long long N;
  cin>>N;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin>>A.at(i);
  }
  long long dp[200010][3];
  if(N%2==1){
    for(long long i=0;i<N;i++){
      if(i==0){dp[i][1]=A.at(0);}
      else if(i==1){dp[i][1]=max(A.at(0),A.at(1));}
      else{
        if(i%2==0){
          dp[i][0]=max(dp[i-2][0]+A.at(i),dp[i-1][1]);
          dp[i][1]=dp[i-2][1]+A.at(i);
        }
        else{
          dp[i][0]=max(dp[i-2][0]+A.at(i),dp[i-1][0]);
          dp[i][1]=max(dp[i-2][1]+A.at(i),dp[i-1][1]);
        }
      }
    }
    cout<<dp[N-1][0]<<endl;
  }
  else{
    for(int i=0;i<N;i++){
      if(i==0){dp[i][1]=A.at(0);}
      else if(i==1){dp[i][0]=max(A.at(0),A.at(1));}
      else{
        if(i%2==0){
          dp[i][0]=max(dp[i-2][0]+A.at(i),dp[i-1][0]);
          dp[i][1]=dp[i-2][1]+A.at(i);
        }
        else{
          dp[i][0]=max(dp[i-2][0]+A.at(i),dp[i-1][1]);
        }
      }
    }
    cout<<dp[N-1][0]<<endl;
  }
}

Measured memory_bytes: 9580
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,a;
    cin>>n;
    int arr[200001]={};
    while(cin>>a)
        arr[a]++;
    for(int i=1;i<=n;i++)
        cout<<arr[i]<<endl;
}


Measured memory_bytes: 5196
#include<stdio.h>
#include<math.h>

double xx(double x1,double y1,double x2,double y2,double x3,double y3){
    
    double bunsi,bunbo;
    bunsi = (x1*x1-x3*x3)*(y1-y2) - (x1*x1-x2*x2)*(y1-y3) - (y2-y3)*(y1-y2)*(y1-y3);
    bunbo = 2*( (x2-x1)*(y1-y3)+(x1-x3)*(y1-y2) );
    return bunsi/bunbo;
}

int main(){
    
    int n;
    double x1,x2,x3,y1,y2,y3;
    
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double x = xx(x1,y1,x2,y2,x3,y3);
        double y;
        if(y1-y2 != 0) y = (x2-x1)/(y1-y2)*(x-(x1+x2)/2)+(y1+y2)/2;
        else y = (x3-x1)/(y1-y3)*(x-(x1+x3)/2)+(y1+y3)/2;
        double r = sqrt( (x-x1)*(x-x1)+(y-y1)*(y-y1));
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
    
    return(0);
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = 1e9;

struct UnionFind {
    vector< int > data;

    UnionFind(int sz) {
        data.assign(sz, -1);
    }

    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if(x == y) return (false);
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return (true);
    }

    int find(int k) {
        if(data[k] < 0) return (k);
        return (data[k] = find(data[k]));
    }

    int size(int k) {
        return (-data[find(k)]);
    }
};


int main() {
    int N, K, C;
    cin >> N >> K >> C;
    vector<int> input;
    {
        string S;
        cin >> S;
        for (int i = 0; i < N; i++) if (S[i] == 'o') input.push_back(i);
    }
    int base = input[0];
    vector<int> left, right;
    left.push_back(base);
    for (auto temp : input) {
        if (base + C < temp) {
            base = temp;
            left.push_back(base);
        }
    }
    reverse(input.begin(), input.end());
    base = input[0];
    right.push_back(base);
    for (auto temp : input) {
        if (base - C > temp) {
            base = temp;
            right.push_back(base);
        }
    }
    reverse(right.begin(), right.end());
    set<int> ans;
    for (int i = 0; i < K; i++) if (left[i] == right[i]) ans.insert(left[i]);
    if (left.size() != K) return 0;
    for (auto temp : ans) {
        cout << temp + 1 << endl;
    }
}


Measured memory_bytes: 13236
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int M = sc.nextInt();
        int a[] = new int[A];
        int b[] = new int[B];
        int c[][] = new int[M][3];
        int a_min = Integer.MAX_VALUE;
        int b_min = Integer.MAX_VALUE;
        for (int i = 0; i < A; i++) {
            a[i] = sc.nextInt();
            a_min = a_min > a[i] ? a[i] : a_min;
        }
        for (int i = 0; i < B; i++) {
            b[i] = sc.nextInt();
            b_min = b_min > b[i] ? b[i] : b_min;
        }
        for (int i = 0; i < M; i++) {
            c[i][0] = sc.nextInt();
            c[i][1] = sc.nextInt();
            c[i][2] = sc.nextInt();
        }
        sc.close();

        int min = a[c[0][0] - 1] + b[c[0][1] - 1] - c[0][2];
        for (int i = 1; i < M; i++) {
            if (min > (a[c[i][0] - 1] + b[c[i][1] - 1] - c[i][2])) {
                min = a[c[i][0] - 1] + b[c[i][1] - 1] - c[i][2];
            }
        }

        if (min > a_min + b_min) {
            System.out.print(a_min + b_min);
        } else {
            System.out.print(min);
        }
    }
}

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

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

mod util {
    #[allow(dead_code)]
    pub fn chmin<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x > y && {
            *x = y;
            true
        }
    }

    #[allow(dead_code)]
    pub fn chmax<T>(x: &mut T, y: T) -> bool
    where
        T: PartialOrd + Copy,
    {
        *x < y && {
            *x = y;
            true
        }
    }

    /// 整数除算切り上げ
    #[allow(dead_code)]
    pub fn roundup(a: i64, b: i64) -> i64 {
        (a + b - 1) / b
    }

    #[allow(dead_code)]
    pub fn ctoi(c: char) -> i64 {
        c as i64 - 48
    }
}

#[allow(unused_imports)]
use util::*;

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        s:String
    }
    let mut ans = 0;
    if s == "SUN" {
        ans = 7;
    } else if s == "MON" {
        ans = 6;
    } else if s == "TUE" {
        ans = 5;
    } else if s == "WED" {
        ans = 4;
    } else if s == "THU" {
        ans = 3;
    } else if s == "FRI" {
        ans = 2;
    } else {
        ans = 1;
    }
    println!("{}", ans);
}


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

namespace AtCoder
{
	public class Program
	{

		static void Main(string[] args)
		{
			int[] vs = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
			int A = vs[0];
			int B = vs[1];
			int T = vs[2];
			Console.WriteLine(T / A * B);
		}
	}
}


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(10) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define pint pair<lli,lli>
#define Lower(v,X) lower_bound(v.begin(),v.end(),X)-v.begin();
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> H >> W;
  Vec(P,string,H,"");rep(i,0,H)cin >> P[i];
  DV(Q1,lli,H,W,0);DV(Q2,lli,H,W,0);DV(Q3,lli,H,W,0);DV(Q4,lli,H,W,0);
  rep(i,0,H)rep(j,0,W){
    if(P[i][j]=='#')Q1[i][j]=0;
    else if(i==0)Q1[i][j]=1;
    else Q1[i][j]=Q1[i-1][j]+1;
    }
  rrep(i,H,0)rep(j,0,W){
    if(P[i][j]=='#')Q2[i][j]=0;
    else if(i==H-1)Q2[i][j]=1;
    else Q2[i][j]=Q2[i+1][j]+1;
    }
  rep(i,0,H)rep(j,0,W){
    if(P[i][j]=='#')Q3[i][j]=0;
    else if(j==0)Q3[i][j]=1;
    else Q3[i][j]=Q3[i][j-1]+1;
    }
  rep(i,0,H)rrep(j,W,0){
    if(P[i][j]=='#')Q4[i][j]=0;
    else if(j==W-1)Q4[i][j]=1;
    else Q4[i][j]=Q4[i][j+1]+1;
    }
  rep(i,0,H)rep(j,0,W)chmax(sum,Q1[i][j]+Q2[i][j]+Q3[i][j]+Q4[i][j]-3);
  Out(sum);
}

Measured memory_bytes: 129664