akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.math.BigDecimal;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
	BigDecimal A = sc.nextBigDecimal();
    BigDecimal B = sc.nextBigDecimal();
    
    BigDecimal C = A.multiply(B);
    
    BigDecimal D = C.setScale(0, BigDecimal.ROUND_DOWN);
    System.out.println(D);
  }
}

Measured memory_bytes: 28992
N = int(input())
lis_h = list(map(int, input().split()))

for i in range(N,1,-1):
    if lis_h[i - 1] < lis_h[i - 2]:
        lis_h[i - 2] -= 1
        if lis_h[i - 1] < lis_h[i - 2]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 14396
package main
import "fmt"

func sigma (n int) int{
	if n == 0 {
		return 0
	} else {
		return (n + sigma (n-1))
	}
}

func main(){
	var a, b int

	fmt.Scanf("%d %d",&a,&b)

	sub := b - a
	ans := sigma (sub) - b

	fmt.Println(ans)
}
	

Measured memory_bytes: 512
# -*- coding: utf-8 -*-


def main():
    s = input()
    n = len(s)
    pre = ''
    ans = 0
    i = 0

    # See:
    # https://atcoder.jp/contests/agc037/submissions/6955216
    while i < n:
        cur = s[i]

        if pre == cur:
            if i + 1 < n:
                pre = cur + s[i + 1]
                # 1文字増やすことに伴い，参照するインデックスも修正
                i += 1
            # 末尾の処理
            else:
                break
        else:
            pre = cur

        ans += 1
        i += 1

    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;


int main() {
	int n;
	cin >> n;
	vector <int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	map <int, int> cnt;
	long long res = 0;
	for (int i = 0; i < n; i++) {
		res += cnt[i - a[i]];
		cnt[a[i]+i]++;
	}
	cout << res;
	return 0;
}



