akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000000

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

auto factor(int n){
  map<int,int>res;
  for(int i=2;i*i<=n;i++){
      for(; n%i==0;n/=i) res[i]++;
  }
  if(n>1)res[n]++;
  return res;
}
////////////////////////////////////////////////////////////
signed main() {
  int n;
  cin>>n;
  int ans=1;
  map<int,int>res;
  for(int j=2;j<=n;j++){
    int t=j;
  for(int i=2;i*i<=t;i++){
      for(; t%i==0;t/=i) res[i]++;
  }
  if(t>1)res[t]++;
}
for(auto[a,b]:res){
  ans=ans*(1+b)%MOD;
}
  cout<<ans<<endl;
}


Measured memory_bytes: 3568
(n,m) = tuple(map(int,input().split()))
b = list(map(int,input().split()))
a = list(map(lambda x:x*(-1),b))

import heapq
heapq.heapify(a)

temp = 0
for i in range(m):
    temp = heapq.heappop(a)
    heapq.heappush(a,temp/2)

import math
c = list(map(lambda x:x*(-1),a))
print(sum(list(map(math.floor,c))))

Measured memory_bytes: 107160
#![allow(unused)]

use std::cmp::{min, max};
use std::collections::BinaryHeap;

macro_rules! dbg {
    ($($a:expr),*) => {
        use std::io::Write;
        writeln!(
            std::io::stderr(),
            concat!($(stringify!($a), " = {:?}, "),*),
            $($a),*);
    }
}

//
// Based on EbTech's Scanner https://stackoverflow.com/q/56449027
//
struct Scanner<'a, R: std::io::BufRead> {
    reader: R,
    buf: String,
    iter: std::str::SplitWhitespace<'a>,
}

impl<'a, R: std::io::BufRead> Scanner<'a, R> {
    fn new(reader: R) -> Scanner<'a, R> {
        Scanner { reader: reader, buf: String::new(), iter: "".split_whitespace() }
    }

    fn get_str(&mut self) -> &str {
        if let Some(t) = self.iter.next() {
            return t;
        }
        self.buf.clear();
        self.reader.read_line(&mut self.buf).expect("I/O error");
        self.iter = unsafe { std::mem::transmute(self.buf.split_whitespace()) };
        self.get_str()
    }

    fn get<T: std::str::FromStr>(&mut self) -> T {
        self.get_str().parse().ok().expect("Parse error")
    }
}

fn main() {
    let stdin = std::io::stdin();
    solve(Scanner::new(stdin.lock()));
}

fn solve<R: std::io::BufRead>(mut sc: Scanner<R>) {
    let n: usize = sc.get();
    let m: usize = sc.get();
    let edges: Vec<(usize, usize)> =
        (0..m).map(|_| (sc.get(), sc.get())).collect();

    let mut g = vec![vec![]; n];
    let mut indeg = vec![0; n];
    for (s, t) in edges {
        g[s - 1].push(t - 1);
        indeg[t - 1] += 1;
    }

    // 入次数が0の頂点から開始したときにパスは最も長くなる
    let mut front: Vec<usize> = (0..n).filter(|&u| indeg[u] == 0).collect();
    let mut dmax = 0;
    loop {
        let mut next = vec![];
        for u in front {
            for &v in &g[u] {
                indeg[v] -= 1;
                if indeg[v] == 0 {
                    next.push(v);
                }
            }
        }
        if next.is_empty() {
            break;
        }
        front = next;
        dmax += 1;
    }

    println!("{}", dmax);
}

Measured memory_bytes: 12540
#include<stdio.h> //挿入ソート
#define N 101

void sort(int *,int);
void output(int * ,int);


int main(){

  int i,n;
  int a[N];

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

  output(a,n);
  sort(a,n);
  
  return 0;
}


void sort(int A[],int n){

  int i,j,key;
  
  for(i = 1 ; i < n ; i++){
    key = A[i];
    j = i-1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key ;

    output(A,n);
  }
}


