akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void  solve(){
  int n;
  cin>>n;
  double x,ans=0;
  string y;
  rep(i,0,n){
    cin>>x>>y;
    if(y=="JPY") ans+=x;
    else ans+= x*380000.0;
  }
  cout<<fixed<<setprecision(6)<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3756
//
// Created on 2020/05/31.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    ll a;
    double b;
    cin>>a>>b;
    ll l_b = (b*100) + 0.5;

    ll ans = a * l_b / 100;

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3716
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
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);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    string s;
    cin >> s;
    int n = s.size();
    int st, en;
    REP(i, n) {
        if (s[i] == 'A') {
            st = i;
            break;
        }
    }
    RREP(i, n - 1) {
        if (s[i] == 'Z') {
            en = i;
            break;
        }
    }
    cout << en - st + 1 << endl;
    return 0;
}


Measured memory_bytes: 640
// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int n;
int[] a;

void main() {
    scan(n);
    a = readln.split.to!(int[]);

    auto b = new int[](0);

    bool sw = false;
    int k = n - 1;

    foreach (i ; 0 .. n) {
        if (k < 0) {
            k = n & 1;
            sw = true;
        }

        if (sw) {
            b ~= a[k];
            k += 2;
        }
        else {
            b ~= a[k];
            k -= 2;
        }

    }

    writefln("%(%s %)", b);
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 12784
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int sum = 0;
  sum += (a + 9) / 10 * 10;
  sum += (b + 9) / 10 * 10;
  sum += (c + 9) / 10 * 10;
  sum += (d + 9) / 10 * 10;
  sum += (e + 9) / 10 * 10;
  sum -= max({(10 - a % 10) % 10, (10 - b % 10) % 10, (10 - c % 10) % 10, (10 - d % 10) % 10, (10 - e % 10) % 10});
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int x[110];
int y[110];
int h[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",x+i,y+i,h+i);
	}
	for(int i=0;i<=100;i++)for(int j=0;j<=100;j++)for(int l=0;l<a;l++){
		bool ok=true;
		int val=h[l]+ABS(i-x[l])+ABS(j-y[l]);
		for(int k=0;k<a;k++){
			if(max(0,val-ABS(i-x[k])-ABS(j-y[k]))!=h[k])ok=false;
		}
		if(ok){
			printf("%d %d %d\n",i,j,val);return 0;
		}
	}
}


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

int main(){
    string s;
    cin >> s;

    long long n = s.size();


    long long cnt[300] = {};
    for(int i = 0;i < n;i++){
        cnt[s[i]]++;
    }

    long long ans = n*(n-1)/2 + 1;

    for(int i = 'a';i <= 'z';i++){
        ans -= cnt[i]*(cnt[i]-1)/2;
    }

    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 640
use std::io;
use std::io::Read;
use std::collections::HashMap;

fn main() -> io::Result<()>{

    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer)?;

    let split: Vec<&str> = buffer.split_ascii_whitespace().collect();
    let N: usize = split[0].parse().unwrap();
    //println!("N={}", N);
    let K: usize = split[1].parse().unwrap();
    //println!("N={} K={}", N,K);

    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer)?;
    // println!("buf={}", buffer);

    let A: Vec<usize> = buffer.split_ascii_whitespace().map(|s| s.parse::<usize>().unwrap() - 1).collect();
    // for i in A {
    //     println!("{}", i)
    // }

    let mut B:Vec<usize> = Vec::new(); // 移動する町をシーケンシャルに並べたものB[0]の次はB[1]へ行く。
    let mut C : HashMap<usize, usize> = HashMap::new(); // 町がBのどのindexに出現したか
    let mut cur = 0;
    for i in 0..N {
        if C.contains_key(&cur) { // ループを発見
            let first = C.get(&cur).unwrap();
            let last = i;
//            println!("found loop {}, {}", first, last);

            if K < last {
                println!("{}", B[K] + 1);
                return Ok(())
            } else {
                let ofs = (K - *first) % (last - *first);
                println!("{}", B[*first + ofs] + 1);
                return Ok(())
            }
        }

        B.push(cur);
        C.insert(cur, i);

  //      println!("->{}",cur);

        cur = A[cur];
    }

    // ループしていない
    println!("{}", B[K] + 1);

    Ok(())
}


Measured memory_bytes: 12268
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <math.h>
using namespace std;

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

    int A,B;
    cin>>A>>B;

    if(A>=10 || B>=10){
        cout<<-1<<"\n";
    }else{
        cout<<A*B<<"\n";
    }

    return 0;

}

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

using namespace std;

#define int long long

#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

#ifdef DBG
#define log(item) cout << #item << " " << item << endl
#else
#define log(item)
#endif

