akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

int marked[3][3];
int nums[3][3];

void mark(int num){
    for(int i = 0; i < 3;++i){
        for(int j = 0; j < 3;++j)
            marked[i][j] = (marked[i][j])| (nums[i][j] == num);
    }
}

int main(){
    for(int i = 0; i < 3;++i){
        for(int j = 0; j < 3;++j)
            scanf(" %d",&nums[i][j]);
    }
    int n; scanf(" %d",&n);
    while(n--){
        int a;scanf(" %d",&a);
        mark(a);
    }
    bool yes = 0;
    for(int i = 0; i < 3 && !yes;++i){
        int sum = 0;
        for(int j = 0; j < 3;++j)
            sum += marked[i][j];
        yes = (sum== 3);
    }
    for(int j = 0; j < 3 && !yes;++j){
        int sum = 0;
        for(int i = 0; i < 3;++i)
            sum += marked[i][j];
        yes = (sum== 3);
    }
    int sum = 0;
    for(int i = 0; i < 3 && !yes;++i) sum+= marked[i][i];
    yes = yes | (sum == 3);
    sum = 0;
    for(int i = 0,j = 2; i < 3 && !yes;++i,--j) sum+= marked[i][j];
    yes = yes | (sum == 3);
    if(yes) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 256
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(std::string s, std::string t) {
  if (s.find(t) != std::string::npos) {
    return 0;
  }
  int64_t ret = INT64_MAX;
  auto const l = s.length();
  auto const tl = t.length();
  for (auto i = 0; i < l - tl + 1; i++) {
    int64_t r = 0;
    for (auto j = 0; j < tl; j++) {
      if (s[i + j] != t[j]) {
        r++;
      }
    }
    ret = std::min(r, ret);
  }
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  std::string s;
  std::cin >> s;
  std::string t;
  std::cin >> t;
  auto const res = solve(s, t);
  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 3660
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
now = 0
res = 0
while True:
    res += 1
    now += n
    now %= 360
    if now == 0:
        print(res)
        break

Measured memory_bytes: 72456
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  ll N, T;
  cin >> N >> T;
  vector<ll> A(N), B(N);
  rep(i, N) {
    cin >> A[i] >> B[i];
  }

  T--;
  vector<vector<ll>> dp1(N + 1, vector<ll>(T + 1));
  rep(n, N) {
    rep(j, T + 1) {
      // not eat
      chmax(dp1[n + 1][j], dp1[n][j]);

      // eat
      if (j + A[n] > T)
        continue;
      chmax(dp1[n + 1][j + A[n]], dp1[n][j] + B[n]);
    }
  }

  reverse(all(A));
  reverse(all(B));
  vector<vector<ll>> dp2(N + 1, vector<ll>(T + 1));
  rep(n, N) {
    rep(j, T + 1) {
      // not eat
      chmax(dp2[n + 1][j], dp2[n][j]);

      // eat
      if (j + A[n] > T)
        continue;
      chmax(dp2[n + 1][j + A[n]], dp2[n][j] + B[n]);
    }
  }

  reverse(all(A));
  reverse(all(B));


  ll ans = 0;
  rep(i, N) {
    ll temp = 0;
    rep(j, T + 1) {
      ll tempp = 0;
      if (i > 0)
        tempp += dp1[i][j];
      if (i < N - 1)
        tempp += dp2[N - i - 1][T - j];
      chmax(temp, tempp);
    }
    temp += B[i];
    chmax(ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 141184
#include <iostream>
#include <limits.h>
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	if (a >= b) cout << "delicious";
	else if (a < b && a + x >= b) cout << "safe";
	else cout << "dangerous";
	return 0;
}


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

long long l, a, b, m;
long long mat[66][3][3] = {0},now[3][3] = {0};

long long solve();
void setmat();
void calc(long long x);


int main(){
    cin >> l >> a >> b >> m;
    cout << solve() << endl;
    return 0;
}

long long solve(){
    long long ten = 1,bf = 0,nowc = 0;
//    {{10^d, 0, 0}
//    {1, 1, 0}
//    {0, B, 1}}
    mat[0][1][0] = mat[0][1][1] = mat[0][2][2] = 1;
    mat[0][2][1] = b % m;
    for(int i = 0;i < 3;++i)now[i][i] = 1;
    for(long long  i = 0;i < 18;++i){
        ten *= 10;
        mat[0][0][0] = ten % m;
        setmat();
        nowc = max((ten - a - 1) / b + 1, 0LL);
        nowc = min(l,nowc);
        swap(bf,nowc);
        nowc = bf - nowc;
        for(long long i = 60;i >= 0;--i)
            if(nowc >= (1LL << i)){
                nowc -= 1LL << i;
                calc(i);
        }
        if(bf == l)break;
    }
    long long ans = 0;
    ans = (a % m * now[1][0] % m + now[2][0]) % m;
    return ans;
}

void setmat(){
    for(int i = 1;i < 62;++i)
        for(int j = 0;j < 3;++j)
            for(int k = 0;k < 3;++k) {
                mat[i][j][k] = 0;
                for (int n = 0; n < 3; ++n)
                    (mat[i][j][k] += mat[i-1][j][n] * mat[i-1][n][k] % m) %= m;
            }
}

void calc(long long x){
    long long tmp[3][3] = {0};
    for(int i = 0;i < 3;++i)
        for(int k = 0;k < 3;++k)
            for(int j = 0;j < 3;++j)
                (tmp[i][j] += now[i][k] * mat[x][k][j] % m) %= m;
    for(int i = 0;i < 3;++i)
        for(int j = 0;j < 3;++j)
            now[i][j] = tmp[i][j];
}

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

typedef pair<int,int> pii;

void solve();
pii pro(int x);
void drow(int x,bool o);
void write(int x,pii now);

int N,K;
vector<int> G[100010];
pii D[100010]; //max min
int ans[100010];
bool visit[100010] = {0};
bool color[100010] = {0};
int O = -1;
bool can = true;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N - 1; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i = 1; i < N + 1; i++)
    {
        D[i].first = INF;
        D[i].second = -1 * INF;
        ans[i] = -1 * INF;
        visit[i]= false;
    }
    scanf("%d",&K);
    for(int i = 0; i < K; i++)
    {
        int v,p;
        scanf("%d%d",&v,&p);
        D[v].first = D[v].second = p;
    }
    solve();
    return 0;
}

void solve()
{
    drow(1,true);
    if(can == false)
    {
        printf("No\n");
        return;
    }
    pii res;
    res = pro(1);
    res.first--;
    res.second++;
    //printf("{%d %d}\n",res.first,res.second);
    if(res.second > res.first)
    {
        printf("No\n");
        return;
    }
    printf("Yes\n");
    write(1,res);
    for(int i = 1; i < N + 1; i++)
    {
        printf("%d\n",ans[i]);
    }
    return;
}

pii pro(int x)
{
    visit[x] = true;
    pii res = make_pair(INF,-1 * INF);
    if(G[x].size() == 1 && x!= 1)
    {
        res.first = D[x].first + 1;
        res.second = D[x].second - 1;
        return res;
    }
    for(int i = 0; i < G[x].size(); i++)
    {
        if(visit[G[x][i]] == true)
        {
            continue;
        }
        pii lim = pro(G[x][i]);
        res.first = min(res.first,lim.first);
        res.second = max(res.second,lim.second);
    }
    if(D[x].first != INF)
    {
        if(D[x].first > res.first || D[x].second < res.second)
        {
            res.first = -1 * INF;
            res.second = INF;
            return res;
        }
        else
        {
            res.first = D[x].first + 1;
            res.second = D[x].second - 1;
            return res;
        }
    }
    D[x] = res;
    if(res.first < res.second)
    {
        res.first = -1 * INF;
            res.second = INF;
            return res;
    }
    res.first++;
    res.second--;
    return res;
}

void drow(int x,bool o)
{
    if(color[x] == true)return;
    color[x] = true;
    if(D[x].first != INF)
    {
        if(O == -1 || O == (bool)(D[x].first % 2 ^ o))
        {
            O = (int)((bool)(D[x].first % 2) ^ o);
        }
        else can = false;
    }
    for(int i = 0; i < G[x].size(); i++)
    {
        drow(G[x][i],!o);
    }
    return;
}

void write(int x,pii now)
{
    pii next;
    if(ans[x] != -1 * INF)return;
    if(D[x].first >= now.first && now.first >= D[x].second)
    {
        ans[x] = now.first;
        next.first = now.first + 1;
        next.second = now.first - 1;
    }
    else
    {
        ans[x] = now.second;
        next.first = now.second + 1;
        next.second = now.second - 1;
    }
    for(int i = 0; i < G[x].size(); i++)
    {
        write(G[x][i],next);
    }
    return;
}


Measured memory_bytes: 13952
n=int(input())
ans=0

def make_divisors(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return len(divisors)

for i in range(1,n+1,2):
    if make_divisors(i)==8:
        ans+=1
        
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x , y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int>a(n);
  int gc = 0;
 unordered_map<int,int>Cnt;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    Cnt[a[i]]++;
    gc = __gcd(a[i] , gc);
  }
  int N = 1e6;
  dg1(a);
  if(gc > 1) {
    cout << "not coprime" << '\n';
    return 0;
  }
  for(int i = 2; i <= N; i++) {
    int sum = 0;
    for(int j = i; j <= N; j += i) {
      sum += Cnt[j];
    }
    dg2(i , sum);
    if(sum > 1) {
      cout << "setwise coprime" << '\n';
      return 0;
    }
  }
  cout << "pairwise coprime" << '\n';
}

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

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll)x.size()
#define hell            1000000007
#define inf             (ll)1e18 + 5
#define PI              (double)3.14159265358979323844
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n;
    cin>>n;
    ll start=100;
    ll cnt=0;
    while (1){
    	if (start>=n){
    		cout<<cnt<<endl;
    		return;
    	}
    	start=start*(1.01);
    	cnt++;
    	//trace(start);
    }
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
 