void output(int A[],int n){
  
  int i;
  
  for(i = 0 ; i < n ; i++){
    if(i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}



Measured memory_bytes: 2112
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector< vector<int> > fldR(33,vector<int>(N));
	vector< vector<int> > fldL(33,vector<int>(N));
	vector< LL > X(N);
	for(int i=0;i<N;++i){
		cin >> X[i];
	}
	
	LL Len;
	cin >> Len;
	////
	LL sum = 0;
	int pos = 1;
	for(int i=0;i<N;++i){
		while(pos<N && X[pos]-X[i] <= Len ){
			++pos;
		}
		fldR[0][i] = pos-1;
	}
	for(int i=1;i<33;++i){
		for(int pos = 0;pos<N;++pos){
			fldR[i][pos] = fldR[i-1][ fldR[i-1][pos] ];
		}
	}

	////
	int Q;
	cin >> Q;
	while(Q--){
		int A,B;
		cin >> A >> B;
		--A;--B;
		if( A>B ){
			swap(A,B);
		}
		int L,R,mid;//日数
		L = 0;
		R = N-1;
		while(R-L>1){
			mid = (L+R)/2;
			int temp = mid;
			int pos = A;//スタート地点
			int pday = 0;
			while(temp){
				if( temp%2 ){
					pos = fldR[pday][pos];
				}
				++pday;
				temp /= 2;
			}
			if( B <= pos ){
				R = mid;
			}else{
				L = mid;
			}
		}
		cerr << ">> ";
		cout << R << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 27896
x=[]
y=[]
n,m=map(int,input().split())
for i in range(n):
    x.append([])
for i in range(n):
    y=list(map(int,input().split()))
    x[i].extend(y)

b=[]
for i in range(m):
    j=int(input())
    b.append(j)

for i in range(n):
    sum=0
    for j in range(m):
        sum+=x[i][j]*b[j]
    print(sum)

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vec a = ivec(n);
    repall (e, a) {
        if (e == 0) {
            print(0);
            return 0;
        }
    }

    int ans = 1;
    constexpr int x = 1e18;
    repall (e, a) {
        if (x / e < ans) {
            print(-1);
            return 0;
        }
        ans *= e;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 3992
N = input()
n = 0
for i in range(1,len(N)):
	if(N[i] == "9"):
		n+=1
if(n==len(N)-1):
	print(int(N[0]) + (len(N)-1)*9)
else:
	print(int(N[0]) - 1 + (len(N)-1)*9)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<cstring>
using namespace std;

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

// 3 ** 11
int N, M;
int num[200000];
int dp[200000];

int encode(string s) {
	int h = 0;
	for(int i = 0; i < s.size(); i++) {
		h = h * 3 + s[i] - '0';
	}
	return h;
}

void decode(int c, string &s) {
	REP(i, M) {
		s[M - 1 - i] = '0' + c % 3;
		c /= 3;
	}
}

int get_num(string str) {
	int state = encode(str);
	if( num[state] >= 0 ) return num[state];
	
	int res = 0;
	for(int i = 0; i < str.size(); i++) {
		if( str[i] == '2' ) {
			str[i] = '0';
			res += get_num(str);
			str[i] = '1';
			res += get_num(str);
			break;
		}
	}
	return num[state] = res;
}

int rec(string s) {
	int state = encode(s);
	if( num[state] <= 1 ) return 0;
	if( dp[state] >= 0 ) return dp[state];
	int res = 999999;
	for(int i = 0; i < s.size(); i++) {
		if( s[i] == '2' ) {
			int t = 0;
			s[i] = '0';
			t = max(t, 1 + rec(s));
			s[i] = '1';
			t = max(t, 1 + rec(s));
			s[i] = '2';
			res = min(t, res);
		}
	}
	return dp[state] = res;
}

int main() {
	for(;;) {
		cin >> M >> N;
		if( N == 0 && M == 0 ) break;
		memset(num, -1, sizeof(num));
		memset(dp, -1, sizeof(dp));
		REP(i, N) {
			string str;
			cin >> str;
			int key = encode(str);
			num[key] = 1;
		}
		
		int three = 1;
		REP(i, M) three *= 3;
		
		string s(M, '_');
		
		REP(state, three) {
			decode(state, s);
			get_num(s);
		}
		
		REP(i, M) s[i] = '2';
		int ans = rec(s);
		cout << ans << endl;
	}
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int maxv[2][200010];
int A[200010];

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

	int N;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> A[i];
	}

	maxv[0][0] = 1;
	maxv[1][N + 1] = 1;
	int tm = 1;
	rep(i, 0, N)
	{
		chmax(tm, A[i]);
		maxv[0][i + 1] = tm;
	}
	tm = 1;
	rrep(i, 0, N)
	{
		chmax(tm, A[i]);
		maxv[1][i + 1] = tm;
	}

	rep(i, 0, N)
	{
		cout << max(maxv[0][i], maxv[1][i + 2]) << endl;
	}

	return 0;
}

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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    string s;
    cin >> s;
    int len = s.length();
    int c = 0;
    for (int i = 0; i < len; i++) {
        if ((s[i] - '1' + 1) == 1) c++;
    }
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
d = [h[i+1]-h[i] for i in range(0, len(h)-1)]
S = 0
for i in range(k-1):
    S += d[i]
ans = S
for i in range(0, n-k):
    SS = S + d[i+k-1] - d[i]
    if SS <= ans:
        ans = SS
    S = SS
print(ans)


Measured memory_bytes: 11216
#include<iostream>

using namespace std;
int n;
int a[100];

int gcd(int a, int b)
{
  if(b==0)
    return a;
  return gcd(b,a%b);
}
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
    cin>>a[i];
  int ans=1;
  for(int i=1;i<=n;i++)
    {
      int d=gcd(ans,a[i]);
     
      ans*=a[i];
      ans/=d;
    }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 1164
#include <unordered_set>
#include <iostream> 

using namespace std;
int main () {
 	
    unordered_set<int> cands{1,2,3};
  	int a, b;
	cin >> a;
  	cin >> b;
  	cands.erase(a);
  	cands.erase(b);
  	cout << *cands.begin() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)

int main(){
    int H,W; cin >> H >> W;
    ve_vec c(H,vec(W));
    rep(i,H) rep(j,W) cin >> c[i][j];

    rep(i,2*H) {
        rep(j,W){
            cout << c[i/2][j];
        }
        cout << endl;
    }
    return 0;
}

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

const int N = 3002;

int p[N][N], len[N][N];

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  string str[2];
  cin >> str[0] >> str[1];
  
  str[0] += '1';
  str[1] += '2';
  int s[2] = {str[0].size(), str[1].size()};
  for(int i = 0; i < s[0]; i++) {
    for(int j = 0; j < s[1]; j++) {
      if(str[0][i] == str[1][j]) {
        len[i][j]++;
        if(len[i+1][j+1] <= len[i][j]) {
          p[i+1][j+1] = 1;
          len[i+1][j+1] = len[i][j];
        }
      } else {
        if(len[i+1][j] <= len[i][j]) {
          p[i+1][j] = 2;
          len[i+1][j] = len[i][j];
        }
        if(len[i][j+1] <= len[i][j]) {
          p[i][j+1] = 3;
          len[i][j+1] = len[i][j];
        }
      }
    }
  }
  string sub = "";
  int i = s[0]-1, j = s[1]-1;
  if(str[0][i] == str[1][j])
    sub = str[0][i] + sub;
  
  while(i != 0 || j != 0) {
    int dir = p[i][j],
        dl[] = {0, -1, -1, 0},
    	dc[] = {0, -1, 0, -1};
    if(dir == 0) {
      cout << i << ' ' << j;
      exit(0);
    }
    i += dl[dir];
    j += dc[dir];
    if(str[0][i] == str[1][j])
      sub = str[0][i] + sub;
  }
  cout << sub;
}

Measured memory_bytes: 70656
private fun readInts() = readLine()!!.split(" ").map(String::toInt)

private val MOD = 1000000007
private val NOT_YET = -1

fun main(args: Array<String>) {
    val (N, M) = readInts()
    val a = (0 until M).map { readLine()!!.toInt() - 1 } // 0-indexed

    if (N == 1) {
        println(1)
        return
    }

    val ways = Array(N) { NOT_YET }
    for (hole in a) ways[hole] = 0

    ways[0] = if (ways[0] != NOT_YET) 0 else 1
    ways[1] = if (ways[1] != NOT_YET) 0 else ways[0] + 1

    for (position in 2 until N) {
        if (ways[position] == NOT_YET) {
            ways[position] = (ways[position - 1] + ways[position - 2]) % MOD
        }
    }

    println(ways.last())
}

Measured memory_bytes: 41444
while True:
    n,x = tuple(int(i) for i in input().split())
    if n == x == 0:
        break
    r = 0
    a = [j for j in range(1,n+1)]
    #print(a)
    for l in a:
        b = [k for k in range(1,l)]
        if len(b) == 0:
            continue
        #print(b)
        for m in b:
            c = [o for o in range(1,m) if l+m+o == x]
            #print(c)
            r += len(c)
            c.clear()
        b.clear()
    print(r)


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

using namespace std;

int H, W;

int Two2One(int x, int y){
  return y*W + x;
}

pair<int, int> One2Two(int pos){
  int x = pos % W;
  int y = pos / W;
  return make_pair(x, y);
}

int BFS(vector<vector<bool>> &s, vector<vector<bool>> &passed, vector<pair<int, int>> &next, int distance){

  vector<int> dx = {-1, 1, 0, 0};
  vector<int> dy = {0, 0, -1, 1};
  
  vector<pair<int, int>> candidates;
  for(auto &elem : next){
    int xcur = elem.first;
    int ycur = elem.second;
    
    for(int i=0; i<4; i++){
      int xs = xcur + dx[i];
      int ys = ycur + dy[i];
      if (xs < 0 || ys < 0 || xs >= W || ys >= H) continue;
      if (!s[ys][xs]) continue;
      if (passed[ys][xs]) continue;
      passed[ys][xs] = true;
      candidates.emplace_back(make_pair(xs, ys));
    }
  }
  
  if (candidates.empty()) return distance;
  
  return BFS(s, passed, candidates, distance+1);
}

int main(){
  cin >> H >> W;
  
  vector<vector<bool>> S(H, vector<bool>(W, false));
  for (int i=0; i<H; i++){
    string temp;
    cin >> temp;
    for(int j=0; j<W; j++) S[i][j] = (temp[j] == '.');
  }
  
  int maxDistance = 0;
 
  for(int s=0; s<H*W; s++){
    auto pos_s = One2Two(s);
    if(!S[pos_s.second][pos_s.first]) continue;

    vector<vector<bool>> passed(H, vector<bool>(W, false));
    vector<pair<int, int>> first = {make_pair(pos_s.first, pos_s.second)};
    passed[pos_s.second][pos_s.first] = true;
    int distance = BFS(S, passed, first, 0);
    maxDistance = max(maxDistance, distance);
    
  }

  cout << maxDistance;
  return 0;
}

Measured memory_bytes: 256
//	@Author : Gaurang_Kothiya

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

#define data_set(type) tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define ld long double
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(int i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define ook(num) order_of_key(num)
#define fbo(num) find_by_order(num)
#define gcd(a,b) __gcd(a,b)
#define bits(n) __builtin_popcountll(n)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846

const int inf= 1e9 +1;
const int inf64= 1e18 -1;
const int MOD= 1e9 +7;
const int MOD2= 998244353;



void Solve()
{
	ld s,t,x;
	cin>>s>>t>>x;
	if(s/t <=x) cout<<"Yes";
	else cout<<"No";
	
}
 
signed main() 
{
	//speed		

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

	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
		
	return 0;
} 

Measured memory_bytes: 3720
N, L = map(int, input().split())


pie = 0
ans = 10**9

for i in range(1,N+1):
  pie += L + i - 1
  
if L >= 1:
  ans = pie - L
elif abs(L-1) <= N:
  ans = pie
else:
  ans = pie - (L+N-1)
print(ans)


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

bool visit[100005];
int arr[105];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int z,x;
	cin>>z>>x;
	int a;
	for(int q=1;q<=z;q++)
	{
		cin>>arr[q];
//		visit[a]=true;
	}
	int d;
	for(int q=1;q<=x;q++)
	{
		for(int w=1;w<=z;w++)
		{
			if(q-arr[w]>=0)
			{
				if(visit[q-arr[w]]==false)visit[q]=true;
			}
		}
	}
	if(visit[x]==true)cout<<"First"<<endl;
	else cout<<"Second"<<endl;
}

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

int main(){
    ll int n,sum=0,count=1,a[200001],b[200002];
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a[i];
        if(i==0){
            b[0]=0;
        }else{
            b[i]=b[i-1]+a[i-1];
        }
    }
    b[n]=b[n-1]+a[n-1];
    sort(b,b+n+1);
    for (int i=1;i<=n;i++){
        if(b[i]==b[i-1]){
            sum+=count;
            count++;
        }else{
            count=1;
        }
    }
    cout << sum;
}

Measured memory_bytes: 6740
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 1000000007;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    int K; cin >> K;
    long long ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class M>
struct LazySegmentTree{
    using T = typename M::T;
    using L = typename M::L;
    int sz, height{};
    vector<T> seg; vector<L> lazy;
    explicit LazySegmentTree(int n) {
        sz = 1; while(sz < n) sz <<= 1, height++;
        seg.assign(2*sz, M::e());
        lazy.assign(2*sz, M::l());
    }

    void set(int k, const T &x){
        seg[k + sz] = x;
    }

    void build(){
        for (int i = sz-1; i > 0; --i) seg[i] = M::f(seg[i<<1], seg[(i<<1)|1]);
    }

    T reflect(int k){ return lazy[k] == M::l() ? seg[k] : M::g(seg[k], lazy[k]); }

    void eval(int k){
        if(lazy[k] == M::l()) return;
        lazy[(k<<1)|0] = M::h(lazy[(k<<1)|0], lazy[k]);
        lazy[(k<<1)|1] = M::h(lazy[(k<<1)|1], lazy[k]);
        seg[k] = reflect(k);
        lazy[k] = M::l();
    }
    void thrust(int k){ for (int i = height; i; --i) eval(k>>i); }
    void recalc(int k) { while(k >>= 1) seg[k] = M::f(reflect((k<<1)|0), reflect((k<<1)|1));}
    void update(int a, int b, const L &x){
        thrust(a += sz); thrust(b += sz-1);
        for (int l = a, r = b+1;l < r; l >>=1, r >>= 1) {
            if(l&1) lazy[l] = M::h(lazy[l], x), l++;
            if(r&1) --r, lazy[r] = M::h(lazy[r], x);
        }
        recalc(a);
        recalc(b);
    }

    T query(int a, int b){ // [l, r)
        thrust(a += sz);
        thrust(b += sz-1);
        T ll = M::e(), rr = M::e();
        for(int l = a, r = b+1; l < r; l >>=1, r>>=1) {
            if (l & 1) ll = M::f(ll, reflect(l++));
            if (r & 1) rr = M::f(reflect(--r), rr);
        }
        return M::f(ll, rr);
    }
};

struct Monoid{
    using T = ll;
    using L = ll;
    static T f(T a, T b) { return min(a, b); }
    static T g(T a, L b) {
        return min(a, b);
    }
    static L h(L a, L b) {
        return min(a, b);
    }
    static T e() { return INF<ll>; }
    static L l() { return INF<ll>; }
};


int main() {
    int n, m;
    cin >> n >> m;
    vector<array<int, 3>> v(m);
    for (int i = 0; i < m; ++i) {
        scanf("%d %d %d", &v[i][1], &v[i][0], &v[i][2]);
        v[i][1]--;
    }
    sort(v.begin(),v.end());
    LazySegmentTree<Monoid> seg(n);
    seg.set(0, 0);
    seg.build();
    for (int i = 0; i < m; ++i) {
        ll val = seg.query(v[i][1], v[i][0]);
        seg.update(v[i][1], v[i][0], val + v[i][2]);
    }
    ll ans = seg.query(n-1, n);
    cout << (ans == INF<ll> ? -1 : ans) << "\n";
    return 0;
}

Measured memory_bytes: 5504
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
using namespace std;
const int N=100005;
int n,m,k,ans,a[N],b[N];
set<int> st;
struct data{
	int x,y;
}d[N];
bool cmp(data a,data b){
	return a.y>b.y;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i],&b[i]);
		if(m-a[i]+1>=1){
			k++;
			d[k].x=m-a[i]+1;
			d[k].y=b[i];
		}
	}
	for(int i=1;i<=m;i++){
		st.insert(i);
	}
	sort(d+1,d+k+1,cmp);
	for(int i=1;i<=k;i++){
		auto tmp=st.upper_bound(d[i].x);
		if(tmp!=st.begin()){
			ans+=d[i].y;
			tmp--;
			st.erase(tmp);
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;
typedef long long int ll;
int main()
{
  int h,n;
  cin>>h>>n;
  int arr[n],sum=0;
  for(int i=0;i<n;i++)
    {cin>>arr[i];sum+=arr[i];}
    if(sum>=h)
        cout<<"Yes\n";
    else
        cout<<"No\n";

}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
int main() {
	long n;
	vector<long> a;
	vector<long> l;
	long asum = 0, bsum = 0;;
	cin >> n;
	for (long i = 0; i < n; i++) {
		long t;
		cin >> t;
		a.push_back(t);
		asum += t;
	}
	bool flag = false;
	long po = 0, ng = 0;
	long nnum = 0;
	for (long i = 0; i < n; i++) {
		long t;
		cin >> t;
		//b.push_back(t);
		bsum += t;
		if (t > a[i]) {
			flag = true;
		}
		long dif = a[i] - t;
		l.push_back(dif);
		if (dif < 0) {
			ng += dif;
			nnum++;
		}
		else {
			po += dif;
		}
	}
	if (!flag) {
		cout << "0" << endl;
		return 0;
	}
	if (asum < bsum) {
		cout << "-1" << endl;
		return 0;
	}

	sort(l.begin(), l.end(), greater<long>());
	long cnt = 0;
	for (auto e : l) {
		cnt++;
		ng += e;
		if (ng >= 0) {
			break;
		}
	}
	cout << cnt + nnum << endl;

	return 0;
}

Measured memory_bytes: 2548
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

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

  double rate = 0;
  for (int i = 1; i <= N; i++) {
    int tmp = i;
    int bit_shift = 0;
    while (tmp < K) {
      tmp <<= 1;
      bit_shift++;
    }
    rate += pow(2.0, -bit_shift) / N;
  }

  cout << setprecision(12) << rate << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int a,b,c,d;

int p[2] = {1,-1};
char q[2] = {'+','-'};

int main(){
    int N;
    cin >> N;
    a = N / 1000;
    N %= 1000;
    b = N / 100;
    N %= 100;
    c = N / 10;
    N %= 10;
    d = N;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                if(a+p[i]*b+p[j]*c+p[k]*d==7){
                    cout << a << q[i] << b << q[j] << c << q[k] << d << "=7" << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = ''
for i in range(1, 99):
	if N <= 26 ** i:
		N -= 1
		for j in range(i):
			ans += chr(ord('a') + N % 26)
			N //= 26
		break
	else:
		N -= 26 ** i
print(ans[::-1]) # reversed

Measured memory_bytes: 9148
#include <iostream>
using ll = long long;
using namespace std;

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d) cout << "Left";
    else if (a + b < c + d) cout << "Right";
    else cout << "Balanced";
    return 0;
}

Measured memory_bytes: 256
/*
* Author. Silviase(@silviasetitech)
* For AtCoder
*/

import java.util.*;
import java.lang.*;
import java.math.*;


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


        int n = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[200000];
        long[] aruiseki = new long[200000];
        for (int i = 0; i < n; i++) {
            int tmpa = sc.nextInt();
            int tmpb = sc.nextInt();
            a[tmpa] += tmpb;
        }
        for (int i = 0; i < aruiseki.length; i++) {
            if (i > 0) {
                aruiseki[i] = aruiseki[i-1] + a[i];
                if (aruiseki[i] >= k) {
                    System.out.println(i);
                    break;
                }
            }
        }
        sc.close();
    }


    public static long gcd(Long m, long n) {
        if(m < n) {
            return gcd(n, m);
        }
        if(n == 0){
            return m;
        } 
        return gcd(n, m % n);
    }

    public static long[][] Combination_nCk(long n, long k) {
        n++; k++;
        long[][] ans = new long[(int)n][(int)k];
        for (int i = 0; i < n; i++) {
            ans[i][0] = 1;
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < k-1; j++) {
                if (i < j) {
                    ans[i][j] = 0;
                }else{
                    ans[i+1][j+1] = ans[i][j] + ans[i][j+1];
                }
            }
        }
        return ans;
    }

    public static double[][] Probability_nCk(int n, int k) {
        n++; k++;
        double[][] ans = new double[n][k];
        for (int i = 0; i < n; i++) {
            if (i == 0) {
                ans[i][0] = 1;
            }else{
                ans[i][0] = ans[i-1][0]/2;
            }
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < k-1; j++) {
                if (i < j) {
                    ans[i][j] = 0;
                }else{
                    ans[i+1][j+1] = (ans[i][j] + ans[i][j+1])/2;
                }
            }
        }
        return ans;
    }
}