typedef vector<int> VI;
typedef pair<int, int> PII;

//-------------------

int R, B, G;

signed main(){
    int N;
    cin >> R >> B >> G >> N;

    int ans = 0;

    int r_sum = 0;
    while (r_sum <= N){
        int b_sum = 0;
        while (b_sum <= (N - r_sum)){
            if((N - r_sum - b_sum) % G == 0){
                ans++;
            }
            b_sum += B;
        }
        r_sum += R;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

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

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


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    set<char> st;
    int n;
    cin >> n;
    rep(i,0,n){
        char c;
        cin >> c;
        st.insert(c);
    }
//    cout << st.size() << endl;
    if(st.size() == 4){
        cout << "Four" << endl;
    }else{
        cout << "Three" << endl;
    }


    return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<string>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;
#define LL long long

int N,W[111],sum=0,ans=1e9;

int main() {
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>W[i];
		sum+=W[i];
	}
	int s1=0,s2=sum;
	for(int i=0;i<N-1;i++){
		s1+=W[i];
		s2-=W[i];
		ans=min(ans,abs(s1-s2));
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>

#define MAX_N 100000

using namespace std;

long long s[MAX_N];

int main( int argc, char **argv )
{
    int N;
    cin >> N;

    for ( int i = 0; i < N; i++ ) cin >> s[i];

    long long ans = 0;
    for ( int C = 1; C < N; C++ )
    {
        long long sum = 0;

        for ( int k = 0; ( k + 1 ) * C < N - 1; k++ )
        {
            if ( k * C >= N - 1 - k * C && ( N - 1 ) % C == 0 ) break;

            sum += s[( N - 1 ) - k * C] + s[k * C];
            ans = max( ans, sum );
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>
#include <tuple>




typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define FOR(i,a,b) for(int i=(int)(a) ; i < (int) (b) ; ++i )
#define rep(i,n) FOR(i,0,n)



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

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    ll n;
    cin>>n;
    ll ans;
    ans=n*(n-1)/2;
    
    cout<<ans;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <assert.h>
#include <map>

using std::cerr;
using std::cin;
using std::cout;
using std::pair;
using std::string;
using std::vector;
//region
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (b); i >= (b); --i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n)-1; i >= 0; --i)
#define repr1(i, n) for (int i = (n); i > 0; --i)
#define outif(b, t, f) cout << ((b) ? (t) : (f)) << endl
#define all(vec) (vec).begin(), (vec).end()
#define sz(x) (int((x).size()))
#define mset(v, n) std::memset((v), n, sizeof(v))
#define BIT(N) (1LL << (N))
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using vint = vector<int>;
using vlong = vector<ll>;
using vstr = vector<string>;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpil = vector<pil>;
using vpll = vector<pll>;
using vvi = vector<vint>;
using vvl = vector<vlong>;
vector<string> split(const string &s, const string &delim) {
  vector<string> res;
  uint pos = 0;
  while (true) {
    const int found = s.find(delim, pos);
    if (found < 0) {
      res.push_back(s.substr(pos));
      break;
    }
    res.push_back(s.substr(pos, found - pos));
    pos = found + delim.size();
  }
  return res;
}
template<typename T> string join(vector<T> &vec, const string &sep) {
  size_t size = vec.size();
  if (!size) return "";
  std::stringstream ss;
  for (int i = 0; i < size - 1; i++)
    ss << vec[i] << sep;
  ss << vec[size - 1];
  return ss.str();
}
template<typename T> std::istream &operator>>(std::istream &is, vector<T> &vec) { for (T &x : vec) is >> x; return is; }
template<typename Iter> inline void print(const Iter &first, const Iter &last, const std::string &d, bool endline) {
  cout << *first;
  for (Iter iter = first + 1; iter < last; ++iter) {
    cout << d << *iter;
  }
  if (endline) cout << "\n";
}
constexpr ll powmod(ll a, ull b, ull p) {
  ll res = 1;
  while (b > 0) {
    if (b % 2) res = res * a % p;
    a = a * a % p;
    b >>= 1u;
  }
  return res;
}
template<class T> bool chmax(T &a, const T &b) { return a < b ? (a = b, true) : false; }
template<class T> bool chmin(T &a, const T &b) { return a > b ? (a = b, true) : false; }
template <typename T> void bsort(vector<T>& v) { std::sort(v.begin(), v.end()); }
template <typename T> void rsort(vector<T>& v) { std::sort(v.begin(), v.end(), std::greater<T>()); }
struct iii {
    iii() {
      cin.tie(nullptr); cout.tie(nullptr);
      std::ios::sync_with_stdio(false);
      cout << std::fixed << std::setprecision(16);
    }
} init;
//endregion

void solve();

int main() {
  int t = 1;
  // scanf("%d", &t);
  rep(_,t) solve();
  return 0;
}

void solve() {
  vint a(3);
  cin>>a;
  bsort(a);
  cout<<(a[2]==a[1]+a[0]?"Yes":"No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1000000 + 10;
char s[N];
int a[N];
int main(){
    int n; scanf("%d",&n);
    scanf("%s",s);
    if(n==1) return 0 * printf("%s",s);
    int cnt = 0;
    for(int i=0;i<n;i++) a[i] = s[i] - '0' - 1, cnt |= (a[i]==1);
    if(cnt){
        int ans = 0;
        for(int i=0;i<n;i++) if((i&(n-1))==i) ans ^= (a[i]%2);
        printf("%d\n",ans);
    }
    else{
        int ans = 0;
        for(int i=0;i<n;i++) if((i&(n-1))==i) ans ^= (a[i]/2);
        printf("%d\n",ans*2);
    }
}


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

int main() {
  int N, A, B, C, D;
  cin >> N;

  A = N / 1000;
  B = (N % 1000) / 100;
  C = (N % 100) /10;
  D = N % 10;

  if (A != B && C != D) cout << "No" << endl;

  else if (B != C) cout << "No" << endl;
  
  else cout << "Yes" << endl;

}

Measured memory_bytes: 256
N, K = map(int, input().split())

res = 0
for i in range(1, N+1):
    tmp = i
    count = 1
    for j in range(1000):
        if tmp >= K:
            break
        tmp *= 2
        count *= (1/2)
        

    res += count

    
print(res/N)




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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] >= sum * 1.0 / (4.0 * m)) ans++;
    }
    if (ans >= m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k;
void dfs(string ans,int p,int& now){
	if(p==0){
		now++;
		if(now==k){
			cout<<ans<<endl;
			exit(0);
		}
		return ;
	}
	int x=ans[ans.size()-1]-'0';
	for(int i=x-1;i<=x+1;i++){
		if(i<0||9<i)continue;
		dfs(ans+(char)(i+'0'),p-1,now);
	}
}
int main(){
	cin>>k;
	int now=0;
	for(int i=1;;i++){
		for(char c='1';c<='9';c++){
			string s="";
			s+=c;
			dfs(s,i-1,now);
		}
	}
	return 0;
}

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

import heapq

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

H = [[] for _ in range(N)]

for _ in range(Q):
    q = list(map(int,input().split()))
    if q[0] == 0:
        heapq.heappush(H[q[1]],-q[2])
    elif q[0] == 1:
        if H[q[1]]:
            print(-H[q[1]][0])
    else:
        if H[q[1]]:
            heapq.heappop(H[q[1]])


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class DSummerVacation {
public:
void solve(std::istream& cin, std::ostream& cout) {
    int n, m;
    cin >> n >> m;
    vector<tuple<int, int>> A(n);
    for (int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        A[i] = make_tuple(a, b);
    }

    sort(A.begin(), A.end());
    int ans = 0;
    priority_queue<int> Q;
    int k = 0;
    for (int i = 0; i <= m; i++){
        while (k < n and get<0>(A[k]) <= i)
            Q.push(get<1>(A[k++]));
        if (Q.empty())
            continue;
        ans += Q.top();
        Q.pop();
    }

    cout << ans << endl;
}
};

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


Measured memory_bytes: 1660
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    REP(i,N) cin >> a[i];
    ll ans = LINF;
    for(int i=-100;i<=100;i++){
        ll tmp = 0;
        REP(j,N) tmp += (a[j] - i) * (a[j] - i);
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	ull N,X;
	cin>>N>>X;
	vull x;
	for(int i=0;i<N;i++){
		ull a;
		cin>>a;
		x.pb(a);
	}
	for(int i=1;i<N;i++)
		x[i]+=x[i-1];
	reverse(x.begin(),x.end());
	ull ans=18446744073709551615LL;
	for(ull K=1;K<=N;K++){
		ull a=3,temp=5*x[0];
		for(ull i=K;i<N;i+=K)
			temp+=2*x[i];
		if(K<N)
			temp-=2*x[K];
		ans=min(ans,temp+(K+N)*X);
	}
	cout<<ans<<endl;
}

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

int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    cin>>b[i];
  }
  int ans=0;
  vector<int> plus;
  ll minus=0;
  rep(i,n){
    if(a[i] < b[i]){
      ans++;
      minus+=b[i]-a[i];
    }
    if(a[i] > b[i]){
      plus.push_back(a[i]-b[i]);
    }
  }
  sort(plus.begin(),plus.end(),greater<int>());
  for(auto x : plus){
    if(minus<=0)break;
    minus-=x;
    ans++;
  }
  if(minus>0) cout<<-1<<endl;
  else cout<<ans<<endl;
}


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

for i in range(K):
    if i % 2 == 0:
        # A
        if A%2 == 0:
            tmp = A//2
            A //= 2
            B += tmp
        else:
            A -= 1
            tmp = A//2
            A //= 2
            B += tmp
    else:
        # B
        if B%2 == 0:
            tmp = B//2
            B //= 2
            A += tmp
        else:
            B -= 1
            tmp = B//2
            B //= 2
            A += tmp
print(A, B)

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

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

long long ans,bai3=0,bai5=0,bai15=0 ;
int  i ;

ans = 0;

bai3 = ((N/3)+1)*(N/3)/2;
bai5 = ((N/5)+1)*(N/5)/2;
bai15 = ((N/15)+1)*(N/15)/2;

if((N%2)==0){
ans = (N+1)*double(N/2);}
else{
ans = (N+1)*(N/2)+(N+1)/2;}

/*
for(i=3;i<=N;i+=3){
bai3 += i;
}
for(i=5;i<=N;i+=5){
bai5 += i;}
for(i=15;i<=N;i+=15){
bai15 += i;}
ans = bai3+bai5-bai15;
*/
if((N%2)==0){
ans = ans-bai3*3-bai5*5+bai15*15;}
else{
  ans = ans-bai3*3-bai5*5+bai15*15/*+((((N/3)/2)+1)*3)+((((N/5)/2)+1)*5)-((((N/15)/2)+1)*15)*/;
}


cout << ans ;

return 0;
}

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

#define MAX_CHAR 4

int main(void)
{
	char str[MAX_CHAR] = {'\0'};
	int x = 0;

	if (fgets(str, MAX_CHAR, stdin) != NULL) {
		x = atoi(str);
		printf("%d\n", x*x*x);
		return 0;
	} else {
		return 1;
	}
}

Measured memory_bytes: 528
object Main extends App {

 for(line <- io.Source.stdin.getLines){
    val n =  line.split(" ").map {_.toDouble}
    val a = n(0)
    val b = n(1)
    val c = n(2)
    val d = n(3)
    val e = n(4)
    val f = n(5)

    var x :Double = (b*f-e*c) / (b*d-a*e)
    var y :Double = ((c - a * x) / b)
    if(x==0)x=0;
    if(y==0)y=0;
    println(f"$x%.3f $y%.3f")
  }
}

Measured memory_bytes: 44108
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <bitset>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);

