akhauriyash/Code-Regression huggingface dataset:
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    int n, m, d;
    std::cin >> n >> m >> d;
    double ans = 1.0;
    ans *= (n - d);
    if(d != 0) ans *= 2;
    ans /= n;
    ans /= n;
    ans *= (m - 1);
    std::cout << std::setprecision(12) << ans << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 256
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / math.gcd(n, m))


def coprimize(p, q):
    common = math.gcd(p, q)
    return (p // common, q // common)

mod = 10**9 + 7

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y : x * y % mod, range(n, n - r, -1), 1)
    denom = reduce(lambda x,y : x * y % mod, range(1, r + 1), 1)
    return (numer // denom ) % mod


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n,k = map(int,input().strip().split())
    # sumx=0
    # for i in range(k,n+1):
    #     sumx+=combinations_count(n+1,i)
    #     eprint('combinations_count(n+1,i) ',end=':\n')
    #     eprint(combinations_count(n+1,i))
    # print(sumx)

    ans=0
    for i in range(k,n+2): # kコ選ぶ から n+1コ選ぶ まで
        ans += (i*(n-i+1)+1)
        ans = ans % mod
        # eprint('ans ',end=':\n')
        # eprint(ans)
    
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 78360
#include <stdio.h>

int main(void){
    int a,b,c,i,count=0;
    scanf("%d %d %d",&a,&b,&c);

    if(a<=b &&1<=a,b,c<=10000){
        for(i=1;i<=c;i++){
        if(c%i == 0&&a<=i&&i<=b)
        count++;    
    }    
    
    printf("%d\n",count);
    }
    return 0;
}


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

int main() {
  string S, T;
  cin >> S >> T;
  int cnt = 0;
  for(int i = 0; i < S.size(); i++) {
    if(S.at(i) != T.at(i)) {
      cnt++;
    }
  }
  cout << cnt << endl;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N, M, H, W;
ll mk1[1 << 11][1 << 11], mk2[1 << 11][1 << 11];
ll anss[1 << 11][1 << 11];
ll i, j, k;

int main(){
    scanf("%lld%lld", &N,&M);
    ll nm = max(N, M);
    fornum(i,0,nm){
        ll h, w;
        fornum(h,0,1<<i){
            ll a = 0;
            fornum(w,0,1<<i){
                a ^= anss[h][w];
            }
            fornum(w,0,1<<i){
                ll b = a ^ mk1[h][w + (1 << i) + 1];
                //printf("%lld %lld %lld\n", h,w + (1 << i), anss[h][w + (1 << i)]);
                if(mk1[h+1][w+1]!=b){
                    //printf("%lld %lld\n", mk1[h + 1][w + 1], b);
                    anss[h][w + (1 << i)] = 1;
                }
                a ^= anss[h][w + (1 << i)];
                mk1[h + 1][w + (1 << i) + 1] = mk1[h + 1][w + 1];
                //printf("%lld\n", anss[h][w + (1 << i)]);
            }
        }
        fornum(w,0,1<<i){
            ll a = 0;
            fornum(h,0,1<<i){
                a ^= anss[h][w];
            }
            fornum(h,0,1<<i){
                ll b = a ^ mk1[h + (1 << i) + 1][w];
                if(mk1[h+1][w+1]!=b){
                    anss[h + (1 << i)][w] = 1;
                }
                a ^= anss[h + (1 << i)][w];
                mk1[h + (1 << i) + 1][w + 1] = mk1[h + 1][w + 1];
            }
        }
        fornum(h,0,1<<i){
            ll a = 0;
            fornum(w,0,1<<i){
                a ^= anss[h + (1 << i)][w];
            }
            fornum(w,0,1<<i){
                ll b = a ^ mk1[h + (1 << i)][w + (1 << i) + 1];
                if(mk1[h+1][w+1]==b){
                    anss[h + (1 << i)][w + (1 << i)] = 1;
                }
                a ^= anss[h + (1 << i)][w + (1 << i)];
                mk1[h + (1 << i) + 1][w + (1 << i) + 1] = !mk1[h + 1][w + 1];
            }
        }
    }
    fornum(i,1,1<<N){
        fornum(j,1,1<<M){
            printf("%lld", anss[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 35584
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    while(A > 0 || C > 0){
        C -= B;
        if(C <= 0){
            cout << "Yes";
            return 0;
        }
        A -= D;
        if(A <= 0){
            cout << "No";
            return 0;
        }
    }
}


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

int main(){
    int N;
    vector <int> row;
    cin >> N;
    
    for(int i=0;i<N;i++){
        int temp;
        cin >> temp;
        row.push_back(temp);
    }
   
    for(int i=0;i<N ;i++){
        
        int k = i;
        for(int j=i - 1;j >= 0; j--){
            if(row[j] > row[k]){
                int temp = row[k];
                row[k] = row[j];
                row[j] = temp;
                k = j;
                
            }
        }
        for(int j=0;j<N;j++){
            if(j == N - 1){
                cout << row[j] << endl;
            }else{
                cout << row[j] << " ";
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3160
n = int(input())
info = {}
for i in range(1, n + 1):
    s, p = input().split()
    info[i] = (s, int(p))

ans = list(info.keys())
ans.sort(key=lambda i: info[i][1], reverse=True)
ans.sort(key=lambda i: info[i][0])
for i in ans:
    print(i)


Measured memory_bytes: 8784
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}


void solve(double N, std::vector<double> v){
    SORT(v);
    REP(i, N-1){
        v[i+1]=(v[i]+v[i+1])/2;
    }
    cout<<setprecision(10)<<(v[N-1])<<endl;
}

int main(){
    double N;
    scanf("%lf",&N);
    std::vector<double> v(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lf",&v[i]);
    }
    solve(N, std::move(v));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    
    
    int main() {
     
     int n;
     cin >> n;
     
     int taro = 0;
     int hana = 0;
     
     string t,h;
     rep(i,n){
     	cin >> t >> h;
     	if(t > h){
     		taro += 3;
     	} else if(t < h){
     		hana += 3;
     	} else if(t == h){
     		taro++;
     		hana++;
     	} 
     }
      printf("%d %d\n",taro,hana);
     
     return 0;
    }
    


Measured memory_bytes: 3272
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int A = sc.nextInt();
        
        if (X < A) {
            System.out.println(0);
        }else{
            System.out.println(10);
        }
    }
}


Measured memory_bytes: 35664
#include <stdio.h>

int main()
{
  int W,H,x,y,r;

  scanf("%d %d %d %d %d" , &W , &H , &x , &y , &r );

  if( x + r <= W && x >= r && y + r <= H && y >= r)
    {
      printf("Yes\n");
    }
  else
    {
      printf("No\n");
    }

  return 0;
}


Measured memory_bytes: 2684
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define clr1(arr) memset(arr,-1,sizeof(arr));
#define clr0(arr) memset(arr,0,sizeof(arr));
#define pi pair<int,int>
#define pii pair<int,pi>
#define sortV(v) v.begin(),v.end()
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
/*ncr mod m
const int mod=1000000009;
int c[r+1];
void ncr(int n,int r){c[0]=1;repre(i,1,n)for(int j=min(i,r);j>0;j--)c[j]=((c[j-1]%mod)+(c[j]%mod))%mod;return c[r];}*/
const int maxn=200019;
int n,q;
vector<int>adj[maxn];
int bit[maxn];
int in[maxn];
int out[maxn];
int cnt=0;
void dfs(int v,int par)
{
  in[v]=++cnt;
  for(auto u:adj[v])
  {
    if(u==par)continue;
    dfs(u,v);
  }
  out[v]=cnt;
}
void update(int x,int val)
{
  for(;x<maxn;x+=x&-x)
  {
    bit[x]+=val;
  }
}
int query(int x)
{
  int ans=0;
  for(;x>0;x-=x&-x)ans+=bit[x];
  return ans;
}
int32_t main()
{
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  fastio
  cin>>n>>q;
  repre(i,1,n-1)
  {
    int a,b;
    cin>>a>>b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  dfs(1,0);
  while(q--)
  {
    int p,x;
    cin>>p>>x;
    update(in[p],x);
    update(out[p]+1,(-1)*x);
  }
  repre(i,1,n){
    cout<<query(in[i])<<" ";
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 27392
#include<stdio.h>
#include<string.h>
int main(void)
{
	char str1[101]={0,},str2[101]={0,};
	int i,n,p1=0,p2=0,judge;
    
	scanf("%d", &n);
	for(i=0;i<n;i++){
		scanf("%s %s", &str1,&str2);
		judge=strcmp(str1,str2);
		if(judge>0) p1+=3;
		else if(judge==0) p1++,p2++;
		else p2+=3;

	}
	printf("%d %d\n",p1,p2);
	return 0;   
}

Measured memory_bytes: 604
H = int(input())
W = int(input())
N = int(input())


if H > W:
    if N % H != 0:
        result = N // H + 1
    else:
        result = N // H
else:
    if N % W != 0:
        result = N // W + 1
    else:
        result = N // W
print(result)

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

int main(void) {
	int a, b, c, k; cin >> a >> b >> c >> k;
	int d = max({ a,b,c });

	for (int i = 1; i <= k; i++) {
		d *= 2;
	}

	if (a <= b && c <= b) {
		cout << a+c+d << endl;
	}
	else if (b <= a && c <= a) {
		cout << b+c+d << endl;
	}
	else if (b <= c && a <= c) {
		cout << a+b+d << endl;
	}
	return 0;
}



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

int main() {
  int x;
  cin>>x;
  if (x==7||x==5||x==3) puts("YES");
  else puts("NO");
  return 0;
}


Measured memory_bytes: 256
listS=list(input())

if "N" in listS and "S" in listS:
    if "W" in listS:
        if "E" in listS:
            print("Yes")
        else:
            print("No")
    elif "E" in listS:
        if "W" in listS:
            print("Yes")
        else:
            print("No")
    else:
        print("Yes")

elif "W" in listS and "E" in listS:
    if "N" in listS:
        if "S" in listS:
            print("Yes")
        else:
            print("No")
    elif "S" in listS:
        if "N" in listS:
            print("Yes")
        else:
            print("No")
    else:
        print("Yes")

else:
    print("No")

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

int main(){
  int n,m,c;
  cin >> n >> m >> c;
  int count = 0;
  vector<int> B(m+10);
  vector<int> C(n+10);
  rep(i,m) cin >> B[i];
  rep(i,n){
    vector<int> A(m+10);
    rep(j,m){
      cin >> A[j];
      C[i] += A[j]*B[j];
    }
    if(C[i] > -c) ++count;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
//made by darkfire
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#define FL "a"
using namespace std;
typedef unsigned long long ll;
typedef long double dd;
const int N=5e5+10;
const ll INF=1e18;
inline ll read(){
  ll data=0,w=1;char ch=getchar();
  while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
  if(ch=='-')w=-1,ch=getchar();
  while(ch<='9'&&ch>='0')data=data*10+ch-48,ch=getchar();
  return data*w;
}
inline void file(){
  freopen(FL".in","r",stdin);
  freopen(FL".out","w",stdout);
}

inline void upd(ll &a,ll b){a=a<b?a:b;}
struct edge{int u,v;ll w;}E[N];
inline bool cmp(edge a,edge b){return a.w<b.w;}

int n,q,m;ll ans,f[N];
int fa[N];int find(int x){return fa[x]!=-1?fa[x]=find(fa[x]):x;}

int main()
{
  n=read();q=read();
  memset(fa,-1,sizeof(fa));
  for(int i=0;i<n;i++)f[i]=INF;
  for(int i=1,a,b,c;i<=q;i++){
    a=read();b=read();c=read();
    upd(f[a],c+1);upd(f[b],c+2);E[++m]=(edge){a,b,c};
  }
  for(int pre=n-1,i=0,cnt=0;cnt<=2*n;pre=i,i=(i+1)%n,cnt++)
    upd(f[i],f[pre]+2);
  //for(int i=0;i<n;i++)printf("%d ",f[i]);puts("");
  for(int i=0;i<n;i++)
    if(f[i]!=INF)E[++m]=(edge){i,(i+1)%n,f[i]};
  sort(E+1,E+m+1,cmp);
  for(int i=1,fu,fv;i<=m;i++){
    fu=find(E[i].u);fv=find(E[i].v);
    if(fu!=fv)fa[fu]=fv,ans+=E[i].w;
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 15616
A,B = map(int,input().split())

Acount = 1
Bcount = 1

print(100,100)
for j in range(49):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Acount<A:
            Acount += 1
            OUTPUT += "."
        else: OUTPUT += "#"
    print(OUTPUT)
print("".join(["#" for i in range(100)]))

B_OUTPUT = []
for j in range(49):
    OUTPUT = ""
    for i in range(100):
        if i%2==0 and j%2==0 and Bcount<B:
            Bcount += 1
            OUTPUT += "#"
        else: OUTPUT += "."
    B_OUTPUT.append(OUTPUT)
B_OUTPUT.append("".join(["." for i in range(100)]))

for b in B_OUTPUT[::-1]:
    print(b)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdint.h>
#include <algorithm>
#include <vector>


using namespace std;

int main() {
	int n, k;
	
	cin >> n >> k;
	
	if (k == 1){
		cout << "0" << endl;
	} else if (n <= k) {
		cout << "0" << endl;
	} else {
		cout << n-k << endl;
	}
	


	return 0;
}


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

using namespace std;

int main(){
        string s;
        cin>>s;
        for(int i=0;i<s.length()-1;i++) if (s[i]=='A'&&s[i+1]=='C'){
                cout<<"Yes";
                return 0;
        }
cout<<"No";
}                      

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

void solve() {
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(all(A));
  ll l = -INFLL, r = INFLL;
  // binary search
  while (l + 1 < r) {
    ll x = (l + r) / 2;
    ll tot = 0;
    for (int i = 0; i < N; i++) {
      int il = -1, ir = N;
      if (A[i] < 0) {
        while (il + 1 < ir) {
          int ix = (il + ir) / 2;
          if (A[i] * A[ix] < x) {
            ir = ix;
          } else {
            il = ix;
          }
        }
        tot += N - ir;
      } else {
        while (il + 1 < ir) {
          int ix = (il + ir) / 2;
          if (A[i] * A[ix] < x) {
            il = ix;
          } else {
            ir = ix;
          }
        }
        tot += ir;
      }
      if (A[i] * A[i] < x) tot--;
    }
    tot /= 2;
    if (tot < K) {
      l = x;
    } else {
      r = x;
    }
  }
  cout << l << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // cout << fixed << setprecision(12);

  solve();

  return 0;
}


Measured memory_bytes: 1792
def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def main():
    n,a,b = map(int,input().split())
    if n*a>b:
        print(b)
    else:
        print(n*a)
    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define mp make_pair
const ll mod=1e9+7;
typedef pair<int,int> pii;
typedef priority_queue<int,vector<int>,greater<int> > small_heap;
typedef priority_queue<int> big_heap;
int n;
ll a[10009];
ll mx[1000006];
ll power(ll aa,ll b)
{
    ll c=1;
    for(;b;b>>=1){
        if(b&1)c=c*aa%mod;
        aa=aa*aa%mod;
    }
    return c%mod;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        ll x=a[i];
        for(ll v=2;v*v<=x;v++){
            if(x%v)continue;
            ll cur=0;
            while(x%v==0){
                cur++;
                x/=v;
            }
            mx[v]=max(mx[v],cur);
        }
        if(x!=1)mx[x]=max(mx[x],1ll);
    }
    ll lcm=1;
    for(ll i=1;i<=1000006;i++)
    {
        if(mx[i]) lcm = (lcm * power(i, mx[i])) % mod;
    }
//    log(lcm);

//    for(int i=2;i<=n;i++){
//        ll x=power(a[i]*prelcm,1);
//        ll y=power(__gcd(a[i],prelcm),mod-2);
//        prelcm=x%mod*y%mod;prelcm%=mod;
//    }
    ll sum=0;
    for(int i=1;i<=n;i++){
        sum=(sum+power(lcm,1)%mod*power(a[i],mod-2)%mod)%mod;
    }
    cout<<sum<<endl;
    return 0;
}


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

int main() {
    int l, n;
    char s[101][101], tmp[101];

    scanf("%d %d", &n, &l);
    for (int i = 0; i < n; i++) {
        scanf("%s", s[i]);
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
            if (strcmp(s[j], s[j+1]) >= 0) {
                strcpy(tmp, s[j]);
                strcpy(s[j], s[j+1]);
                strcpy(s[j+1], tmp);
            }
        }
    } 

    for (int i = 0; i < n; i++) {
        printf("%s", s[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
"use strict";
main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	console.log(lines[0].replace(/[A-Za-z]/g, function(c){return c<="Z"?c.toLowerCase():c.toUpperCase()}));
}

Measured memory_bytes: 15696
#include<stdio.h>
 
int main(void)
{
 char a[2];
 scanf("%s",a);
  if(a[0]=='A')
    printf("T");
   if(a[0]=='T')
    printf("A");
   if(a[0]=='C')
    printf("G");
   if(a[0]=='G')
    printf("C");
 return 0;
}

Measured memory_bytes: 128
def resolve():
    import bisect
    n = int(input())
    a = [int(input()) for _ in range(n)]
    m = []
    for i in range(n-1, -1, -1):
        if i == n-1:
            m.append(a[i])
        else:
            if m[-1] <= a[i]:
                m.append(a[i])
            elif m[0] > a[i]:
                m[0] = a[i]
            else:
                j = bisect.bisect_right(m, a[i])
                m[j] = a[i]
    print(len(m))
resolve()

Measured memory_bytes: 55896
#include <iostream>
#include <vector>

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    const int sweet = 1;

    int M, N;
    cin >> M >> N;

    vector<vector<int>> a(M, vector<int>(N));
    for (int i=0; i<M; ++i) {
        for (int j=0; j<N; ++j) {
            cin >> a[i][j];
        }
    }

    int count = 0;
    for (int i=0; i<M; ++i) {
        int j = 0;
        int k = N - 1;
        while (j <= k) {
            if (a[i][j] == sweet) {
                count ++;
                if (j + 1 < N) a[i][j + 1] = 1 - a[i][j + 1];
                if (i + 1 < M) a[i + 1][j] = 1 - a[i + 1][j];
                j ++;
            } else {
                count += a[i][k];
                if (0 <= k - 1) a[i][k - 1] = 1 - a[i][k - 1];
                if (i + 1 < M) a[i + 1][k] = 1 - a[i + 1][k];
                k --;
            }
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1264
import java.util.*;

class Main{
	public static void main(String args[]){
    	Scanner in = new Scanner(System.in);
      
      	String s = in.nextLine();
      
      	if(s.charAt(s.length()-1) == 's'){
          System.out.println(s.substring(0,s.length()) + "es");

        }
        else{
          System.out.println(s+"s");
        }
    }
}

Measured memory_bytes: 38552
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;


public class Main {

	public static final int MAX = 123456 * 2;
	public static final int SQT = (int) Math.ceil(Math.sqrt(MAX));
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final String input = sc.nextLine();
			
			if(".".equals(input)){
				break;
			}
			
			final char[] in_ch = input.toCharArray();
			
			Stack<Character> stack = new Stack<Character>();
			
			boolean flag = true;
			for(char in : in_ch){
				if(in == '(' || in == '['){
					stack.add(in);
				}if(in == ')'){
					if(stack.isEmpty() || stack.pop() != '('){
						flag = false;
						break;
					}
				}else if(in == ']'){
					if(stack.isEmpty() || stack.pop() != '['){
						flag = false;
						break;
					}
				}
			}
			
			flag &= stack.isEmpty();
			
			System.out.println(flag ? "yes" : "no");
		}
	}

}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  int n; cin >> n;
  vector<int> v(n); cin >> v;
  int cnt_p = 0,cnt_z = 0;
  for(auto e:v){
    cnt_p += e > 0;
    cnt_z += e == 0;
  }
  if(cnt_p+cnt_z == n){
    cout << n-1 << endl;
    for(int i = 0; i < n-1; ++i){
      cout << i+1 << ' ' << i+2 << endl;
    }
  }else if(cnt_p == 0){
    cout << n-1 << endl;
    for(int i = n; i > 1; --i){
      cout << i << ' ' << i-1 << endl;
    }
  }else{
    cout << 2*n - 2 << endl;
    int idx = 0;
    for(int i = 0; i < n; ++i){
      if(abs(v[idx]) < abs(v[i]))idx = i;
    }
    for(int i = 0; i < n; ++i){
      if(i == idx)continue;
      cout << idx+1 << ' ' << i+1 << endl;
    }
    if(v[idx] > 0){      
      for(int i = 0; i < n-1; ++i){
	cout << i+1 << ' ' << i+2 << endl;
      }
    }else{
      for(int i = n; i > 1; --i){
	cout << i << ' ' << i-1 << endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3580
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 100100100
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

#define mod 998244353
 
int main(){
    int n; cin >> n;
    string s;
    cin >> s;
    vector<int> l(n), r(n);
    int lsum = 0, rsum = 0;
    rep(i,n){
        l[i] = lsum;
        if(s[i] =='W') lsum++;
    }
    
    for(int i=n-1; i>=0; i--){
        r[i] = rsum;
        if(s[i] =='E') rsum++;
    }
    
    int ans = INF;
    
    rep(i,n){
        ans = min(ans, l[i] + r[i]);
    }
    
    cout << ans << endl;
    
    

}


Measured memory_bytes: 3076
# include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+10;
int a[maxn];
int main()
{
    int n, m, imax = 0;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&m);
        ++a[m], ++a[m+1], ++a[m+2];
    }
    for(int i=0; i<maxn; ++i)
        if(a[i] > imax) imax = a[i];
    printf("%d\n",imax);
    return 0;
}


Measured memory_bytes: 640
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, M;
    scan(N, M);
    if (M <= N)
    {
        writeln(0);
        return;
    }
    auto X = aryread();
    X.sort();
    auto D = new long[](M - 1);
    foreach (i; 0 .. M - 1)
    {
        D[i] = X[i + 1] - X[i];
    }
    D.sort!"b<a"();
    long ans = X[$ - 1] - X[0];
    // writeln(D);
    foreach (i; 0 .. N - 1)
        ans -= D[i];
    writeln(ans);
}


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

bool isprime(int n){
    double rootn = sqrt(n);
    if (n < 2){
        return false;
    }
    else if (n == 2){
        return true;
    }
    else if (n % 2 == 0){
        return false;
    }
    else{
        for(int i = 3; i <= rootn; i += 2){
            if(n % i == 0){
                return false;
            }
        }
        return true;
    }
}


int main(){
    int N, M;
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int Ai;
        cin >> Ai;
        N -= Ai;
    }
    if(N < 0){
        cout << -1 << endl;
    }
    else{
        cout << N << endl;
    }
    return 0;
}

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

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPR(i, a, b) for (int i = (a); i >= (b); i--)
#define ALL(container) (container).begin(), (container).end()

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const int MAX_N = 50;
int x[MAX_N], y[MAX_N];

int main() {
  int N;
  cin >> N;
  set<pi> st;
  REP(i, 0, N) {
    cin >> x[i] >> y[i];
    st.insert(pi(x[i], y[i]));
  }

  int count, costZeroCount = 0;
  REP(i, 0, N) {
    REP(j, 0, N) {
      if (i == j) continue;
      pi diff = pi(x[i] - x[j], y[i] - y[j]);
      count = 0;
      REP(k, 0, N) {
        pi tmp = pi(x[k] + diff.first, y[k] + diff.second);
        if (st.count(tmp)) {
          count++;
        }
      }
      costZeroCount = max(costZeroCount, count);
    }
  }

  cout << N - costZeroCount << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <algorithm>
#include <unordered_map>
#define int                long long
#define pb                 push_back
#define pi                 pair<int,int>
#define vi                 vector<int>
#define all(v)             v.begin(),v.end()
#define modd               1e9+7
#define ff                 first
#define ss                 second
#define FOR(i,r)           for(int i=0;i<r;i++)
#define rep(i,l,r)         for(int i=l;i<r;i++)
#define rer(i,l,r)         for(int i=l;i>=r;i--)
#define print(v)           for(auto i : v)cout << i << ' ';
#define FASTIO             ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mem(arr,k)         memset(arr,k,sizeof(arr));
#define pii                acos(-1.0)
#define PI                 3.1415926535897932385
#define Sin(a)             sin((pi*a)/180)
using namespace std;
int32_t main(){

    int a,b;
    cin >> a >> b;
    cout << a*b/(__gcd(a,b));
    return 0;

}

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

using namespace std;

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

// int gcd( int m, int n )
// {
// 	if ( ( 0 == m ) || ( 0 == n ) )
// 		return 0;
	
// 	while( m != n )
// 	{
// 		if ( m > n ) m = m - n;
// 		else         n = n - m;
// 	}
// 	return m;
// }

int gcd(int x, int y)
{
    int r;

    if(x == 0 || y == 0) 
    {
        return 0;
    }

    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

// int multipleGcd(int a[], int n) {
//   for (int i=0; i<n; i++) {

//   }
// }

int main() {
  int N, tmp, preM, A, preA;
  long long int m = 10000000000;
  // vector<int> A;

  cin >> N;
  cin >> preA;
  preM = preA;

  for (int i=1; i<N; i++) {
    cin >> A;
    m = min(m, gcd(A, preA));
    preA = A;
  }

  cout << m << endl;

}

Measured memory_bytes: 384
# coding: utf-8

if __name__ == '__main__':
    while True:
        n = int(input())
        if n == 0:
            break
        id = 1
        sm = 0
        res = 0
        while True:
            sm += id
            if sm >= n:
                break
            if (n - sm)%(id+1) == 0:
                if (n - sm)//(id+1) > 0:
                    res += 1
            id += 1
        print(res)

Measured memory_bytes: 7576
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VS s(n);
    REP(i,0,n) cin >> s[i];
    map<string, int> m;
    REP(i,0,n) m[s[i]]++;
    int maxn = 0;
    for (auto it = m.begin(); it != m.end(); ++it) chmax(maxn, it->second);
    VS ans;
    for (auto it = m.begin(); it != m.end(); ++it) if (it->second == maxn) ans.push_back(it->first);
    sort(all(ans));
    for (auto &s: ans) cout << s << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 28404
#include <bits/stdc++.h>
using namespace std;
struct edge
{
	int v,p;
}e[100010];
int n,k,a[100010],top,head[100010],cnt;
void addedge(int u,int v)
{
	e[++top]=(edge){v,head[u]};
	head[u]=top;	
}
int dfs(int u,int dep)
{
	int ret=dep;
	for(int i=head[u];i;i=e[i].p)
	{
		ret=max(ret,dfs(e[i].v,dep+1));
	}
	if(a[u]!=1&&ret-dep==k-1)
	{
		cnt++;
		return 0;
	}
	return ret;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",a+i);
	}
	if(a[1]!=1)cnt++;
	a[1]=1;
	for(int i=2;i<=n;i++)
	{
		addedge(a[i],i);
	}
	dfs(1,0);
	cout<<cnt<<endl;
	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s; cin >> s;
    if (s.size() % 2 != 0) {
        cout << "No\n";
        return 0;
    }
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0 && s[i] != 'h') {
            cout << "No\n";
            return 0;
        }
        if (i % 2 == 1 && s[i] != 'i') {
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
const ll INF = 1LL << 60;

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

int n;
vector<int> a, b, c;

void input() {
    cin >> n;
    a = vector<int>(n);
    b = vector<int>(n);
    c = vector<int>(n);
    for(int i = 0; i < n; i++) {
        cin >> a.at(i) >> b.at(i) >> c.at(i);
    }
}

void solve() {
    vector<vector<int>> g(3, vector<int>(n, 0));
    g[0][0] = a[0];
    g[1][0] = b[0];
    g[2][0] = c[0];

    for(int i = 1; i < n; i++) {
        g[0][i] = max(g[1][i-1] + a[i], g[2][i-1] + a[i]);
        g[1][i] = max(g[0][i-1] + b[i], g[2][i-1] + b[i]);
        g[2][i] = max(g[0][i-1] + c[i], g[1][i-1] + c[i]);
    }
    /*
    for(int i = 0; i< 3; i++) {
        for(int j = 0; j < n; j++) {
            cout << g[i][j] << ", ";
        }
        cout << endl;
    }
    */
    cout << max(max(g[0][n-1], g[1][n-1]), g[2][n-1]) << endl;
}



int main() {
    input();
    solve();
}


Measured memory_bytes: 2944
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;


int main(){
    string s;
    string divide[4] = {"dream", "dreamer", "erase", "eraser"};

    cin>>s;

    //各文字列を反転させ、後ろから考える
    reverse(s.begin(), s.end());
    for (int i = 0; i < 4; i++){
        reverse(divide[i].begin(), divide[i].end());
    }

    bool canDivide = false;
    bool ans = true;

    for(int i=0;i<s.size();){
        canDivide = false;
        for (int j = 0; j < 4; j++){
            if(s.substr(i, divide[j].size()) == divide[j]){
                // cout<<"j:"<<j<<", before s:"<<s;
                canDivide = true;
                // cout<<", after s:"<<s<<endl;
                i += divide[j].size();
            }
        }
        if(canDivide==false){
            ans = false;
            break;
        }
    }

    if(ans==true) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}



Measured memory_bytes: 512
n = input()
Ls = list(map(int, input().split()))

count = 0
l_set = set()
for i1 in range(len(Ls)):
    for i2 in range(i1+1,len(Ls)):
        for i3 in range(i2+1, len(Ls)):
            l1 = Ls[i1]
            l2 = Ls[i2]
            l3 = Ls[i3]
            if l1 == l2 or l2 == l3 or l1==l3:
                continue
            max_l = max(l1, l2 ,l3)
            if max_l < l1+l2+l3 - max_l:
                if tuple(sorted([l1, l2, l3])) not in l_set:
                    count += 1
print(count)

Measured memory_bytes: 9212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
using namespace std;
typedef long long unsigned int llui_t;
typedef long long int lli_t;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

/* inputs */
int c[3][3];

int main() {
	for(int i=0; i<3; i++){
        for(int j=0; j<3; j++){
            int x;
            cin >> x;
            c[i][j] = x;
        }
	}

    bool ans = true;
	for(int i=0; i<3; i++){
        for(int j=i+1; j<3; j++){
            if (c[0][i] - c[0][j] != c[1][i] - c[1][j]) ans = false;
            if (c[1][i] - c[1][j] != c[2][i] - c[2][j]) ans = false;
            if (c[i][0] - c[j][0] != c[i][1] - c[j][1]) ans = false;
            if (c[i][1] - c[j][1] != c[i][2] - c[j][2]) ans = false;
        }
    }

	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int a, b; cin >> a >> b;
	cout << 6 - a - b;
}

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

int n, k;
double x[60], y[60], c[60], r[60];
double EPS = 1e-9;

double dist(pair<double, double> p, pair<double, double> q) {
	double xx = (p.first - q.first)*(p.first - q.first);
	double yy = (p.second - q.second)*(p.second - q.second);

	return sqrt(xx + yy);
}

vector<pair<double, double>> circle_circle_intersection(double x1, double y1, double r1, double x2, double y2, double r2) {
	vector<pair<double, double>> ans;
	double d = dist(make_pair(x1, y1), make_pair(x2, y2));
	if (d > r1 + r2) {
		return ans;
	}
	if (x1 == x2 && y1 == y2) {
		ans.emplace_back(x1, y1); return ans;
	}
	if (d < abs(r1 - r2)) {
		ans.emplace_back(x1, y1); return ans;
	}

	double a = (r1*r1 - r2*r2 + d*d)/(2*d);
	double h = sqrt(r1*r1 - a*a);

	//cout << d << ' ' << a << ' ' << h << '\n';

	double x3 = (x2 - x1)*(a/d) + x1;
	double y3 = (y2 - y1)*(a/d) + y1;

	ans.emplace_back(x3 + h*(y2 - y1)/d, y3 - h*(x2 - x1)/d);
	ans.emplace_back(x3 - h*(y2 - y1)/d, y3 + h*(x2 - x1)/d);

	return ans;
}

int check(double t) {
	int ans = 0;
	for (int i = 0; i < n; i++) {
		r[i] = t/c[i];
	}

	for (int i = 0; i < n; i++) {
		int cnt = 0;
		pair<double, double> p(x[i], y[i]);
		for (int k = 0; k < n; k++) {
			if (dist(p, make_pair(x[k], y[k])) <= r[k] ) cnt++;
		}
		ans = max(ans, cnt);
	}
//cout<<ans<<" ";
//ans=0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			vector<pair<double, double>> pts = circle_circle_intersection(x[i], y[i], r[i], x[j], y[j], r[j]);
			for (auto p: pts) {
				int cnt = 0;
				//cout << i << ' ' << j << ' ' << p.first << ' ' << p.second << '\n';
				//cout << x[i] << ' ' << y[i] << ' ' << r[i] << '\n';
				//cout << x[j] << ' ' << y[j] << ' ' << r[j] << '\n';
				for (int k = 0; k < n; k++) {
					if (dist(p, make_pair(x[k], y[k])) <= r[k] + EPS) cnt++;
				}
				ans = max(ans, cnt);
			}
		}
	}
	
	//cout<<ans<<endl;
	return ans;
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//feenableexcept(29);
//freopen("input.txt","r",stdin);
	cin >> n >> k;
	if (k == 1) {
		cout << "0\n"; exit(0);
	}
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> c[i];
	}

	double lo = 0, hi = 100000000;
	while(hi-lo>=1e-7)
	{
		double mid = (lo + hi)/2;

		if (check(mid) >= k) {
			hi = mid;
		} else {
			lo = mid;
		}
		//cout<<check(mid)<<endl;
	}
	cout << fixed << setprecision(9) << hi << '\n'; 

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    int p[n];
    for (int i=0; i<n; i++){
        cin >> p[i];
    }
    int m = p[0];
    int cnt = 0;
    for (int i=0; i<n; i++) {
        if (m >= p[i]) cnt++;
        m = min(m, p[i]);
    }
    cout << cnt << endl;
}

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

using namespace std;

#define mod 1000000007

int n, m, broken[112345], mem[112345];

int count(int atual) {
	if (atual == n) 
		return 1;
	if (atual > n)
		return 0;
		
	if (mem[atual]!=-1)
		return mem[atual];
		
	long long resp = 0;
	if (!broken[atual+1])
		resp += count(atual+1);
	if (!broken[atual+2])
		resp += count(atual+2);
		
	return mem[atual] = resp%mod;
}

int main() {
	int x;
	scanf("%d %d", &n, &m);
	
	while (m--) {
		scanf("%d", &x);
		broken[x] = 1;
	}
	
	memset(mem, -1, sizeof mem);
	
	printf("%d", count(0)%mod);
	return 0;
}

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

int findSumOfDigits(int n)
{
    int sum = 0;
    while(n > 0)
    {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

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

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

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <chrono>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	unsigned long long int n;
	cin >> n;
	unsigned long long int s, t, ans;
	s = n / 11;
	t = n % 11;
	if (t == 0) {
		ans = s * 2;
	}
	else if (t <= 6) {
		ans = s * 2 + 1;
	}
	else {
		ans = s * 2 + 2;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#define MAX 200
int main(void) {
  long A[MAX][MAX ] = {0}, B[MAX][MAX] = {0}, C[MAX][MAX] = {0};
  int n, m, l;
  int i, j, k;

  scanf("%d %d %d", &n, &m, &l);

  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%ld", &A[i][j]);
    }
  }

  for (j = 0; j < m; j++) {
    for (k = 0; k < l; k++) {
      scanf("%ld", &B[j][k]);
    }
  }

  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      for (k = 0; k < l; k++) {
        C[i][k] += A[i][j] * B[j][k];
      }
    }
  }

  for (i = 0; i < n; i++) {
    printf("%ld", C[i][0]);
    for (k = 1; k < l; k++) {
      printf(" %ld", C[i][k]);
    }
    puts("");
  }
  return 0;
}

Measured memory_bytes: 1984
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufRead, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;($($r :tt ) *) =>{let mut s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .expect ("Parse error" ) } ;}
#[allow(unused_macros)]
macro_rules !dbg {($($a :expr ) ,*) =>{writeln !(&mut stderr () ,concat !($(stringify !($a ) ," = {:?}, " ) ,*) ,$($a ) ,*) .unwrap () ;} }
#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        n: u64,
        a: u64,
        b: u64
    }
    let mut ans: u64 = (n / (a + b)) * a;
    let rem = n % (a + b);
    ans += min(rem, a);
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<stdio.h>
int main(){
  int n,m,i,j,a,r[101],p[101]={0};
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++)scanf("%d",&r[i]);
  for(i=0;i<m;i++){
    for(j=0;j<n;j++){scanf("%d",&a);
      if(a==r[i])p[1+j ]++;
      else       p[r[i]]++;
    }
  }
  for(i=0;i<n;i++)printf("%d\n",p[i+1]);
  return 0;
}

Measured memory_bytes: 596
import sys

def intinput():
    return map(int,sys.stdin.readline().split())

n,m=intinput()
a1=0
b1=n+1
for i in range(m):
    a,b=intinput()
    a1 = max(a,a1)
    b1 = min(b,b1)
if b1>=a1:
    print(b1-a1+1)
else:
    print(0)

Measured memory_bytes: 3060