Measured memory_bytes: 89132
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[])throws Exception{
    // Scanner sc = new Scanner(System.in);
    // int n = sc.nextInt();
    StringBuilder bl = new StringBuilder();
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    int A[] = new int[n];
    int B[] = new int[n];
    String C[] = new String[n];
    String D[] = new String[n];
    String S[];

    for(int i = 0; i<n; i++){
      // A[i] = sc.nextInt();
      S = br.readLine().split("\\s+");
      C[i] = S[0];
      A[i] = Integer.parseInt(S[1]);
      B[i] = A[i];
      D[i] = C[i];
    }

    quicksort(A,C,0,A.length-1);
    mergesort(B,D, n, 0, B.length);

    //安定性の判定
    int j = 0;
    int flag = 0;
    while(j<n){
      if(D[j]!=C[j]){
        System.out.println("Not stable");
        break;
      }
      j++;
    }
    if(j==n)System.out.println("Stable");

    //出力
    for(int i = 0; i < n; i++){
      bl.append(C[i]).append(' ').append(A[i]).append("\n");
    }
    System.out.print(bl);
  }
  static int partition(int A[],String C[], int p, int r){
    int x = A[r];
    int i = p-1;
    int tmp;
    String s;
    for(int j =p; j<r; j++){
      if(A[j]<=x){
        i = i+1;
        tmp = A[i];
        A[i] = A[j];
        A[j] = tmp;
        s = C[i];
        C[i] = C[j];
        C[j] = s;
      }
    }
    tmp = A[i+1];
    A[i+1] = A[r];
    A[r] = tmp;
    s = C[i+1];
    C[i+1] = C[r];
    C[r] = s;
    return i+1;
  }

  static void quicksort(int A[], String C[], int p, int  r){
    if(p<r){
      int q = partition(A, C, p, r);
      quicksort(A, C, p, q-1);
      quicksort(A, C, q+1,r);
    }
  }


  //mergesortと比較
  static void merge(int A[],String S[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    int L[] = new int[n1+1];
    int R[] = new int[n2+1];
    String Ls[] = new String[n1+1];
    String Rs[] = new String[n2+1];
    for(int i = 0; i<n1;i++){
      L[i] = A[left+i];
            Ls[i] = S[left+i];
    }
    for(int i =0; i<n2; i++){
      R[i] = A[i+mid];
      Rs[i] = S[i+mid];
    }
    L[n1] = (int)Double.POSITIVE_INFINITY;
    R[n2] = (int)Double.POSITIVE_INFINITY;
    int i = 0;
    int j = 0;
    for(int k = left; k<right; k++){
      if(L[i]<=R[j]){
        A[k] = L[i];
        S[k] = Ls[i++];
      }else{
        A[k] = R[j];
        S[k] = Rs[j++];
      }
    }
  }

  static void mergesort(int A[],String S[], int n, int left, int right){
    if(left+1<right){
      int mid = (left+right)/2;
      mergesort(A,S, n, left, mid);
      mergesort(A,S, n, mid, right);
      merge(A,S, left, mid, right);
    }
  }
}