int N,M,X; vi C; vector<vector<int>> A;
void input()
{
    cin>>N>>M>>X;
    A.resize(N);
    for(int i=0;i<N;++i){
        int c; cin>>c; C.emplace_back(c);
        for(int j=0;j<M;++j){
            int a; cin>>a; A[i].emplace_back(a);
        }
    }
}

void solve()
{
    bitset<12> bst(12);
    int ans=-1; vi understand;
    for(int i=0;i<(1<<N);++i){
        bst=0|i;
        // cout<<bst[0]<<endl;
        understand.assign(M,0);
        int cost=0;
        for(int j=0;j<N;++j){
            if(bst[j]==0) continue;
            for(int k=0;k<M;++k) {
                understand[k]+=A[j][k];
                // cout<<understand[k]<<" ";
            }
            cost+=C[j];
            // cout<<"\n";
        }
        // cout<<"cost:"<<cost<<"\n";
        bool check=true;
        for(int j=0;j<M;++j){
            if(understand[j]<X) check=false;
        }
        if(check){
            if(ans<0) ans=cost;
            else ans=min(ans,cost);
        }
    }
    cout<<ans<<endl;
}

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(){
  int n;
  cin>>n;
  char c;
  REP(i,n){
    cin>>c;
    if(c=='Y'){
      cout<<"Four"<<endl;
      return 0;
    }
  }
  
  cout<<"Three"<<endl;
  return 0;
}

