akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
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; }
ll mod = 1000000007;

void solve()
{
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	rep(i, n)
	{
		if (a[i]%2==0)
		{
			if(a[i]%3!=0 && a[i]%5!=0)
			{
				cout << "DENIED" << endl;
				return;
			}
		}
	}
	cout << "APPROVED" << endl;
	return;	
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;
template <typename T>
using V = std::vector<T>;

using namespace std;

int main() {
  V<int> a(3);
  rep(i, 3) cin >> a[i];
  sort(all(a));
  out(a[2] - a[0]);
}


Measured memory_bytes: 3648
import bisect

n = int(input())
a = map(int,raw_input().split())
a.sort()
b = map(int,raw_input().split())
b.sort()
c = map(int,raw_input().split())
c.sort()

count = 0
for i in b:
	count += bisect.bisect_left(a,i)*(n-bisect.bisect_right(c,i))

print count 

Measured memory_bytes: 17708
#include <iostream>
using namespace std;
 
int main() {
	int n, b[101], a[102];
	cin >> n;
	for (int i=0; i<=n; i++){
		cin >> b[i];
	}
	a[0]=b[0];
	a[n-1]=b[n-2];
	for (int i=0; i<n-2; i++){
		if (b[n-i-2]>b[n-i-3])
		a[n-i-2]=b[n-i-3];
		else
		a[n-i-2]=b[n-i-2];
	}
	int score=0;
	for (int i=0; i<n; i++){
		score+=a[i];
	}
	cout << score;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,l;
    cin >> n >> l;
    int ans=0;
    int m=1000;
    int k;
    for(int i=1;i<n+1;i++){
        if(abs(l+i-1)<m){
            m = abs(l+i-1);
            k = l+i-1;
        }
        ans+=l+i-1;
    }
    cout << ans-k;


    return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

li = rl()
for i in range(len(li)):
  if li[i] == 0:
    print(i+1)
    exit()



Measured memory_bytes: 26896
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        boolean out = true;
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
            if(a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0) out = false;
        }
        System.out.println(out ? "APPROVED" : "DENIED");
    }
}

Measured memory_bytes: 23892
#include <iostream>
#include <bitset>
#include <vector>

int a[25][25];
std::vector<int> v[22];
int dp[1<<22];

const int mod = 1e9+7;

int main(){
    int n;
    std::cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            std::cin >> a[i][j];
            if(a[i][j]){
                v[i].push_back(j);
            }
        }
    }
    dp[0] = 1;
    for(int b = 1; b < (1<<n); b++){
        int i = std::bitset<32>(b).count();
        for(int j : v[i-1]){
            if((b >> j) & 1){
                dp[b] = (dp[b] + dp[b-(1<<j)])%mod;
            }
        }
    }
    std::cout << dp[(1<<n)-1] << std::endl;
    return 0;
}


Measured memory_bytes: 10496
class Node():
    def __init__(self, key):
        self.parent = None
        self.left = None
        self.right = None
        self.key = key

class Tree():
    def __init__(self):
        self.root = None
    def insert(self, key):
        z = Node(key)
        y = None
        x = self.root
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        
        if y == None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z
        
    def preorder(self, node):
        print(" {}".format(node.key), end = "")
        if node.left:
            self.preorder(node.left)
        if node.right:
            self.preorder(node.right)
            
    def inorder(self, node):
        if node.left:
            self.inorder(node.left)
        print(" {}".format(node.key), end = "")
        if node.right:
            self.inorder(node.right)
            
    def out(self):
        self.inorder(self.root)
        print('')
        self.preorder(self.root)
        print('')

tree = Tree()
N = int(input())
for _ in range(N):
    order = input().split()
    if order[0] == 'insert':
        tree.insert(int(order[1]))
    else:
        tree.out()

Measured memory_bytes: 153772
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

const int nax = 1e5 + 5;
vector<int> edges[nax];

const int mod = 1e9 + 7;
int mul(int a, int b) {
    return (ll) a * b % mod;
}