Measured memory_bytes: 21156
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let a: f64 = sc.read();
    let b: f64 = sc.read();
    let x: f64 = sc.read();
    if a * a * b / 2.0 >= x {
        let h = 2.0 * x / (a * b);
        println!("{}", 90.0 - h.atan2(b).to_degrees());
        return;
    } else {
        let c = 2.0 * (a * a * b - x) / (a * a);
        println!("{}", 90.0 - (a / c).atan().to_degrees());
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
map<int,int>ma;
int main()
{
    //cout << 40*40*20 << endl;
    for(int i=0;i<200;i++)
    {
        ma[i*i]=1;
    }
    int a[10][10]={0};
    int n,d;
    cin >> n >> d;
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin >> a[i][j];
        }
    }
    int ans=0;
    int num=0;
    for(int i=1;i<n;i++){
        for(int j=0;j<i;j++){
                num=0;
            for(int k=0;k<d;k++){
                num=num+(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
            }
            if(ma[num]==1){
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def resolve():
    a=[-1]
    for  _ in range(3):
        a.extend(list(map(int,input().split())))
    n=int(input())
    for _ in range(n):
        b=int(input())
        if b in a:
            a[a.index(b)]=0
    if a[1]==a[2]==a[3]==0 or a[4]==a[5]==a[6]==0 or a[7]==a[8]==a[9]==0 or a[1]==a[4]==a[7]==0 or a[2]==a[5]==a[8] or a[3]==a[6]==a[9]==0 or a[1]==a[5]==a[9]==0 or a[3]==a[5]==a[7]==0:
        print("Yes")
    else:
        print("No")        
resolve()

Measured memory_bytes: 38256
#![allow(non_snake_case, unused_imports)]

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

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,BTreeMap,VecDeque};

// Functions

// Main
fn main(){
    input!{
        AB: i64,
        BC: i64,
        CA: i64
    }
    println!("{}", AB*BC/2);
}

Measured memory_bytes: 4352
import scala.io.StdIn._

object Main extends App {


  val Array(h,k) = readLine().split(" ").map(_.toInt)
  val H = readLine().split(" ").map(_.toLong)

  def solve() = {
    val sorted = H.sorted(Ordering[Long].reverse)
    sorted.drop(k).sum
  }

  println(solve())

}



Measured memory_bytes: 86904
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int a, b;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b;
	cout << (((a * b) % 2) ? "Odd\n" : "Even\n");
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <vector>

using namespace std;

#define debug(x) (cout << # x ": " << x << endl)
#define int long long int
#define repeat(n) for (int i = 0; i < n; ++i)
#define repeat2(n) for (int j = 0; j < n; ++j)
#define all(x) (x).begin(), (x).end()

#define MAX_SIZE (100001)

signed main() {
    int n;
    cin >> n;

    set<string> se;

    repeat(n) {
        string s;
        cin >> s;

        se.insert(s);
    }

    cout << se.size();
    
    return 0;
}

Measured memory_bytes: 15660
S = input()
c = '0'
ans1 = 0
for i in range(len(S)):
    if S[i] != c:
        ans1 += 1
    if c == '0':
        c = '1'
    else:
        c = '0'

c = '1'
ans2 = 0
for i in range(len(S)):
    if S[i] != c:
        ans2 += 1
    if c == '0':
        c = '1'
    else:
        c = '0'
print(min(ans1,ans2))


Measured memory_bytes: 3188
#include <cstdio>

int main(){
	while(true){
		int K;
		scanf("%d", &K);
		if(K == 0){ break; }
		int n = K * (K - 1) / 2, sum = 0;
		while(n--){
			int c;
			scanf("%d", &c);
			sum += c;
		}
		printf("%d\n", sum / (K - 1));
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n;
	cin>>n;
	ll arr[n];
	
	ll ans=0;
	
	
	for(ll i=0;i<n;i++)
	cin>>arr[i];
	
	ll maxx=arr[0];
	for(ll i=1;i<n;i++)
	{
		if(arr[i]<maxx)
		{
			ans+=(maxx-arr[i]);
			
		}
		
		maxx=max(maxx,arr[i]);
	}
	
	cout<<ans;
}


Measured memory_bytes: 5152
# -*- coding: utf-8 -*-


def calc(k, kiten, a):
    koho1 = abs(kiten -a)
    koho2 = kiten + k - a
    koho3 = a + k - kiten

    return min(koho1, koho2, koho3)


def main():
    k, n = map(int, input().split())
    a_list = list(map(int, input().split()))

    max_kkn = a_list[0] + k - a_list[-1]
    for a, b in zip(a_list, a_list[1:]):
        max_kkn = max(max_kkn, b - a)

    print(k - max_kkn)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26444
import itertools
n,m,q=map(int,input().split())
x=[list(map(int,input().split())) for y in range(q)]
ans=0
for A in itertools.combinations_with_replacement(range(1,m+1),n):
  new_ans=0
  for i in range(q):
    if A[x[i][1]-1]-A[x[i][0]-1]==x[i][2]:
      new_ans +=x[i][3]
  ans=max(ans,new_ans)
print(ans)

Measured memory_bytes: 9208
h,w = map(int,input().split())
s = ["."*(w+2) for _ in range(h+2)]
for i in range(1, h+1):
  s[i] = "."+input()+"."
#準備完了 マス目は周りに1つ .が追加されている
kekka = [["#" for i in range(w)] for _ in range(h)]
#結果を収納するところ
for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j]=="#":
      pass
    else:
      cnt = 0
      for x in range(-1, 1+1):
        for y in range(-1, 1+1):
          if (x!=0 or y!=0) and s[i+x][j+y]=="#":
            cnt += 1
      kekka[i-1][j-1] = str(cnt)
for i in range(h):
  print("".join(kekka[i]))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N;
    cin >> N;
    int a, b, tmp;
    int ans = inINF;
    for (int i = 1; i < N; i++) {
        a = i;
        b = N - i;
        tmp = 0;
        while(b > 0){
            tmp = tmp + b % 10;
            b = b / 10;
        }

        while(a > 0){
            tmp = tmp + a % 10;
            a = a / 10;
        }
        ans = min(ans, tmp);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int mi = 1145141919, ma = 0, n;
	cin >> n;
	int a;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		mi = min(a, mi);
		ma = max(a, ma);
	}
	cout << ma - mi << endl;
	return 0;
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 100016

int ans[N];

int main()
{
    canhazfast();

    int n;

    cin >> n;
    for (int i = 1; i <= n; ++i) {
        int a;
        cin >> a;
        ans[a] = i;
    }
    for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
    cout << '\n';

    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define ll long long 

using namespace std;

int main()
{
    ll n;
    cin >> n;
    ll a[n];
    ll b[100001] = {0};
    ll sum = 0;
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        b[a[i]]++;
        sum += a[i];
    }
    ll m;
    cin >> m;
    while(m--)
    {
        ll p,q;
        cin >> p >> q;
        ll ans = 0;
        
        ans = sum;
        ans -= b[p]*p;
        ans += q*b[p];
        b[q] += b[p];
        b[p] = 0;
        sum = ans;
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 5132
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repi(i,a,b) for(ll i=a;i>=b;--i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 110
#define N 3010

string s,t,ans;
ll dp[N][N];

ll f(ll i,ll j){
	if(!i or !j) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	ll ans = 0;
	if(s[i-1] == t[j-1]) ans = f(i-1,j-1) + 1;
	else ans=max(f(i-1,j),f(i,j-1));
	return dp[i][j]=ans;
}
void find(ll i,ll j){
	if(!i or !j) return;
	if(s[i-1] == t[j-1]) ans+=s[i-1],find(i-1,j-1);
	else {
		if(f(i-1,j)>f(i,j-1)) find(i-1,j);
		else find(i,j-1);
	}
}
int main(){
	IOS;
	// freopen("inp.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	
	cin>>s>>t;
	memset(dp,-1,sizeof(dp));
	ans="";
	ll n=sz(s),m=sz(t);
	find(n,m);
	ll x=sz(ans);
	if(x)repi(i,x-1,0)cout<<ans[i];
	return 0;
}

Measured memory_bytes: 71424
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string S;
int main(){
    cin >> S;
    cout << "2018" + S.substr(4) << '\n';
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	s := Scanner()
	l, r := -1, -1
	for i := 0; i < len(s)-2; i++ {
		if s[i] == s[i+1] {
			l, r = i+1, i+2
		} else if s[i] == s[i+2] {
			l, r = i+1, i+3
		}
	}
	if s[len(s)-2] == s[len(s)-1] {
		l, r = len(s)-1, len(s)
	}
	fmt.Println(l, r)
}


Measured memory_bytes: 896
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n + 1), b(n);
    for(auto &x : a){
        cin >> x;
    }
    for(auto &x : b){
        cin >> x;
    }
    ll ans = min(a[0], b[0]);
    b[0] -= min(a[0], b[0]);
    for(int i = 1; i < n + 1; i++){
        if(a[i] > 0){
            if(b[i - 1] > 0){
                ans += min(a[i], b[i - 1]);
                a[i] -= min(a[i], b[i - 1]);
            }
            if(i < n && b[i] > 0){
                ans += min(a[i], b[i]);
                b[i] -= min(a[i], b[i]);
            }
        }
    }
    cout << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<int> value(n), cost(n);
  REP(i,n) cin >> value[i];
  REP(i,n) cin >> cost[i];
  int ans = 0;
  REP(i,n){
    if(value[i]-cost[i]>0) ans += value[i]-cost[i];
  }
  cout << ans << endl; 
    
}

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

using namespace std;

#define ll long long

int main(){
    int K, S, ans = 0;
    cin >> K >> S;

    for(int i = 0; i <= K; ++i){
        for(int j=0; j <= K; ++j){
            if(i+j <= S && S-(i+j)<=K)
                ++ans;
        }
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{
	int r,c,a[102][102],i,j;
	cin>>r>>c;

	for(i=1;i<=r;i++)
	{
		for(j=1;j<=c;j++)
			cin>>a[i][j];

	}
	

	for(j=1;j<=c+1;j++)
		a[r+1][j]=0;
	for(i=1;i<=r;i++)
		a[i][c+1]=0;
	
 
	for(i=1;i<=r;i++)
	{
		for(j=1;j<=c;j++)
			a[i][c+1]+=a[i][j];
	}
 
	for(j=1;j<=c;j++)
	{
		for(i=1;i<=r;i++)
			a[r+1][j]+=a[i][j];
	}
 
	for(i=1;i<=r;i++)
		a[r+1][c+1]+= a[i][c+1];

	for(i=1;i<=r+1;i++)
	{
		for(j=1;j<=c;j++)
			cout<<a[i][j]<<" ";
		cout<<a[i][c+1]<<endl;
	}
	return 0;
 } 


Measured memory_bytes: 3128
using System;

class Program
{
    static void Main(string[] args)
    {
        var str = Console.ReadLine();
        var counter = 0;
        counter += str[0] == '1' ? 1 : 0;
        counter += str[1] == '1' ? 1 : 0;
        counter += str[2] == '1' ? 1 : 0;

        Console.WriteLine(counter);
    }
}


Measured memory_bytes: 25852
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    int N;
    LL x = 1, y = 1e9 + 7;
    while (cin >> N) {
        FOR(i,1,N+1) {
            x *= i;
            x %= y;
        }
        cout << x << endl;
    }
}


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

typedef long long ll;

#define MOD (int)(1e9 + 7)

int main()
{
	ll N, K; cin >> N >> K;

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

	vector<ll>cnt(N), cnt2(N);
	for (int i = 0; i < N; i++)
	{
		for (int j = i + 1; j < N; j++)
		{
			if (A[i] > A[j])cnt[i]++;
		}
		for (int j = 0; j < N; j++)
		{
			if(A[i] > A[j])cnt2[i]++;
		}
	}

	ll ans = 0;
	for (int i = 0; i < N; i++)
	{
		ans += (cnt[i]*K)%MOD + cnt2[i] * ((K * (K-1) / 2)%MOD);
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
    ll n;
    cin >> n;
    cout << pow(n,3) << endl;
    return 0;
}


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

int main() {
  
  int n,h,next;
  cin >> n >> h;
  
  int hantei = 1;
  
  for ( int i = 1; i < n; i++){
    cin >> next;
    if ( h == next ){
      h = next;
      continue;
    }else if ( h + 1 <= next ){
      h = next - 1;
      continue;
    }else{
      hantei = 0;
      break;
    }
  }
  
  if ( hantei ){
    cout << "Yes" << endl;
  }else{
    cout << "No" <<endl;
  }
  
}


Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  val c = Math.cos(Math.PI/3)
  val s = Math.sin(Math.PI/3)

  def getPoints(list:IndexedSeq[(Double,Double)],i:Int):IndexedSeq[(Double,Double)]  =
    if(i==0) list
    else
      getPoints( for{
        k<-0 until list.length-1; i = list(k); j = list(k+1)
        p1 = ((i._1*2+j._1)/3,(i._2*2+j._2)/3)
        p2 = ((i._1+j._1*2)/3,(i._2+j._2*2)/3)
        x = (p2._1-p1._1)*c-(p2._2-p1._2)*s+p1._1
        y = (p2._1-p1._1)*s+(p2._2-p1._2)*c+p1._2
        list2 = if(k==0) Iterator(i,p1,(x,y),p2,j) else Iterator(p1,(x,y),p2,j)
        q<-list2
      } yield q , i-1)

  def main(args:Array[String]) = {
    val n = readInt
    val list = getPoints(IndexedSeq((0D,0D),(100D,0D)),n)
    println(list.map(s=>s._1+" "+s._2).mkString("\n"))
  }
}

Measured memory_bytes: 50944
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

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

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

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

#include <ctime>
////
#include <random>//
#pragma endregion //#include
/////////

#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)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int K;
	cin >> K;
	vector<LL> A(K);
	for(int i=0;i<K;++i){
		cin >> A[i];
	}
	//////
	vector<LL> X(2);
	X[0] = 2;//最小値
	X[1] = 2;//最大値
	for(int i=K-1;i>=0;--i){
		//A[i]
		LL minX = ((X[0]+A[i]-1)/A[i])*A[i];
		if( minX < X[0] || X[1] < minX ){
			cout << -1 << endl;
			return;
		}
		X[0] = minX;

		LL maxX = (X[1]/A[i])*A[i];
		X[1] = maxX + A[i]-1;
	}
	cout << X[0] << " " << X[1] << 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: 1024
#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    double b[n];
    for(int c=0;c<n;c++){
        scanf("%d",&a[c]);
        b[c]=1/(double)a[c];
    }
    double d=0;
    for(int e=0;e<n;e++){
        d+=b[e];
    }
    double f;
    f=1/d;
    printf("%f\n",f);
    return 0;
}

Measured memory_bytes: 128
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
#mod = 10**9 + 7
#mod = 9982443453
mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
a,b,c,d = readInts()
left = a+b
right = c+d
print('Left' if left > right else ('Balanced' if left == right else 'Right'))


Measured memory_bytes: 10384
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	vector<int> nums=vector<int>(3);
	int k;
	cin>>nums[0]>>nums[1]>>nums[2];
	cin>>k;
	
	for(int i=0; i<k; ++i) {
		vector<int>::iterator it = max_element(nums.begin(), nums.end());
		nums[it-nums.begin()]=2*(*it);
	}

	int sum = nums[0]+nums[1]+nums[2];
	cout<<sum<<endl;

	return 0;
}


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

int main(){
  string S, ans;
  cin >> S;
  
  sort(S.begin(),S.end());
  if(S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[2]){
    ans = "Yes";
  }else{
    ans = "No";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
main = 
    interact (calc . map (read) . words)

calc :: [Int] -> String
calc (0:0:_) = ""
calc (h:w:xs) = 
    row h w 0 ++ "\n" ++ calc xs

row :: Int -> Int -> Int -> String
row 0 _ _ = ""
row h w 0 = take w (concat $ replicate w "#.") ++ "\n" ++ row (h - 1) w 1
row h w _ = take w (concat $ replicate w ".#") ++ "\n" ++ row (h - 1) w 0



Measured memory_bytes: 5024
#include "bits/stdc++.h" 
using namespace std; 
#define MAXN 1000001 
 
#define ll long long int

int main(){

	ll sum = 0;
	ll k;
	cin>>k;
	for(ll i=1;i<=k;i++){
		for(ll j=1;j<=k;j++){
			ll g = __gcd(i,j);
			for(ll l=1;l<=k;l++){
				sum+= __gcd(g,l);
			}
		}
	}
	cout<<sum;
	return 0; 
} 


Measured memory_bytes: 3620
#include<stdio.h>
#include<iostream>
#include<vector>
#include <algorithm>
using namespace std;

int maxtime(int x){
    //intどうしを割るとintが帰ってくる
    return ((x+9)/10)*10;
}
int remtime(int x){
    return maxtime(x)-x;
}


int main(){

int a,b,c,d,e;
cin >> a >>b >>c >>d >>e;
int sum = maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e);
sum -= max({remtime(a) ,remtime(b) ,remtime(c) ,remtime(d) ,remtime(e)});
cout << sum << endl;

}





Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
using namespace std;

const int p=1000000007;
int n,m,k,f[4010][2010],ans;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    f[1][1]=1,f[1][k]=p-1;
    repu(i,1,(n+m-1)/(k-1))
        repu(j,1,m)
            if ((f[i][j]+=f[i][j-1])%=p)
            {
                (f[i+1][j]+=f[i][j])%=p;
                (f[i+1][min(m+1,j+k)]+=p-f[i][j])%=p;
                if ((m-j)%(k-1)==0 && (k-1)*i-j<n && (n-1-(k-1)*i+j)%(k-1)==0)
                    (ans+=f[i][j])%=p;
            }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 31616
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};

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

  map<int,int> raw,col;
  // rep1(i,n*m){
  //   cout << raw[i] << "\n";
  //   raw[i] = 0;
  //   col[i] = 0;
  // }

  rep(i,n){
    raw[a[i]]++;
  }

  rep(i,m){
    col[b[i]]++;
  }

  int cntr=0,cntl=0,cnt=0;
  mint res(1);
  for(int i=n*m;i>0;--i){
    int x = raw[i];
    int y = col[i];
    //    cout << i << ":" << x << ":" << y << "\n";
    if(x>=2||y>=2){
      cout << 0 << "\n";
      return 0;
    }
    if(x==1&&y==1){
      cntr++;
      cntl++;
    }
    else if(x==1&&y==0){
      res *= (mint)cntl;
      cntr++;
    }
    else if(x==0&&y==1){
      res *= (mint)cntr;
      cntl++;
    }
    else if(x==0&&y==0){
      res *= (mint)(cntr*cntl-cnt);
    }
    cnt++;
  }

  cout << res.x << "\n";
  
  return 0;
}


Measured memory_bytes: 93952
magialist=[]
datalist=[]
h,w=map(int,input().split())
for i in range(10):
    add=list(map(int,input().split()))
    magialist.append(add)

for j in range(h):
    add1=list(map(int,input().split()))
    datalist.extend(add1)
 
storelist=[[[[] for i in range(10)] for i in range(10)] for i in range(10)]
    #わーシャルフロイド法
for i in range(10):
    for j in range(10):
            a=min(magialist[i][j],magialist[i][0]+magialist[0][j])
            storelist[0][i][j]=a
k=1
while k<=9:
    for i in range(10):
        for j in range(10):
                a=min(storelist[k-1][i][j],storelist[k-1][i][k]+storelist[k-1][k][j])
                storelist[k][i][j]=a
    k+=1

uselist=[]
                                                                                        
for j in range(10):
    uselist.append(storelist[9][j][1])
ans=0
for nums in range(h*w):
        if datalist[nums]==-1:
            continue
        else:
            for j in range(10):
                if datalist[nums]==j:
                    ans+=uselist[j]
print(ans)

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>ok;
int main(){
	
	int n , x ; scanf("%d%d", &n, &x);
	ok.resize(n);
	for(int i=0; i<n; i++)scanf("%d", &ok[i]);
	int ans=0;
	sort(ok.begin() , ok.end());
	for(int i=0 ;i<n ; i++){
		if(ok[i]<=x && i+1!=n){ans++;x-=ok[i];}
		else if(i+1==n && ok[i]==x)ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();

    for (int i = 0; i < (k / 2); i++) {
      a /= 2;
      b += a;
      b /= 2;
      a += b;
    }

    if ((k % 2) == 1) {
      a /= 2;
      b += a;
    }

    System.out.println(a + " " + b);

  }
}

Measured memory_bytes: 38784
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int D = sc.nextInt();
   int X = sc.nextInt();
   int[] l = new int[N];
   
   for(int i=0;i<N;i++) l[i] = sc.nextInt();
   int sum =N;
   for(int i=0;i<N;i++) sum +=(D-1)/l[i];
   System.out.println(sum+X);
 }
}

