akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long int ulli;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
/* TUMSE NAA HO PAAYEGA HAR DO DIN MAI LAGEGA
   LEKIN RUKNE KA NAHI :P */

int main() {
	// your code goes here
	FASTIO
	ll n;
	cin >> n;
	vector<vector<ll>> v(n,vector<ll>(2));
	for(ll i=0;i<n;i++){
	    cin >> v[i][0] >> v[i][1];
	}
	ll plusmax=INT_MIN,plusmin=INT_MAX,minusmax=INT_MIN,minusmin=INT_MAX;
	ll xplusmax,yplusmax,xplusmin,yplusmin,xminusmax,yminusmax,xminusmin,yminusmin;
	for(ll i=0;i<n;i++){
	    if(v[i][0]-v[i][1]>minusmax){
	        minusmax=v[i][0]-v[i][1];
	        xminusmax=v[i][0];
	        yminusmax=v[i][1];
	    }
	    if(v[i][0]-v[i][1]<minusmin){
	        minusmin=v[i][0]-v[i][1];
	        xminusmin=v[i][0];
	        yminusmin=v[i][1];
	    }
	    if(v[i][0]+v[i][1]>plusmax){
	        plusmax=v[i][0]+v[i][1];
	        xplusmax=v[i][0];
	        yplusmax=v[i][1];
	    }
	    if(v[i][0]+v[i][1]<plusmin){
	        plusmin=v[i][0]+v[i][1];
	        xplusmin=v[i][0];
	        yplusmin=v[i][1];
	    }
	}
	ll dist1 = abs(xplusmin - xplusmax) + abs(yplusmin - yplusmax);
	ll dist2 = abs(xminusmin - xminusmax) + abs(yminusmin - yminusmax);
	ll dist = max(dist1,dist2);
	cout << dist << endl;
	return 0;
}


Measured memory_bytes: 14264
#include <iostream>
#include<set>
using namespace std;
int main() {
   string st;
   cin >>st ;
   
   set<char> s;
   for(int i=0;i<4;i++)
   {
       s.insert(st[i]);
   }
   if(s.size()!=2)
    cout<<"No";
    else
    { int c1=0,c2=0,k=0;
        for(char i:s)
        {   
            for(int j=0;j<4;j++)
            {   
                if(k==0){
                if(i==st[j])
                 c1++;
                }
                else
                {
                    if(i==st[j])
                    c2++;
                }
               //k++;
            }
            k++;
        }
        if(c1==2 && c2==2)
        cout<<"Yes";
        else cout<<"No";
    }
}


Measured memory_bytes: 256
n=io.read("*n","*l")
v={}
for i=1,n do
    x=io.read("*n")
    if i%2==1 then
        if not v[x] then
            v[x]={1,0}
        else
            v[x][1]=v[x][1]+1
        end
    else
        if not v[x] then
            v[x]={0,1}
        else
            v[x][2]=v[x][2]+1
        end
    end
end

omax={0,0}
emax={0,0}
omax2={0,0}
emax2={0,0}
for k,_ in pairs(v) do
    if omax[1]<=v[k][1] then
        omax={v[k][1],k}
    end
    if emax[1]<=v[k][2] then
        emax={v[k][2],k}
    end
end
for k,_ in pairs(v) do
    if k~=omax[2] then
        if omax2[1]<=v[k][1] then
            omax2={v[k][1],k}
        end
    end
    if k~=emax[2] then
        if emax2[1]<=v[k][2] then
            emax2={v[k][2],k}
        end
    end
end

if omax[2]==emax[2] then
    print(n-math.max(omax2[1]+emax[1],omax[1]+emax2[1]))
else
    print(n-omax[1]-emax[1])
end

Measured memory_bytes: 35168
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<ll, ll>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;
const ll MAX = 1000005;

ll ans;
bool isprime[MAX];
vector<pair<long, long> > vv;

void prime_factrization(long long n) {

	for (long long _p = 2; _p*_p<=n; _p++) {
        long long _c = 0;
		if (n % _p == 0) {
			while (n % _p == 0) {
				_c++;
				n /= _p;
			}
             vv.pb(mp(_p ,_c));
		}
       
	}
	
	if (n > 1) vv.pb(mp(n, 1));
	return;
}

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


      prime_factrization(N);

    for (auto x : vv) {

        ll xx = x.second;
        ll j = 1;
        while (xx-j>=0) {
            xx -= j;
            j++;
            ans++;
        }
    }

     



  
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 3640
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
   input! {s:chars};
   for i in 0..s.len()-8 {
       print!("{}", s[i]);
   }
   println!("");
}