// returns a pair {black, white}
pair<int,int> dfs(int a, int parent) {
    int all_white = 1; // means: my vertex can be painted black
    int sth_is_black = 1;
    for(int b : edges[a]) {
        if(b != parent) {
            pair<int,int> p = dfs(b, a);
            // p.first is the number of ways to color the subtree
            // such that 'b' is black
            //int memo_all_white = all_white;
            all_white = mul(all_white, p.second);
            sth_is_black = mul(sth_is_black, p.first + p.second);
        }
    }
    return make_pair(all_white, ( sth_is_black) % mod);
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n - 1; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    pair<int,int> p = dfs(1, -1);
    int answer = (p.first + p.second) % mod;
    printf("%d\n", answer);
}

Measured memory_bytes: 12672
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;
const int MOD = 1000000007;


int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int bingo[3][3];
    rep(i,3) rep(j,3) cin >> bingo[i][j];

    int n; cin >> n;

    bool b[3][3]; rep(i,3) rep(j,3) b[i][j] = false;

    rep(i,n){
        int x; cin >> x;
        rep(i,3) rep(j,3){
            if(bingo[i][j]==x) b[i][j] = true;
        }
    }

    bool good = false;

    rep(i,3){
        if(b[i][0] && b[i][1] && b[i][2]) good = true;
        if(b[0][i] && b[1][i] && b[2][i]) good = true;
    }

    if(b[0][0] && b[1][1] && b[2][2]) good = true;
    if(b[0][2] && b[1][1] && b[2][0]) good = true;

    if(good) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    A = [0] * n
    B = [0] * n
    for i in range(n):
        A[i], B[i] = map(int, input().split())

    A.sort()
    B.sort()
    k = n // 2

    if n & 1:
        print(B[k] - A[k] + 1)
    else:
        print((B[k] + B[k - 1]) - (A[k] + A[k - 1]) + 1)
resolve()

Measured memory_bytes: 79904
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}
use input::*;

