akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define op(i) cout << (i) << endl;
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

ll n, a, b;
ll h[100005];

bool check(ll x)
{
    ll res = 0;
    rep(i, n)
    {
        res += (max(0ll, h[i] - x * b) + (a - b - 1)) / (a - b);
    }
    return (res <= x);
}

int main()
{
    cin >> n >> a >> b;
    rep(i, n) cin >> h[i];
    ll MIN = 0, MAX = infi;
    while (1)
    {
        if (MIN + 1 == MAX)
            break;
        if (check((MIN + MAX) / 2))
        {
            MAX = (MIN + MAX) / 2;
        }
        else
        {
            MIN = (MIN + MAX) / 2;
        }
    }
    cout << MAX << endl;
}


Measured memory_bytes: 1024
// Problem : C - Product and GCD
// Contest : AtCoder - CADDi 2018
// URL : https://atcoder.jp/contests/caddi2018/tasks/caddi2018_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	ll n,p;
	cin>>n>>p;
	map<ll,ll> map;
	ll cpy=p;
	while(cpy%2==0)
		cpy/=2,map[2]++;
	for(ll i=3;i<=sqrt(p);i+=2)
	{
		while(cpy%i==0)
		{
			cpy/=i;
			map[i]++;
		}
	}
	if(cpy!=1)
		map[cpy]++;
	ll ans=1;
	trav(i,map)
	{
		if(i.s>=n)
		{
			for(int j=1;j*n<=i.s;j++)
				ans*=i.f;
		}
	}
	cout<<ans<<nl;
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3684
package main

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