Measured memory_bytes: 96116
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int main(){
    int n, m;
    cin >> n >> m;
    vi vec[n+1];
    int a[n+1]={0};
    for(int i=0; i<m; i++){
        int u, v;
        cin >> u >> v;
        vec[u].push_back(v);
        a[v]++;
    }
    queue<int> q;
    for(int i=1; i<=n; i++){
        if(a[i]==0){
            q.push(i);
        }
    }
    int ans[n+1] = {0};
    while(!q.empty()){
        int u = q.front();
        q.pop();
        for(int v:vec[u]){
            ans[v] = max(ans[v], ans[u] + 1);
            a[v]--;
            if(a[v]==0){
                q.push(v);
            }
        }
    }
    int res = ans[1];
    for(int i=2; i<=n; i++){
        res = max(res, ans[i]);
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 9728
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;



ld dis(pair<ld, ld>l, pair<ld, ld>r) {
	ld dx=l.first-r.first;
	ld dy=l.second-r.second;
	return sqrt(ld(dx)*dx+ ld(dy)*dy);
}

ld get_x(pair<ld, ld>f, pair<ld, ld>t, ld y) {
	if(f.second>t.second)return get_x(t,f,y);

	ld a=y-f.second;
	ld b=t.second-y;

	return (t.first*a+f.first*b)/(a+b);
}

int main() {
	vector<string>sts{ 
		"Rock","Fire","Scissors","Snake","Human","Tree","Wolf","Sponge","Paper","Air","Water","Dragon","Devil","Lightning","Gun" };
	while (true) {
		int N;cin>>N;
		if(!N)break;
		vector<int>nums(N);
		for (int i = 0; i < N; ++i) {
			string st;cin>>st;
			nums[i]=find(sts.begin(),sts.end(),st)-sts.begin();
			assert(nums[i]!=15);
		}
		int ans_id=-1;
		for (int i = 0; i < N; ++i) {
			int ok=true;
			int num=0;
			for (int j = 0; j < N; ++j) {
				if(i==j)continue;
				int a=nums[i];
				int b=nums[j];

				int sa=a-b;
				if(sa<0)sa+=15;
				if (sa == 0) {

				}
				else if (sa <= 7) {
					ok=false;
				}
				else {
					num++;
				}
			}
			if(ok&&num>0)ans_id=i;
		}
		if(ans_id==-1)cout<<"Draw"<<endl;
		else cout<<sts[nums[ans_id]]<<endl;
	}
	return 0;
}


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

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;

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

  ll a, b, n;
  cin >> a >> b >> n;

  ll x = min(n, b - 1);
  ll p = (a * x) / b;
  ll q = x / b;
  ll ans = p - a * q;
  cout << ans << endl;
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   string S;
   cin>>S;
   if(S.at(6)=='1'||S.at(6)=='2'||S.at(6)=='3'||S.at(6)=='4'){
   if(S.at(5)=='0'){
     cout<<"Heisei"<<endl;}
       else
   {
       cout<<"TBD"<<endl;
   }
   
   }
   else
   {
       cout<<"TBD"<<endl;
   }
   
}
   


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;
int h[100009];
int main(){
	int n;
	long long int a,b;
	cin>>n>>a>>b;
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	long long int sa=a-b;
	long long int mi=0,ma=1000000000,mid;
	while(ma-mi>1){
		mid=(mi+ma)/2;
		long long int cnt=0;
		for(int i=0;i<n;i++){
			if(h[i]>b*mid){
				cnt+=(h[i] - b * mid + a - b - 1) / (a-b);
			}
		}
		if(cnt>mid){
			mi=mid;
		}
		else{
			ma=mid;
		}
	}
	cout<<ma<<endl;
	return 0;
}


Measured memory_bytes: 640
//Author: Lixiang
#include<stdio.h>
const int maxn=100005;
struct C{
	int cnt[maxn],N;
	void init(){
		scanf("%d",&N);
		for(int i=1,t;i<=N;i++){
			scanf("%d",&t);
			cnt[t]++;
			cnt[t+1]++;
			cnt[t+2]++;
		}
	}
	void work(){
		int ans=0;
		for(int i=maxn-1;i>=0;i--)
			if(cnt[i]>ans)
				ans=cnt[i];
		printf("%d\n",ans);
	}
}sol;
int main(){
	sol.init();
	sol.work();
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

class Dice{
public:
    int F[6];
    void roleE(){
        int a = F[0]; F[0] = F[3]; F[3] = F[5]; F[5] = F[2]; F[2] = a;
    }
    void roleW(){
        int a = F[0]; F[0] = F[2]; F[2] = F[5]; F[5] = F[3]; F[3] = a;
    }
    void roleN(){
        int a = F[0]; F[0] = F[1]; F[1] = F[5]; F[5] = F[4]; F[4] = a;
    }
    void roleS(){
        int a = F[0]; F[0] = F[4]; F[4] = F[5]; F[5] = F[1]; F[1] = a;
    }
};

int main() {
    int n;
    string s;
    Dice dice;
    for (int i = 0; i < 6; i++) {
        cin >> n;
        dice.F[i] = n;
    }
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'E') dice.roleE();
        else if (s[i] == 'W') dice.roleW();
        else if (s[i] == 'N') dice.roleN();
        else if (s[i] == 'S') dice.roleS();
    }
    cout << dice.F[0] << endl;
    return 0;
}