fn main() {
    let x: isize;
    input!(x);
    let mut t = 0;
    loop {
        if t * (t + 1) / 2 >= x {
            p(t);
            break;
        }
        t += 1;
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct hito{
    int sh;
    vector<P> ar;
};

int main() {
    int n; cin >> n;
    vector<hito> h(n);
    rep(i,n){
        cin >> h[i].sh;
        h[i].ar.resize(h[i].sh);
        rep(j,h[i].sh) {
            cin >> h[i].ar[j].first >> h[i].ar[j].second;
            h[i].ar[j].first--;
        }
    }
    int ans = 0;
    rep(i,1<<n){
        bool t = true;
        int ima = 0;
        rep(j,n){
            if (i>>j&1){
                ima++;
                rep(k,h[j].sh){
                    if ((h[j].ar[k].second==1&&i>>h[j].ar[k].first&1)||(h[j].ar[k].second==0&&(i>>h[j].ar[k].first)%2==0)){
                        continue;
                    }
                    else {
                        t = false;
                        break;
                    }
                }
            }
            if (!t) break;
        }
        if (t) ans = max(ans,ima);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
if N >= 1:
    P = sorted(list(map(int, input().split())))
else:
    P = []

c = 200
for x in range(-1, 102):
    if x in P:
        continue
    else:
        tmp = abs(X-x)
        if tmp < c:
            c = tmp
            ans = x
print(ans)

Measured memory_bytes: 9076
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int a = stdIn.nextInt();
        int b = stdIn.nextInt();

        System.out.print(a * b);
        System.out.print(" ");
        System.out.println(2 * (a + b));

    }
}


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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

const int MOD = 1e9 + 7;

int main()
{
    ios::sync_with_stdio(false);

    int N; cin >> N;
    vector<int> A(N);
    map<int, int> num;
    rep(i, N) {
        cin >> A[i];
        num[A[i]]++;
    }

    bool ok = true;
    ll ans = 1LL;

    int s = (N%2 == 0);
    for (int i=s; i<=N; i+=2) {
        int tmp = (i == 0 ? 1 : 2);
        if (num[i] != tmp) {
            ok = false;
            break;
        }
        if (i > 0) ans *= 2;
        ans %= MOD;
    }

    cout << (ok ? ans : 0) << endl;
}



Measured memory_bytes: 3584
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int A,B,K;
    cin>>A>>B>>K;
    string S;
    for(int i=min(A,B);i>=1;i--){
        if(A%i==0&&B%i==0){

            K--;
            if(K==0){
                cout<<i<<endl;
                return 0;

            }
        }
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll zero = 0;
ll INF = 10000000000;

int main(){
    int S,W;
    cin >> S >> W;
    if(W>=S){
        printf("unsafe");
    }
    else{
        printf("safe");
    }
    //printf("%d\n", );
    
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define debug(x) std::cerr<<#x<<":"<<(x)<<std::endl;
#define INIT ios::sync_with_stdio(false);cin.tie(0);

signed main() {
  INIT;
  long double n;cin>>n;
  long double d = ((int)n+1)/2;
  cout<<fixed<<setprecision(10)<<d/n<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, l;
    cin >> n >> l;
    vector<string> lol(n);
    for (int i = 0; i < n; i++) {
        cin >> lol[i];
    }
    sort(lol.begin(), lol.end());
    string tot_str = "";
    for (int i = 0; i < n; i++) {
        tot_str += lol[i];
    }
    cout << tot_str;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
string A;
inline void Exit(){
	puts("Impossible");
	exit(0);
}
int n;
typedef pair<int,int> pi;
vector<int> ths;
vector<int> operator + (vector<int> a, vector<int> b){
	for(size_t i=0;i<b.size();i++){
		a.push_back(b[i]);
	}return a;
}
inline vector<int> Rev(vector<int> a){
	reverse(a.begin(),a.end());
	for(size_t i=0;i<a.size();i++)a[i]=-a[i];
	return a;
}

vector<pi> pit;

int main(){
	cin >> n >> A;
	if(A[0]=='0')Exit();
	for(int i=0;i<1<<n;i++){
		if(A[i]=='1')for(int j=i;j;j=i&(j-1)){
			if(A[j]=='0')Exit();
		}
	}
	for(int s=0;s<1<<n;s++){
		int flg=0;
		if(A[s]=='0'){
			for(int j=(s-1)&s;j;j=s&(j-1)){
				if(A[j]=='0')flg=1;
			}
			if(flg)continue;
			ths.clear();
			for(int i=0;i<n;i++){
				if(s&(1<<i)){
					if(!ths.size())ths = ths + vector<int>(1,i+1);
					else ths = vector<int>(1,i+1) + ths + vector<int>(1,-(i+1)) + Rev(ths);
				}
			}
			for(size_t i=0;i<ths.size();i++){
				int j = ths[i];
				int d = abs(j)-1;
				for(int i=0;i<=d;i++)pit.push_back(pi(i,0));
				if(j<0){
					pit.push_back(pi(d,1));
					pit.push_back(pi(d+1,1));
					pit.push_back(pi(d+1,0));
				}else{
					pit.push_back(pi(d+1,0));
					pit.push_back(pi(d+1,1));
					pit.push_back(pi(d,1));
				}
				for(int i=d;i;i--)pit.push_back(pi(i,0));
			}
		}
	}
	pit.push_back(pi(0,0));
	cout << "Possible\n" << pit.size()-1 << endl;
	for(size_t i=0;i<pit.size();i++){
		printf("%d %d\n",pit[i].first,pit[i].second);
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
long long substract(long long a,long long b){//差の絶対値　3項演算
  long long num=(a-b);
  return (num > 0) ? num : -num;}
int main() {
  long long N,K,m=0;
  cin>>N>>K;
    m=N%K;
    if(m<substract(m,K)){
      cout<<m;
      return 0;
    }
    else{
      m=substract(m,K);
      cout<<m;
  }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif


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

class BellmanFord {
    int V;
    int E;
    vector<edge> edges;
    vector<ll> dist;
    vector<bool> negative;

public:
    BellmanFord(int v, int e) : V(v), E(e), negative(v) {
        dist.resize(V, INF);
    }

    void add_edge(int from, int to, ll cost) {
        edges.push_back({from, to, cost});
    }

    ll get_total_cost(int v) {
        return dist[v];
    }

    // v に到達するまでに負ループがあるかを検出する
    bool is_negative(int v) {
        return negative[v];
    }

    // ベルマンフォード法の実行・全辺の負閉路を検出 trueを返す時に負閉路を含む
    bool exec() {
        bool updated = false;
        dist[0] = 0;
        for (int i = 0; i < V; ++i) {
            for (int j = 0; j < E; ++j) {
                edge edge = edges[j];
                if (dist[edge.from] != INF && dist[edge.to] > dist[edge.from] + edge.cost) {
                    dist[edge.to] = dist[edge.from] + edge.cost;
                    if (i == V - 1) updated = true;
                }
            }
        }

        for (int i = 0; i < V; ++i) {
            for (int j = 0; j < E; ++j) {
                edge edge = edges[j];
                if (dist[edge.from] != INF && dist[edge.to] > dist[edge.from] + edge.cost) {
                    negative[edge.to] = true;
                }
                if (negative[edge.from]) {
                    negative[edge.to] = true;
                }
            }
        }
        return updated;
    }
};


void Main() {
    int N, M;
    cin >> N >> M;
    BellmanFord bellmanFord(N, M);
    rep(i, M) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        bellmanFord.add_edge(a, b, -c);
    }
    bellmanFord.exec();

    if (bellmanFord.is_negative(N - 1)) {
        cout << "inf" << '\n';
    } else {
        cout << -bellmanFord.get_total_cost(N - 1) << '\n';
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 384
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws FileNotFoundException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\0531-input.txt"));

		while (scan.hasNext()) {

			int n = 2;
			for (int i = 0; i < n; i++) {
				TOP3 top3 = new TOP3();
				int k = 10;
				for (int j = 0; j < k; j++)
					top3.e(scan.nextInt());
				if (i > 0)
					System.out.print(" ");
				System.out.print(top3.s());
			}
			System.out.println();

			scan.close();
			System.exit(0);
		}
	}
}

class TOP3 {
	int[] sc = new int[3];

	public void e(int x) {
		if (x < sc[0])
			return;

		sc[0] = x;
		for (int i = 0; i < 2; i++)
			if (sc[i] > sc[i + 1]) {
				int tmp = sc[i];
				sc[i] = sc[i + 1];
				sc[i + 1] = tmp;
			}
	}

	public int s() {
		int tot = 0;
		for (int i = 0; i < 3; i++)
			tot += sc[i];
		return tot;
	}

}

Measured memory_bytes: 25880
#include <iostream>

using namespace std;

int ca(int c){
  int x = 0;
  for(int i=1; i<=c; i++){
    if(c<i) break;
    c-=i;
    x++;
  }
  return x;
}

int main(void){

  long long N;
  int c, ans = 0;

  cin >> N;

  for(long long z=2; z*z<=N; z++){
    c = 0;
    while(true){
      if(N%z==0){
        N = N / z;
        c++;
      }
      else{
        ans += ca(c);
        break;
      }
    }
  }
  if(N!=1) ans++;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,A,B;
  cin >> N >> A >> B;
  if(A==0){
    cout << 0;
  	return 0;
  }
  if(A>=N){
    cout << N;
    return 0;
  }
  long long roopCount = N / (A+B);
  long long amari = N%(A+B);
//cout << "roopCount:" << roopCount << endl;
//cout << "amari:" << amari << endl;
  
  long long result=0;
  if(amari-A > 0)
    result = roopCount*A + A;
  else
    result = roopCount*A + amari;
  
  cout << result;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

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

    std::string s;
    std::cin >> s;

    std::vector<int> vec(s.size() + 1, 0);
    for(int i = 0; i < s.size() - 1; ++i){
        if("AC" == s.substr(i, 2)){
            vec.at(i + 1) = vec.at(i) + 1;
        }else{
            vec.at(i + 1) = vec.at(i);
        }
    }
    int start, end, count;
    for(int i = 0; i < q; ++i){
        std::cin >> start >> end;
        std::cout << vec.at(end - 1) - vec.at(start - 1) << std::endl;;
    }

    return 0;
}



Measured memory_bytes: 1472
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n;
int main()
{
    cin >> n;
    vector<P> v(n);
    rep(i, n)
    {
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());
    int dx, dy;
    int ans = 0;
    rep(i, n)
    {
        REP(j, i + 1, n)
        {
            dx = v[j].first - v[i].first;
            dy = v[j].second - v[i].second;
            vector<int> fl(n, 0);
            rep(k, n)
            {
                REP(l, k + 1, n)
                {
                    if (v[l].first - v[k].first != dx)
                    {
                        continue;
                    }
                    if (v[l].second - v[k].second != dy)
                    {
                        continue;
                    }
                    fl[l] = 1;
                }
            }
            ans = max(ans, accumulate(fl.begin(), fl.end(), 0));
        }
    }
    cout << n - ans << endl;
}

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

using namespace std;

using int64 = long long;

int64 Solve(int64 a, int64 b) {
  if (a % b == 0) {
    int64 k = a / b;
    return (2 * k - 1) * b;
  }
  int64 r = a % b;
  int64 k = a / b;
  return 2 * k * b + Solve(b, r);
}

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

  int64 n, x;
  cin >> n >> x;
  if (2 * x < n) {
    cout << n + Solve(n - x, x) << endl;
  } else {
    cout << n + Solve(x, n - x) << endl;
  }
}

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

int main() {
  int K,N;
  int dist;
  cin >> K >> N;
  
  vector<int> A(N);
  for(int i=0; i<N; i++){
  	cin >> A.at(i);
  }
  
  dist = A.at(N-1)-A.at(0);
  
  for(int i=0; i<N-1; i++){
    	if(A.at(i)+K-A.at(i+1) < dist){
        	dist = A.at(i) + K - A.at(i+1);
        }
  }
  cout << dist << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define FOR(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i=(int)(n);i>=0;--i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

ll gcd(ll a,ll b) { return a?gcd(b%a,a):b; }
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
signed main() {
    int N,M;
    cin>>N>>M;
    vi A(N);
    cin>>A;
    int k=lcm(N,M);
    A.insert(A.end(),ALL(A));
    int ans=0;
    REP(i,k) {
        int max=-1,min=INF;
        REP(j,M) {
            chmax(max,A[(i+j)%N]);
            chmin(min,A[(i+j)%N]);
        }
        i+=M-1;
        ans+=max-min;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
    int N, A;
    cin >> N >> A;
    //1円玉A枚、金額N

    if(N % 500 <= A){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import itertools

n, k = map(int, input().split())
p = list(map(int, input().split()))
e = []
ans = 0

def getExp(n):
    return (n*(n+1)/2) / n

for i in range(n):
    e.append(getExp(p[i]))

s = [0] + list(itertools.accumulate(e))

for i in range(k, n+1):
    temp = s[i] - s[i-k]
    ans = max(ans, temp)

print(ans)


Measured memory_bytes: 80776
n, m = map(int, input().split())
x = sorted(map(int, input().split()))
delx = []
for i in range(m-1):
    delx.append(abs(x[i+1] - x[i]))
delx.sort()
# print(delx)
if n >= m:
    print(0)
else:
    print(sum(delx[:m-n]))

Measured memory_bytes: 13964
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int A, B, C; cin >> A >> B >> C;
  multiset<int> s = {A, B, C};
  auto ans = s.count(5) == 2 && s.count(7) == 1;
  cout << (ans ? "YES" : "NO") << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
n = int(input())
for line in range(n):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    d = (x2 - x1)*(y4 - y3) - (y2 - y1)*(x4 - x3)
    if -10**-11 <d < 10**-11:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 7568
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;

int main() {
    vector<vector<int>> C(3, vector<int>(3));
    rep(i, 3) rep(j, 3) { cin >> C[i][j]; }
    rep(x, 101) rep(y, 101) rep(z, 101) {
        int flag = 1;
        rep(i, 3) {
            if(C[i][0] - x != C[i][1] - y || C[i][1] - y != C[i][2] - z ||
               C[i][0] - x != C[i][2] - z)
                flag = 0;
        }
        if(flag == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  
  int minChange = 10000;
  for(int i=0; i<=s.size()-t.size(); i++){
    int change = 0;
    for(int j=0; j<t.size(); j++){
      if(s.at(i+j) != t.at(j))
        change++;
    }
    if(change < minChange)
      minChange = change;
  }
  cout << minChange << endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int arr[2003];
int n;
int dp[2003][2003][2][2];
int get(int x,int y,int who,int need){
if(max(x,y)==n)return abs(arr[x]-arr[y]);
if(dp[x][y][who][need]>=0)
    return dp[x][y][who][need];
if(who==1){
    if(need)return dp[x][y][who][need]=get(x,max(x,y)+1,1,0);
    else return dp[x][y][who][need]=min(get(x,max(x,y)+1,who,0),get(x,y,0,1));
}
if(who==0){
    if(need)return dp[x][y][who][need]=get(max(x,y)+1,y,0,0);
    return dp[x][y][who][need]=max(get(max(x,y)+1,y,who,0),get(x,y,1,1));
}



}
int main(void){
cin >> n;
cin >> arr[1] >> arr[2];
n+=2;
for(int i=3;i<=n;i++)
    cin >> arr[i];
memset(dp,-1,sizeof(dp));
cout << get(1,2,0,1);
}

Measured memory_bytes: 63232
#include<vector>
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s,ans;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1') ans.push_back('1');
    else if(s[i]=='0') ans.push_back('0');
    else if(ans.size()>0) ans.erase(ans.size()-1);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

const long long int MOD = 1000000007;
//const int MOD = 998244353;

long long int N, M, K, H, W, L, R;
//int N, M, K, H, W, L, R;



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

	cin >> N >> K;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	for (int i = 1; i < N; i++) {
		if (v[i] + v[i - 1] >= K) {
			cout << "Possible\n";
			for (int j = 1; j < i; j++) cout << j << endl;
			for (int j = N - 1; j > i;j--)cout << j << endl;
			cout << i << endl;
			return 0;
		}
	}
	cout << "Impossible\n";
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N,M;
    cin>>N>>M;
    vll A(M),B(M);
    vvll next(N);
    for(ll i=0;i<M;i++){
        cin>>A[i]>>B[i];
        A[i]--;B[i]--;
        next[A[i]].push_back(B[i]);
        next[B[i]].push_back(A[i]);
    }
    
    vector<bool> done(N,false);
    vll open;
    open.push_back(0);
    vll ans(N,-1);
    
    while(open.size()>0){
        ll node=open[0];
        open.erase(open.begin());
        
        for(ll i=0;i<next[node].size();i++){
            ll n=next[node][i];
            if(!done[n] && ans[n]==-1){
                done[n]=true;
                ans[n]=node;
                open.push_back(n);
            }
        }
    }
    
    printf("Yes\n");
    for(ll i=1;i<N;i++){
        printf("%lld\n",ans[i]+1);
    }
    
    return 0;
}


Measured memory_bytes: 16824
# -*- coding: utf-8 -*-
x1,y1,x2,y2 = map(int, input().split())

sx = x2 - x1
sy = y2 - y1

x3 = x2 - sy
y3 = y2 + sx
x4 = x3 - sx
y4 = y3 - sy

print(x3,y3,x4,y4)


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>

using namespace std;

int a[200000];
double sum[200000];

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

    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        sum[i] = (a[i] + 1)*a[i]/2/(double)a[i];
        if(i)sum[i] += sum[i - 1];
    }
    double Max = 0;
    for (int i = 1; i <= n; i++) {
        if (i == k - 1)
            Max = max(Max,sum[i]);
        else if (i >= k)
            Max = max(Max, sum[i] - sum[i - k]);
    }
    
    printf("%.121f\n", Max);
}


Measured memory_bytes: 6104
package main

import (
	"fmt"
)

func main() {
	var (
		a     int
		b     int
		total int
	)
	fmt.Scan(&a)
	fmt.Scan(&b)

	for i := 0; i < 2; i++ {
		if a > b {
			total += a
			a--
		} else {
			total += b
			b--
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define first fi;
#define second se;
using namespace std;
typedef pair<int, int> P;

int change_to_i(string s){
    stringstream ss; int k;
    ss<<s; ss>>k;
    return k;
}
const int INF = 1e12;

signed main(){
    int n;
    while(cin >> n, n){
        string s;
        vector<int> d(n);
        rep(i, 0, n){
            cin >> s;
            if(s == "x") d[i] = INF;
            else d[i] = change_to_i(s);
            // cout << d[i] << " ";
        }
        // cout << endl;
        bool f = true;
        int l = -1e10, r = 1e10;
        rep(i, 0, n){
            if(d[i] == INF){
                if(i - 1 >= 0 && d[i - 1] == INF) f = false;
                if(i + 1 < n && d[i + 1] == INF) f = false;
                if((i + 1) % 2){
                    if(i - 1 >= 0) r = min(r, d[i - 1] - 1);
                    if(i + 1 < n) r = min(r, d[i + 1] - 1);
                }else{
                    if(i - 1 >= 0) l = max(l, d[i - 1] + 1);
                    if(i + 1 < n) l = max(l, d[i + 1] + 1);
                }
            // cout << i << " " <<  l << " " << r << endl;
                
            }else{
                if((i + 1) % 2){
                    if(i - 1 >= 0 && d[i - 1] != INF && d[i - 1] <= d[i]) f = false;
                    if(i + 1 < n && d[i + 1] != INF && d[i] >= d[i + 1]) f = false;
                }else{
                    if(i - 1 >= 0 && d[i - 1] != INF &&  d[i - 1] >= d[i]) f = false;
                    if(i + 1 < n && d[i + 1] != INF && d[i] <= d[i + 1]) f = false;
                }
            }
        }
        // cout << l << " " << r << endl;
        if(l > r) f = false;
        if(!f) cout << "none" << endl;
        else if(l == r) cout << l << endl;
        else cout << "ambiguous" << endl;
    }
}

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

void cookie(int &a,int &b,int &c,bool &same,bool &check){
  int S=a+b+c;
  if(a!=b && b!=c && c!=a){
  a= (S-a)/2;
  b= (S-b)/2;
  c= (S-c)/2;
    if(a+b+c!=S){
      check=false;
    }
  }else if(a+b+c==3){
    check = false;
  }else{
    same = true;
  }
}
    
int main(){
  int A,B,C;
  cin >> A >> B >> C;
  int sum = A+B+C;
  int count = -1;
  bool check=true;
  bool same = false;
  while(check==true && same == false){
    count++;
    cookie(A,B,C,same,check);
  }
  if(!(same)){
  cout << count << endl;
  }else{
    cout << -1 << endl;
  }
}


Measured memory_bytes: 256
/*
	ID: sixathofpain
	TASK: friday
	LANG: C++   

*/


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
	
	ldb a,b;
	cin>>a>>b;
	a = a*b;
	a = floor(a);
	int ans = a;
	cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3764
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
       {
  scanf("%d%d",&a,&b);
  if(a==0&&b==0){break;}
 
  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
    {
      if(i>1&&i<a&&j<b&&j>1)printf(".");
      else printf("#");
    }
      printf("\n");
    }
  printf("\n");
     
       }
  return 0;
}


Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int32_t main() {
	ll t, i, x, j, y, 	z = 0, k, n;
	string s;
	cin >> n;

	ll a[n];
	for(long long i=0;i<n;i++) {
		cin >> a[i];
		if (i) {
			x = a[i - 1];
			if (x > a[i]) {
				t = x - a[i];
				z += t;
				a[i] += t;
			}
		}
	}


cout<<z<<endl;
}

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

int main(){
    int H, W;
    cin >> H >> W;
    string S[H];
    for(int i=0;i<H;i++) cin >> S[i];

    int Row[H][W+1] = {};
    int Col[H][W+1] = {};
    
    //Row
    for(int i=0;i<H;i++){
        int l = 0;
        while (l < W){
            int r = l, cnt = 0;
            while (r < W && S[i][r] == '.'){
                r += 1;
                cnt += 1;
            }
            Row[i][l] += cnt;
            Row[i][r] -= cnt;
            l = r+1;
        }
        for(int j=0;j<W;j++){
            Row[i][j+1] += Row[i][j];
        }
    }

    //Col
    for(int j=0;j<W;j++){
        int u = 0;
        while (u < H){
            int d = u, cnt = 0;
            while (d < H && S[d][j] == '.'){
                d += 1;
                cnt += 1;
            }
            Col[u][j] += cnt;
            Col[d][j] -= cnt;
            u = d+1;
        }
        for(int i=0;i<H;i++){
            Col[i+1][j] += Col[i][j];
        }
    }
    
    int ans = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            ans = max(ans, Row[i][j]+Col[i][j]-1);
        }
    }

    cout << ans << endl;

    
}

Measured memory_bytes: 35584
import java.util.*;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] lun = new int[16];
        int digit = 0;

        for(;k > 0; k--){
            boolean allnine = true;
            int nines = 0;
            for(int i = 0 ; i <= digit ; i++){
                if(lun[i] != 9){
                    allnine = false;
                    nines = i;
                }
            }
            if(allnine){
                digit++;
                for(int i = 0 ; i < digit ; i++){
                    lun[i] = 0;
                }
                lun[digit] = 1;
            }else {
                int addPos = 0;
                while ((lun[addPos] - 1 == lun[addPos + 1]) && addPos < digit) {
                    addPos++;
                }
                lun[addPos]++;
                for (int i = addPos - 1; i >= 0; i--) {
                    lun[i] = Math.max(lun[i + 1] - 1, 0);
                }

                boolean hasten = false;
                for(int i = digit ; i >= 0 ; i--){
                    if(lun[i] == 10){
                        hasten = true;
                    }
                }
                if(hasten){
                    k++;
                }
            }
        }

        StringBuilder strb = new StringBuilder();
        for(int i = digit ; i >= 0 ; i--){
            strb.append(lun[i]);
        }
        System.out.println(strb.toString());

    }
}


Measured memory_bytes: 22992
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

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

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

    vll b(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &b[i]);
    }

    ll sum = 0;
    ll rest = a[0];
    for (int i = 0; i < n; i++)
    {
        if (rest <= b[i])
        {
            sum += rest;
            if (a[i + 1] <= b[i] - rest)
            {
                sum += a[i + 1];
                rest = 0;
            }
            else
            {
                sum += b[i] - rest;
                rest = a[i + 1] - (b[i] - rest);
            }
        }
        else
        {
            sum += b[i];
            rest = a[i + 1];
        }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 1792
# input
A = list(map(int, input().split()))

ans1 = 0
ans2 = 0

for i in range(len(A)):
    if A[i] == 5:
        ans1 += 1
    if A[i] == 7:
        ans2 += 1

if ans1 == 2 and ans2 == 1:
    print('YES')
else:
    print('NO')




Measured memory_bytes: 2940
import itertools
n = int(input())
march = dict()

a = "MARCH"
for i in range(5):
    march[a[i]] = 0

for i in range(n):
    s = input()
    if s[0] in march:
        march[s[0]] += 1

res = 0
for i in itertools.combinations("MARCH", 3):
    tmp = 1
    for j in i:
        tmp *= march[j]
    res += tmp

print(res)


Measured memory_bytes: 9084
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
lis=[abs(a-b),abs(a-c),abs(a-d),abs(a-e),abs(b-c),abs(b-d),abs(b-e),abs(c-d),abs(c-e),abs(d-e)]
lis2=sorted(lis)
if lis2[-1]<=k:
    print("Yay!")
else:
    print(":(")

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

using namespace std;
int n;
bool p(string s,int a,int b){
    int i=a,j=b-1;
    while((i<j)&&(s[i]==s[j])){
        i++;j--;
    }
    return i>=j;
}

int main(){
    string s;
    cin>>s;
    n=s.size();
    if(p(s,0,n)&&p(s,0,(n-1)/2)&&p(s,(n+3)/2-1,n))
        cout<<"Yes";
    else
    {
        cout<<"No";
    }
            
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    string S,T;
    cin>>S>>T;
    int A,B;
    cin>>A>>B;
    string U;
    cin>>U;
    
    if (U==S)
        A--;
    else
        B--;
    cout<<A<<" "<<B;
       
    return 0;
}


Measured memory_bytes: 256