Measured memory_bytes: 4352
#include<stdio.h>

int main(void){

int a,b,c,d,e,f,g,h,ss,st;

scanf("%d %d %d %d",&a,&b,&c,&d);
scanf("%d %d %d %d",&e,&f,&g,&h);

ss = a+b+c+d;
st = e+f+g+h;

if(ss >= st){
printf("%d\n",ss);
}

else if(st > ss){
printf("%d\n",st);
}

return 0;
}


Measured memory_bytes: 2112
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            Integer[] map = new Integer[200000];
            Arrays.fill(map, 0);
            for (int i = 0; i < n; i++) {
                int a = in.nextInt();

                map[a]++;
            }

            Arrays.sort(map, Comparator.reverseOrder());
            int index = 1;
            int cnt = 0;
            for (int element : map) {
                if (element != 0) {
                    if (index <= k) {
                        index++;
                    } else {
                        cnt += element;
                    }
                }
            }

            out.print(cnt);

        }

    }
}



Measured memory_bytes: 84820
#include<stdio.h>
#include<string.h>
#include<algorithm>
const int MAXL = 1e4 + 10;
using namespace std;
char str[MAXL];
char substr[5 * MAXL][10];
int id[5 * MAXL];
int m;
bool cmp(int a, int b) {
	return strcmp(substr[a], substr[b]) < 0;
}
int main() {
	while (scanf("%s", str) != EOF) {
		int L = strlen(str);
		scanf("%d", &m);
		int cnt = 0;
		for (int j = 0; j < m; j++) {
			for (int i = 0; i < L - j; i++) {
				for (int k = 0; k <= j; k++) {
					substr[cnt][k] = str[i + k];
				}
				substr[cnt++][j + 1] = 0;
			}
		}
 
		for (int i = 0; i < cnt; i++) {
			id[i] = i;
		}
 
		sort(id, id + cnt, cmp);
 
		int t = 0;
		while (m  > 1 && t < cnt) {
			while (t + 1 < cnt && strcmp(substr[id[t]], substr[id[t + 1]]) == 0)
				t++;
      //printf("%d -> %s\n", m, substr[id[t]]);
			m--;
			t++;
		}
		printf("%s\n", substr[id[t]]);
	}
	return 0;
}

Measured memory_bytes: 512
#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>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  mint ans = 0;
  mint col = m;
  for (int x = n-1; x >= 0; --x) {
    mint now = col;
    now *= c(n-1,x);
    if (x <= k) ans += now;
    col *= m-1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6228
import sys
sys.setrecursionlimit(1000000)

sosuu = [False,False] + [True for i in range(300000)]

for i in range(300000):
	if sosuu[i]:
		for j in range(i**2,300000,i):
			sosuu[j] = False
ruisekiwa = [0,0]
for i in range(2,300000):
	if sosuu[i]:
		ruisekiwa.append(ruisekiwa[i-1]+1)
	else:
		ruisekiwa.append(ruisekiwa[i-1])

def main():
	n = int(input())
	if n == 0:
		return
	print(ruisekiwa[2*n]-ruisekiwa[n])
	main()
	return
main()


Measured memory_bytes: 12852
import java.io.*;

class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();

    int n = Integer.parseInt(br.readLine());
    String[] str = br.readLine().split(" ");

    for (int i = n - 1; i >= 0; i--){
      if (i > 0)
        sb.append(str[i] + " ");
      else if (i == 0)
        sb.append(str[i]);  
    }
    System.out.println(sb);
  }
}