func main() {
	fmt.Println(nextInt() - (nextInt() - 1))

}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  int t[n];
  rep(i,0,n) cin>>t[i];
  int sum=0;
  rep(i,0,n) sum+=t[i];
  int m;
  cin>>m;
  rep(i,0,m){
    int p,x;
    cin>>p>>x;
    cout<<sum-t[p-1]+x<<endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
long long N,S,W,E;
string n;
int main()
{
	cin>>n;
	for(int s=0;s<n.size();s++)
	{
		if(n[s]=='N')N=1;
		if(n[s]=='S')S=1;
		if(n[s]=='W')W=1;
		if(n[s]=='E')E=1;
	}
	if(N==S&&W==E)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#define MOD 1000000007
using namespace std;

char maze[1001][1001];
int dp[1001][1001];
int H,W;

void add(int &a,int b){
    a += b;
    if(a >= MOD) a -= MOD;
}

int main(){
    cin >> H >> W;
    for(int i=0;i < H;i++){
        for(int j=0;j < W;j++){
            cin >> maze[i][j];
        }
    }
    
    dp[0][0] = 1;

    for(int i=0;i < H;i++){
        for(int j=0;j < W;j++){
            if(i+1 < H && maze[i+1][j] == '.'){
                add(dp[i+1][j],dp[i][j]);
            }
            if(j+1 < W && maze[i][j+1] == '.'){
                add(dp[i][j+1],dp[i][j]);
            }
        }
    }
    cout << dp[H-1][W-1] << endl;
    return 0;
}

Measured memory_bytes: 8432
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define  _CRT_SECURE_NO_DEPRECATE
using namespace std;
#define maxv 100005
#define che 1LL<<32
#define modi 1000000007
int main()
{
    ll a,b;
    cin>>a>>b;
    ll x=b/2019;
    ll y=(a-1)/2019;
    if(x!=y)
        cout<<"0"<<endl;
    else
    {
      ll i,j,ans=2018;
      a=a%2019,b=b%2019;
      for(i=a;i<=b;i++)
      {
        for(j=i+1;j<=b;j++)
        {
          ans=min(ans,(i*j)%2019);
        }
      }
      cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class CR
{
    public static string GetText() { return Console.ReadLine(); }
    public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
    public static long GetLong() { return long.Parse(Console.ReadLine()); }
    public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
}

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var text = CR.GetText();

            switch (text)
            {
                case "hi":
                case "hihi":
                case "hihihi":
                case "hihihihi":
                case "hihihihihi":
                    return "Yes";
                default:
                    return "No";
            }
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <math.h>
#include <cmath>

using namespace std;

int main(){
	int n;
	double x[100] = {0},y[100] = {0},p_1 = 0,p_2 = 0,p_3 = 0,p_infinity = -1;
	scanf("%d",&n);
	for(int i = 0; i < n; i++) scanf("%lf",&x[i]);
	for(int i = 0; i < n; i++) scanf("%lf",&y[i]);

	for(int i = 0; i < n; i++){
		p_1 += abs(x[i] - y[i]);
		p_2 += (x[i] - y[i])*(x[i] - y[i]);
		p_3 += abs((x[i] - y[i])*(x[i] - y[i])*(x[i] - y[i]));
		p_infinity = (p_infinity >= abs(x[i] - y[i]))? p_infinity:abs(x[i] - y[i]);
 	}
	printf("%.6lf\n",p_1);
	printf("%.6lf\n",sqrt(p_2));
	printf("%.6f\n",cbrt(p_3));
	printf("%.6lf\n",p_infinity);

}

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

int main(){
  ll n,i,a;
  cin >> n;
  ll b[n+1];
  for(i=0;i<=n;i++){
    b[i]=0;
  }
  for(i=2;i<=n;i++){
    cin >> a;
    b[a]+=1;
  }
  for(i=1;i<=n;i++){
    cout << b[i] << endl;
  }
}

Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
/*
ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=2000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll nPk(ll n,ll k){
	return nCk(n,k)*F[k]%mod;
}*/

int a,b,c,k;

int main(){
	cin>>a>>b>>c>>k;
	int t=0;
	while(a>=b) b*=2,t++;
	while(b>=c) c*=2,t++;
	cout<<(t<=k?"Yes":"No")<<endl;
}

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


typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

int H,W,N;

int dx[2] = {1,-1};

int main(){
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> H >> W >> N;
    
    vector<int> a(N);
    rep(i,N)cin >> a[i];

    vector<int> color; //1,1,...,2,2,...,3,3,...
    rep(i,N){
        rep(j,a[i]){
            color.PB(i+1);
        }
    }

    vector<int> grid(H*W);
    pii pos = pii(0,0);
    int index;

    rep(i,H){
        rep(j,W){
            if(i % 2){
                index = i * W + W - j - 1;
            }else{
                index = i * W + j;
            }
            cout << color[index] << ' ';
        }
        cout << endl;
    }


}

Measured memory_bytes: 512
n = [int(input()) for k in range(3)]
pay=int(input())
cnt=0
for i,j,k in [(i,j,k) for i in range(n[0]+1) for j in range(n[1]+1) for k in range(n[2]+1)]:
    if i*500+j*100+k*50==pay:
        cnt+=1
print(cnt)

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

int main() {
  vector<vector<int>>a(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++) cin>>a[i][j];
  }
  int n;
  cin>>n;
  vector<int>b(n);
  for(int i=0;i<n;i++) cin>>b[i];
  vector<vector<bool>>bingo(3,vector<bool>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      bingo[i][j]=false;
      for(int k=0;k<n;k++){
        if(a[i][j]==b[k]) bingo[i][j]=true;
      }
    }
  }
  if(bingo[0][0] && bingo[0][1] && bingo [0][2]) cout<<"Yes"<<endl;
  else if(bingo[1][0] && bingo[1][1] && bingo [1][2]) cout<<"Yes"<<endl;
  else if(bingo[2][0] && bingo[2][1] && bingo [2][2]) cout<<"Yes"<<endl;
  else if(bingo[0][0] && bingo[1][0] && bingo [2][0]) cout<<"Yes"<<endl;
  else if(bingo[0][1] && bingo[1][1] && bingo [2][1]) cout<<"Yes"<<endl;
  else if(bingo[0][2] && bingo[1][2] && bingo [2][2]) cout<<"Yes"<<endl;
  else if(bingo[0][0] && bingo[1][1] && bingo [2][2]) cout<<"Yes"<<endl;
  else if(bingo[0][2] && bingo[1][1] && bingo [2][0]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto & a : A)
    cin >> a;
  auto minmax = minmax_element(A.begin(), A.end());
  cout << *minmax.second - *minmax.first;
  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 998244353;//998244353
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}
 
int n, m, k;
int dp[3003][3003];
int f[6006];

int mult (int a, int b) {
	return a * (ll)b % mod;
}
void add (int &a, int b) {
	a += b;
	if (a >= mod) a-=mod;
	if (a < 0) a += mod;
}


int main () {
	SpeedForce;
	setIO();
	
	int a,b, c,d;
	cin >> a >> b >> c >> d;
	dp[a][b] = 1;
	for (int i = a; i <= c; ++i)
	for (int j = b; j <= d; ++j) {
		//~
//		add(dp[i+1][j], mult(dp[i][j], j));
//		add(dp[i][j+1], mult(dp[i][j], i));
		if(i>a) {
			add(dp[i][j], mult(dp[i-1][j], j));
		}
		if (j>b) {
			add(dp[i][j], mult(dp[i][j-1], i));
		}
		if (i>a &&j>b) {
			add(dp[i][j], -mult(dp[i-1][j-1], mult(i-1, j-1))); 
		}
//		add(f[i-j+3000], dp[i][j]);
		
	//	cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
	}

	cout << dp[c][d];

	return Accepted;
}

/*
	01
	02
	

	01
	02
*/
// B...a

Measured memory_bytes: 38708
#include<bits/stdc++.h>
using namespace std;
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x,y,m,n;
    cin>>x>>y;
    m=max(4-x,0);
    n=max(4-y,0);
    if(x+y==2){cout<<1000000;}
    else{
        cout<<(m+n)*100000;
    }
}

Measured memory_bytes: 256
import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, M, Q = in.next().toInt
  val table = Array.ofDim[Int](501, 501)
  for (_ <- 1 to M){
    val L, R = in.next().toInt
    table(L)(R) += 1
  }


  //
  for (l <- 1 to 500; r <- 2 to 500) {
    table(l)(r) += table(l)(r-1)
  }

  for (_ <- 1 to Q) {
    val p, q = in.next().toInt
    var ans = 0L
    for(l <- p to 500) {
      ans += table(l)(q)
    }
    pw.println(ans)
  }
  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}