#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector< ii >
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);
 
using namespace std;
 
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
 
int gcd(int a, int b){
  if(a == 0) return b;
  else return gcd(b%a, a);
}
 
int32_t main(){
  DESYNC;
  int k,x,y;
  cin >> k >> x >> y;
  
  //check
  if(k%2 == 0 && (abs(x) + abs(y))%2 == 1){
    cout << -1 << endl;
    return 0;
  }
  
  int cx = 0, cy = 0;
  // calculate N
  int N = (abs(x) + abs(y) + k-1)/k + (abs(x) + abs(y) <= k && abs(x) + abs(y) != k);
  //fix N
  while((N*k)%2 != (abs(x)+abs(y))%2) N++;
  
  int B = (N*k - abs(x) - abs(y))/2;
  
  cout << N << endl;
  
  while(B > 0){
    bool less = abs(x - cx) < abs(y - cy);
    
    if(B > k){
      if(less){
        if(x >= 0) cx -= k;
        else cx += k;
      }
      else {
        if(y >= 0) cy -= k;
        else cy += k;
      }
      B -= k;
    }
    else {
      if(less){
        if(x >= 0) cx -= B;
        else cx += B;
        if(y >= 0) cy += (k - B);
        else cy -= (k - B);
        B = 0;
      }
      else {
        if(y >= 0) cy -= B;
        else cy += B;
        if(x >= 0) cx += (k - B);
        else cx -= (k - B);
        B = 0;
      }
    }
    
    cout << cx << " " << cy << endl;
  }
  
  //deal with upmoves
  while(cx != x or cy != y){
    int have = k;
    if(cx != x){
      int need = min(have, abs(cx-x));
      if(cx < x) cx += need;
      else cx -= need;
      have -= need;
    }
    if(cy != y){
      int need = min(have, abs(cy-y));
      if(cy < y) cy += need;
      else cy -= need;
      have -= need;
    }
    assert(have == 0);
    cout << cx << " " << cy << endl;
  }
}