Measured memory_bytes: 24192
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
///////////////////////___combination___////////////////////
vector<ll> fac, finv, inv;
void COMinit(const int MAX = 5000000, const ll &MOD = MOD){
  fac.resize(MAX);finv.resize(MAX);inv.resize(MAX);
  fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
  repd(i,2,MAX){
    fac[i] = fac[i-1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}
ll 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;
}

///////////////////////////////////////////////////////////
int n,a[210000];
signed main(){
  cin>>n;bool b = true;
  rep(i,n)cin>>a[i];
  int ans = a[n-1], m = a[n-1]-1;
  for(int i = n-2;i >= 0;i--){
    if(m > a[i] || m > i){
      b = false;
    }
    if(a[i+1] != a[i]+1){
      ans += a[i];
    }
    m--;
  }
  if(b && a[0] == 0)cout << ans << endl;
  else cout << -1 << endl;
}



Measured memory_bytes: 1792
#include<iostream>
#include<cassert>
using namespace std;
#define N 8
#define FREE -1
#define NOT_FREE 1
int row[N], col [N], dpos[2 * N - 1], dneg[2 * N - 1];
bool X[N][N];
void initialize() {
for(int i = 0; i < N; i++ ){row[i] = FREE, col[i] = FREE; }
for(int i=0; i<2* N - 1; i++ ){ dpos[i] = FREE; dneg[i] = FREE;}
}
void printBoard(){
for (int i = 0; i< N; i++ ){
for (int j = 0; j < N; j++ ){
if (X[i][j]){
if (row[i] != j)return;
}
}
}
for (int i = 0; i < N; i++ ){
for (int j = 0; j < N; j++ ){ cout << ((row[i] == j)? "Q":".");}
cout << endl;
}
}
void recursive(int i){
if (i == N){ // クイーンの配置に成功
printBoard(); return;
}
for(int j = 0; j< N; j++ ){
// (i,j)が他のクイーンに襲撃されている場合は無視
if( NOT_FREE == col[j] ||
NOT_FREE == dpos[i + j] ||
NOT_FREE == dneg[i - j + N - 1] ) continue;
//(i,j)にクイーンを配置する
row[i] = j; col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
// 次の行を試す
recursive(i + 1);
// (i, j)に配置されているクイーンを取り除く
row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
// クイーンの配置に失敗
}
}
int main(){
initialize();
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++ ) X[i][j] = false;
int k; cin >> k;
for (int i = 0; i<k; i++ ){
int r, c; cin >>r >> c;
X[r][c] = true;
}
recursive(0);
return 0;    
}




Measured memory_bytes: 3128
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int A=stdIn.nextInt();
		int B=stdIn.nextInt();
		int C=stdIn.nextInt();
		if(C*A<=B)
			System.out.println(C);
		else
			System.out.println(B/A);
	}

}

Measured memory_bytes: 23124
s = input()
n = len(s)
rs = sorted(s)
cnt = 0
ans = 'no'
for i in range(0, n-1):
    if rs[i] != rs[i+1]:
        cnt += 1
        if cnt == n-1:
            ans = 'yes'
            print(ans)
            exit()
print(ans)


Measured memory_bytes: 8984
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vvi vector<vi>
#define mii map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 998244353
#define all(v) v.begin(), v.end()

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k, sum=0, i;
    cin>>n>>k;
    vi p(n);
    for (i=0; i<n; i++)
        cin>>p[i];
    sort(p.begin(), p.end());
    for (i=0; i<k; i++)
        sum+=p[i];
    cout<<sum;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll k,n;
    cin>>k>>n;
    ve <ll> arr(n);
    rep (i,0,n)
    {
        cin>>arr[i];
    }
    ll diff=k-arr[n-1]+arr[0];
    rep (i,1,n)
    {
        diff=max(diff,arr[i]-arr[i-1]);
    }
    cout<<k-diff<<"\n";
}


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

using namespace std;

typedef long long ll;

const int maxn = 1e5 + 100, inf = 1e9 + 100;



int main()
{
    #ifdef ONPC
    ifstream cin("a.in");
    ofstream cout("a.out");
    #else
    //ifstream cin("gift.in");
    //ofstream cout("gift.out");
    #endif // ONPC
    ios::sync_with_stdio(0);
    ll x;
    cin >> x;
    ll l = 0, r = x + 1;
    while (r - l > 1){
        ll m = (l + r) / 2;
        if (m * (m + 1) / 2 >= x)
            r = m;
        else
            l = m;
    }
    cout << r;
}


Measured memory_bytes: 256
def chmax(a, b):
    if a < b:
        a = b
        return a
    else:
        return a


n, w = map(int, input().split())
ls = [[int(_) for _ in input().split()] for _ in range(n)]

dp = [[0] * (w + 1) for _ in range(n + 1)]

for i in range(1, n + 1):
    for sumw in range(w + 1):
        if sumw + ls[i - 1][0] <= w:
            dp[i][sumw + ls[i - 1][0]] = chmax(dp[i][sumw + ls[i - 1][0]], dp[i - 1][sumw] + ls[i - 1][1])
        
        dp[i][sumw] = chmax(dp[i][sumw], dp[i - 1][sumw])

print(dp[n][w])

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