Measured memory_bytes: 53648
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
using namespace std;


int main()
{
    std::cout<<std::fixed<<std::setprecision(10);
    
    int N;
    map<string, int> counts;
    cin >> N;
    
    string A;
    int maxCount = 0;
    for (int i = 0; i < N; i++) {
        cin >> A;
        int x = counts[A];
        counts[A] = x + 1;
        maxCount = max(maxCount, x + 1);
    }
    
    for (auto x: counts){
        if (x.second == maxCount) {
            cout << x.first << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 25216
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {

	sc.Scan()
	a := sc.Text()
	sc.Scan()
	b := sc.Text()

	a = a + a

	if strings.Contains(a, b) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}



Measured memory_bytes: 1120
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    int s=0;
    for(int i = 0; i < 3; ++i) {
        int a; cin >> a; s += a;
    }
    if(s>=22) cout << "bust" << endl;
    else cout << "win" << endl; 
    return 0;
}

Measured memory_bytes: 256
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
s = 0
for i in range(1,n+1):
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        s += i
print(s)

Measured memory_bytes: 64904
let () = Scanf.scanf "%d" @@ fun n ->
  print_endline @@ if
    Array.fold_left (Array.fold_left ( || )) false @@
    Array.init 9 @@ fun i ->
      Array.init 9 @@ fun j -> n = (i + 1) * (j + 1)
  then "Yes"
  else "No"



Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
#define TIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
///__builtin_popcount(x) -- > sum of 1
    const ll N = 1e5 + 7;
    const ll mod = 1e9 + 7;
int n , k , s;
vector < int > v;
int main(){
    TIME
    cin >> n >> k >> s;
    for(int i = 1; i <= k ; i ++)
        v.pb(s);
    for(int i = 1; i <= n - k; i ++){
        if(s != 1e9){
            v.pb(s + 1);
        }
        else{
            v.pb(s - 1);
        }
    }
    for(auto i: v)
        cout << i << " ";
}
///...


Measured memory_bytes: 1912
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;
int main(){
	int n, m;
	cin >> n >> m;
	vector<pair<int, int>>a(n);
	vector<pair<int, int>>b(m);
	for (int i = 0; i < n; i++){
		cin >> a[i].first >> a[i].second;
	}
	for (int i = 0; i < m; i++){
		cin >> b[i].first >> b[i].second;
	}
	int min;
	int tmp;
	vector<int>ans(n);
	for (int i = 0; i < n; i++){
		min = 500000000;
		for (int j = 0; j < m; j++){
			tmp = abs(b[j].first - a[i].first) + abs(b[j].second - a[i].second);
			if (min>tmp){
				min = tmp;
				ans[i] = j + 1;
			}
		}
	}
	for (int i = 0; i < n; i++){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int *v = new int[n], *c = new int[n];
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 0; i < n; ++i) cin >> c[i];
  int r = 0;
  for (int i = 0; i < n; ++i) r += v[i] - c[i] > 0 ? v[i] - c[i] : 0;
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a,b=map(int,input().split())
H=list(map(int,input().split()))
d=[]
e=[]
f=[]
for i in range(n):
    k=H[i]
    if k<=a:
        d.append(k)
    elif a<k<=b:
        e.append(k)
    else:
        f.append(k)
print(min(len(d),len(e),len(f)))

Measured memory_bytes: 3064
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

let ctr = 0;

while (line = lines.shift()) {
    if (ctr % 2 === 1) {
        const scores = Object.assign([], line.split(' ')
            .map(Number))
            .sort((l,r) => parseInt(l) - parseInt(r))

        const smallestGap = scores.slice(1).reduce((acc, curr, idx) => {
            const gap = Math.abs(curr - scores[idx]);
            return acc > gap ? gap : acc;
        }, 1000000)

        console.log(smallestGap);
    }
    ctr++
}



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

using namespace std;

int main(){
  int N;
  cin >> N;
  
  vector<long long> A(N), B(N);
  for(auto& a : A) cin >> a;
  for(auto& b : B) cin >> b;
  
  priority_queue<pair<long long, int>> pq;
  for(int i = 0; i < N; i++){
    if(A[i] != B[i]) pq.push(make_pair(B[i], i));
  }
  
  long long turn = 0;
  while(!pq.empty()){
    int i = pq.top().second;
    pq.pop();
    
    long long d = B[(N + i - 1) % N] + B[(i + 1) % N];
    
    if(B[i] - A[i] < d){
      turn = -1;
      break;
    }
    
    turn += (B[i] - A[i]) / d;
    B[i] = A[i] + (B[i] - A[i]) % d;
    if(B[i] > A[i]) pq.push(make_pair(B[i], i));
  }
  
  cout << turn << endl;
  
  return 0;
}

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

#define DEBUG(x) cout << #x << " = " << x << endl
typedef long long ll;
const int N = 5e3 + 5;
int a[N];
bitset<N> dp;
int n, k;
ll sum;

bool check(int m) {
    if (a[m] >= k) return true;
    dp.reset();
    dp.set(0);
    for (int i=1; i<=n; ++i) if (i != m) {
        dp |= (dp << a[i]);
    }
    for (int i=k-a[m]; i<k; ++i) {
        if (dp[i]) return true;
    }
    return false;
}

int solve() {
    if (sum < k) return n;
    sort(a+1, a+n+1);
    if (check(0)) return 0;
    int low = 1, high = n, ret = 0;
    while (low <= high) {
        int mid = low + high >> 1;
        if (check(mid)) high = mid-1;
        else { ret = mid; low = mid+1; }
    }
    return ret;
}

int main() {
    cin >> n >> k;
    for (int i=1; i<=n; ++i) {
        cin >> a[i];
        sum += a[i];
    }
    cout << solve() << '\n';
    return 0;
}


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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n"
#define ll long long
#define uint unsigned int
#define ushort unsigned short
#define ulong unsigned long

ll MOD = 10e9 + 7;

int main() {
    int n,d;
    cin >> n >> d;
    vector<vector<int> > x = vector<vector<int> >(n, vector<int>(d, 0));
    for(int i=0; i<n; i++) {
        for(int j=0; j<d; j++) {
            cin >> x[i][j];
        }
    }
    auto f = [&d] (vector<int> xi, vector<int>yi) {
        double res = 0;
        for(int i=0; i<d; i++) {
            res += pow((yi[i] - xi[i]), 2);
        }
        res = sqrt(res);
        return res - (int)res;
    };
    int count = 0;
    for(int i=0; i<n; i++) {
        for(int j=i+1; j<n; j++) {
            if (f(x[i], x[j]) == 0) count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

# 赤と青を独立に塗る → 重なった場所が緑

N,A,B,K = map(int,input().split())

MOD = 998244353
fact = [1]
for n in range(1,N+1):
    fact.append(fact[-1] * n % MOD)
fact_inv = [1] * (N+1)
fact_inv[N] = pow(fact[N],MOD-2,MOD)
for n in range(N,0,-1):
    fact_inv[n-1] = fact_inv[n] * n % MOD

comb = [fact[N] * x * y % MOD for x,y in zip(fact_inv, reversed(fact_inv))]

answer = 0
for a in range(N+1):
    q,r = divmod(K - a * A, B)
    if q > N:
        continue
    if q < 0:
        break
    if r != 0:
        continue
    answer += comb[a] * comb[q]

answer %= MOD
print(answer)

Measured memory_bytes: 38680
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(),t.end(),greater<char>());
    if(s<t){
        cout<< "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

#define int long long

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

	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> ans(n);
	for (auto &t : a) {
		cin >> t;
	}
	vector<int> seen = a;
	sort(seen.begin(), seen.end());
	seen.resize(unique(seen.begin(), seen.end()) - seen.begin());
	reverse(seen.begin(), seen.end());
	seen.push_back(0);
	map<int, int> moc;
	map<int, int> occ;
	for (int i = 0; i < n; i++) {
		if (!moc.count(a[i])) moc[a[i]] = i;
		occ[a[i]]++;
	}
	int cm = n;
	int cnt = 0;
	for (int i = 0; i + 1 < (int)seen.size(); i++) {
		cm = min(cm, moc[seen[i]]);
		cnt += occ[seen[i]];
		ans[cm] += (seen[i] - seen[i + 1]) * cnt;
	} 
	for (auto t : ans) {
		cout << t << ' ';
	}
	cout << '\n';
}


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

#define endl '\n'

using namespace std;

struct custom_hash 
{
    static unsigned long long splitmix64(unsigned long long x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(unsigned long long x) const 
    {
        static const unsigned long long FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int n; 
void read()
{
	cin >> n;
}

void solve()
{
	long long ans = 0; 
	for (int i = 1; i <= n; i++)
		if (i % 3 != 0 && i % 5 != 0)
			ans += i;

		cout << ans << endl; 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	read();
	solve();
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll md = 1000000007;
vector<ll> fact(1e6 + 7), invfact(1e6 + 7);

ll fn(ll a, ll r, ll n, ll mod = md) {
    ll res = 1, x = r%mod;
    ll ans = 0;
    while(n) {
        if(n&1) ans = (x*ans + res)%mod;
        res = ((res*x)%mod + res%mod)%mod;
        x = (x*x)%mod;
        n = n/2;
    }
    ans = (ans*a)%mod;
    return ans;
}

ll nCr(ll n, ll r) {
    if(r == 0) return 1;
    ll num = fact[n];
    ll den = (invfact[r] % md *invfact[n-r] % md)%md;
    return (num*den)%md;
}

ll mul(ll a, ll b, ll mod = md) {
    ll res = (a%mod * b%mod)%mod;
    return res;
}

ll mulm(ll a, ll b, ll mod = md) {
    ll r = 0;
    a %= mod;
    while (b) {
        if (b & 1) r = (r+a)%mod;
        a = (a+a)%mod;
        b = b/2;
    }
    r %= mod;
    return r;
}

ll power(ll x, ll n, ll mod = md) {
    ll res = 1;
    x %= mod;
    while (n) {
        if (n & 1)  res = (res*x)%mod;
        n = n/2;
        x = (x*x)%mod;
    }
    return res;
}

ll power2(ll x, ll n) {
    ll res = 1;
    while (n)  
    {  
        if (n & 1)  res = (res*x);  
        n = n/2; 
        x = (x*x);  
    }  
    return res;
}

bool is_prime(ll x) {
    if(x == 1 || x == 0) return false;
    for(int i=2; i*i <= x; i++) {
        if(x%i == 0) return false;
    }
    return true;
}

ll compgcd(ll n, vector<ll> const &primes) { 
    ll res = n; 
    for (ll i=0; primes[i]*primes[i] <= n; i++) {
        if (n % primes[i]== 0) { 
            res -= (res / primes[i]); 
            while (n%primes[i]== 0) {
               n/=primes[i]; 
            }
        } 
    } 
    if (n > 1) {
       res -= (res / n); 
    }
    return res; 
} 

void sieve(vector<bool> &prime, vector<ll> &primes, ll lim) {
    for(int i = 2; i*i <= lim; i++) {
        if(prime[i]) {
            for(int j = 2; j*i <= lim; j++) {
                prime[j*i] = false;
            }
        }
    }
    for(int i = 2; i <= lim; i++) {
        if(prime[i]) {
            primes.push_back(i);
        }
    }
}

void sieveGCD(ll lim, vector<ll> &tab, vector<ll> const &primes) {
    for(int  i = 1; i <= lim; i++) {
        tab[i] = i;
    }
    for(int i = 0; i<primes.size() && primes[i] <= lim; i++) {
        tab[primes[i]] = primes[i]-1;
        for(int j = 2; primes[i]*j <= lim; j++) {
            tab[primes[i]*j] = (tab[primes[i]*j]/primes[i])*(primes[i]-1);
        }
    }
}

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool good = true;
    map<string ,int> m;
    m[s]++;
    for(int i = 1; i < n; i++) {
        string t;
        cin >> t;
        if(t[0] != s[s.size()-1] || m[t] != 0) {
            good=  false;
            break;
        }
        m[t]++;
        s = t;
    }
    if(good) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0; 
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int main()
{
  int N;
  cin >> N;
  vector<double> V(N);
  cin >> V;
  sort(V.begin(), V.end());
  double ans = V[0];
  REP(i,N-1){
    ans = (ans + V[i+1])/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
char*p,E0[128],E1[128],da[128],db[128],dc[128],X;R(char*s){char*p=s+strlen(s),t;for(;--p>s;s++){t=*p,*p=*s,*s=t;}}C(){int ia,ib,ic,v;for(v=ia=ib=ic=0;dc[ic];){if(da[ia])v+=da[ia++]-'0';if(db[ib])v+=db[ib++]-'0';if(v%10+'0'!=dc[ic++])return 0;v/=10;}if(v||da[ia]||db[ib])return 0;return 1;}main(){for(;~scanf("%[^\n]\n",E0);){for(X='0';X<='9';X++){strcpy(E1,E0);while(p=strchr(E1,'X'))*p=X;sscanf(E1,"%[^+]+%[^=]=%s",da,db,dc);if(*da=='0'&&da[1]||*db=='0'&&db[1]||*dc=='0'&&dc[1])continue;R(da);R(db);R(dc);if(C()){printf("%c\n",X);break;}}if(X=='9'+1)puts("NA");}}

Measured memory_bytes: 0
function Main(input) {
  let deposit = 100;
  input = parseInt(input);

  let count = 0;

  while(deposit < input){
    deposit += Math.floor(deposit * 0.01);
    count++
  }

  console.log(count)
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30264
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;
int n, A, B, C;

int main() {
   cin >> n >> A >> B >> C;
   int l[n];
   for (int i = 0; i < n; i++) cin >> l[i];
   
   int used[n];
   memset(used, 0, sizeof(used));
   int ans = A + B + C;
   for (int mask = 0; mask < (1 << n); ++mask) {
      int tmp = 0;
      int cnt = 0;
      int cstA = 0;
      int cstB = 0;
      int cstC = 0;
      vector<int> rest1;
      for (int i = 0; i < n; i++) {
         if ((mask >> i) & 1) {
            tmp += l[i];
            cnt++;
         } else rest1.push_back(l[i]);
      }
      if (cnt == 0) continue;
      cstA = abs(A - tmp) + 10 * (cnt - 1);
      int n2 = (int)rest1.size();
      if (n2 < 2) continue;
      for (int mask2 = 0; mask2 < (1 << n2); ++mask2) {
         tmp = 0;
         cnt = 0;
         vector<int> rest2;
         for (int j = 0; j < n2; j++) {
            if ((mask2 >> j) & 1) {
               tmp += rest1[j];
               cnt++;
            } else rest2.push_back(rest1[j]);
         }
         if (cnt == 0) continue;
         cstB = abs(B - tmp) + 10 * (cnt - 1);
         int n3 = (int)rest2.size();
         if (n3 < 1) continue;
         for (int mask3 = 0; mask3 < (1 << n3); ++mask3) {
            tmp = 0;
            cnt = 0;
            for (int k = 0; k < n3; k++) {
               if ((mask3 >> k) & 1) {
                  tmp += rest2[k];
                  cnt++;
               }
            }
            if (cnt == 0) continue;
            cstC = abs(C - tmp) + 10 * (cnt - 1);
            ans = min(ans, cstA + cstB + cstC);
         }
      }
   }
   cout << ans << endl;
   return 0;
}


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

const ll mod=998244353;

ll n,R,B,G,RB,RG,BG,ans=1;

char s[maxn*3];

int main(){
	scanf("%lld%s",&n,s+1);
	for(int i=1;i<=n;i++) ans*=i,ans%=mod;
	for(int i=1;i<=n*3;i++){
		if(s[i]=='R'){
			if(BG) ans*=BG,BG--;
			else if(B) ans*=B,B--,RB++;
			else if(G) ans*=G,G--,RG++;
			else R++;
		}
		else if(s[i]=='B'){
			if(RG) ans*=RG,RG--;
			else if(R) ans*=R,R--,RB++;
			else if(G) ans*=G,G--,BG++;
			else B++;
		}
		else if(s[i]=='G'){
			if(RB) ans*=RB,RB--;
			else if(R) ans*=R,R--,RG++;
			else if(B) ans*=B,B--,BG++;
			else G++;
		}
		ans%=mod;
	}
	printf("%lld",ans%mod);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, size) for (int i = start; i < size; i++)
#define FORR(i, start, size) for (int i = start; i > start-size; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

//time以上の数値のうち最小のs+f*i
int st(int s,int f,int time){
    FOR(i,0,INF){
        if (s + f * (i-1) < time && time <= s + f * i){
            return s+f*i;
        }
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> csf;

    vint v;
    int c,s,f;

    FOR(i,0,n-1){
        cin >> c >> s >> f;
        v = {c,s,f};
        csf.pb(v);
    }

    int time;

    FOR(j,0,n-1){
        time = 0;
        FOR(i,j,n-1){
            c = csf[i][0];
            s = csf[i][1];
            f = csf[i][2];
            if (time < s){
                time = s + c;
            }else{
                time = st(s,f,time) + c;
            }
        }
        cout << time << endl;
        
    }
    cout << 0 << endl; 


}

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

using namespace std;
#define N 200100
#define SIGMA 26

long double v[N], s[N];
long double x;
int i, n, k;
int main()
{
    cin >> n >> k;
    for (i = 0; i < n; ++i){
        cin >> x;
        v[i] = (x + 1) * x / 2;
        v[i] /= x;
        if (!i)
            s[i] = v[i];
        else
            s[i] = s[i - 1] + v[i];
    }
    long double ans = s[k - 1];
    for (i = k; i < n; ++i)
        ans = max (ans, s[i] - s[i - k]);
    cout << fixed << setprecision(7) << ans;
    return 0;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep0(i,n) for(i=0;i<n;i++)
using namespace std;
int main(){
    FAST;

    double a,b,h,m,angle,res1,res2,res3,res4,finalres1;
    char c;
    //while(1){
    cin>>a>>b>>h>>m;
    if(h==12){
        h=0;
        res1=h*5*6;
        res2=m*6;
        res3=m*0.5;
        angle=res2-res3;
    }
    else{
            res1=h*5*6;
            res2=m*6;
            res3=m*0.5;
            res4=res1+res3;
            if(res2>res4){
                angle=res2-res4;
            }
            else if(res4>res2){
                    angle=res4-res2;
            }
            else if(res2==res4){
                angle=0;
            }
    }
    if(angle>=180){
        angle=360-angle;
    }
    double finalres=angle;
    if (finalres == 90.0)
    finalres = 0.0;
    else
     finalres = cos(finalres*PI/180.0);

    finalres1=sqrt((pow(a,2))+ (pow(b,2))-(2*a*b*finalres));
    printf("%.20f",finalres1);

}






Measured memory_bytes: 4208
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
int n;
char in[1000];
char ret[1000];
int dist[1000];
bool check(){
	vector<pair<pair<int,int>,int> >edge;
	for(int i=0;i<(1<<(2*n+1));i++){
		int L,R,to;
		L=0;R=0;to=i/2;
		if(ret[i]=='?'){
			L--;
		}else if(ret[i]=='1'){
			L--;R--;
		}
		edge.push_back(make_pair(make_pair(i*2+1,i*2),R));
		edge.push_back(make_pair(make_pair(i*2,i*2+1),-L));
		
		edge.push_back(make_pair(make_pair(i*2,to*2+1),0));
		edge.push_back(make_pair(make_pair(to*2+1,i*2),0));
		L=0;R=0;to=i/2+(1<<(2*n));
		if(ret[i]=='?'){
			L--;
		}else if(ret[i]=='1'){
			L--;R--;
		}
		edge.push_back(make_pair(make_pair(i*2,to*2+1),1));
		edge.push_back(make_pair(make_pair(to*2+1,i*2),-1));
	}
	for(int i=0;i<(1<<(2*n+2));i++)dist[i]=999999999;
	dist[0]=0;
	for(int i=0;i<=(1<<(2*n+2));i++){
		for(int j=0;j<edge.size();j++){
			if(dist[edge[j].first.first]+edge[j].second<dist[edge[j].first.second]){
				dist[edge[j].first.second]=dist[edge[j].first.first]+edge[j].second;
				if(i==(1<<(n*2+2)))return false;
			}
		}
	}
	return true;
}
int main(){
	int a;scanf("%d",&a);
	n=a;
	scanf("%s",in);
	for(int i=0;i<(1<<(2*a+1));i++)ret[i]=in[i];
	if(check()){
		printf("%s\n",ret);return 0;
	}
	for(int i=(1<<(2*a+1))-1;i>=0;i--){
		ret[i]='?';
		if(in[i]=='0'){
			ret[i]='1';
			if(check()){
				for(int j=i+1;j<(1<<(2*a+1));j++){
					ret[j]='0';
		//			printf("%s\n",ret);
					if(!check())ret[j]='1';
				}
				printf("%s\n",ret);return 0;
			}
			ret[i]='?';
		}
	}
	printf("no\n");
}

Measured memory_bytes: 1044
def main():
    n,l = map(int,input().split())
    a = [l+i-1 for i in range(1, n+1)]
    b = [abs(i) for i in a]
    m = min(b)
    i = b.index(m)
    del a[i]
    print(sum(a))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include<stdio.h>

int main(void){

    int n;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    int all=0;

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

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


    for(int i=0;i<n;i++){
        if((a[i]-b[i])>0){
            all=all+a[i]-b[i];
        }
    }

    printf("%d",all);



    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



ll mod = 1000000007;
int prime[1010101];

ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


vector<ll>dv;
map<ll, ll>li;
void divisor(ll n) {
	dv.clear();
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			if (i == n / i) {
				dv.push_back(i);
			}
			else {
				dv.push_back(i);
				dv.push_back(n / i);
			}
		}
	}
}

int p = 1000005;
void era() {
	rep(i, 0, p + 1)prime[i] = 1;
	prime[0] = prime[1] = 0;

	for (int i = 2; i*i <= p; i++) {
		if (prime[i]) {
			for (int j = 2 * i; j <= p; j += i) {
				prime[j] = 0;
			}
		}
	}
}


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

	era();
	int N;
	cin >> N;
	vector<ll>A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		divisor(A[i]);
		fore(x, dv) {
			if (x == 1)continue;
			if (!prime[x])continue;
			ll tmp = A[i];
			ll cnt = 0;
			while (tmp % x == 0) {
				tmp /= x;
				cnt++;
			}
			li[x] = max(li[x],cnt);
		}
	}




	ll lcm = 1;
	fore(x,li) {
		lcm *= modpow(x.first,x.second);
		lcm %= mod;
	}

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += modpow(A[i], mod - 2);
		ans %= mod;
	}
	ans *= lcm;
	puts(ans % mod);

	return 0;
}

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

using namespace std;

int main(){
    long long i, n, x, operations = 0, difference, a[100005];

    cin >> n >> x;

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

    for(i = 1; i < n; i++){
        if(a[i - 1] + a[i] > x){
            difference = a[i - 1] + a[i] - x;
            if(difference > a[i]){
                operations += a[i], a[i] = 0;
                operations += difference - operations;
                a[i - 1] -= difference - a[i];
            }
            else operations += difference, a[i] -= difference;
        }
    }

    cout << operations << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		for (int i = 0; i < n; i++) {
			int b = 0;
			int c = 0;
			boolean acFlag = true;
			for (int j = 0; j < 10; j++) {
				int number = scan.nextInt();
				if (number > b) {
					b = number;
					continue;
				}
				if (number > c) {
					c = number;
					continue;
				}
				acFlag = false;
			}
			System.out.println(acFlag?"YES":"NO");
		}
	}
}

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

typedef long long ll;


#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    int N,M; cin >> N >> M;
    vector<vector<int>> G(N);
    REP(i,M){
        int a,b; cin >> a >> b;
        G[a-1].push_back(b-1);
    }
    REP(i,N){
        sort(ALL(G[i]));
    }
    int l = 0, r = N-1;
    int ans = 0;
    REP(i,N-1){
        l = i;
        if(G[i].size() > 0) r = min(r, G[i][0]);

        //cout << l << ", " << r << endl;
        if(r-l == 1){
            ans++;
            r = N;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8816
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int a, b;
    cin >> a >> b;
    if((a + b) % 2 == 0){
        cout << (a + b) / 2;
    }else{
        cout << (a + b) / 2 + 1;
    }
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    Scanner sc = new Scanner(System.in);
 
    public void run() {
        while(true){
 
            String s=sc.nextLine();
            if("-".equals(s))break;
            int count=sc.nextInt();
            for(int i=0;i<count;i++){
                int index=sc.nextInt();
                s=s.substring(index)+s.substring(0,index);
            }sc.nextLine();
            ln(s);
        }
    }
 
    public static void main(String[] args) {
        new Main().run();
    }
 
    public static void pr(Object o) {
        System.out.print(o);
    }
 
    public static void ln(Object o) {
        System.out.println(o);
    }
 
    public static void ln() {
        System.out.println();
    }
}



Measured memory_bytes: 26268
n = int(input())
a =[0]*n
b = [0]*n
c = [0]*n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

# dp[日にち][0:a 1:b 2:c]
dp = [[0]*3 for _i in range(n)]
dp[0] = [a[0], b[0], c[0]]
#print(dp)
for i in range(n-1):
    dp[i+1][0] = max(dp[i][1], dp[i][2]) + a[i+1]
    dp[i+1][1] = max(dp[i][0], dp[i][2]) + b[i+1]
    dp[i+1][2] = max(dp[i][0], dp[i][1]) + c[i+1]
print(max(dp[n-1]))


Measured memory_bytes: 60888
use proconio::input;
use std::cmp;

fn main() {
    input! {
        mut n: u64,
    }

    let mut ans = 0;
    for prime in 2..=cmp::min(n, 1_000_000) {
        let mut exp = 0;
        let mut k = 1;
        while n % prime == 0 {
            exp += 1;
            if exp >= k {
                exp = 0;
                k += 1;
                ans += 1;
            }
            n /= prime;
        }
    }
    if n > 1 {
        ans += 1;
    }

    println!("{}", ans);
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+7;
int n,m;
vector<int>vec[N];
priority_queue<int,vector<int>,greater<int> >q;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=n;i++)
	{
		scanf("%d%d",&x,&y);
		if(x)vec[x].push_back(y);else q.push(y);
	}
	for(int i=1;i<=m+1;i++)sort(vec[i].begin(),vec[i].end());
	int pos=-1;
	for(int i=1;i<=m;i++)
	if(vec[i].size()>1)
	for(int j=0;j<vec[i].size()-1;j++)q.push(vec[i][j]);
	else if(!vec[i].size())
	{
		if(!q.empty()&&q.top()<=i)q.pop();
		else{
			pos=max(pos,i);
			while(!vec[pos].size()&&pos<=m)pos++;
			if(vec[pos].size())vec[pos].pop_back();
		}
	}
	printf("%d",q.size());
}


Measured memory_bytes: 8960