Measured memory_bytes: 3196
def main():
    N, L = (int(i) for i in input().split())
    s = sum(L + i for i in range(N))
    mi = 10**9
    ans = -1
    for i in range(N):
        eat = L + i
        if abs(eat) < mi:
            mi = abs(eat)
            ans = s - eat
    print(ans)


if __name__ == '__main__':
    main()


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

const int N = 3e3+3;
int a[N][N], yay[N][N];

int main(){
	int n; cin >> n;
	for (int i = 1; i <= n; i++){
		for  (int j = 1; j <= n; j++){
			scanf("%d",&a[i][j]);
		}
	}
	int fuck = 0;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			if (i != j){
				for (int k = 1; k <= n; k++){
					if (i == k || j == k) continue;
					if (a[i][k] + a[k][j] < a[i][j]) fuck = 1;
					if (a[i][k] + a[k][j] == a[i][j]) yay[i][j] = 1;
				}
			}
		}
	}
	// for (int i = 1; i <= n; i++){
	// 	for (int j = 1; j <= n; j++){
	// 		cout << yay[i][j];
	// 	}
	// 	cout << endl;
	// }
	if (fuck){
		puts("-1");
		return 0;
	}
	long long ans = 0;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			if (!yay[i][j]) ans += a[i][j];
		}
	}
	printf("%lld\n",ans/2);
}