int main()
{
	long double a,b,c;
  	long double eps=1e-14;
	cin>>a>>b>>c;
	if(sqrt(a)+sqrt(b)+eps<sqrt(c)) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <numeric>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <deque>
#include <bitset>
#include <cstring>
#include <sstream>
#include <complex>

#define f first
#define s second
#define ll long long
#define ld double
#define pb push_back
#define all(x) x.begin(),x.end()
#define mp make_pair
#define y0 eto
#define y1 mezhdy
#define y2 nami
#define left extermination
#define right dismemberment
 
using namespace std;
 
double start_moment = 0;
double get_runtime() { return 1.0*clock()/CLOCKS_PER_SEC; }
void reset_timer() { start_moment = get_runtime(); }
double timer_time() { return get_runtime() - start_moment; }
void runtime(){cout<<fixed<<setprecision(5)<<get_runtime()<<'\n';}
 
typedef pair<ll,ll> pii;
typedef pair<ll,ll> pll;
 
template <class T>void read(vector<T> &a,ll n){T x; a.clear();for(ll i=0;i<n;i++){cin>>x;a.pb(x);}}
template <class T>void write(vector<T> &a){for(T x : a) cout<<x<<' ';cout<<'\n';}

const int N=200005;

int n,m;
vector<int> g[N];
int used[N];
int cnt;

void dfs(int u)
{
    cnt++;
    used[u]=1;
    for(int to : g[u])
        if(!used[to])
            dfs(to);
}

int main()
{
    ios_base::sync_with_stdio(0);
//    freopen("INPUT.txt","r",stdin);
//    freopen("OUTPUT.txt", "w", stdout);
    
    int res=0;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    
    for(int i=1;i<=n;i++)
        if(!used[i])
        {
            cnt=0;
            dfs(i);
            res=max(res,cnt);
        }
    
    cout<<res;
    
    
}


Measured memory_bytes: 21140
import java.io.*;

class Main{
 public static void main(String[] args)throws IOException{

  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  String str = br.readLine();
  String[] strAry = str.split(" ");
  int a = Integer.parseInt(strAry[0]);
  int b = Integer.parseInt(strAry[1]);
  
  if(a>b){
  
     System.out.println("a > b");

  }else if(a<b){
     
     System.out.println("a < b");     

  }else{

    System.out.println("a == b");
  }
  
 }
}

Measured memory_bytes: 24276
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());

        System.out.println(Math.max(A + B, Math.max(A - B, A * B)));
    }
}


Measured memory_bytes: 21844
import java.io.*;

class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      int[] array = new int[n];
      int putnum = 0;
      while(true){
    	  String str = br.readLine();
    	  array[putnum] = Integer.parseInt(str);
    	  if(++putnum == n)break;
      }
      
      System.out.println(String.valueOf(getMaxNumber(array)));
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static int getMaxNumber(int array[]){
	  int maxNumber = Integer.MIN_VALUE;
	  int minNumber = array[0];
	  for(int i = 1;i < array.length;++i){
		  final int divide = array[i] - minNumber;
		  
		  if(divide > maxNumber){
			  maxNumber = divide;
		  }
		  
		  if(minNumber > array[i]){
			  minNumber = array[i];
		  }
	  }
	  return maxNumber;
  }
}

