akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N;
vector<ll> X,Y;

const ll INF=1e18;

int main(){
  cin>>N;
  X.resize(N);
  Y.resize(N);
  rep(i,N) cin>>X[i]>>Y[i];

  for(int i=0;i<N;i++){
      if(X[i]>Y[i]) swap(X[i],Y[i]);
  }

  int mat=0,mit=0;
  for(int i=0;i<N;i++){
      if(X[mit]>X[i]) mit=i;
      if(Y[mat]<Y[i]) mat=i;
  }

  ll ans=INF;
  if(mit!=mat){
      ll R=Y[mat]-X[mit];
      vector<pair<ll,ll>> v;
      for(int i=0;i<N;i++){
          if(i!=mit&&i!=mat) v.push_back(mkp(X[i],Y[i]));
      }
      sort(v.begin(),v.end());

      if(v.size()==0) ans=min(ans,R*abs(Y[mit]-X[mat]));
      else{
          ll ma=max(Y[mit],X[mat]);
          ll mi=min(Y[mit],X[mat]);// X...XY...Y

          ll ymi=v[0].second;
          ll yma=v[0].second;
          for(int i=1;i<v.size();i++){
              ll s=min(mi,min(ymi,v[i].first));
              ll t=max(ma,max(yma,v[i].first));
              s=min(s,v.back().first);
              t=max(t,v.back().first);

              ans=min(ans,R*(t-s));
              yma=max(yma,v[i].second);
              ymi=min(ymi,v[i].second);
          }

          ll ls=mi,lt=ma;//all X
          for(int i=0;i<v.size();i++){
              ls=min(ls,v[i].first);
              lt=max(lt,v[i].first);
          }
          ans=min(ans,R*(lt-ls));

          ls=mi;lt=ma;// all Y
          for(int i=0;i<v.size();i++){
              ls=min(ls,v[i].second);
              lt=max(lt,v[i].second);
          }
          ans=min(ans,R*(lt-ls));
      }
  }

  ll rmi=Y[mit],bma=X[mat];
  for(int i=0;i<N;i++){
      if(i==mat||i==mit) continue;
      rmi=min(rmi,Y[i]);
      bma=max(bma,X[i]);
  }
  ans=min(ans,(Y[mat]-rmi)*(bma-X[mit]));
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 9584
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
long long ha[100005],total[100005];
int inc(const void *a, const void *b)
{
    if(a<b)return -1;
    else return 1;
}
int main()
{
	long long m,n,l=0,r=200005,fenjie,sum,num,mid,kk,temp;
	//fenjie:二分答案的结果 sum:握手好感总和 num:握手次数 kk: 临界点 temp:区别于fenjie的临时值 
    scanf("%lld%lld",&n,&m);
    ha[0]=9999999;
    for(long long i=1;i<=n;i++)scanf("%lld",&ha[i]);
    sort(ha+1,ha+n+1);
    total[0]=0;
    for(long long i=1;i<=n;i++)total[i]=total[i-1]+ha[i];
    mid=(l+r)/2;
    while(l<=r)
	{
        sum=0;num=0;
        for(long long i=1;i<=n;i++)
		{
            kk=lower_bound(&ha[1],&ha[n+1],mid-ha[i])-&ha[0];
            num+=n-kk+1;
        }
		temp=mid;
        if(num>=m)
		{
            fenjie=mid;
            l=mid+1;
        }
        else
		{
			//fenjie=mid;
			r=mid-1;
		}
        mid=(l+r)/2;
    }
    for(long long i=1;i<=n;i++)
	{
        kk=lower_bound(&ha[1],&ha[n+1],temp-ha[i])-&ha[0];
        sum+=total[n]-total[kk-1];
        sum+=ha[i]*(n-kk+1);
    }
    if(m==num)printf("%lld\n",sum);
    else if(m>num)printf("%lld\n",sum+(m-num)*fenjie);
    else printf("%lld\n",sum-(num-m)*fenjie);
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main () {
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll k;
    cin>>k;
	string s;
    cin>>s;
    
    ll a=s.size();
    if(a<=k)
    cout<<s<<endl;
    else
    {
    	string s0=s.substr(0,k);
		std::string stuff(3, '.');
		cout<<s0+stuff<<endl;
    	
	}
    return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[][] a = new int[9][9];

		int i,j;
		for(i = 1; i <= 9; i++) {
			for(j = 1; j <= 9; j++) {
				a[i - 1][j - 1] = i * j;
			}
		}

		int n = scan.nextInt();

		for(i = 0; i < 9; i++) {
			for(j = 0; j < 9; j++) {
				if(a[i][j] == n) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>

using namespace std;

int main(){
    int n;
    string s,s1,s2;
    cin >> n;
    cin >> s;

    if(n % 2 != 0){
        cout << "No" << endl;
    }else{
        s1 = s.substr(0,n/2);
        s2 = s.substr(n/2,n/2);
        if(s1 == s2)cout << "Yes" << endl;
        else cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
from itertools import product
from collections import deque

class ZeroOneBFS:
    def __init__(self, N):
        self.N = N # #vertices
        self.E = [[] for _ in range(N)]
        
    def add_edge(self, init, end, weight, undirected=False):
        assert weight in [0, 1]
        self.E[init].append((end, weight))
        if undirected: self.E[end].append((init, weight))
        
    def distance(self, s):
        INF = float('inf')
        E, N = self.E, self.N
        dist = [INF] * N # the distance of each vertex from s
        prev = [-1] * N # the previous vertex of each vertex on a shortest path from s
        dist[s] = 0
        dq = deque([(0, s)]) # (dist, vertex)
        n_visited = 0 # #(visited vertices)
        while dq:
            d, v = dq.popleft() 
            if dist[v] < d: continue # (s,v)-shortest path is already calculated
            for u, c in E[v]:
                temp = d + c
                if dist[u] > temp:
                    dist[u] = temp; prev[u] = v
                    if c == 0: dq.appendleft((temp, u))
                    else: dq.append((temp, u))
            n_visited += 1
            if n_visited == N: break
        self.dist, self.prev = dist, prev
        return dist
    
    def shortest_path(self, t):
        P = []
        prev = self.prev
        while True:
            P.append(t)
            t = prev[t]
            if t == -1: break
        return P[::-1]

H, W = map(int, input().split())
zobfs = ZeroOneBFS(H * W)
 
def vtx(i, j): return i*W + j
def coord(n): return divmod(n, W)
 
grid = [input() for _ in range(H)] # |string| = W
E = [[] for _ in range(H * W)]
ans = 0 if grid[0][0] == '.' else 1
for i, j in product(range(H), range(W)):
    v = vtx(i, j)
    check = [vtx(i+dx, j+dy) for dx, dy in [(1, 0), (0, 1)] if i+dx <= H-1 and j+dy <= W-1]
    for u in check:
        x, y = coord(u)
        if grid[i][j] == '.' and grid[x][y] == '#':
            zobfs.add_edge(v, u, 1)
        else:
            zobfs.add_edge(v, u, 0)
dist = zobfs.distance(0)
ans += dist[vtx(H-1, W-1)]
print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, p[100001];
  cin >> n;
  rep(i, 0, n) cin >> p[i];

  int ans1[100001] = {}, ans2[100001] = {};
  rep(i, 0, n) {
    ans1[i] = (i + 1) * 20001;
  }
  dep(i, n, 0) {
    ans2[i] = ((n - i) + 1) * 20001;
  }

  rep(i, 0, n) {
    ans2[p[i] - 1] -= (20000 - i);
  }
  rep(i, 0, n) cout << ans1[i] << " ";
  cout << endl;
  rep(i, 0, n) cout << ans2[i] << " ";
  cout << endl;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    int N,K;
    cin >>N>>K;
    vector<ll>v(N);
    deque<ll> d;
    deque<ll> d2;
    rep(i,N){
        cin>>v[i];
        d.pb(v[i]);
    }
    
    ll ans = 0;
    d2 = d;
    
    rep(i,min(N,K)+1){
        
        rep(j,min(N,K)-i+1){
            //cout<<i<<" "<<j<<endl;
            vector<ll>have;
            d=d2;
            ll now=0;
            rep(k,i){
                now += d.front();
                have.pb(d.front());
                d.pop_front();
            }
            rep(k,j){
                now += d.back();
                have.pb(d.back());
                d.pop_back();
            }
            sort(all(have));
            int size = have.size();
            rep(k,min(K-i-j,size)){
                if(have[k]<0){
                    now+=-have[k];
                }else{
                    break;
                }
            }
            //cout<<now<<endl;
            chmax(ans,now);
        }
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3620
#include <stdio.h>

int main(void)
{
  int n,m,c,i,j,tmp,ans=0;

  scanf("%d %d %d\n",&n,&m,&c);

  int b[m],a[n][m];

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

  tmp = c;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c = c + a[i][j] * b[j];
    }
    if(c>0){
      ans = ans + 1;
    }
    c = tmp;
  }

  printf("%d",ans);

  return 0;
}


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

bool is_sosu(int a){
	for(int i = 2; i * i <= a;i++){
		if(a % i == 0) return false;
	}
	return true;
}

int main(){
	int n;
	while(cin >> n){
		for(int i = n - 1; i >= 2; i--){
			if(is_sosu(i)) {
				cout << i << " ";
				break;
			}
		}
		for(int j = n+1;;j++){
			if(is_sosu(j)){
				cout << j << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
n,m=input().split()
n=int(n)
m=int(m)
i=0
x=list()
y=list()
ans=0
g=0
ll=[]
rr=[]


while i!=m:
    i=i+1
    l,r=input().split()
    l=int(l)
    r=int(r)
    ll.append(l)
    rr.append(r)
l=max(ll)
r=min(rr)

ans=r-l+1
if l>r:
    ans=0
print(ans)



Measured memory_bytes: 10992
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007

int main() {
    int n, t, a;
    scanf("%d %d %d", &n, &t, &a);
    double GOSA =  2000000000;
    int ans;
    rep(i,n) {
        int high;
        double temp;
        scanf("%d", &high);
        temp = (double) t - high*0.006;
        if (fabs(a-temp) <  GOSA) {
            ans = i+1;
            GOSA = fabs(a-temp);
        }
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 256
import subprocess as sp
import sys
 
code = r"""
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int add(int x,int y){return(x+=y)<mod?x:x-mod;}
int sub(int x,int y){return(x-=y)>= 0?x:x+mod;}
int dp[1<<21];
int n,a[21][21];
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;++i){
    for(int j=0;j<n;++j){
      scanf("%d",&a[i][j]);
    }
  }
  dp[0]=1;
  for(int b=1;b<(1<<n);++b){
    int bc=__builtin_popcount(b)-1;
    for(int i=0;i<n;++i){
      if((b>>i&1)&&a[bc][i]){
        dp[b]=add(dp[b],dp[b^(1<<i)]);
      }
    }
  }
  printf("%d\n",dp[(1<<n)-1]);
}
"""
 
with open("A.cpp","w") as f:
	f.write(code)
    
sp.Popen(['g++','-std=c++11','-O2',"A.cpp"]).communicate()
sp.Popen(['./a.out'],stdin=sys.stdin,stdout=sys.stdout).communicate()


Measured memory_bytes: 172296
function main(input) {
  input = input.trim();
  const [a,b] = input.split(" ").map(Number);

  if(a+b>=10){
    console.log("error");
  }else{
    console.log(a+b);
  }
    
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 30344
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a = I()
    print(a + a**2 + a**3)

main()



Measured memory_bytes: 78280
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long 
#define sort(v) sort(v.begin(),v.end()) 
#define pb push_back
/*
ll ar[1000000+9]={0}; 
void seiv() { 
ll n=1000000,i,j; 
ar[1]=1; 
for(i=4;i<=n;i+=2)ar[i]=1; 
for(i=3;i<=n;i+=2) 
{ if(ar[i]==0) 
{ for(j=i*i;j<=n;j+=i*2)ar[j]=1; }
 } 
}*/
int main()
{
  vector<ll>v,x;
 ll a,b,c,d,u,j,k,l,i;
 cin>>a;c=1000000000+7;
 for(i=1;i<=a;i++)
 {
 cin>>b;b=b%c;v.pb(b);x.pb(b);
 if(i>1){x[i-1]=x[i-2]+b;}
 }
   ll sum=0;
for(i=0,j=a-1;i<x.size();i++)
{
 sum+=((x[j]-x[i])%c*v[i]%c)%c;
 sum=sum%c;
}
cout<<sum<<endl;
}

Measured memory_bytes: 6620
// C - Candies
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	vi A(N+1),B(N+1);
	rp(i, 1, N+1){ cin>>A[i]; A[i] += A[i-1]; }
	rp(i, 1, N+1){ cin>>B[i]; B[i] += B[i-1]; }
	int ans = 0;
	rp(i, 1, N+1) ans = max(ans, A[i]+B[N]-B[i-1]);
	cout<< ans <<endl;
}

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

int debug=0;

int main()
{
    int a,b;
    cin >> a >> b;
    for(int n=0;n <10000;++n){
        int za = n * 8 / 100;
        int zb = n * 10 / 100;
        if( a==za && b == zb){
            cout << n << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::stdin;
use std::iter::Iterator;
use std::collections::VecDeque;

fn solve(cin: &mut ConsoleInputWrapper) {
    let n: usize = cin.input().parse().unwrap();
    let mut a = vec![0; n];
    for i in 0..n {
        let index: usize = cin.input().parse().unwrap();
        a[index - 1] = i + 1;
    }
    for i in a {
        print!("{} ", i);
    }
    println!();
}

//Other Functions Here

fn main() {
    let mut cin = ConsoleInputWrapper::new();
    solve(&mut cin);
}

fn min(a: i32, b: i32) -> i32 {
    if a < b { a } else { b }
}

fn max(a: i32, b: i32) -> i32 {
    if a > b { a } else { b }
}

struct ConsoleInputWrapper {
    queue: VecDeque<String>
}

impl ConsoleInputWrapper {
    fn new() -> ConsoleInputWrapper {
        ConsoleInputWrapper {
            queue: VecDeque::new()
        }
    }
    fn input(&mut self) -> String {
        if self.queue.len() <= 0 {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let list: Vec<&str> = s.split_whitespace().collect();
            for string in list {
                self.queue.push_back(String::from(string));
            }
        }
        self.queue.pop_front().unwrap()
    }
}

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

using ll = long long;

const int MAXN = 2.1e5;
int N;
int K;
int A[MAXN];
ll pref[MAXN];

int cnt[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> A[i]; A[i] -= K;
	}
	vector<ll> vals;
	vals.push_back(pref[0] = 0);
	for (int i = 0; i < N; i++) {
		vals.push_back(pref[i+1] = pref[i] + A[i]);
	}
	sort(vals.begin(), vals.end());
	vals.resize(unique(vals.begin(), vals.end()) - vals.begin());

	ll ans = 0;
	for (int i = 0; i <= N; i++) {
		int v = int(lower_bound(vals.begin(), vals.end(), pref[i]) - vals.begin());
		for (int a = v+1; a; a -= a & (-a)) {
			ans += cnt[a];
		}
		for (int a = v+1; a <= int(vals.size()); a += a & (-a)) {
			cnt[a]++;
		}
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 5104
N,A=map(int,input().split())
X=list(map(int,input().split()))
dp=[[0]*5001 for _ in range(N+1)]
dp[0][2500]=1
for i in range(N):
    for j in range(5001):
        if dp[i][j]>0:
            dp[i+1][j]+=dp[i][j]
            dp[i+1][j+X[i]-A]+=dp[i][j]
print(dp[N][2500]-1)


Measured memory_bytes: 41200
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
const int mod = 1000000007;
int dp[2200][2200];
//#########################################
void add(int &a,int b){
	a = (a + b)%mod;
	a = (a%mod + mod)%mod;
}
signed main(){
	int n,m;cin >>n >> m;
	vector<int> s(n+1),t(m+1);
	rep(i,n)cin >> s[i+1];
	rep(i,m)cin >> t[i+1];
	dp[0][0] = 1;
	vector<vector<int>> sum(n+2,vector<int>(m+2));
	auto getsum = [&](int i,int j){
		//sum[i][j] - sum[i][0] - sum[0][j] + sum[0][0];
		int tmp = sum[i][j];
		tmp = (tmp+mod - sum[i][0])%mod;
		tmp = (tmp + mod - sum[0][j])%mod;
		tmp = (tmp + sum[0][0])%mod;
		return tmp;
	};
	int ret = 0;
	rep(i,n+1)rep(j,m+1){
		if(i == 0 || j == 0)continue;
		if(s[i] == t[j])dp[i][j] = (getsum(i,j)+1)%mod;
		else dp[i][j] = 0;
		// sum[i+1][j+1] = sum[i+1][j] + sum[i][j+1] - sum[i][j] + dp[i][j];
		sum[i+1][j+1] = sum[i+1][j];
		add(sum[i+1][j+1],sum[i][j+1]);
		add(sum[i+1][j+1],-sum[i][j]);
		add(sum[i+1][j+1],dp[i][j]);
		add(ret,dp[i][j]);
	}
	cout << (ret+1)%mod << endl;
	
	return 0;
}

Measured memory_bytes: 68900
from math import floor,ceil
# 自分の解答(模範解答と同じ)
def myAnswer(A:int,B:int) -> int:
   price = 1
   while True:
      if(floor(price*0.08)==A and floor(price*0.1)==B):
         return price
      elif(floor(price*0.08)>A or floor(price*0.1)>B):
         return -1
      else:
         price+=1
   

def modelAnswer(A:int,B:int) -> int:
   ans = max(ceil(A/0.08),ceil(B/0.1))
   return ans if(floor(ans*0.08)==A and floor(ans*0.1)==B) else -1

def main():
   A,B = map(int,input().split())
   print(modelAnswer(A,B))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h> 

using namespace std;

int main() {

	double r;
	cin >> r;

	cout << fixed;
	cout << setprecision(5);
	cout << r * r*M_PI << " " << 2 * r*M_PI << endl;
}



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

int main() 
{
	long long n,k,q; cin>>n>>k>>q;
	long long a[q];
	vector<int>fr(100001,0);
for(int i=0;i<q;i++)
{
		cin>>a[i];
		fr[a[i]-1]++;
}
int dec=0;
	for(int i=0;i<fr.size();i++)
	{
		dec+=fr[i];
	}
	int res;
	vector<string>r;
	for(int i=0;i<n;i++)
	{
		res=k-dec+fr[i];
		if(res>0){r.push_back("Yes");}
		else{r.push_back("No");}
	}
	for(auto x: r)
	{
		cout<<x<<endl;
	}
}

Measured memory_bytes: 8564
#include<iostream>
using namespace std;
int main(){
int t,a,b,c;
cin>>a>>b>>c;
if(a>b){t=a;a=b;b=t;}
if(b>c){t=b;b=c;c=t;}
if(a>b){t=a,a=b,b=t;}
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}


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

main(){
  long long n,s=0;
  cin>>n;
  for(int i=1;i<n+1;i++){
    if(i%3==0) continue;
    if(i%5==0) continue;
    s = s+i;
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if(S.charAt(3) == S.charAt(2) && S.charAt(4) == S.charAt(5)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
}


Measured memory_bytes: 22996
#include <stdio.h>

int total;

int main(void) {
    int x, max = 0;
    scanf("%d", &x);
    if(x == 1) {
        printf("1\n");
        return 0;
    }
    for(int b = 2; b * b <= x; ++b) {
        total = b;
        while(total * b <= x) total *= b;
        if(max <= total) max = total;
    }
    printf("%d\n", max);
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void){
  
  char	s[4];
  
  scanf("%s",s);
  
  if(s[0]==s[1]){ printf("Bad"); return 0; }
  if(s[1]==s[2]){ printf("Bad"); return 0; }
  if(s[2]==s[3]){ printf("Bad"); return 0; }
  if(s[3]==s[4]){ printf("Bad"); return 0; }
  
  printf("Good");
  return 0;
}

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

public class Main {

    public static void main(String[] args) {
        new Main().solve(System.in, System.out);
    }

    public void solve(InputStream in, PrintStream out) {
        Scanner sc = new Scanner(in);
        String s = sc.next();
        String t = sc.next();
        out.println(t + s);
    }

}


Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>
#include <string>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  int N;
  std::cin >> N;
  if ((N % 1000) % 111 == 0) {
    std::cout << "Yes\n";
    return 0;
  }
  if ((N / 10) % 111 == 0) {
    std::cout << "Yes\n";
    return 0;
  }
  std::cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    int N; cin >> N;
    int check[110] = {};
    FOR(i,1,10){
        FOR(j,1,10){
            check[i*j] = 1;
        }
    }
    if(check[N] == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n: usize = read_as_vec()[0];

    let mut a = read_as_vec::<u64>();

    let num4 = a.iter().filter(|x| **x%4 == 0).count();
    let num2 = a.iter().filter(|x| **x%2 == 0).count() - num4;

    if n/2 <= num4{
        println!("Yes");
        return;
    }
    let n = n - num4*2;

    if n <= num2{
        println!("Yes");
        return;
    }

    println!("No");
}


Measured memory_bytes: 6396
#include <iostream>

using namespace std;

int main(){
	int n,a[10000],q,q1,q2,q3,q3s;
	cin >> n >> q;
	for (int i = 0; i <= n; i++){
		a[i] = i;
	}
	for (int i = 0; i < q; i++){
		cin >> q1 >> q2 >> q3;
		if (q1){
			if (a[q2] == a[q3]){
				cout << 1 << endl;
			} else{
				cout << 0 << endl;
			}
		} else {
			q3s = a[q3];
			for (int j = 0; j <= n; j++){
				if (a[j] == q3s){
					a[j] = a[q2];
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1200
from sys import stdin

a = stdin.readline().rstrip()

b = ["R","U","D"]
c = ["L","U","D"]

for i in range(len(a)):
    if i % 2 == 0:
        if a[i] not in b:
            print("No")
            exit()      
    else:
        if a[i] not in c:
            print("No")
            exit() 
print("Yes")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    string s;
    cin>>s;
    int n = sz(s);

    int cp = 0;
    int cg = 0;     // cp <= cg
    int ans = 0;
    rep(i, n) {
        if (i % 2 == 1 && s[i] != 'p') ans++;
        if (i % 2 == 0 && s[i] != 'g') ans--;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string s; cin >> s;
    string ans = "";
    for(int i = 0; i < s.size(); i += 2) ans += s[i];
    cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<time.h>
#include<random>
#include<string>
#include<cmath>
#include <ctime>
#include<bitset>
#include <cctype>
#define low_bit(x) ((x)&(-(x)))
#define debug cout<<"*********degug**********";
#define index index_
#define int long long
#define RE register
#define yn yn_
using namespace std;
mt19937 rnd(233);
const long long max_ = 3e5 + 7;
const double alpha = 0.75;
const int mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1e18;
int read() {
	int s = 0, f = 1;
	char ch = getchar();
	while (ch<'0' || ch>'9') {
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0'&&ch <= '9') {
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * f;
}
inline int min(int a, int b) {
	return a < b ? a : b;
}
inline int max(int a, int b) {
	return a > b ? a : b;
}
int dfs(int now) {
	if (now == 0 || now == 1)return 1;
	if (now / 2 < 1) {
		return dfs(now / 2) + 1;
	}
	else return dfs(now / 2) * 2 + 1;
}
signed main() {
	int temp = read();
	cout << dfs(temp);
	return 0;
}

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

int main() {
    while(true) {
        int n,r; scanf("%d%d", &n, &r);
        if(n==0) break;

        vector<pair<pair<int,int>,int> > evts(n*4+1);
        for(int i = 0; i < n; i++) {
            int x1,y1,x2,y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
            x1++; y1++; x2++; y2++;
            evts[i*4+0] = make_pair(make_pair(y1, x1), 1);
            evts[i*4+1] = make_pair(make_pair(y1, x2), -1);
            evts[i*4+2] = make_pair(make_pair(y2, x1), -1);
            evts[i*4+3] = make_pair(make_pair(y2, x2), 1);
        }
        evts[n*4] = make_pair(make_pair(10002, 10002), 0);
        sort(evts.begin(), evts.end());

        static int dp[10002];
        fill(dp, dp+10002, 0);
        int fill=0,stroke=0;
        int evtpos = 0;
        for(int y = 1; y < 10002; y++) {
            int amount = 0;
            for(int x = 1; x < 10002; x++) {
                while(evts[evtpos].first == make_pair(y,x)) {
                    amount += evts[evtpos].second;
                    evtpos++;
                }
                int a = (dp[x]>0);
                dp[x] += amount;
                int b = (dp[x]>0);
                stroke += a^b;
                stroke += (dp[x-1]>0)^b;
                fill += b;
            }
        }
        if(r==1)
            printf("%d\n", fill);
        else
            printf("%d\n%d\n", fill, stroke);
    }
    return 0;
}

Measured memory_bytes: 1556
#!/usr/bin/env python3
import sys
import fractions


def solve(A: int, B: int):
    print(A * B //fractions.gcd(A, B))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5176
#include<cstdio>
#include<queue>
#include<cstring>
#include<utility>
using namespace std;
const int N = 100010;
const int M = N << 1;
int dis[N];
int k;
int tot, head[N], pre[M], ver[M], val[M];
int vis[N];
void add(int x, int y, int z) {
  ver[++tot] = y, val[tot] = z, pre[tot] = head[x], head[x] = tot;
}
void build() {
  for(int i = 1; i < k; i++) {
    add(i, (i + 1) % k, 1);
  }
  for(int i = 1; i < k; i++) {
    add(i, (i * 10) % k, 0);
  }

}
int main() {
  scanf("%d", &k);
  build();
  memset(dis, 0x3f, sizeof(dis));
  priority_queue< pair<int, int> > q;
  q.push(make_pair(-1, 1));
  dis[1] = 1;
  while(!q.empty()) {
    int x = q.top().second; q.pop();
    if(vis[x]) continue;
    vis[x] = 1;
    for(int i = head[x]; i; i = pre[i]) {
      int y = ver[i], v = val[i];
      if(dis[y] > dis[x] + v) {
	dis[y] = dis[x] + v;
	q.push(make_pair(-dis[y], y));
      }
    }
  }
  printf("%d", dis[0]);
  return 0;
}


Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
bool comp1(pair<int,int> &a,pair<int,int> &b)
{
    return a.second>b.second;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    ll b=0;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        b^=a[i];
    }
    for(ll i=0;i<n;i++)
    {
        ll ans=b^a[i];
        cout<<ans<<" ";
    }

}

Measured memory_bytes: 5140
#include <iostream>
#include<string>
using namespace std;
int main(void){
    string S;
    cin>>S;
    int T;
    T=700;
    if(S[0]=='o'){
        T=T+100;
    }
    if(S[1]=='o'){
        T=T+100;
    }
    if(S[2]=='o'){
        T=T+100;
    }
    cout<<T<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define ALL(a) (a).begin(), (a).end()
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
#define INF 1e18
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
  return s.find(v) != std::string::npos;
}
ULL mod = 1e9 + 7;

int main()
{
  string s;
  int al[26]={};
  cin >> s;
  rep(i,s.size())
  {
    al[s[i]-'a']++;
  }
  rep(i,26)
  {
    if(al[i]>=2){
      no;
      return 0;
    }
  }
  yes;
}

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

struct data{
    int number, min;
    data(int n, int m) : number(n), min(m){}

    bool operator<(const data other) const {
        return min < other.min;
    }
};

int main(){
    while(true){
        int n, id, m, s;
        cin >> n;

        if(n == 0)  break;

        vector<data> table;
        for(int i = 0; i < n; i++){
            cin >> id;
            int minutes = 0;
            for(int j = 0; j < 4; j++){
                cin >> m >> s;
                minutes += 60*m+s;
            }
            table.push_back(data(id, minutes));
        }

        sort(table.begin(), table.end());

        cout << table[0].number << endl;
        cout << table[1].number << endl;
        cout << table[n-2].number << endl;
    }
}


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

long long gcd(long long x, long long y){
  if(x < y) swap(x,y);
  while(y){
    x %= y;
    swap(x,y);
  }
  return x;
}

int main(){
  long long n, m;
  cin >> n >> m;
  vector<long long> A(n);
  vector<double> P(n);
  for(int i = 0; i < n; ++i) cin >> A[i];
  for(int i = 0; i < n; ++i){
    cin >> P[i];
    P[i] /= 100.0;
  }
  double ans = 0;
  // vector<long long> LCM;
  // vector<double> P_;
  // vector<int> C;
  // LCM.push_back(1);
  // P_.push_back(1.0);
  // C.push_back(0);
  vector<long long> LCM((1<<n)+1);
  vector<double> P_((1<<n)+1);
  vector<int> C((1<<n)+1);
  LCM[0] = 1;
  P_[0] = 1;
  C[0] = 0;
  long long s = 1;
  for(int i = 0; i < n; ++i){
    long long s_ = s;
    for(long long j = 0; j < s; ++j){
      if(LCM[j]/gcd(LCM[j],A[i]) > m/A[i]) continue;
      long long t = LCM[j]/gcd(LCM[j],A[i])*A[i];
      if(t > m) continue;
      double p = P_[j]*P[i];
      int c = C[j] + 1;
      if(c%2) ans += m/t*p;
      else ans -= m/t*p;
      // LCM.push_back(t);
      // P_.push_back(p);
      // C.push_back(c);
      LCM[s_] = t;
      P_[s_] = p;
      C[s_] = c;
      ++s_;
      //cout << t << " " << p << " " << c << endl;
    }
    s = s_;
  }
  printf("%.12f\n",ans);
  return 0;
}



Measured memory_bytes: 23516
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void solve(){
    string s,t;
    cin>>s>>t;
    ll n = s.length();
    ll m = t.length();
    ll mxi = INT_MAX;
    for(int i =0;i<n;i++){
        ll cnt = 0;
        // cout<<s[i]<<" ";
        if(i+m-1<n){
        for(int j =0;j<m && i+j<n;j++){
            if(s[i+j]!=t[j]){
                cnt++;
            }
            // cout<<t[j]<<" \n";
        }
        mxi = min(cnt,mxi);
        }
    }
    cout<<mxi<<'\n';
}
int main(){
    IOS
    int tt;
    tt = 1;
    // cin>>tt;
    while(tt--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3676
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, M = list(map(int, sys.stdin.buffer.readline().split()))
ans = 0
if N > 1:
    ans += N * (N - 1) // 2
if M > 1:
    ans += M * (M - 1) // 2
print(ans)


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

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int cnt  = 0;
  for (int i = 0; i < size; i++) {
    if (i == 0 || i == size - 1) {
      cout << s[i];
      continue;
    }
    cnt++;
    if (i == size - 2) cout << cnt;
  }
  cout << endl;
}

Measured memory_bytes: 256
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    ll a;
    cin >> a;
    cout << a + a*a + a*a*a;
}

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

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll mod=998244353;
using P=pair<ll,ll>;
ll N;
ll dp[400005];
ll dat[1600005];
ll n1;
void init(ll n_){
n1=1;while(n1<=n_)n1*=2;
  for(ll i=0;i<2*n1-1;i++)
    dat[i]=-1;

}
void update(ll k,ll a){
k+=n1-1;
  dat[k]=a;
  while(0<k){
  k=(k-1)/2;
    dat[k]=max(dat[2*k+1],dat[2*k+2]);
  }
}
ll query(ll a,ll b,ll k,ll l,ll r){
if(a<=l && r<=b)
  return dat[k];
  else if(b<=l || r<=a)
    return -1;
  else{
  ll val=query(a,b,2*k+1,l,(l+r)/2);
    ll var=query(a,b,2*k+2,(l+r)/2,r);
    return max(val,var);
  }
}
int main(){
  cin>>N;
  map<ll,ll>M;set<ll>S;
  for(ll i=0;i<N;i++){
  ll x,d;cin>>x>>d;S.insert(x);S.insert(x+d);
    if(M.count(x)){
    if(M.at(x)<x+d)M.at(x)=x+d;
    }else{
    M[x]=x+d;
    }
   }map<ll,ll>m;ll I=1;
  for(auto s:S){
  m[s]=I;I++;
  }ll n=M.size();
  vector<P>A(n);ll J=0;
  for(auto p:M){
  ll l=p.first;ll r=p.second;
    l=m.at(l);r=m.at(r);
    P q(l,r);A[J]=q;J++;
  }dp[n]=1;init(2*N);
  for(ll i=n-1;0<=i;i--){
  ll l=A[i].first;ll r=A[i].second;
    ll t=query(l,r,0,0,n1);
    if(t==-1){
    dp[i]=(2*dp[i+1])%mod;update(l,i+1);
    }else{
    dp[i]=(dp[i+1]+dp[t])%mod;update(l,t);
     }
  }cout<<dp[0]<<endl;
  
}

Measured memory_bytes: 72352
sx,sy,tx,ty = map(int,input().split())
ans = ''
ans += 'R'*(tx-sx) + 'U'*(ty-sy)
ans += 'L'*(tx-sx) + 'D'*(ty-sy)
ans += 'D' + 'R'*(tx-sx+1) + 'U'*(ty-sy+1)+ 'L'
ans += 'U' + 'L'*(tx-sx+1) + 'D'*(ty-sy+1)+ 'R'
print(ans)

Measured memory_bytes: 3060
/**
 *    author:  tourist
 *    created: 28.06.2020 20:30:31       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  if (y >= 2 * x && y <= 4 * x && y % 2 == 0) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}


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

int main(){
    int t;
    char s[100020];
    scanf("%s",&s);
    t=strlen(s);
//dream dreamer erase eraser
    for (int i=0;i<(t-5);i++) {
        if (s[i]=='e' && s[i+1]=='r' && s[i+2]=='a' && s[i+3]=='s' && s[i+4]=='e' && s[i+5]=='r') {
            for (int j=0;j<6;j++) s[i+j]='#';
        }
    }
    for (int i=0;i<(t-4);i++) {
        if (s[i]=='e' && s[i+1]=='r' && s[i+2]=='a' && s[i+3]=='s' && s[i+4]=='e') {
            for (int j=0;j<5;j++) s[i+j]='#';
        }
    }
    for (int i=0;i<(t-6);i++) {
        if (s[i]=='d' && s[i+1]=='r' && s[i+2]=='e' && s[i+3]=='a' && s[i+4]=='m' && s[i+5]=='e' && s[i+6]=='r') {
            for (int j=0;j<7;j++) s[i+j]='#';
        }
    }
    for (int i=0;i<(t-4);i++) {
        if (s[i]=='d' && s[i+1]=='r' && s[i+2]=='e' && s[i+3]=='a' && s[i+4]=='m') {
            for (int j=0;j<5;j++) s[i+j]='#';
        }
    }
    for (int i=0;i<t;i++) {
        if (s[i]!='#') {
            printf("NO\n");
            return 0;
        }
    }
    printf("YES\n");

    return 0;
}


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

int mincost(vector <int> ar, int n, int k){
    vector <int> dp(n+1);
    dp[1] = 0;
    for(int i=2; i<=n; i++){
        dp[i] = INT_MAX;
        for(int j= i - 1; j >= 1 && i - j <= k; j--){
            dp[i] = min(dp[i], abs(ar[i] - ar[j]) + dp[j]);
        }
    }
    return dp[n];
}

int main(){
    int n,k;
    cin >> n >> k;
    vector <int> ar(n+1);
    for(int i=1; i<=n; i++){
        cin >> ar[i];
    }
    cout << mincost(ar,n,k) << endl;
}

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

int main(void){
  
  double ave;
	int arr[8][2];
	int n, i, j;
	scanf("%d",&n);
	
	for(i=0;i<n;i++) scanf("%d %d", &arr[i][0], &arr[i][1]);
	
	for(i=0;i<n-1;i++)
		for(j=i+1;j<n;j++)
			ave+=sqrt(pow(arr[i][0]-arr[j][0],2)+pow(arr[i][1]-arr[j][1],2));
	
	printf("%.7lf\n", ave*2/n);
  return 0;
}


Measured memory_bytes: 128
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    s = in_s()

    if s == s[::-1]:
        print(0)
        exit()

    t = s.replace('x', '')
    if t != t[::-1]:
        print(-1)
        exit()

    f = (s[0] == 'x')
    xnum = []
    count = 0
    s = s + 'a'
    N = len(s)

    for i in range(N):
        if s[i] == 'x':
            if f:
                count += 1
            else:
                count = 1
            f = True
        else:
            if f:
                xnum.append(count)
                count = 0
            else:
                xnum.append(0)
            f = False

    ans = 0
    xn = len(xnum)
    for i in range(xn // 2):
        ans += abs(xnum[i] - xnum[xn - 1 - i])

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9636
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)

inline int read()
{
	int res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	return bo ? ~res + 1 : res;
}

const int N = 405, ZZQ = 1e9 + 7;

int n, c, l[N], r[N], pw[N][N], sum[N][N], a[N][N], f[N][N];

int main()
{
	int i, j, k;
	n = read(); c = read();
	For (i, 1, n) l[i] = read();
	For (i, 1, n) r[i] = read();
	For (i, 0, 400)
	{
		pw[i][0] = 1;
		For (j, 1, 400)
			pw[i][j] = 1ll * pw[i][j - 1] * i % ZZQ;
	}
	For (i, 0, 400)
	{
		sum[i][0] = pw[0][i];
		For (j, 1, 400)
			sum[i][j] = (sum[i][j - 1] + pw[j][i]) % ZZQ;
	}
	For (i, 1, n) For (j, 0, 400)
		a[i][j] = (sum[j][r[i]] - sum[j][l[i] - 1] + ZZQ) % ZZQ;
	f[0][0] = 1;
	For (i, 1, n) For (j, 0, c) For (k, 0, j)
		f[i][j] = (1ll * f[i - 1][k] * a[i][j - k] + f[i][j]) % ZZQ;
	std::cout << f[n][c] << std::endl;
	return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define MOD 1000000007
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define RREP(i,a,b) for(ll i=(a); i>=(b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef int64_t in;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> p;
typedef vector<pair<ll, ll>> vpl;


int main(){
    ll n; cin >> n;
    vl a(n);
    ll sum=0;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    ll heikin = round(sum/(double)n);
    //cout << heikin;
    ll ans=0;
    rep(i,n){
        ans += pow(a[i]-heikin, 2);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 384