Measured memory_bytes: 7424
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);


int main(){
    IOS;
    ll n;cin>>n;
    ll a[n];
    f(i,0,n)cin>>a[i];
    ll pre[n];
    pre[n-1]=a[n-1];
    for(ll i=n-2;i>=0;i--){
        pre[i]=(pre[i+1]+a[i])%mod;
    }
    ll sum=0;
    f(i,0,n-1){
        sum+=(a[i]*pre[i+1])%mod;
        sum%=mod;
    }
    cout<<sum;
    return 0;  
} 





Measured memory_bytes: 6772
#include<stdio.h>
#include<math.h>

int isPrime(int x);

int main(void)
{
  int i;
  int x;
  int n;
  int ans=0;
  int count=0;

  scanf("%d",&n);
  
  for(i=0;i<n;i++)
    {
      scanf("%d",&x);
    
      ans=isPrime(x);
    
      if(ans!=0)
	{
	  count++;
	}   
    }
  printf("%d\n",count);

  return 0;
}

int isPrime(int x)
{
  int i;

  if(x==2)
    {
      return 1;
    }
  
  if(x<2||x%2==0)
    {
      return 0;
    }
  
  i=3;

  while(i<=sqrt(x))
    {
      if(x%i==0)
	{
	  return 0;
	}
      
      i+=2;
    }
  
  return 1;
}




Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<cmath>
int n;