Measured memory_bytes: 42980
#include<iostream>
using namespace std;
int main() {
	int a,ne[3],n, ans;
	ans = 1;
	n = 0;
	for (int i = 1; i <= 4; i++) {
		cin >> a;
		for (int z = 1; z <= n; z++) {
			if (ne[z] == a) {
				ne[z] = -1;
				goto a;
			}
		}
		if (n <= 1) {
			n = n + 1;
			ne[n] = a;
			goto a;
		}
		ans = 0;
	a:;
	}
	if (ans==1) {
		cout << "yes" << endl;
	}
	else {
		cout << "no" << endl;
	}
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define all(v) v.begin(),v.end()
#define mp make_pair
#define mm(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define fto(k,m) for(auto k:m)
#define in_edges(m) repp(i, 1, m){ ll a, b; cin >> a >> b; adj[a].pb(b), adj[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define MOD 1000000000000000007
#define pii 3.14159265358979323846
int main()
{
	    // freopen("in.txt","r",stdin);
	    // freopen("out","w",stdout);
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	    ll t;t=1;
	    // cin >> t;
	    while(t--)
	    {
			cout.precision(22);
			long double n; cin >> n;
			cout << 2*pii*n;

		}
}


Measured memory_bytes: 3816
from collections import deque

N, M, Q = map(int, input().split())

point = [list(map(int, input().split())) for _ in range(Q)]


def A_generator():
    q = deque()
    q.append([1])
    while len(q) > 0:
        a = q.pop()
        if len(a) < N + 1:
            for i in range(a[-1], M + 1):
                q.append(a + [i])
        else:
            yield a


ans = 0

for A in A_generator():
    point_sum = 0
    for p in point:
       if A[p[1]] - A[p[0]] == p[2]:
            point_sum += p[3]

    ans = max(ans, point_sum)

print(ans)

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

using namespace std;

struct obj{
	long long w, v;
};

int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);

	int N, W;
	cin >> N >> W;

	vector<obj>v(N);
	for(auto &i : v) cin >> i.w >> i.v;

	vector<vector<long long>> dp(N, vector<long long>(W+1, -1));
	dp[N-1][W] = 0;
	dp[N-1][W-v[N-1].w] = v[N-1].v;

	for(int i=N-2; i>=0; i--)
		for(int j=0; j <= W; j++){
			dp[i][j] = max(dp[i][j], dp[i+1][j]);
			if(j-v[i].w >= 0 && dp[i+1][j] != -1)
				dp[i][j-v[i].w] = max(dp[i][j-v[i].w], dp[i+1][j] + v[i].v);
		}

	long long ans = 0;
	for(auto i : dp)
		ans = max(ans, *max_element(i.begin(), i.end()));
	cout << ans;
}


Measured memory_bytes: 79488
n,m=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
a=[]
for i in range(m-1):
    a.append(abs(x[i+1]-x[i]))
a.sort()
al=sum(a)
if n==1:
    print(al)
else:
    a_skip=sum(a[-n+1:])
    print(al-a_skip)

Measured memory_bytes: 20504
n = int(input())
L = list(map(int,input().split()))
L.sort()
L2 = []
ans = 0
import bisect
for i in range(n-2):
    for j in range(i+1, n-1):
        index = bisect.bisect_left(L,  L[i] + L[j])
        ans += index - j - 1
print(ans)



Measured memory_bytes: 3188
n, k = map(int,input().split())
 
a=list(map(int,input().split()))
 
mod = 1000000007
 
need = (k * (k + 1)) // 2
need2 = ((k - 1) * k) // 2
ans = 0
 
freq = []
before = []
for i in range(0, 3000):
	freq.append(0)
	before.append(0)
	
 
for i in range(0, n):
	for j in range(i + 1, n):
		if(a[i] > a[j]):
			freq[i] += 1
			
	j = i - 1
	while j >= 0:
		if(a[i] > a[j]):
			before[i] += 1
		j -= 1
		
	ans += (freq[i] * need)
	ans += (before[i] * need2)
	ans %= mod
 
#print(ans)
print(ans % mod)

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

int main() {
	int L, R, d;
	cin >> L >> R >> d;
	int total = 0;
	for (int i = L; i < R + 1; i++) {
		if (i % d == 0) {
			total++;
		}
		else {
			continue;
		}
	}
	cout << total << endl;
}



Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class Main {
    public static void main(final String[] args) throws IOException {
        new Main().run();
    }

    private void run() throws IOException {
        boolean b = true;
        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        while (b) {
            b = runOnce(reader);
        }

        reader.close();
    }

    private boolean runOnce(final BufferedReader reader) throws IOException {
        final String[] params = reader.readLine().split(" ");
        final int count = Integer.parseInt(params[0]);
        final int length = Integer.parseInt(params[1]);
        if (count == 0 && length == 0) return false;
        final List<Ant> list = new ArrayList<>(count);
        for (int i = 0; i < count; i++) {
            final Ant a = new Ant(reader.readLine().split(" "), i + 1);
            list.add(a);
        }
        exec(list, length);
        return true;
    }

    private void exec(final List<Ant> ants, final int length) {
        List<Ant> deleted = new ArrayList<>();
        int count;
        for (count = 0; !ants.isEmpty(); count++) {
            deleted = update(ants, length);
        }

        final int index = (deleted.size() == 2) ? (deleted.get(0).left ? deleted.get(0).index : deleted.get(1).index) : deleted.get(0).index;
        System.out.println(count + " " + index);
    }

    private List<Ant> update(final List<Ant> ants, final int length) {
        final Map<Integer, Ant> map = new HashMap<>();
        final ArrayList<Ant> outList = new ArrayList<>();
        for (final Ant ant : ants) {
            ant.position = ant.left ? ant.position - 1 : ant.position + 1;
            if (map.containsKey(ant.position)) {
                final Ant ant1 = map.get(ant.position);
                ant1.left = !ant1.left;
                ant.left = !ant.left;
            }
            map.put(ant.position, ant);
            if (ant.position == 0 || ant.position == length) {
                outList.add(ant);
            }
        }
        ants.removeAll(outList);
        return outList;
    }

    class Ant {
        int position;
        int index;
        boolean left;

        Ant(final String[] params, final int index) {
            this.position = Integer.parseInt(params[1]);
            this.left = params[0].equals("L");
            this.index = index;
        }
    }
}