Measured memory_bytes: 2304
import sys

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

if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    a = abs(A - ((N+1) // 2))
    b = abs(B - ((N+1) // 2))
    if a > b:
        print(A + ((B - A - 1) // 2))

    else:
        print((N - B) + 1 + ((B - A - 1) // 2))


Measured memory_bytes: 38384
a,b,c,d,e,f = list(map(int,input().split()))
ans = []
g = 0
for i in range(f//(a*100)+1):
    for j in range((f-a*i*100)//(b*100)+1):
        for k in range(min((f-a*i*100-b*j*100)//c,e*(a*i+b*j)//c)+1):
            l = min((e*(a*i+b*j) - k*c)//d,(f-100*a*i-100*b*j-c*k)//d)
            if (a*i*100+b*j*100+c*k+d*l)>0 and (a*i*100+b*j*100+c*k+d*l)<=f:
                if g < (k*c+d*l)/(a*i*100+b*j*100+c*k+d*l):
                    g = (k*c+d*l)/(a*i*100+b*j*100+c*k+d*l)
                    ans = [a*i*100+b*j*100+c*k+d*l,k*c+d*l]
if len(ans) == 0:
    print(min(a,b)*100,0)
else:
    print(' '.join(map(str,ans)))

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<i64>();
    let l = read::<i64>();
    let mut sum = 0;
    let mut min_value = 1i64 << 30;
    for i in 0..n {
        let v = l + i;
        sum += l + i;
        if v.abs() < min_value.abs() {
            min_value= v;
        }
    }
    println!("{}", sum - min_value);
}


Measured memory_bytes: 4352
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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; }

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    bool turn = false;
    while (a > 0 && c > 0) {
        //cout << a << " " << b << endl;
        if (turn) a -= d;
        else c -= b;
        turn = !turn;
    }

    if (a<=0) cout << "No";
    else cout << "Yes";



    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#define rep(i, a, n) for(ll i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) { return a * b / gcd(a, b);}

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll double_c = b / c - (a-1) / c;
    ll double_d = b / d - (a-1) / d;
    ll double_cd = b / lcm(c, d) - (a-1) / lcm(c, d);
    //cout << double_c << double_d << double_cd << endl;
    cout << (b - a + 1) - (double_c + double_d - double_cd) << endl;;
    return 0;
}


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

struct edge{
	int from, to, cost;
};

const int N = 5010;
const int INF = 1e9;

vector <int> G[N];
vector <int> G2[N];
edge E[N];
int used[N], valid[N], d[N];
int n, m;

void dfs1(int x){
	used[x] = 1;
	for (auto it : G[x]){
		if (!used[it]) dfs1(it);
	}
}

void dfs2(int x){
	used[x] = 1;
	for (auto it : G2[x]){
		if (!used[it]) dfs2(it);
	}
}

bool Bellman_Ford(int s){
	for (int i = 1; i <= n; i++) d[i] = INF;
	d[s] = 0;
	for (int i = 1, flag; i <= n; i++){
		flag = 0;
		for (int j = 1; j <= m; j++){
			edge e = E[j];
			if (d[e.from] != INF && valid[e.from] && valid[e.to] && d[e.to] > d[e.from] + e.cost){
				d[e.to] = d[e.from] + e.cost;
				if (i == n) return false;
				flag = 1;
			}
		}
		if (!flag) break;
	}
	return true;
}

int main(){
	int x;
	scanf("%d %d %d",&n,&m,&x);
	for (int i = 1; i <= m; i++){
		scanf("%d %d %d",&E[i].from,&E[i].to,&E[i].cost);
		E[i].cost = x - E[i].cost;
		G[E[i].from].push_back(E[i].to);
		G2[E[i].to].push_back(E[i].from);
	}
	for (int i = 1; i <= n; i++) valid[i] = 1;
	memset(used, 0, sizeof(used));
	dfs1(1);
	for (int i = 1; i <= n; i++){
		if (!used[i]) valid[i] = 0;
	}
	memset(used, 0, sizeof(used));
	dfs2(n);
	for (int i = 1; i <= n; i++){
		if (!used[i]) valid[i] = 0;
	}
	if (!Bellman_Ford(1)) printf("-1\n");
	else printf("%d\n", max(-d[n], 0));
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

const int mod = 1000000007;
int main() {
    int n;
    cin >> n;
    ll sum = 1;
    rep(i,n) {
        sum *= 10;
        sum %= mod;
    }
    ll a = 1;
    ll b = 1;
    ll c = 1;
    rep(i,n) {
        a *= 9;
        a %= mod;
        b *= 9;
        b %= mod;
        c *= 8;
        c %= mod;
    }
    ll sum2 = (a+b-c)%mod;
    
    ll ans = (sum-sum2+mod)%mod;
    cout << ans << endl;
}

Measured memory_bytes: 3652
import Foundation

let  N = Int(readLine()!) ?? 0
var  array = (readLine()!)  .components(separatedBy: " ").map{Int($0) ?? 0 }
var  array2: [(Int,Int)] = []
for  (x, value) in array.enumerated(){
    array2.append((x, value))
}

array2.sort {$0.1 > $1.1}

var  status_array = Array(repeating: Array(repeating: 0, count: N+1), count: N+1)

array2.enumerated().forEach{
    //print($0.0,$0.1.0,$0.1.1)
    for j in 0..<$0.0+1{
    //左に詰める場合
        status_array[$0.0 + 1][j + 1] = max(status_array[$0.0 + 1][j + 1] , status_array[$0.0][j] + ($0.1.0 - j) * $0.1.1)

    // 右に詰める場合
        status_array[$0.0 + 1][j] = max(status_array[$0.0 + 1][j], status_array[$0.0][j] + ((N - ($0.0 - j) - 1) - $0.1.0) * $0.1.1)
    }
    
}

var total = 0
for i in status_array{
    
    for j in i{
        total = total < j ? j :total
    }
}
print(total)


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string A,B;
  cin >> A;
  cin >> B;
  string ans;

  if(A.size() > B.size()){
    ans = "GREATER";
  } else if(A.size() < B.size()){
    ans = "LESS";
  } else{
    ans = "EQUAL";
    for(int i =0; i < A.size(); i++){
      if(A[i] > B[i]){
        ans = "GREATER";
        break;
      } 
      if(A[i] < B[i]){
        ans = "LESS";
        break;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;
typedef tuple<int,int,int> TP;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}
 
ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}
 
ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int H1,H2,M1,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    if(M1 > M2) {
        H2--;
        M2 += 60;
    }
    cout << (H2 - H1) * 60 + (M2 - M1) - K << endl;
}

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

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

signed main(){
	int A,B; cin>>A>>B;
	set<int> div_a;
	div_a.insert(1);
	if(A>B)swap(A,B);
	for(int i=1;i*i<=A;i++){
		if(A%i==0){
			int j=A/i;
			if(pri(i))div_a.insert(i);
			if(pri(j))div_a.insert(j);
		}
	}
	int ans=0;
	for(auto p: div_a){
		if(B%p==0)ans++;
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

int main() {
	int n;
	cin >> n;
	rep(i, n + 1) {
		if ((int)(i * 1.08) == n) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int,input().split()))
    res = 10**18
    for i in range(-101,101):
        tmp = 0
        for j in a:
            tmp += (j-i)**2
        res = min(res, tmp)
    print(res)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38768
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        switch (num)
        {
            case 25:
                WriteLine("Christmas");
                break;
            case 23:
                WriteLine("Christmas Eve Eve");
                break;
            case 24:
                WriteLine("Christmas Eve");
                break;
            case 22:
                WriteLine("Christmas Eve Eve Eve");
                break;
        }
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11220
# include <iostream>

int main() {
	int n;
	std::cin >> n;

	for (int i = 1; i <= n; i++) {
		int x = i;
		if (x % 3 == 0) {
			std::cout << " " << i;
		}
		else {
			for (; x; x /= 10) {
				if (x % 10 == 3) {
					std::cout << " " << i;
					break;
				}
			}
		}
	}
	std::cout << std::endl;

	return 0;
}

Measured memory_bytes: 3092
import java.util.*;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    try {
      int n = scanner.nextInt();
      int[] a =IntStream.range(0, n)
        .map(i -> scanner.nextInt())
        .toArray();

      int sum = Arrays.stream(a).sum();
      a = Arrays.stream(a).map(i -> i * n).toArray();
      
      int mini = 999;
      int ans = 999;
      for (int i = n - 1; i >= 0; i--) {
        int diff = Math.abs(a[i] - sum);
        if (diff <= mini) {
          mini = diff;
          ans = i;
        }
      }
      System.out.println(ans);
    } finally {
      scanner.close();
    }
  }
}


Measured memory_bytes: 26960
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <math.h>

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

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
template<class T> using hset = unordered_set<T>;
template<class Key, class T> using hmap = unordered_map<Key, T>;

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

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

    for (int _=0; _<m; _++) {
        hset<string> hs;
        string s; cin >> s;
        hs.insert(s);
        for (int i=1; i<=s.size()-1; i++) {
            for (int j=0; j<8; j++) {
                string s1, s2;
                if ((j>>2) % 2 == 0) {
                    s1 = s.substr(0, i);
                    s2 = s.substr(i);
                } else {
                    s1 = s.substr(i);
                    s2 = s.substr(0, i);
                }
                if ((j>>1) % 2 != 0) reverse(s1.begin(), s1.end());
                if ((j>>0) % 2 != 0) reverse(s2.begin(), s2.end());

                hs.insert(s1+s2);
            }
        }
        cout << hs.size() << endl;
    }

    return 0;
}

Measured memory_bytes: 3260
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(c,b/a)<<endl;
	return 0;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    
    x=[]
    for i in range(n):
        s=int(input())
        x.append(s)
    x1=sorted(x)
    if n==0:
        break
    else:
        sum1=sum(x1)
        sum1-=x1[0]+x1[n-1]
        y=sum1//(n-2)
        print(y)


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 10000000000
int n;
vector<int>bam(3),sum(3);
int ans=INF;
vector<int>l(8),check(8);
void calc(vector<int>v){
    vector<int>use(3,-1);
    int cnt=0;
    rep(i,n){
        if(v[i]!=3){
        sum[v[i]]+=l[i];
        use[v[i]]++;
        }
    }
    rep(i,3){
        int t=max((int)(0),use[i]);
        cnt+=10*t;
    }
    rep(i,3){
        if(sum[i]==0){
        rep(i,3)sum[i]=0;
        return;
        }
    }
    rep(i,3)cnt+=abs(bam[i]-sum[i]);
    ans=min(cnt,ans);
    rep(i,3)sum[i]=0;
    return;
}
void dfs(int depth,vector<int>v){
    if(depth==n){
        calc(v);
        return;
    }
    rep(i,4){
        v[depth]=i;
        dfs(depth+1,v);
    }
    return;
}
signed main(){
    cin>>n>>bam[0]>>bam[1]>>bam[2];
    rep(i,n)cin>>l[i];
    dfs(0,check);
    cout<<ans<<endl;
    return 0;
}


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

sumA=As[-1]
MOD=10**9+7
ans=0
for n in range(N-1):
    Ai=As[N-2-n]
    ans+=sumA*Ai
    ans%=MOD
    sumA+=Ai
    sumA%=MOD
print(ans)

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

int main(){
  ll n,k;
  cin >> n >> k;
  vector<int> vc(n);
  rep(i, n){
    cin >> vc[i];
  }

  vector<int> ans;
  ll mx = 0;
  for (int i = 0; i < n - k; i++){
    if(vc[i] < vc[i+k]){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4052
// template version 1.14
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;
const int MOD=1e9+7;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

signed main() {
  int n,m;cin>>n>>m;
  map<int, int> d;
  vector<int> a(n);
  rep(i, n) {
    cin>>a[i];
    d[a[i]]++;
  }
  dump(a);
  vector<int> b(m);
  rep(i, m) {
    cin>>b[i];
    d[b[i]]++;
  }
  dump(b);

  vi vor, vand;
  each(el, d){
    vor.pb(el.first);
    if (el.second==2) vand.pb(el.first);
  }
  dump(vand);
  dump(vor);
  cout << sz(vand) << " " << sz(vor) << endl;
  rep(i, sz(vand)) cout << vand[i] << endl;
  rep(i, sz(vor)) cout << vor[i] << endl;
  return 0;
}



Measured memory_bytes: 20528
#include <stdio.h>
int main(void){
	int N,x,i;
	x=0;
	scanf("%d",&N);
	if((N>=700)&&(N<=800)){
		printf("Yes\n");
		x=1;
	}
	if(x==0){
		if((N+3)%10==0){
			printf("Yes\n");
			x=1;
		}
	}
	
	if(x==0){
		for(i=21;i<=30;i++){
			if((N+i)%100==0){
				printf("Yes\n");
				x=1;
			}
		}
	}
	if(x==0){
		printf("No\n");
	}
	
	return 0;
}
		
				

Measured memory_bytes: 1644
import java.awt.geom.*;
import java.io.*;
import java.util.*;

public class Main{
	double EPS = 1.0e-08;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			Point2D[] p = new Point2D[n];
			for(int i = 0; i < n; i++){
				String [] input = sc.next().split(",");
				double x = Double.parseDouble(input[0]);
				double y = Double.parseDouble(input[1]);
				p[i] = new Point2D.Double(x, y);
			}
			Point2D [] res = convexHull(p);
			System.out.println(n - res.length);
			
		}
	}
	
	Comparator< Point2D > com = new Comparator< Point2D >() {
		public int compare(Point2D o1, Point2D o2) {
			if(o1.getX() < o2.getX()) return -1;
			else if(o1.getX() > o2.getX()) return 1;
			else if(o1.getY() < o2.getY()) return -1;
			else if(o1.getY() > o2.getY()) return 1;
			else return 0;
		}
	};
	
	private Point2D [] convexHull(Point2D [] p) {
		int n = p.length;
		Arrays.sort(p, com);
		ArrayList<Point2D> q = new ArrayList<Point2D>();
		q.add(p[0]);
		q.add(p[1]);
		
		for(int i = 2; i < n; i++){
			boolean correct_turn;
			do{
				Point2D q1 = q.get(q.size() - 2);
				Point2D q2 = q.get(q.size() - 1);
				correct_turn = Line2D.relativeCCW(q1.getX(), q1.getY(), q2.getX(), q2.getY(), p[i].getX(), p[i].getY()) == -1;
				if(! correct_turn)q.remove(q.size() - 1);
			}while(! correct_turn && q.size() >= 2);
			q.add(p[i]);
		}
		int t = q.size();
		for(int i = n - 2; i >= 0; i--){
			boolean correct_turn;
			do{
				Point2D q1 = q.get(q.size() - 2);
				Point2D q2 = q.get(q.size() - 1);
				correct_turn = Line2D.relativeCCW(q1.getX(), q1.getY(), q2.getX(), q2.getY(), p[i].getX(), p[i].getY()) == -1;
				if(! correct_turn)q.remove(q.size() - 1);
			}while(! correct_turn && q.size() > t);
			q.add(p[i]);
		}
		q.remove(q.size() - 1);
		Point2D [] res = q.toArray(new Point2D[q.size()]);
		return res;
	}
	
	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

	public static void main(String[] args) {
		new Main().doit();
	}
}

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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;

ll gcd(ll a, ll b)
{
    return (a < b) ? gcd(b, a) : ((a % b) ? gcd(b, a % b) : b);
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

ll powmod(ll x, ll p, ll m)
{
    if (p == 0)
        return 1;
    if (p & 1)
        return powmod(x, p - 1, m) * x % m;
    ll r = powmod(x, p / 2, m);
    return r * r % m;
}

constexpr ll MOD = 1000000007;

int main()
{
    ll N, D;
    cin >> N >> D;
    llvv X(N, llv(D));
    rep(i, N)
    {
        rep(j, D)
        {
            cin >> X[i][j];
        }
    }
    ll cnt = 0;
    rep(i, N)
    {
        rep(j, N)
        {
            if (j <= i)
                continue;
            ll sum = 0;
            rep(k, D)
            {
                ll diff = X[i][k] - X[j][k];
                sum += diff * diff;
            }
            ll l = 1;
            while (l * l <= sum)
                if (l * l == sum)
                {
                    cnt++;
                    break;
                }
                else
                {
                    l++;
                }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int ZERO = 48;

    public static String process(String S) {

        int diffStartWithZero = diffStartsWith(0, S);
        int diffStartWithOne = diffStartsWith(1, S);

        return String.valueOf(Math.min(diffStartWithZero, diffStartWithOne));
    }

    private static int diffStartsWith(int start, String S) {
        int diff = 0;
        for (int i = 0, length = S.length(); i < length; ++i) {
            if (S.codePointAt(i) - ZERO != start) {
                diff++;
            }
            start = (start + 1) % 2;
        }

        return diff;
    }

    // Util func

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        final String result = process(S);

        output(result);
    }

    private static void output(String result) {
        System.out.println(result);
    }
}


Measured memory_bytes: 24400
#include <iostream>

using namespace std;

int main(){
    int n;
    int min, index;
    int count=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int j1=0;j1<n;j1++){
        min = a[j1];
        index = j1;
        for(int j2=j1+1;j2<n;j2++){
            if(min>a[j2]){
                min = a[j2];
                index = j2;
            }
        }
        if(j1!=index){
          swap(a[j1], a[index]);
          count += 1;
        }
    }
    for(int t=0;t<n;t++){
        if(t==n-1){
            cout << a[t];
            break;
        }
        cout << a[t] << " ";
    }
    cout << endl << count << endl;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
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; }
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

int n,y;

void input(){
    cin >> n >> y;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    for(int i=0;10000*i<=y;i++){
        for(int j=0;10000*i+5000*j<=y;j++){
            if((y-10000*i-5000*j)/1000 == n-i-j){
                cout << i << ' ' << j << ' ' << n-i-j << endl;
                exit(0);
            }
        }
    }
    cout << -1 << ' ' << -1 << ' ' << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main(void){
    
    int n=0;
    int x[5];
    for(int i=0; i<5; i++){
        cin >> x[i];
        if(x[i] == 0){
            n = i+1;
            break;
        }
    }
    cout << n << endl;
}

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

using namespace std;

int main(){
    string s,ans = "Yes";
    cin >> s;

    for(int i = 0;i < s.size();i++){
        if(i % 2 == 0 && s[i] == 'L')
            ans = "No";
        else if(i % 2 != 0 && s[i] == 'R')
            ans = "No";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 * @author Video Vocabulary
 * @date 2020-05-31 18:43:19
 */
#include <bits/stdc++.h>

using namespace std;

long long biggest = pow(10, 18);

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

    long long a, c;
    long double b;
    cin >> a >> b;
    c = a*b;
    cout << c << endl;
}


Measured memory_bytes: 3748
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro split-ints-bind (vars string &body body)
  (let ((position (gensym))
        (s (gensym)))
    (labels ((expand (vars &optional init-pos)
               (if (null vars)
                   body
                   `((multiple-value-bind (,(car vars) ,position)
                         (parse-integer ,s :start ,(or init-pos position)
                                           :junk-allowed t)
                       ,@(when (null (cdr vars)) `((declare (ignore ,position))))
                       ,@(expand (cdr vars)))))))
      `(let ((,s ,string))
         (declare (string ,s))
         ,@(expand vars 0)))))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (declare (inline sort))
  (let* ((n (read))
         (m (read))
         ;; (cost . max)
         (table (make-array n :element-type '(cons uint32 uint32))))
    (dotimes (i n)
      (split-ints-bind (a b) (read-line)
        (setf (aref table i) (cons a b))))
    (setf table (sort table #'< :key #'car))
    (let ((cost-sum 0)
          (cumul 0))
      (loop for i below n
            for (cost . limit) = (aref table i)
            do (if (>= (+ cumul limit) m)
                   (progn (incf cost-sum (* cost (- m cumul)))
                          (loop-finish))
                   (progn (incf cumul limit)
                          (incf cost-sum (* cost limit)))))
      (println cost-sum))))

#-swank(main)


Measured memory_bytes: 55912