struct Point{
        double x;
        double y;
};

void calc(int m,Point p1,Point p2){
        if(m>=n){
                return;
        }
        Point s,t,u;
        s.x=(2.0*p1.x+p2.x)/3.0;
        s.y=(2.0*p1.y+p2.y)/3.0;
        t.x=(p1.x+2.0*p2.x)/3.0;
        t.y=(p1.y+2.0*p2.y)/3.0;
        u.x=(t.x-s.x)*(1.0/2.0)-(t.y-s.y)*(sqrt(3.0)/2.0)+s.x;
        u.y=(t.x-s.x)*(sqrt(3.0)/2.0)+(t.y-s.y)*(1.0/2.0)+s.y;
        calc(m+1,p1,s);
        printf("%.8f %.8f\n",s.x,s.y);
        calc(m+1,s,u);
        printf("%.8f %.8f\n",u.x,u.y);
        calc(m+1,u,t);
        printf("%.8f %.8f\n",t.x,t.y);
        calc(m+1,t,p2);
}

int main(){
        std::cin>>n;
        Point p1,p2;
        p1.x=0; p1.y=0; p2.x=100; p2.y=0;
        printf("%.8f %.8f\n",p1.x,p1.y);
        calc(0,p1,p2);
        printf("%.8f %.8f\n",p2.x,p2.y);

        return 0;
}