Measured memory_bytes: 28556
N, A, B, C = map(int,input().split())
INF = 10 ** 9
L = []
for _ in range(N):
    L.append(int(input()))

def dfs(cur, a, b, c):
    if cur == N:
        return abs(A - a) + abs(B - b) + abs(C - c) - 30 if min(a, b, c) > 0 else INF

    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a+L[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b+L[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c+L[cur]) + 10
    return min(ret0, ret1, ret2, ret3)

print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,T;
int main(){
    cin >> N >> T;
    ll sum = 0;
    int tp,s;
    cin >> s;
    rep1(i,N-1){
        cin >> tp;
        if(tp >= s+T) sum += T;
        else sum += tp-s;
        s = tp;
    }
    pr(sum+T);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else {
    if(z->key < y->key)y->left=z;
    else y->right=z;
  }
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
   if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else;
  }

  return 0;
}



Measured memory_bytes: 25176
N = int(input())
B = list(map(int,input().split()))
#A = [B[0]]
i = 0
sum = B[0]
while(i < N-2):
  tuika = min(B[i],B[i+1])
  #A.append(tuika)
  sum += tuika
  i += 1
#A.append(B[i])
sum += B[i]
print(sum)

Measured memory_bytes: 3064
s=str(input())
can=0
ans=int(0)
for i in range(len(s)):
    if s[i]=='A':
        can=1
    
    if can:
        ans+=1

for i in range(len(s)):
    if s[len(s)-i-1]=='Z':
        print(ans)
        break
    else:
        ans-=1

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

// stack -> vectorを用いて実装できる！！！

int top = 0;
vector<int> st(300);
void push(int a){
    
    st[top] = a;
    top++;
}

int pop(){
    
    top--;
    return st[top];
}

int main(void){
    
    string c;
    while (cin >> c){
        int a, b;
        
        if (c == "+"){
            a = pop();
            b = pop();
            push(a+b);
        }
        else if (c == "-"){
            b = pop();
            a = pop();
            push(a-b);
        }
        else if (c == "*"){
            a = pop();
            b = pop();
            push(a*b);
        }
        else push(stoi(c));
    }
    
    
    cout << pop() << endl;
}




Measured memory_bytes: 3176
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-1,1,-1):
  for j in range(i-1,0,-1):
    ans+=j-bisect.bisect_right(l,l[i]-l[j],hi=j)
print(ans)

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

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int N;
    cin >> N;
    if ( N % 2 == 1) {
      cout << 0 << endl;
      return 0;
    }
    int deonominator = 10LL;
    int sum = 0LL;
    for (int i = 0LL; i < 48; i++) {
      sum += N / deonominator;
      deonominator *= 5;
    }
    cout << sum << endl;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int x;
    cin >> x;
    int ans = 8 - (x - 400) / 200;
    cout << ans << endl;
}

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

const int MOD=1000000007;

int main() {
  int n; cin>>n;
  vector<int> a(n);
  rep(i, n) cin>>a[i];

  ll res=1;
  vector<int> x(3, 0);
  rep(i, n) {
    int cnt=0;
    rep(j, 3) if (a[i]==x[j]) cnt++;
    res*=cnt;
    res%=MOD;
    rep(j, 3) {
      if (a[i]==x[j]) {
        x[j]++;
        break;
      }
    }
  }
  cout<<res<<endl;
}


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

int N[4];