Measured memory_bytes: 23892
using System;

public class Hello
{
	public static void Main()
	{
		string[] line = Console.ReadLine().Trim().Split(' ');
		var a = int.Parse(line[0]);
		var p = int.Parse(line[1]);
		var ans = (a * 3 + p) / 2;
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int x = N%10;
    if(x==3)cout << "bon" << endl;
    else if(x==0 || x==1 || x==6 || x==8)cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3552
#include <stdio.h>

int main(void)
{
	int i;
	char str[20];
	
	scanf("%s", str);
	
	i = 0;
	while (str[i] != '\0'){
		i++;
	}
	i--;
	while (i >= 0){
		printf("%c", str[i]);
		i--;
	}
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 524
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<limits.h>
#include<stdbool.h>
#define e 1000000007

typedef  long long ll;

int int_cmp(const void *a, const void *b){ 
    const int *ia = (const int *)a;
    const int *ib = (const int *)b;
    return *ia  - *ib; 
} 


ll int_cmp1(const void *a, const void *b){ 
    const int *ia = (const int *)a;
    const int *ib = (const int *)b;
    return *ia  - *ib; 
} 


int max(int a,int b){
	if(a<b)
		a=b;
	return a;	
}

int min(int a,int b){
	if(a>b)
		a=b;
	return a;	
}

int absolu(int n){
	if(n<0)
		n*=-1;
	
	return n;	
}


void solve(){
  int n,x,t;
  ll ans=0;
  scanf("%d%d%d",&n,&x,&t);
  
  while(n>0){
  	 n-=x;
  	 ans+=t;
  }
  
  printf("%lld\n",ans);
}

 





int main(){
 /* int t;
	scanf("%d",&t);
	
	while(t--)*/
		solve();
	
	
	
	return 0;
}	
	

Measured memory_bytes: 1716
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define LL long long
using namespace std;
LL N;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%lld",&N);
	for(RG LL h=1;h<=3500;h++)
	{
		for(RG LL n=1;n<=3500;n++)
		{
			LL mu=4*h*n-N*n-N*h, zi=N*h*n;
			if(mu>0 && zi%mu==0 ) 
			{
				printf("%lld %lld %lld",h,n,zi/mu);
				return 0;
			}
		}
	}
	//fclose(stdin); fclose(stdout);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n, k;
int main() {
    cin >> n >> k;
    vector<long long> a(n, 0);
    for(int i = 0; i < n; ++i) cin >> a.at(i);

    vector<long long> aup;
    long long start = a.at(0)+1;
    for(int i = 1; i < n; ++i) aup.push_back(a.at(i));
    int uplen = aup.size();
    k--;

    long long mincost = 1e18;
    for(int bit = 0; bit < (1<<uplen); ++bit) {
        vector<int> ss(uplen, 0);
        int cnt = 0;
        for(int i = 0; i < uplen; ++i) {
            if(bit & (1<<i)) {
                ss.at(i) = 1;
                cnt++;
            }
        }

        if(cnt == k) {
            long long cstart = start;
            long long sum = 0;
            for(int j = 0; j < uplen; ++j) {
                if(ss.at(j) == 1) {
                    if(cstart < aup.at(j)) {
                        cstart = aup.at(j)+1;
                    }else {
                        sum += (cstart - aup.at(j));
                        cstart++;
                    }
                }else {
                    if(cstart < aup.at(j)) {
                        cstart = aup.at(j);
                    }
                }
            }
            chmin(mincost, sum);
        }
    }
    cout << mincost << endl;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
 
/*
// ordered_set 
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
# define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
 
using namespace std;
 
typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define Sort(x)                                         sort(all(x))
# define InTheNameOfGod                                  ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
 
ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));}
 
const int xn = 4e2 + 10;
const int xm = 1e5 + 10;
const int SQ = 320;
const int sq = 320 + 10;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int mod = 1e9 + 7;
const int TM = 3;
const int base = 257;

int n, m, ans, cnt;
pii a[xm];
bool mark[xn], flag[xn];
bitset <xm> bs[xn], tohi;

void add(int v, int ind, int u){
	mark[v] = true;
	bs[u][ind] = true;
}

int main(){
    InTheNameOfGod;
    
	cin >> n >> m;
	for (int i = 0; i < m; ++ i) cin >> a[i].A >> a[i].B;
	for (int i = 1; i <= n; ++ i){
		memset(mark, false, sizeof mark);
		mark[i] = true;
		flag[i] = false;
		for (int j = m - 1; j >= 0; -- j){
			flag[i] |= (mark[a[j].A] && mark[a[j].B]);
			if (mark[a[j].A]) add(a[j].B, j, i);
			else if (mark[a[j].B]) add(a[j].A, j, i);
		}
	}
	for (int i = 1; i <= n; ++ i){
		if (flag[i]) continue;
		for (int j = 1; j < i; ++ j){
			if (flag[j]) continue;
			if ((bs[i] & bs[j]) != tohi) continue;
			++ ans;
		}
	}
	cout << ans << endl;
 
    return 0;
}


Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,m1,d1,m2,d2;
    cin>>m1>>d1;
    cin>>m2>>d2;
    if(m1<=7)
    {
        if((m1%2==1 && d1==31) || (m1==2 && d1==28) || (m1%2==0 && d1==30))
        cout<<"1";

        else
        cout<<"0";
       
    }
    else
    {
        if((m1%2==0 && d1==31) || (m1%2==1 && d1==30))
        cout<<"1";
       
        else
        cout<<"0";
       
        
    }
    
    return 0;
}

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

long double volu(long double s) 
{ 
    
    long double l = s / 3; 
  
    s = s- l; 
  
     
    long double b = s / 2; 
  
     
    long double h = s - b; 
  
    return l * b * h; 
} 

int main(){

long double n;
cin>>n;
cout<<fixed;
cout<<volu(n);
    
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(a));i>=((int)(b));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	int n, l; int f = scanf("%d%d", &n, &l);
	int a[n+2];
	reg(i, 1, n) f = scanf("%d", &a[i]);
	a[0] = a[n+1] = 0;
	
	reg(i, 1, n) if(a[i] + a[i+1] >= l){
		printf("Possible\n");
		reg(j, 1, i-1) printf("%d\n", j);
		ireg(j, n-1, i) printf("%d\n", j);
		return 0;
	}
	
	printf("Impossible\n");
	
	return 0;
}

Measured memory_bytes: 1152
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *

N, K = MAP()

ans = 0

for b in range(K+1, N+1):
	p = N//b
	r = N%b
	ans += p * (b-K) + max(0, r-K+1)

if K == 0:
	ans -= N

print(ans)


Measured memory_bytes: 10456
#include <bits/stdc++.h>
using namespace std;
#include "string"
#define endl '\n'
#define pi pair<int,int>
#define ff first
#define ss second
#define int long long 
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
int32_t main(){
	boost;
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.size()<=k)
		cout<<s<<endl;
	else{
		cout<<s.substr(0,k);
		cout<<"..."<<endl;
	}
}

 

Measured memory_bytes: 3644
import sys

input_data = []
input_pointer = 0

output_data = []

def input_scan():
    global input_data
    input_data = sys.stdin.readlines()
    input_data = [x[:-1] for x in input_data]

def next_line():
    global input_pointer
    global input_data
    if input_pointer < len(input_data):
        input_pointer += 1
        return input_data[input_pointer - 1]
    else:
        return ""

def append_output(string):
    global output_data
    output_data.append(string)

def print_output():
    global output_data
    output_data.append("")
    sys.stdout.write("\n".join(output_data))

a = int(input())
append_output(str(a + a * a + a * a * a))
print_output()


Measured memory_bytes: 9196
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    string s;
    cin >> s;
    REP(i,3) cout << s[i];
    cout << endl;
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll a, b;
    cin >> a >> b;
    if(a > 8 || b > 8) {
        out(":(");
    }
    else {  
        out("Yay!");
    }
    re0;
}

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

int main() {
    int n;
    while (cin>>n,n) {
        vector<ll> a(n);
        rep(i,n) cin>>a[i];
        sort(a.begin(),a.end());
        a.pop_back();
        sort(a.begin(),a.end(),greater<>());
        a.pop_back();
        ll sum = 0;
        rep(i,n-2) sum+=a[i];
        ll ans=sum/(n-2);
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3000
import java.util.Scanner;

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		long a=sc.nextLong();
		long b=sc.nextLong();
		long c=sc.nextLong();
		long x=sc.nextLong();
		long y=sc.nextLong();
		long ans = 0;
		if(a+b>=2*c) {
			if(x<=y) {
				ans += x * 2 * c;
				if(b>=2*c) {
					ans += (y-x)*2*c;
				} else {
					ans += (y-x)*b;
				}
			}else {
				ans += y * 2 * c;
				if(a>=2*c) {
					ans += (x-y)*2*c;
				} else {
					ans += (x-y)*a;
				}
			}
		} else {
			ans += a*x+b*y;
		}
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 21716
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int A = int.Parse (str[0]);
            long B = long.Parse (str[1]);
            long N = long.Parse (str[2]);

            long ans = 0;

            if (N < B)
            {
                ans = A * N / B;
            }
            else
            {
                ans = A * (B - 1) / B;
            }

            Console.Write (ans);
        }
    }

    class MyLibrary
    {
        public static int GCD (int a, int b)
        {
            if (a % b == 0) return b;
            return GCD (b, a % b);
        }
    }
}

Measured memory_bytes: 27484