Measured memory_bytes: 256
class PERM_COMB_MOD():
    # http://drken1215.hatenablog.com/entry/2018/06/08/210000
    def __init__(self, max_n=510000, mod=10**9+7):
        self.fac = [0]*max_n
        self.finv = [0]*max_n
        self.inv = [0]*max_n
        self.fac[0] = self.fac[1] = 1
        self.finv[0] = self.finv[1] = 1
        self.inv[1] = 1
        self.max = max_n
        self.mod = mod
        self._maesyori()

    def _maesyori(self):
        for i in range(2,self.max):
            self.fac[i] = self.fac[i-1] * i % self.mod
            self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod
            self.finv[i] = self.finv[i-1] * self.inv[i] % self.mod

    def perm(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * self.finv[n-k] % self.mod % self.mod

    def comb(self, n, k):
        if n < k : return 0
        if n < 0 or k < 0:return 0
        return self.fac[n] * (self.finv[k] * self.finv[n-k] % self.mod) % self.mod

p = PERM_COMB_MOD()

mod = 10**9+7
n, k = map(int, input().split())
# n個をr個に分ける
def h(n, r):
    if n == 0 and r == 0:
        return 1
    return p.comb(n-1, r-1)

for i in range(1, k+1):
    blue = h(k, i)
    red = h(n-k, i-1) + 2*h(n-k, i) + h(n-k, i+1)
    ans = blue*red
    ans %= mod
    print(ans)

Measured memory_bytes: 63860
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long k = sc.nextLong();
    int q = sc.nextInt();
    long[] p = new long[n];
    for(int i = 0; i < n; i++) {
      p[i] = k - (long)q;
    }
    for(int i = 0; i < q; i++) {
      int a = sc.nextInt();
      p[a - 1]++;
    }
    for(int i = 0; i < n; i++) {
      String ans = "No";
      if(p[i] > 0) ans = "Yes";
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 60628
def check(v):
    l = int(-1e18)
    r = int(1e18)
    while r - l > 1:
        m = int((r + l) / 2)
        if m ** 5 > v:
            r = m
        else:
            l = m
    return l

x = int(input())
for b in range(-10000, 10000):
    v = int(b ** 5 + x)
    k = check(v)
    if k ** 5 == v:
        print(k, b)
        break

Measured memory_bytes: 9028
#include<cstdio>
int a[1005],n,ans[1005],cnt;
long long sum[2];
int main(){
	scanf("%d",&n);bool t=0;
	for(int i=1;i<=n;++i)scanf("%d",a+i),a[i]>0?(t=1):0;
	if(n==2){printf("%d\n1\n%d\n",a[1]>a[2]?a[1]:a[2],a[1]>a[2]?2:1);return 0;}
	if(!t){
		int Max=1;for(int i=2;i<=n;++i)if(a[i]>a[Max])Max=i;
		printf("%d\n%d\n",a[Max],n-1);
		for(int i=n;i>Max;--i)printf("%d\n",i);
		for(int i=1;i<Max;++i)puts("1");
		return 0;
	}
	for(int i=1;i<=n;++i)if(a[i]>0)sum[i&1]+=a[i];
	if(sum[1]>sum[0]){
		printf("%lld\n",sum[1]);
		if((n&1)==0)ans[++cnt]=n--;
		bool ok=1;
		for(int i=n;i>=1;i-=2)if(a[i]<0)
			if(ok)ans[++cnt]=i,ans[++cnt]=i-1;
			else ans[++cnt]=i,i==1?(ans[++cnt]=1):0;
		else if(ok)ok=0;
			else ans[++cnt]=i+1;
	}
	else{
		printf("%lld\n",sum[0]);
		if(n&1)ans[++cnt]=n--;
		bool ok=1;
		for(int i=n;i>=1;i-=2)if(a[i]<0)
			if(ok)ans[++cnt]=i,ans[++cnt]=i-1;
			else ans[++cnt]=i;
		else if(ok)ok=0;
			else ans[++cnt]=i+1;
		ans[++cnt]=1;
	}
	printf("%d\n",cnt);
	for(int i=1;i<=cnt;++i)printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main(){
	fast;
	ll a,b,c;
	cin>>a>>b>>c;
	if(a+b==c||a+c==b||b+c==a)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}



Measured memory_bytes: 3544
#include<iostream>
#include<algorithm>
#define INF (1000*1000*200)
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int dp[1001][200];
int land[200][200],sea[200][200];
int main(){
	int n,m;
	while(cin>>n>>m,n||m){
		fill_n((int*)dp,1001*200,INF);
		fill_n((int*)land,200*200,INF);
		fill_n((int*)sea,200*200,INF);
		rep(i,n){
			land[i][i]=sea[i][i]=0;
		}
		rep(i,m){
			int x,y,t;
			char sl;
			cin>>x>>y>>t>>sl;
			x--;y--;
			if(sl=='L'){
				land[x][y]=land[y][x]=min(land[x][y],t);
			}else{
				sea[x][y]=sea[y][x]=min(sea[x][y],t);
			}
		}
		rep(k,n)rep(i,n)rep(j,n){
			land[i][j]=min(land[i][j],land[i][k]+land[k][j]);
			sea[i][j]=min(sea[i][j],sea[i][k]+sea[k][j]);
		}
		
		int r,z[1000];
		cin>>r;
		rep(i,r)cin>>z[i],z[i]--;
		dp[0][z[0]]=0;
		rep(i,r-1){
			rep(j,n){
				dp[i+1][j]=min(dp[i+1][j], dp[i][j]+land[z[i]][z[i+1]]);
				rep(k,n){
					dp[i+1][k]=min(dp[i+1][k],
						dp[i][j]+land[z[i]][j]+sea[j][k]+land[k][z[i+1]] );
				}
			}
		}
		cout<<*min_element(dp[r-1],dp[r-1]+n)<<endl;
	}
	return 0;
}

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

int main(void)
{
   char a[11],b[11],c[11];
   int ar,br,cr;

   scanf("%s%s%s",a,b,c);
   ar=strlen(a);
   br=strlen(b);
   cr=strlen(c);
   if((a[ar-1]==b[0])&&(b[br-1]==c[0])) printf("YES\n");
   else printf("NO\n");
   return 0;
}


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

int main() {
    int n; cin >> n;
    int x[n], y[n];

    int f = 1; vector<int> c(n);
    REP(i, 0, n) {
        cin >> x[i] >> y[i];
        c[i] = i;
        f *= (i + 1);
    }

    double ans = 0;
    REP(i, 0, f) {
        REP(j, 0, c.size() - 1) {
            double d = sqrt(pow(x[c[j+1]] - x[c[j]], 2) + pow(y[c[j+1]] - y[c[j]], 2));
            ans += d;
        }
        next_permutation(c.begin(), c.end());
    }
    ans /= f;
    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.* ;
class Main {
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
 int a= scan.nextInt();
     int b= scan.nextInt();
     int c= scan.nextInt();
     int d= scan.nextInt();
  	 System.out.println(Math.min(a,b)+Math.min(c,d));
  }
}


Measured memory_bytes: 20948
#include <iostream>
#include <string>
using namespace std;
 
int main(){
  string s, ss, sss;
  cin >> s >> ss >> sss;
  if(s.back() == ss.front() && ss.back() == sss.front()) cout << "YES" << '\n';
  else cout << "NO" << '\n';
  
  return 0;
}

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

typedef long long int int64;

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int64 ans=0;
  int r=0;
  int sum=0;
  for(i=0;i<n;i++){
    while(r<n && (sum&a[r])==0) sum+=a[r++];
    ans+=r-i;
    sum-=a[i];
  }
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<functional>
#include<numeric>
#include<ctime>

#include<sys/time.h>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int dbl(int i){ return i * i; }

int main(){
  int n = getInt();
  int k = getInt();

  vector<bool> take(n, false);
  vector<int> sum(k);
  vector<vector<int> > have(n, vector<int>());
  int diff = 0;

  REP(i, k){
    REP(j, n / 2){
      int t = getInt() - 1;

      have[t].push_back(i);
    }
  }

  srand(10);

  while(true){
    REP(i,n) take[i] = (rand() % 2 == 0 ? true : false);

    REP(i,n){
      if(take[i]){
        FOR(it, have[i]){
          sum[*it]++;
        }
      }
    }
    REP(i,k){
      diff += dbl(sum[i] - (n / 4));
    }

    int prev = -1;

    REP(cc, max(10, n / 2)){
      REP(i,k){
        if(sum[i] < n / 8 || n * 3 / 8 < sum[i])
          goto next;
      }

      goto ok;

    next:

      int nn = 0;
      if(rand() % 100 > 10){
        int best = INT_MIN;
        REP(i,n){
          int est = 0;

          FOR(it, have[i]){
            int s = sum[*it];
            int o = dbl(s - (n / 4));
            int p = dbl(s + (take[i] ? -1 : 1) - (n / 4));

            est += (p - o);
          }

          if(best < est){
            nn = i;
            best = est;
          }
        }
        if(best < 0){
          break;
        }
      }else{
        do{
          nn = rand() % n;
        }while(nn == prev);
      }

      if(prev == nn){
        break;
      }else{
        FOR(it, have[nn]){
          if(take[nn]){
            sum[*it]--;
          }else{
            sum[*it]++;
          }
        }
        take[nn] = !take[nn];
        prev = nn;
      }
    }
  }

 ok:
  REP(i,n){
    printf("%d", take[i] ? 1 : 0);
  }
  puts("");

  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b,i;

            a = int.Parse(Console.ReadLine());

            b = 0;

            for (i = 1; i <= a; i++)
            {
                b = b + i;
            }

            Console.WriteLine(b);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 2e18

int dp[1 << 15][1005];

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

    rep(i, 1<<15){
        rep(j, 1005){
            if(i!=0) dp[i][j] = INF;
        }
    }

    rep(i, m){
        int a, b;
        cin >> a >> b;
        int s = 0;
        rep(j, b){
            int c;
            cin >> c;
            s += 1 << (c-1);
        }

        rep(j, 1<<n) dp[j][i+1] = dp[j][i];
        rep(j, 1<<n){
            dp[j|s][i+1] = min(dp[j|s][i+1], dp[j][i] + a);
        }

    }

    if(dp[(1<<n) -1][m] == INF){
        cout << -1 << endl;
    }else{
        cout << dp[(1<<n) -1][m] << endl;
    }
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 129024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int l = str.length();
        String[] array = str.split("");
        int ans = 0;

        for (int i = 0; i < l; i++) {
            int tmp = Integer.parseInt(array[i]);
            ans += tmp;
        }
        if (ans % 9 == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 65476
import sys
n, k, c = map(int, input().split())
s = input()
front = [0 for _ in range(n)]
back = [0 for _ in range(n)]

rm = -10**6
cur = 0
for i in range(n):
	if s[i] == "o" and i - rm > c:
		cur += 1
		front[i] = cur
		rm = i

if cur > k:
	sys.exit()

lm = 10**6
cur = k+1
for i in range(n-1, -1, -1):
	if s[i] == "o" and lm - i > c:
		cur -= 1
		back[i] = cur
		lm = i

for i in range(n):
	if front[i] > 0 and front[i] == back[i]:
		print(i+1)

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

using namespace std;

int main()
{
	string input;
	cin >> input;
	char abc[3] = { 'a', 'b', 'c' };
	bool abcFlag[3] = { false, false, false };
	for (int i = 0; i < input.length(); i++) {
		for (int j = 0; j < sizeof(abc); j++) {
			if (input[i] == abc[j]) {
				abcFlag[j] = true;
			}
		}
	}
	for (int i = 0; i < sizeof(abcFlag); i++) {
		if (abcFlag[i] == false) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	//int qwe; cin >> qwe;
    return 0;
}


Measured memory_bytes: 256
/*  ex7_1 Ruined Square
    pandacodeb  */

#include <stdio.h>
#include <stdlib.h>

//座標の構造体
typedef struct point{
    int x_elem;
    int y_elem;
}point;

//ある頂点を移動する関する
point shift_point(point p, int xshift, int yshift);

int main(void){
    point p1, p2, p3, p4;

    //最初の２つ (p1, p2 とする) の点の座標を入力
    scanf("%d %d %d %d", &p1.x_elem, &p1.y_elem, &p2.x_elem, &p2.y_elem);

    //p1 から p2 までのx軸の変位、y軸の変位
    int xshift = p2.x_elem - p1.x_elem;
    int yshift = p2.y_elem - p1.y_elem;

    //x 軸の変位、y 軸の変位と挙げられた頂点で残りの２つの点を計算
    p3 = shift_point(p2, -yshift, xshift);
    p4 = shift_point(p3, -xshift, -yshift);

    //出力
    printf("%d %d %d %d\n", p3.x_elem, p3.y_elem, p4.x_elem, p4.y_elem);
    return 0;
}


point shift_point(point p, int xshift, int yshift){
    point p_shift = {p.x_elem + xshift, p.y_elem + yshift};
    return p_shift;
}

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

int main(){
     int N;
     cin>>N;
     switch (N%10) {
          case 0:cout<<"pon"<<endl;
          break;
          case 1:cout<<"pon"<<endl;
          break;
          case 2:cout<<"hon"<<endl;
          break;
          case 3:cout<<"bon"<<endl;
          break;
          case 4:cout<<"hon"<<endl;
          break;
          case 5:cout<<"hon"<<endl;
          break;
          case 6:cout<<"pon"<<endl;
          break;
          case 7:cout<<"hon"<<endl;
          break;
          case 8:cout<<"pon"<<endl;
          break;
          case 9:cout<<"hon"<<endl;
          break;
     }
}

Measured memory_bytes: 3596
#include <cstdio>
int main(){
	long A[100][100], b[100], c[100];
	int m, n;
	scanf("%d%d", &m, &n);
	int i, j = 0;
	while(i++ < m){
		j = 0;
		while(j++ < n) scanf("%d", &A[i-1][j-1]);
	}
	i = 0;
	while(i++ < n) scanf("%d", &b[i-1]);
	i = 0;
	while(i++ < m){
		c[i-1], j = 0;
		while(j++ < n) c[i-1] += A[i-1][j-1]*b[j-1];
	}
	for(int i = 0; i < m; i++){
		printf("%d\n", c[i]);
	}
	return 0;
}


Measured memory_bytes: 2780
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int ui;

typedef vector<ull> vull;
typedef vector<ll> vll;
typedef vector<ui> vui;
typedef vector<long> vl;
typedef vector<int> vi;

typedef pair<ull, ull> pull;
typedef pair<ll, ll> pll;
typedef pair<ui, ui> pui;
typedef pair<long, long> pl;
typedef pair<int, int> pi;

int main() {
    int n; cin >> n;
    vi v(100100, 0);
    for (int i = 0; i < n; ++i) cin >> v[i];

    vector<pi> vl(100100, pi(0, 0));
    vector<pi> vr(100100, pi(0, 0));
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) {
            ++vl[v[i]].first;
            vl[v[i]].second = v[i];
        } else{
            ++vr[v[i]].first;
            vr[v[i]].second = v[i];
        }            
    }

    sort(vl.begin(), vl.end(), greater<pi>());
    sort(vr.begin(), vr.end(), greater<pi>());

    int ans;
    if (vl[0].second != vr[0].second) ans = n - (vl[0].first + vr[0].first);
    else                              ans = n - (max(vl[0].first + vr[1].first, vl[1].first + vr[0].first));

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2936
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>

using namespace std;

long long int a,b,c,d;
long long int ans;

int main () {

    cin>>a>>b>>c>>d;

    if (b>=0 and c>=0 and d>=0 or a>=0 and b>=0 and d>=0) {
        ans = b*d;
    }

    if (a<=0 and b<=0 and c>=0 and d>=0) {
        ans = b*c;
    }

    if(a>=0 and b>=0 and c<=0 and d<=0) {
        ans = a*d;
    }

    if(a<=0 and b>=0 and c<=0 and d>=0) {
        if(a*c>b*d) {
            ans = a*c;
        }
        else {
            ans = b*d;
        }
    }

    if (a<=0 and b<=0 and c<=0 and d>=0 or a<=0 and b>=0 and c<=0 and d<=0) {
        ans = a*c;
    }

    if (a<=0 and b<=0 and c<=0 and d<=0) {
        ans = a*c;
    }

    cout << ans << endl;

}



Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC057C - Digits in Multiplication
  // 全探索 O(NM)
  int N, M; cin >> N >> M;
  vector<pair<int, int> > ab(N, pair<int, int>());
  vector<pair<int, int> > cd(M, pair<int, int>());
  REP(i, N){
    int a, b; cin >> a >> b;
    ab[i] = {a, b};
  }
  REP(i, M){
    int c, d; cin >> c >> d;
    cd[i] = {c, d};
  }
  vector<int> ans(N, 0);
  REP(i, N){
    int d = 1e9;
    REP(j, M){
      if(d > abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second)){
        d = abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second);
        ans[i] = j + 1;
      }
    }
  }
  REP(i, N){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    String blank = sc.nextLine();
    String s[] = new String[h];

    for(int i = 0; i < h; i++){s[i] = sc.nextLine();}
    for(int i = 0; i < h; i++){
      for(int j = 0; j < 2; j++){
        System.out.println(s[i]);
      }
    }

  }
}

Measured memory_bytes: 22356
import sys
sys.setrecursionlimit(10**8)
N,M = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]
es = [[] for i in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)

colors = [0 for i in range(N)]

def dfs(v,color):
    colors[v] = color
    for to in es[v]:
        if colors[to] == color:
            return False
        if colors[to] == 0 and not dfs(to, -color):
            return False
    return True

def is_bipartite():
    return dfs(0,1)

if is_bipartite():
    b = colors.count(1)
    w = N-b
    print(b*w-M)
else:
    whole = N*(N-1)//2
    print(whole-M)

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

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
        String[] input1 = br.readLine().split(" ");
        int n = Integer.parseInt(input1[0]);
        int m = Integer.parseInt(input1[1]);
        
        String[] input2 = br.readLine().split(" ");
        int[] cost = new int[m];
        
        for(int i = 0; i < m; i++){
            cost[i] = Integer.parseInt(input2[i]);
        }
        
        int totalCost = 0;
        
        for(int i = 0; i < m; i++){
            totalCost += cost[i];
        }
        
        out.println(n >= totalCost ? n - totalCost : -1);
        out.close();
        
    }
}

Measured memory_bytes: 34628
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n, d;
    cin >> n >> d;
    int w = 2 * d + 1;
    cout << (n + w - 1) / w << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力1をnに入れる
		int k = sc.nextInt();
		int s = sc.nextInt();
		int count = 0;
		int l;

		for (int i = 0; i <= k; i++) {
			for (int j = 0; j <= k; j++) {
				l = s - i - j;
				if ( !(l < 0 || k < l) && i + j + l == s) {
					count++;
				}
			}
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 23124