int main() {
    for (int i = 0; i < 4; i++) cin >> N[i];

    sort(N, N+4);
    
    if (N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9+7;


const ll M = 16;
ll counter(int x) {
	if (x == 0) return 0;
	return counter(x >> 1) + (x & 1);
}
int main() {
	ll n, a[M] = {}; cin >> n;
	ll x[M][M], y[M][M];
	repe(i, 1, n) {
		cin >> a[i];
		repe(j, 1, a[i]) {
			cin >> x[i][j] >> y[i][j];
		}
	}

	ll ans = 0;
	for (int b = 0; b < 1 << n; b++) {
		bool ok = true;
		repe(i, 1, n) {
			if (!(b & (1 << (i - 1))))continue;
			
			repe(j, 1, a[i]) {
				if (((b >> (x[i][j] - 1)) & 1) ^ y[i][j]) ok = false;
			}
		}

		if (ok) ans = max(ans, counter(b));
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, f[33];
int main() {
	f[1] = 1, f[2] = 2, f[3] = 5;
	for (int i = 4; i <= 30; i++) {
		if (i & 1) {
			f[i] = 4;
			for (int j = 1; j < i / 2; j++) f[i] *= 3;
			f[i] += f[i - 2];
		}
		else {
			f[i] = 1;
			for(int j = 1; j < i / 2; j++) f[i] *= 3;
			f[i] += f[i - 1];
		}
	}
	while (cin >> n) {
		cout << f[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
n = int(input())

a_list = []
person_list = []
syogen_list = []
ans = 0

for i in range(0, n):
    w = []
    v = []
    a = int(input())
    for j in range(0, a):
        x,y = map(int,input().split())
        w.append(x)
        v.append(y)
    person_list.append(w)
    syogen_list.append(v)
#print(person_list)
#print(syogen_list)

for bit in range(1 << n):
    break_flag = 0
    bit_1_cnt = 0
    for i in range(n):
        #print(bin(bit))
        if break_flag:
            break
        if (bit >> i) & 1: #人iが正直
            for j in range(len(syogen_list[i])):
                if syogen_list[i][j] != ((bit>>(person_list[i][j]-1))&1): #矛盾　：　正直としているのに証言が食い違えばbreak
                    break_flag = 1
                    #print("1_break",bit>>(person_list[i][j]-1))
                    break
#                if j == len(syogen_list[i])-1:
#                    bit_1_cnt += 1
#        else: #人iが嘘つき
#            for j in range(len(syogen_list[i])):
#                if syogen_list[i][j] == ((bit>>(person_list[i][j]-1))&1):
#                    break_flag = 1
#                    #print("0_break")
#                    break
        if break_flag==0 and i==n-1:
            #ans = max(ans, bit_1_cnt)
            ans = max(ans, bin(bit).count("1"))
            #print(bin(bit), bit_1_cnt)
            #print("correct")
print(ans)


Measured memory_bytes: 9156
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
#define PI 3.14159265358979323846L
using namespace std;

int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

	int A,B,H,M;
	cin>>A>>B>>H>>M;
	H=H*60+M;
	M=M*12;
	cout<<fixed;
	cout<<setprecision(11);
	cout<<sqrt(A*A+B*B-2*A*B*cos(abs(H-M)*2*PI/(12*60)))<<endl;
	return 0;
}


Measured memory_bytes: 4180
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#pragma GCC optimize ("O2")
#pragma GCC optimize ("tree-vectorize")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class BPalindromePhilia {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        string S;
        in>>S;
        int N = LEN(S), ans = 0;
        REP(i, N/2){
            if(S[i]!=S[N-i-1]) ++ans;
        }
        out<<ans<<'\n';
    }
};


int main() {
	BPalindromePhilia solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3660
n = gets.chomp.to_i
num = [0]
for d in 1..n do
    num << gets.chomp.to_i
end
num.sort!
compare = num[0]
count = 0
for d in 1..n do
    if num[d] > compare
        count += 1
        compare = num[d]
    end
end
puts count

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

const double eps = 1e-9;
int N;
int a[20];
vector<double> v;

bool equals(double s, double t) {
  return fabs(s-t) < eps;
}

double cost(int s, int t) {
  return (double)abs(s-t)/s;
}

bool rec(int bx, int k, double lim) {
  if(k == N) return true;
  for(int b = bx; ; b += bx) {
    double newV = cost(a[k], b);
    if(newV < lim || equals(newV, lim)) {
      if(rec(b, k+1, lim)) return true;
    } else {
      if(a[k] < b) break;
      else continue;
    }
  }
  return false;
}

double solve() {
  v.push_back(0.0);
  for(int m = 1; m <= 100000; ++m) {
    for(int i = 0; i < N; ++i) {
      v.push_back((double)m/a[i]);
    }
  }
  sort(v.begin(), v.end());
  int l = 0;
  int r = v.size();
  int ansi = 0;
  while(l < r) {
    int m = (l+r)/2;
    if(rec(1, 0, v[m])) {
      ansi = r = m;
    } else {
      l = m+1;
    }
  }
  return v[ansi];
}

int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> a[i];
  printf("%.12f\n", solve());
  return 0;
}

Measured memory_bytes: 16000
mod = 998244353

n, s = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0 for _ in range(s + 1)] for _ in range(n + 1)]
dp[0][0] = 1
for i, num in enumerate(a, start = 1):
    for j in range(s + 1):
        dp[i][j] = (dp[i - 1][j] * 2) % mod
        if j - num >= 0:
            dp[i][j] += dp[i - 1][j - num]

print(dp[-1][-1] % mod)

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int N, A, B; cin >> N >> A >> B;
    string S; cin >> S;
    int a = 0;
    int b = 0;
    REP(i, N) {
        if ((a + b >= A + B) || (S[i] == 'b' && b >= B) || (S[i] == 'c')) {
            cout << "No" << "\n";
            continue;
        }

        cout << "Yes" << "\n";
        if (S[i] == 'a') {
            a++;
        } else if (S[i] == 'b') {
            b++;
        }
    }
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <queue>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
typedef long long ll;
typedef pair <int,ll> pii;
int a[55];
int n;

int main(void)
{
  ll x,y;
  cin >> x >> y;
  if(x%y==0 || x==y)
    {
      cout << -1 << endl;
      return 0;
    }
  else
    {
      if(y%x==0)
	{
	  cout << x << endl;
	}
      else
	{
	  int i=2;
	  while((x*i)%y==0)
	    {
	      i++;
	    }
	  cout << x*i << endl;
	}
	  return 0;
    }
}


Measured memory_bytes: 256
S = list(str(input()))
ls = len(S)
a = [1]*ls
for i in range(ls-2):
    if S[i] == S[i+1] == "R":
        a[i+2] += a[i]
        a[i] = 0
for i in range(ls)[::-1]:
    if S[i] == S[i-1] == "L":
        a[i-2] += a[i]
        a[i] = 0
print(" ".join(map(str, a)))

Measured memory_bytes: 11180
#include<stdio.h>

int main(){
  int A[100],i,j,k,temp,cnt=0;
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&A[i]);
  }
  for (i = 0;i < k-1 ;i++) {
    for (j = 0;j < k-1 ;j++) {
      if (A[j + 1] < A[j]) {
	temp = A[j];
	A[j] = A[j + 1];
	A[j + 1] = temp;
	cnt++;
      }
    }
  }
    
    
    for(i=0;i<k;i++){
      if(i)printf(" ");
      printf("%d",A[i]);
    }
    printf("\n");
  printf("%d\n",cnt);
  return 0;
  }
  