Measured memory_bytes: 3204
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int q,s,h,d,n;
    scanf("%d%d%d%d%d",&q,&s,&h,&d,&n);
    s=min(s,2*q);
    h=min(h,2*s);
    d=min(d,2*h);
    printf("%lld\n",(n/2)*1ll*d+(n%2)*1ll*h);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 100005;
int dp[13][100005];
int solve(int a[], int size, int n)
{
	if(dp[size][n]!=-1)
	{
		// cout<<"0 "<<dp[size][n]<<' '<<n<<' '<<size<<endl;
		return dp[size][n];
	} 
	if(n<0 && size>0)
	{
		// cout<<"1 "<<n<<' '<<size<<endl;
		return INF;
	}
	else if(n==0)
	{
		// cout<<"2 "<<n<<' '<<size<<endl;
		return 0;
	}
	else if(size<=0)
	{
		// cout<<"3 "<<n<<' '<<size<<endl;
		return INF;
	}
	int ans1 = 1+solve(a,size,n-a[size-1]);
	int ans2 = solve(a,size-1,n);
	// return min(ans1,ans2);
	return dp[size][n] = min(ans1,ans2);
}
int main()
{
	int n,i,j;
	cin>>n;
	int v[100000];
	int size=0;
	v[size++]=1;
	int multiplier=6;
	while(multiplier<=n)
	{
		v[size++]=multiplier;
		multiplier*=6;
	}
	multiplier=9;
	while(multiplier<=n)
	{
		v[size++]=multiplier;
		multiplier*=9;
	}
	sort(v,v+size);
	// cout<<size<<endl;
	for(i=0;i<13;i++)
		for(j=0;j<100005;j++)
			dp[i][j]=-1;
	int ans = solve(v,size,n);
	// cout<<'h'<<dp[8]<<' '<<endl;
	cout<<ans<<endl;
}

Measured memory_bytes: 5376
#include<iostream>
#include<vector>

using namespace std;

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

typedef vector<int> Dice;
enum {TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM};
#define rotate_swap(x, a, b, c, d) swap(x[a], x[b]); swap(x[b], x[c]); swap(x[c], x[d]);

void rotate_r(Dice &dice) {rotate_swap(dice, TOP, LEFT, BOTTOM, RIGHT);}
void rotate_l(Dice &dice) {rotate_swap(dice, TOP, RIGHT, BOTTOM, LEFT);}
void rotate_f(Dice &dice) {rotate_swap(dice, TOP, BACK, BOTTOM, FRONT);}
void rotate_b(Dice &dice) {rotate_swap(dice, TOP, FRONT, BOTTOM, BACK);}
void rotate_w(Dice &dice) {rotate_swap(dice, BACK, LEFT, FRONT, RIGHT);}
void rotate_c(Dice &dice) {rotate_swap(dice, BACK, RIGHT, FRONT, LEFT);}

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    Dice dice(6);
    dice[TOP] = 1;
    dice[BACK] = 2;
    dice[LEFT] = 3;
    dice[RIGHT] = 4;
    dice[FRONT] = 5;
    dice[BOTTOM] = 6;
    rep (i, n) {
      string dir;
      cin >> dir;
      if (dir == "north") rotate_b(dice);
      if (dir == "east") rotate_r(dice);
      if (dir == "south") rotate_f(dice);
      if (dir == "west") rotate_l(dice);
    }
    cout << dice[TOP] << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, FastReader in, PrintWriter out) {

            int a = in.nextInt();
            int b = in.nextInt();

            if (a / 10 >= 1 || b / 10 >= 1)
                out.println(-1);
            else
                out.println(a * b);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,t;
    cin>>n;
    int sum=0;
    std::deque<int> deq;
    for (int i=0;i<n;i++) {
        cin>>t;
        deq.emplace_back(t);
        sum+=t;
    }
    int m,p,x;
    cin>>m;
    for (int j=0;j<m;j++) {
        cin>>p>>x;
        sum-=deq[p-1];
        sum+=x;
        cout<<sum<<endl;
        sum-=x;
        sum+=deq[p-1];
    }
}


Measured memory_bytes: 256
S = input()
R_count = [0,0]
L_count = [0,0]
N = len(S)
ans_R = [0] * N
ans_L = [0] * N
for i in range(N):
    if S[i] == 'R':
        if sum(R_count) % 2 != 0:
            R_count[0] += 1
        else:
            R_count[1] += 1
    else:
        if sum(R_count) == 0:
            continue
        ans_R[i] = R_count[0]
        ans_R[i-1] = R_count[1]
        R_count = [0,0]
for i in range(N):
    if S[N-1-i] == 'L':
        if sum(L_count) % 2 != 0:
            L_count[0] += 1
        else:
            L_count[1] += 1
    else:
        if sum(L_count) == 0:
            continue
        ans_L[N-1-i] = L_count[0]
        ans_L[N-1-(i-1)] = L_count[1]
        L_count = [0,0]
ans = [0]*N
for i in range(N):
    ans[i] = ans_R[i] + ans_L[i]
print(*ans)

Measured memory_bytes: 8048