akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
int power(int x,int k,int p){int res=1;for(;k;k>>=1,x=1ll*x*x%p)if(k&1)res=1ll*res*x%p;return res;}
const int maxn=1e6+5,mod=1e9+7;
int n,k,ans;
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
vector<int>a;
int f[maxn];
int main(){
	read(n);read(k);
	int tmp=sqrt(n);
	rep(i,1,tmp)if(n%i==0){
		a.pb(i);
		if(n/i!=i)a.pb(n/i);
	}
	sort(All(a));
	ans=f[0]=k;
	rep2(i,1,SZ(a)){
		f[i]=power(k,(a[i]+1)/2,mod);
		rep2(j,0,i)if(a[i]%a[j]==0)f[i]=sub(f[i],f[j]);
		if(a[i]&1)ans=(ans+1ll*f[i]*a[i])%mod;
		else ans=(ans+1ll*f[i]*(a[i]/2))%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define ppi pair<int,pair<int,int> >
#define fr first
#define sc second
#define PI acos(-1)
#define mp make_pair

using namespace std;

#define sim template < class c

#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "



char c[10];
int cnt[26];
int main()
{

    int n; cin >> n;
    map<string ,int>m;
    ll ans = 0;
    for(int i = 0;i<n;i++){
        scanf("%s",c);
        sort(c,c+10);
        ans += m[c]++;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 11136
#include "bits/stdc++.h"

using namespace std;

#define print(s) cout << (s) << endl;
#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n) 
#define all(a) (a).begin(), (a).end()
#define inf 10000000
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b; cin>>a>>b;
    if(a+b>=24){
        cout<<a+b-24<<endl;
    }else{
            cout<<a+b<<endl;
    }
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 8
#define NOT_FREE 1
#define FREE -1
void putQueen(int);
void printBoard(void);
int row[N],col[N],dpos[2*N-1],dneg[2*N-1],A[N][N];
int main ()
{
  int i,j,n,b,c;
  scanf("%d",&n);
   
  for(i=0;i<N;i++)
    {
      row[i]=col[i]=FREE;
      for(j=0;j<N;j++)
    {
      A[i][j]=0;
    }
    }
  for(i=0;i<2*N-1;i++)
    {
      dpos[i]=dneg[i]=FREE;
    }
  for(i=0;i<n;i++)
    {
      scanf("%d%d",&b,&c);
      A[b][c]=2;
    }
  putQueen(0);
  return 0;
}
 
void putQueen(int i)
{
  int j;
  if(i==N)
    {
      printBoard();
      return;
    }
   
  for(j=0;j<N;j++)
    {
      if(col[j]==NOT_FREE||dpos[i+j]==NOT_FREE||dneg[i-j+N-1]==NOT_FREE) continue;
       
      row[i]=j;
      col[j]=dpos[i+j]=dneg[i-j+N-1]=NOT_FREE;
      putQueen(i+1);
      col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
    }
}
 
void printBoard(void)
{
  int i,j;
  for(i=0;i<N;i++)
    {
      for(j=0;j<N;j++)
    {
      if(A[i][j])
        {
          if(row[i]!=j) return;
        }
    }
    }
  for(i=0;i<N;i++)
    {
      for(j=0;j<N;j++)
    {
      if(row[i]==j) printf("Q");
      else printf(".");
    }
      printf("\n");
    }
}



Measured memory_bytes: 2700
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, m;
    cin >> n >> m;
    priority_queue<int> que;
    rep(i, n)
    {
        int a;
        cin >> a;
        que.push(a);
    }
    rep(i, m)
    {
        int a = que.top();
        que.pop();
        que.push(a / 2);
    }
    int ans = 0;
    while (!que.empty())
    {
        int a = que.top();
        que.pop();
        ans += a;
    }
    cout << ans << endl;
}

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define m_p make_pair

ll cnt(string s,string t){
    ll num = 0;
    bool founds,foundt;
    for(char c='a';c<='z';c++){
        founds = foundt = false;
        rep(i,s.size()){
            if(c==s[i]) founds = true;
        }
        rep(i,t.size()){
            if(c==t[i]) foundt = true;
        }
        if(founds && foundt) num++;
    }
    return num;
}

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

    ll n,ans=0,tmp;
    string s;
    cin >> n >> s;
    rep(i,n-1){
        tmp = cnt(s.substr(0,i+1),s.substr(i+1));
        ans = max(ans,tmp);
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

vector<vector<ll>> v(666);
ll n, m;
double dp[666];

double dfs(int node, int ignore){
	if(node == n - 1)return 0;
	if(dp[node] != 0)return dp[node];
	double ret = 0;
	double ma = 0;
	REP(i, v[node].size()){
		double tmp = dfs(v[node][i], ignore);
		ret += tmp;
		ma = max(ma, tmp);
	}

	if(node == ignore && v[node].size() > 1){
		return dp[node] = ((ret - ma) / (int)(v[node].size() - 1)) + 1.;
	}
	else {
		return dp[node] = (ret / (int)(v[node].size())) + 1.;
	}
}

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

	cin >> n >> m;
	REP(i, m){
		ll a, b;cin >> a >> b;
		a--;b--;
		v[a].PB(b);
	}

	double ans = INF;
	REP(i, n){
		REP(i, n)dp[i] = 0;
		ans = min(ans , dfs(0, i));
	}

	cout << Decimal << ans << endl;

	return 0;
}


Measured memory_bytes: 2560
/*Author : Prokash
           JU CSE 48
           CF: epiprokash
           UVa: epiprokash
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i,j;
    string a,b,c;
    cin>>n>>a>>b;
    for(i=0,j=0;i<2*n;i++)
    {
        if(i%2==0)
        {
            c[i]=a[j];
        }
        else
        {
            c[i]=b[j];
            j++;
        }
    }
    for(i=0;i<2*n;i++)
    {
        cout<<c[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
a,b,k=map(int,input().split())
if a+k >= b:
    ans = [i for i in range(a,b+1)]
else:
    ans = []
    for i in range(k):
        ans.append(a+i)
        ans.append(b-i)
    ans = sorted(set(ans))
for x in ans:
    print(x)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cctype>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<algorithm>
using namespace std;

#define LL long long
#define LLU unsigned long long
#define re return(0)
#define pi 2*acos(0.0)

const int infinity=100000000000;

int main()
{
    LL a,b;
    while(cin>>a>>b)
    {
        LL sum,ans;
        sum=a+b;
        ans=0;
        while(sum>0)
        {
            ans++;
            sum/=10;
        }
        cout<<ans<<endl;
    }
    re;
}

Measured memory_bytes: 1156
import math
PI = math.pi
EPS = 0.0000000001

a, b, x = map(int, input().split())

def f(a, b, theta):
    # theta = pi/2-theta
    if a * math.tan(theta) <= b:
        return a * a * b - a * a * a * math.tan(theta) / 2
    else:
        return b * b / math.tan(theta) * a / 2


def solve():
    ok = PI / 2
    ng = 0.0
    for _ in range(100000):
        mid = (ok+ng) / 2
        if f(a, b, mid) < x:
            ok = mid
        else:
            ng = mid
    print(ok/PI*180)    

solve()

Measured memory_bytes: 38896
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

int samu(int n,int a,int b){
    int ret = 0;
    int ans = n;
    while(n>0){
        ret += n%10;
        n /= 10;
    }
    return a<=ret&&ret<=b?ans:0;
}

signed main(){
    int n,a,b;
    cin >> n >> a >> b;
    int ans = 0;
    REP1(i,n) ans += samu(i,a,b);
    cout << ans << endl;
    return 0;
}

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

int main() {
  int K;
  cin >> K;
  long long ans = 0;
  for (int a = 1; a <= K; a++) {
    for (int b = 1; b <= K; b++) {
      for (int c = 1;c <= K; c++) {
        ans += gcd(a, gcd(b, c));
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
ABC = list(map(int, input().split()))
cnt_5 = 0
cnt_7 = 0
for e in ABC:
  if e == 5: cnt_5 += 1
  if e == 7: cnt_7 += 1
 
if cnt_5 == 2 and cnt_7 == 1:
  print("YES")
else:
  print("NO")



Measured memory_bytes: 2940
using System;

namespace AOJ0055
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) break;

                decimal sum = 0.00000000M;
                sum = decimal.Parse(input) * 211 / 27;

                Console.WriteLine(sum);
            }
        }
    }
}

Measured memory_bytes: 9216
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')



def solve():
    
    

    # for _ in range(ii()):
        
        
    a=ii()
    print(a+a*a+a*a*a)
        














        
if __name__ =="__main__":

    if path.exists('input.txt'):
        sys.stdin=open('input.txt', 'r')
        sys.stdout=open('output.txt','w')
    else:
        input=sys.stdin.readline
    solve()


Measured memory_bytes: 68116
use io::*;
use std::cmp::max;

fn maxp(a: (i64, i64), b: (i64, i64)) -> (i64, i64) {
    if a.0 > b.0 {
        (a.0, max(a.1, b.0))
    } else {
        (b.0, max(a.0, b.1))
    }
}

fn solve(pos: usize, p: usize, tbl: &mut Vec<Vec<(i64, i64)>>, a: &Vec<i64>) -> (i64, i64) {
    if pos >= tbl.len() {
        return (a[p],-1);
    }

    if tbl[pos][p].0 >= 0 {
        return tbl[pos][p];
    }

    let ret = solve(pos+1,p, tbl, a);
    let ret = if p&(1<<pos) != 0 {
        maxp(ret, solve(pos+1, p&!(1<<pos),tbl,a))
    } else {ret};

    tbl[pos][p] = ret;
    ret
}

fn main() {
    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let a: Vec<i64> = sc.next_vec(1 << n);

    let mut tbl: Vec<Vec<(i64, i64)>> = vec![vec![(-1, -1); 1<<n]; n];

    let mut ans = 0;

    for k in 1..1 << n {
        // println!("* k: {}", cnv(k));
        let t = solve(0, k, &mut tbl, &a);
        ans = max(ans, t.0 + t.1);
        println!("{}", ans);
    }
}

//-----

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin >> t;
    if(t>=30){
        cout << "Yes" ;
    }else{
        cout << "No" ;
    }
    return 0;
}


Measured memory_bytes: 3652
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 5e3 + 10, MOD = 1e9 + 7;
const ll OO = 2e18;
int n, m;
int a[N][N], b[N][N];
int k;
string s;
long long compute_hash(string const& s) {
	const int p = 31;
	const int m = 1e9 + 9;
	long long hash_value = 0;
	long long p_pow = 1;
	for (char c : s) {
		hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
		p_pow = (p_pow * p) % m;
	}
	return hash_value;
}
int main() {
	cin >> n;
	cin >> s;
	int mx = 0;

	// first is from [ i - > mid ] .. the second is from [mid - > n ] 

	// so we shoud make a move 
	for (int i = 0; i < s.size(); ++i) {
		const int p = 31, p2 = 47;
		const int m = 1e9 + 9, m2 = 1e9 + 7;
		long long hash_value = 0, hash_value2 = 0;
		long long p_pow = 1, p_pow2 = 1;
		for (int j = i; j < s.size(); ++j) {
			hash_value = (hash_value + (s[j] - 'a' + 1) * p_pow) % m;
			hash_value2 = (hash_value2 + (s[j] - 'a' + 1) * p_pow2) % m;
			p_pow = (p_pow * p) % m;
			p_pow2 = (p_pow2*p2) % m;
			a[i][j - i + 1] = hash_value;
			b[i][j - i + 1] = hash_value2;
		}
	}


	for (int i = 0; i < n; ++i) {
		for (int j = i; j < n; ++j) {

			int left = 0, right = j - i;
			while (left <= right) {
				int mid = (left + right) / 2;
				if (a[i][mid] == a[j][mid] && b[i][mid] == b[j][mid]) {
					mx = max(mx, mid);
					left = mid + 1;
				}
				else {
					right = mid - 1;
				}
			}
		}
	}
	cout << mx << endl;
}

Measured memory_bytes: 195072
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll a,b,c,k;
  cin >> a >> b >> c >> k;
  ll ans = 0;
  ans += min(a,k);
  k -= a;
  if(k>0) {
    k -= b;
  }
  if(k>0) {
    ans -= k;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n,k;
int main(){
    cin>>n>>k;
    vector<long long> yoyo(n);
    for(int i=0;i<n;i++){
        cin>>yoyo[i];
    }
    vector<long long> dp(n,0);
    for(int i=1;i<n;i++){
        dp[i]=LLONG_MAX;
        for(int j=i-1;j>=max(i-k,0);j--){
            dp[i]=min(dp[i],abs(yoyo[i]-yoyo[j])+dp[j]);
        }
    }
    cout<<dp[n-1]<<endl;
}


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

int main(){
  int n,m;
  cin >>n>>m;
  if (n==m)cout<<"Yes"<<endl;
  else cout <<"No"<<endl;
}


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

int main()
{
    int X, Y, A, B, C, a = 0, b = 0, c = 1;
    unsigned long long int sum = 0;
    bool a_ = true, b_ = true;
    cin >> X >> Y >> A >> B >> C;

    vector<int> p(A), q(B), r(C);

    rep(i, A)
    {
        cin >> p.at(i);
    }
    rep(i, B)
    {
        cin >> q.at(i);
    }
    rep(i, C)
    {
        cin >> r.at(i);
    }

    sort(p.begin(), p.end());
    sort(q.begin(), q.end());
    sort(r.begin(), r.end());

    rep(i, C)
    {
        if (C - c >= 0)
        {
            if (p.at(A - X + a) > q.at(B - Y + b))
            {
                if (q.at(B - Y + b) < r.at(C - c))
                {
                    q.at(B - Y + b) = r.at(C - c);
                    b++;
                    c++;
                    if (B - Y + b == B)
                    {
                        b--;
                        b_ = false;
                    }
                }
            }
            else if (p.at(A - X + a) <= q.at(B - Y + b))
            {
                if (p.at(A - X + a) < r.at(C - c))
                {
                    p.at(A - X + a) = r.at(C - c);
                    a++;
                    c++;
                    if (A - X + a == A)
                    {
                        a--;
                        a_ = false;
                    }
                }
            }
        }
    }

    rep(i, X)
    {
        sum += p.at(A - i - 1);
    }

    rep(i, Y)
    {
        sum += q.at(B - i - 1);
    }

    cout << sum << endl;
}


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

int main(){
	int N, K;
	cin >> N;
	cin >> K;
	int x[N], i;
	for(i=0; i<N; i++){
		cin >> x[i];
	}
	
	int sum=0;
	
	for(i=0; i<N; i++){
		if(x[i]-0 < abs(K-x[i]))	sum += x[i];
		else			sum += abs(K-x[i]);
	}
	
	cout << 2*sum << endl;
}


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

int main() {
  int N;
  cin >> N;
  int count=1;

  vector<string> s(N);

  for(int i=0; i<N; i++){
    cin >> s.at(i);
  }

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

  for(int i=1; i<N; i++){
    if(s.at(i-1) < s.at(i)){
      count++;
    }
  }

  cout << count << endl;

  return 0;
}


Measured memory_bytes: 9576
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int T = scanner.nextInt();
    int ans = 1001;
    for (int i = 0; i < N; i++) {
      int c = scanner.nextInt();
      int t = scanner.nextInt();
      if (t <= T && c < ans) ans = c;
    }
    scanner.close();
    if (ans == 1001) {
      System.out.println("TLE");
    } else {
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

template <typename T>
struct BIT {
    int siz;
    vector<T> bit;

    BIT(int N) : siz(N + 1), bit(siz) {}

    void add(int k, T x) {
        while (k < siz) {
            bit[k] += x;
            k += (k & -k);
        }
    }

    T sum(int k) {
        T res(0);
        while (k > 0) {
            res += bit[k];
            k -= (k & -k);
        }
        return res;
    }
};

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

    ll N, D, A;
    cin >> N >> D >> A;
    vector<pll> p(N);
    for (int i = 0; i < N; ++i)
        cin >> p[i].first >> p[i].second;
    sort(p.begin(), p.end());

    BIT<ll> bit1(N + 1), bit2(N + 1);

    auto add = [&](int a, int b, ll x) -> void {
        bit1.add(a, -x * (a - 1));
        bit1.add(b + 1, x * b);
        bit2.add(a, x);
        bit2.add(b + 1, -x);
    };

    auto getsum = [&](int k) -> ll {
        return bit1.sum(k) + bit2.sum(k) * k;
    };

    for (int i = 0; i < N; ++i)
        bit1.add(i + 1, p[i].second);

    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        ll val = getsum(i + 1) - getsum(i);
        if (val <= 0)
            continue;
        ll cnt = (val + A - 1) / A;
        int idx = lower_bound(p.begin(), p.end(), pll{p[i].first + 2 * D, INT_MAX}) - p.begin();
        add(i + 1, idx, -cnt * A);
        ans += cnt;
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 9484
from collections import defaultdict


def main():
    height, width, target_count = [int(x) for x in input().split()]
    count_by_height = defaultdict(int)
    count_by_width = defaultdict(int)
    bomb_locations = set()
    for _ in range(target_count):
        h, w = [int(x) - 1 for x in input().split()]
        count_by_height[h] += 1
        count_by_width[w] += 1
        bomb_locations.add((h, w))
    max_h = max(v for v in count_by_height.values())
    max_w = max(v for v in count_by_width.values())
    max_h_index = [i for i, x in count_by_height.items() if x == max_h]
    max_w_index = [i for i, x in count_by_width.items() if x == max_w]
    no_cross = any((h, w) not in bomb_locations
                   for h in max_h_index for w in max_w_index)
    return max_h + max_w - (not no_cross)


if __name__ == '__main__':
    print(main())


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

// #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
// #define FORR(i, a, b) for (int i = (a); i > (b); --i)
// #define REP(i, n) for (int i = 0; i < (n); ++i)
// #define REPR(i, n) for (int i = n; i >= 0; i--)
// #define FOREACH(x, a) for (auto &(x) : (a))
// #define VECCIN(x)            \
// 	for (auto &youso_ : (x)) \
// 	cin >> youso_
// #define mp make_pair
// #define bitcnt __builtin_popcount
// #define All(a) (a).begin(), (a).end()
// template <typename T = long long>
// inline T IN()
// {
// 	T x;
// 	cin >> x;
// 	return (x);
// }
// inline void CIN() {}
// template <class Head, class... Tail>
// inline void CIN(Head &&head, Tail &&... tail)
// {
// 	cin >> head;
// 	CIN(move(tail)...);
// }
// #define CINT(...)    \
// 	int __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define LCIN(...)   \
// 	ll __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define SCIN(...)       \
// 	string __VA_ARGS__; \
// 	CIN(__VA_ARGS__)
// #define Yes(a) cout << (a ? "Yes" : "No") << "\n"
// #define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
// typedef vector<int> V;
// typedef vector<ll> VL;
// typedef pair<int, int> P;
// typedef pair<ll, ll> PL;
// typedef priority_queue<int> PQ;
// typedef priority_queue<int, V, greater<int>> PQG;

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

int a, b;
int n;
vector<ll> sum;

int main()
{
	cin >> a >> b >> n;
	sum.resize(1001);
	for (int i = 0; i < n; i++)
	{
		int s, f;
		cin >> s >> f;
		sum[s]++;
		sum[f]--;
	}
	for (int i = 0; i < 1001; i++)
	{
		sum[i + 1] += sum[i];
	}
	for (int i = a; i < b; i++)
	{
		if (sum[i] > 0)
		{
			cout << 1 << "\n";
			return 0;
		}
	}
	cout << 0 << "\n";
	return 0;
}


Measured memory_bytes: 3128
#include <iostream> 
#include <cstdio> 
#include <fstream> 
#include <algorithm> 
#include <cmath> 
#include <deque> 
#include <vector> 
#include <queue> 
#include <string> 
#include <cstring> 
#include <map> 
#include <stack> 
#include <set> 
typedef  long long ll;
const int  maxn = 2e5 + 10;
using namespace std;
int n, m;

int main()
{
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &m);
		if (m != i)
		{
			ans++;
		}
	}
	if (ans > 2)
	{
		printf("NO");
	}
	else
	{
		printf("YES");
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  long long a, b, k;
  cin >> a >> b >> k;
  if (k < a){
    cout << a - k << " " << b << "\n";
  }
  else if (k > a + b){
    cout << 0 << " " << 0 << "\n";
  }
  else {
    cout << 0 << " " << a + b - k << "\n";
  }

}

Measured memory_bytes: 504
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;


int main(){
    map<int,int> cnt;
    for(int i = 0; i < 3; i++){
        int A;
        cin >> A;
        cnt[A]++;
    }
    if(cnt[5] == 2 and cnt[7] == 1) puts("YES");
    else puts("NO");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

/*
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/STACK: 20000000005")
*/

using namespace std;

const ll N = 200005, MOD = 1e9 + 7;

int n;

double C = 1;

double x, ans;

main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> x;
        x = C / x;
        ans += x;
    }
    ans = C / ans;
    printf ("%.8f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  cout << n * (n + 1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
s=input()
K=int(input())

l=len(s)
ans=0

if K==1:
  Ls=list(s)
  for n in range(1,l):
    if Ls[n]==Ls[n-1]:
      ans+=1
      Ls[n]=str(n)
elif K==2:
  Ls=list(s+s)
  for n in range(1,2*l):
    if Ls[n]==Ls[n-1]:
      ans+=1
      Ls[n]=str(n)
else:
  ansA=0
  ansB=0
  ansC=0
  Ls=list(s+s+s)
  for n in range(1,l):
    if Ls[n]==Ls[n-1]:
      ansA+=1
      Ls[n]=str(n)
  for n in range(l,2*l):
    if Ls[n]==Ls[n-1]:
      ansB+=1
      Ls[n]=str(n)
  for n in range(2*l,3*l):
    if Ls[n]==Ls[n-1]:
      ansC+=1
      Ls[n]=str(n)
  if Ls[0]==Ls[l]:
    ans=ansA*K
  elif Ls[0]!=Ls[l] and Ls[0]==Ls[2*l]:
    if K%2==0:
      ans=(ansA+ansB)*(K//2)
    else:
      ans=(ansA+ansB)*(K//2)+ansA
  else:
    ans=ansA+ansB*(K-1)
print(ans)
  

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

#define MOD (1000000000+7)

long long power( long long x, int n )
{
	long long res = 1;
	while( n > 0 ) {
		if( n % 2 ) res = res * x % MOD;
		x = x * x % MOD;
		n /= 2;
	}
	return res;
}

int main()
{
	int N;
	cin >> N;
	vector<long long> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	vector<vector<int>> a( N + 1, vector<int>( 60 ) );
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j < 60; j++ ) {
			a[i + 1][j] = a[i][j] + (A[i] >> j & 1);
		}
	}
	vector<long long> b( 60 );
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j < 60; j++ ) {
			int nb = a[N][j] - a[i + 1][j];
			if( A[i] >> j & 1 ) {
				b[j] += N - 1 - i - nb;
			}
			else {
				b[j] += nb;
			}
          	b[j] %= MOD;
		}
	}
	long long ans = 0;
	for( int i = 0; i < 60; i++ ) {
		ans += power( 2, i ) * b[i] % MOD;
		ans %= MOD;
	}

	cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy";
  } else if (s == "Cloudy") {
    cout << "Rainy";
  } else {
    cout << "Sunny";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
    int n;
    scanf("%d", &n);
    vector<int> p(n);
    rep(i, n) scanf("%d", &p[i]);
    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    p[0] /= 2;
    int ans = 0;
    rep(i, n) ans += p[i];
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }

    int cnt = 0;
    for (int i = 0; i < N - 1; i++) {
        if (a[i] == a[i + 1]) {
            cnt++;
            i++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define inf 1000000000
int MAX=52;
int n,m;
int a[52];
int b[52];
int dp[52][52][52][52][2][3];
int min(int x,int y){
    if(x<y) return x;
    else return y;
}
int max(int x,int y){
    if(x<y) return y;
    else return x;
}
int dfs(int l0, int r0, int l1, int r1, int turn, int pass, int p0, int p1) {
    //int ret = dp[l0][r0][l1][r1][turn][pass];
    //if (ret != inf && ret != -inf) return ret;
    int ret=dp[l0][r0][l1][r1][turn][pass];
    if (ret != inf && ret != -inf) return ret;
    //if(~dp[l0][r0][l1][r1][turn][pass])return dp[l0][r0][l1][r1][turn][pass];
    if (!turn) {
        ret=-inf;
        // stackに積む場合
        if (r0 < n) {
            if (a[r0] > 0) {
                // 得点カードを積む場合
                ret = max(ret, dfs(l0, r0 + 1, l1, r1, turn^1, 0, p0 + a[r0], p1));
            } else {
                // 妨害カードを積む場合
                ret = max(ret, dfs(l0, r0 + 1, l1, r1, turn^1, 0, p0, 0));
            }
        }
        // パスする場合
        if (l0 == r0 && l1 == r1) {
            // stackが空のとき
            if (pass == 0) {
                ret = max(ret, dfs(r0, r0, r1, r1, turn^1, 1, 0, 0));
            } else if (pass == 1) {
                ret = max(ret, 0ll);
            }
        } else {
            // stackが空でないとき
            ret = max(ret, dfs(r0, r0, r1, r1, turn^1, 0, 0, 0) + p0 - p1);
        }
    } else {
        ret=inf;
        // stackに積む場合
        if (r1 < m) {
            if (b[r1] > 0) {
                // 得点カードを積む場合
                ret = min(ret, dfs(l0, r0, l1, r1 + 1, turn^1, 0, p0, p1 + b[r1]));
            } else {
                // 妨害カードを積む場合
                ret = min(ret, dfs(l0, r0, l1, r1 + 1, turn^1, 0, 0, p1));
            }
        }
        // パスする場合
        if (l0 == r0 && l1 == r1) {
            // stackが空のとき
            if (pass == 0) {
                ret = min(ret, dfs(r0, r0, r1, r1, turn^1, 1, 0, 0));
            } else if (pass == 1) {
                ret = min(ret, 0ll);
            }
        } else {
            // stackが空でないとき
            ret = min(ret, dfs(r0, r0, r1, r1, turn^1, 0, 0, 0) + p0 - p1);
        }
    }
    
    return dp[l0][r0][l1][r1][turn][pass]=ret;
}
int main(void){
    scanf("%d%d",&n,&m);
    rep(i,n) scanf("%d",&a[i]);
    rep(i,m) scanf("%d",&b[i]);
    rep(i,MAX) rep(j,MAX) rep(k,MAX) rep(l,MAX) rep(p,2) rep(q,3) {
        dp[i][j][k][l][p][q] = (!p ? -inf : inf);
    }
    printf("%d\n",dfs(0,0,0,0,0,0,0,0));
}



Measured memory_bytes: 173228
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#include <fstream>
#define rep(i, n) for (int i = 0; i < n; i++)
#define PI 3.14159265358979323846
#define MOD 1000000007
using namespace std;
using ll = long long;

const int MAX = 1000000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

template <class T> struct cord{
  T x,y;
};

template <class T> double dist(cord<T> a, cord<T> b){
  T dx=a.x-b.x;
  T dy=a.y-b.y;
  return sqrt(dx*dx+dy*dy);
}

int main()
{

  //cout << fixed << setprecision(10);
  
  int a,b; cin >> a >>b;
  cout << ceil((a+b)/2.0);

  return 0;
}


Measured memory_bytes: 256
H,W,N,*as=$<.read.split.map(&:to_i)

ret = Array.new(H) { Array.new(W,0)}

k = 0
c = as[k]
d = true
H.times do |i|
  W.times do |j|
    j_ = d ? j : (W-1-j)
    ret[i][j_] = k+1
    c -= 1
    if c == 0
      k += 1
      c = as[k]
    end
  end
  d = !d
end

puts ret.map{|l|l.join(" ")}.join("\n")


Measured memory_bytes: 2556
from math import gcd


def main():
    N = int(input())
    A = list([int(x) for x in input().split()])

    max_a = max(A)

    before = 0
    result = [0 for _ in range(max_a + 1)]

    for i in A:
        before = gcd(before, i)
        result[i] += 1

    is_pairwise = True
    for i in range(2, max_a + 1):
        cnt = 0
        for j in range(i, max_a + 1, i):
            cnt += result[j]

        if cnt > 1:
            is_pairwise = False
            break

    if is_pairwise:
        print('pairwise coprime')
        exit()

    if before == 1:
        print('setwise coprime')
    else:
        print('not coprime')


if __name__ == '__main__':
    main()


Measured memory_bytes: 133180
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = (ll)1e9 + 7;

const int N = 2020;
int n;
ll k;
int a[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%lld", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	ll ans = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			if (a[i] <= a[j]) continue;
			ans += k * (k - 1) / 2;
			if (i < j) ans += k;
			ans %= MOD;
		}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
a,b = map(int,input().split())
f = [1]
while(b!=0):
  a,b=b,a%b
while a%2==0:
  f.append(2)
  a//=2
p = 3
while p*p<=a:
  if a%p==0:
    f.append(p)
    a//=p
  else:
    p+=2
if a!=1:
  f.append(a)
print(len(set(f)))

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = sc.nextInt();
        
        int ln = s.length();
        char c = s.charAt(0);
        boolean all_same = true;
        int count=1, borderF=1, borderL=0, pos=0;
        long ans=0;
        
        if(c == s.charAt(ln-1)){
            for(int i=1; i<ln-1; i++){
                if(c != s.charAt(i)){
                    all_same = false;
                    break;
                }
            }
            if(all_same){
                ans = ln*k/2;
            }else{
                for(int i=1; i<ln; i++){
                    if(c == s.charAt(i)){
                        borderF++;
                    }else{
                        c = s.charAt(i);
                        pos=i;
                        break;
                    }
                }
                for(int i=pos+1; i<ln; i++){
                    if(c == s.charAt(i)){
                        count++;
                    }else{
                        ans += count/2;
                        c = s.charAt(i);
                        count = 1;
                    }
                }
                borderL = count;
                ans *= k;
                long borderAns = (borderL+borderF)/2;
                borderAns *= (k-1);
                ans += borderAns;
                ans += (borderF/2);
                ans += (borderL/2);
            }
        }else{
            for(int i=1; i<ln; i++){
                if(c == s.charAt(i)){
                    count++;
                }else{
                    ans += count/2;
                    c = s.charAt(i);
                    count = 1;
                }
            }
            ans += count/2;
            ans *= k;
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
import sys
from operator import itemgetter
input = sys.stdin.readline

N = int(input())
A = [0]*N
work = 0
for i in range(N):
    A[i] = list(map(int, input().split()))
A.sort(key=itemgetter(0))
A.sort(key=itemgetter(1))

for i in range(N):
    work += A[i][0]
    if work > A[i][1]:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 53636
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
#define inf  100000000000000000
# define M_PI           3.14159265358979323846  /* pi */

int main(){
    string a,b;
    cin>>a>>b;
    int n=a.size();
    int m=b.size();
    vector<string> A(n,""),J(m,""),AJ(m,"");

    if(a[0]==b[0]){
        A[0]+=a[0];
        J[0]+=a[0];}
    for(int i=0;i<1;i++)
        for(int j=1;j<m;j++)
            if(J[j-1].size()>0)
                J[j]=J[j-1];
            else if(a[i]==b[j])
                J[j]+=a[i];
    for(int i=0;i<1;i++)
        for(int j=1;j<n;j++)
            if(A[j-1].size()>0)
                A[j]=A[j-1];
            else if(a[j]==b[i])
                A[j]+=a[j];


//        for(int e=0;e<m;e++)cout<<J[e]<<" ";
//        cout<<endl;
    for(int i=1;i<n;i++){
    for(int j=1;j<m;j++){
            AJ[0]=A[i];

        if(a[i]==b[j]){
            AJ[j]=J[j-1];
            AJ[j]+=a[i];
            //cout<<i<<" "<<j<<" "<<AJ[j]<<endl;
        }
        else {
            if(AJ[j-1].size()>J[j].size())
                AJ[j]=AJ[j-1];
            else AJ[j]=J[j];
        }
//        for(int e=0;e<m;e++)cout<<i<<"* "<<AJ[e]<<" ";
//        cout<<endl;
    }
        J=AJ;
        AJ.clear();
        AJ=vector<string> (m,"");
    }
    cout<<J[m-1];
    return 0;
}


Measured memory_bytes: 16772
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#include <random>
#include <chrono>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll d;
vector<ll> c(26 + 1, 0);
vector<vector<ll>> s(365 + 1, vector<ll>(26 + 1, 0));

ll scoring(vector<int> t)
{
    ll ans = 0;
    vector<ll> last(26 + 1, 0);

    for (int i = 1; i <= d; i++)
    {
        ans += s[i][t[i]];
        ans -= c[t[i]] * (i - last[t[i]]) * (i - last[t[i]] - 1) / 2;
        last[t[i]] = i;
    }

    for (int i = 1; i <= 26; i++)
    {

        ans -= c[i] * (d - last[i] + 1) * (d - last[i]) / 2;
    }

    return ans;
}

int main(void)
{
    random_device seed_gen;
    mt19937 rand(seed_gen());
    cin >> d;

    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }

    for (int i = 1; i <= d; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
        }
    }

    vector<int> BestT(d + 1, 1);

    for (int i = 1; i <= d; i++)
    {
        BestT[i] = rand() % 26 + 1;
    }

    double BestScore = scoring(BestT);
    double score;

    auto start = chrono::system_clock::now();
    vector<int> t(d + 1, 1);

    double T0 = 1e6;
    double T1 = 5e2;
    double TL = 1980;
    double msec;

    ll count = 0;

    while (1)
    {
        if (count % 100 == 0)
        {
            msec = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - start).count();
        }

        if (msec >= TL)
        {
            break;
        }

        double T = powf(T0, 1 - msec / TL) * powf(T1, msec / TL);

        t = BestT;

        for (int i = 0; i < 5; i++)
        {
            t[rand() % d + 1] = rand() % 26 + 1;
        }

        score = scoring(t);

        double p = exp((score - BestScore) / T);

        if (p > 0.5)
        {
            BestT = t;
            BestScore = score;
        }

        count++;
    }

    for (int i = 1; i <= d; i++)
    {
        printf("%d\n", BestT[i]);
    }
}


Measured memory_bytes: 4424
import java.io.*;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException
	{
		
		int tmp;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String s = br.readLine();
		StringTokenizer st = new StringTokenizer(s, " ");
		int W = Integer.parseInt(st.nextToken());
		int H = Integer.parseInt(st.nextToken());
		int x = Integer.parseInt(st.nextToken());
		int y = Integer.parseInt(st.nextToken());
		int r = Integer.parseInt(st.nextToken());
		
		if(x >= r && x <= W-r && y >= r && y <= H-r)
			System.out.println("Yes");
		else 
			System.out.println("No");
	}		
}

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

int main () 
{
  int a,b,c,d;
  
  scanf("%d %d %d %d",&a,&b,&c,&d);

  while (1)
  {
  	c=c-b;
  	if ( c<=0 )
    {
    	printf("Yes");
    	return 0;
    }
    
    a=a-d;
    if ( a<=0 )
    {
    	printf("No");
      	return 0;
    }
        
  }

}

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

int main(){
	int n,m;
	cin >> n>>m;
	vector<int>a(n);
	int sum = 0;
	rep(i,m){
		cin >> a[i];
		sum+= a[i];
	}
	if(n-sum >=0)cout << n-sum << endl;
	else cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 7212