Measured memory_bytes: 2104
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools

def j(q):
    if q==1: print("Heisei")
    else:print("TBD")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

def swap(s,pos):
    s[pos]-=1
    s[pos+1]+=1
    print(s)
    if pos == n-2: return s
    if s[pos+2] == 0: swap(s,pos+1)
    return s


#n = ip()                              #入力整数1つ
#h,w= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
l = []
for i in range(n):
    l.append(ip())
if a in l and b in l and c in l:
    print(0)
    exit(0)
l.sort()
req = [a, b,c]
m  =set()
set = [0 for i in range(n)]
set[0] = -1
while sum(set) < n*3:
    while sum(set) < n*3:
        d = 0
        set[d]+=1
        while set[d] == 4:
            set[d]=0
            d+=1
            set[d]+=1
        if 0 in set and 1 in set and 2 in set: break
    if sum(set) != n*3:
        s = [0,0,0,0]
        mi = 0
        for i in range(n):
            s[set[i]]+= l[i]
        for i in range(3):
            mi += abs(s[i] - req[i]) + (set.count(i)-1) * 10
        m.add(mi)
print(min(m))

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

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

int main() {
    //cout.precision(11);
    int n, m;
    cin >> n >> m;
    vector<pair<ll, int>> pair(n);
    
    for(int i = 0; i < n; i++){
        cin >> pair[i].first >> pair[i].second;
    }

    sort(pair.begin(), pair.end());
    ll ans = 0;
    vector<ll>::iterator iter;
    for(int i = 0;i < n; i++){   
        ans += pair[i].first * min(m, pair[i].second);
        m -= min(m, pair[i].second);
        if(m == 0) break;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792