akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;
int nt[N];
int top = 0, stack[100]; 

void push(int x){
	stack[++top] = x;
}

int pop(){
	top--;
	return stack[top+1];
}

// uに隣接するvを番号順に収得
int next ( int u) {
	int v;
	for ( v = nt[u]; v < n; v++ ) {
		nt[u] = v + 1;
		if ( M[u][v] ) return v;
	}
	return -1;
}

// スタックを用いた深さ優先探索
void dfs_visit ( int r) {
	int i;
	for ( i = 0; i < n; i++) nt[i] = 0;

	push(r);
	color[r] = GRAY;
	d[r] = ++tt;

	while (top != 0) {
		int u = stack[top];
		int v = next(u);
		if ( v != -1) {
			if ( color[v] == WHITE) {
				color[v] = GRAY;
				d[v] = ++tt;
				push(v);
			}
		} else {
			pop();
			color[u] = BLACK;
			f[u] = ++tt;
		}
	}

}

void dfs() {
	int i;
	int u;

	// 初期化
	for ( i = 0; i < n; i++) {
		color[i] = WHITE;
		nt[i] = 0;
	}

	// 未訪問のuを始点として深さ優先探索
	for ( u = 0; u < n; u++) {
		if ( color[u] == WHITE ) dfs_visit(u);
	}
	for ( i = 0; i < n; i++) {
		printf("%d %d %d\n",i + 1, d[i], f[i]);
	}

}

int main () {
	int i, j;
	int u, k, v;

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

	for ( i = 0; i < n; i++) {
		scanf("%d%d",&u,&k);
		u--;
		for (j = 0; j < k; j++) {
			scanf("%d",&v);
			v--;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int sum=0;
    for(int i=0; i<n; i++)
    {
        int l,r;
        cin>>l>>r;
        sum+=(r-l)+1;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
/*---> 31 October 2019 <--- > 23:42:59 <---*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//boot#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
const int N=1e5+5;

int32_t main(){__
	int n;
	cin>>n;
	cout<<n*n*n<<"\n";
return 0;
}

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

def gcd(a,b):
    if a>b: a,b = b,a
    while a>0:
        a,b = b%a,a
    return b

for i in range(N-1):
    A[i+1] = gcd(A[i],A[i+1])

print(A[-1])

Measured memory_bytes: 14252
#include <iostream>
#include <cstdint>
#include <cmath>

using namespace std;

int main() {
  int64_t H;
  cin >> H;

  int64_t l = log2(H);
  int64_t res = ((1 + l) * l / 2);
  
  int64_t cnt = 0;
  for (int64_t i = 0; i <= l; ++i) {
    cnt += pow(2, i);
  }
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 512
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        Dictionary<string, int> counts = new Dictionary<string, int>();
        long res = 0;
        for (int i = 0; i < n; i++)
        {
            var str = string.Join("", Console.ReadLine().OrderBy(x => x));
            if (!counts.ContainsKey(str)) counts.Add(str, 0);
            res += counts[str];
            counts[str]++;
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 31760
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), M = sc.nextInt(),a,b;
    int A[] = new int[N];
    for(int i=0; i<M; i++) {
      a=sc.nextInt()-1;
      b=sc.nextInt()-1;
      A[a]++;
      A[b]++;
    }
    for(int j=0; j<N; j++) {
      System.out.println(A[j]);
    }
  }
}

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

using namespace std;

typedef long long ll;

int main(){
  ll x, y; cin >> x >> y;  ll ans = 0;
  
  if( x >= 0 && y >= 0){
    if( y >= x){ ans += y- x;}
    else{ 
      if( y != 0){ans += x - y + 2;}
       else{ ans += x - y + 1;}}}
  
  else if( x < 0 && y >= 0){
    if( y >= -x){ ans += 1 + x + y;}
    else{ ans += min( y - x, -x - y + 1);}}
  
  else if( x < 0 && y < 0){
    if( y <= x){ ans += x- y + 2;} else{ ans += y - x;}}
  
  else if( y < 0 && x >= 0){
    if( -y >= x){ ans += -y - x + 1;}
    else{ ans += y + x + 1;}}
  
  cout << ans << endl; return 0;}


Measured memory_bytes: 256
z='abcdefghijklmnopqrstuvwxyz'
for _ in[0]*int(input()):
 e=input()
 for i in range(1,26,2):
  for j in range(26):
   a=''.join(z[(z.index(c)*i+j)%26]if c in z else c for c in e)
   if'that'in a or'this'in a:print(a);break


Measured memory_bytes: 5600
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),(OUT(YES),1),(OUT(NO),0))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 5010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p998 = 998244353;
const LL p107 = 1000000007;
const LL p = p107;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
//LL A[SIZE],B[SIZE],C[SIZE];
LL solve(){
	LL A,B;
	cin >> A >> B >> M;
	VI a(A),b(B);
	REP(i,A) cin >> a[i];
	REP(i,B) cin >> b[i];
	LL mna=INF,mnb=INF;
	REP(i,A) MN(mna,a[i]);
	REP(i,B) MN(mnb,b[i]);
	LL ans=mna+mnb;
	REP(i,M){
		LL x,y,z;
		cin >> x >> y >> z;
		MN(ans,a[x-1]+b[y-1]-z);
	}
	return ans;
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	LL T=1;
	//cin >> T;
	REP(i,T){
		DEFAULT;
	}
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


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

using namespace std;

int H,c,ct=0,tmpct=0;
vector<int> b;
int ren=0;
void solve(){
  bool roop = true;
  while(roop){
  for(int i=0;i<H*6-2;i++){
    if(b[i] == b[i+1] && b[i+1] == b[i+2] && b[i] != 0){
      if(ren == 0){tmpct += b[i]*3;ren++;
      }else{
	tmpct += b[i];
	ren++;
      }
    }else if(ren>0){
      for(int j=i-ren;j<i+2;j++)
	b[j]=0;
      ren = 0;
    }
  }




  for(int i=0;i<5;i++){
    c=0;
    for(int j=0;j<H;j++)
	if(b[(H-j-1)*6 + i]==0)c++;
	else if(c>0){
	  b[(H-j+c-1)*6 + i] = b[(H-j-1)*6 + i];
	  b[(H-j-1)*6 + i] = 0;
    }
  }

  /*      for(int i=0;i<H;i++){
      for(int j=0;j<6;j++){
      cout << b[(i)*6 + j] << " ";
      }
      cout << "\n";
    }
      cout << "tmpct" << tmpct << "\n";
  */      
    if(tmpct > 0){ct += tmpct;
      tmpct = 0;}
    else break;


  
  }
}



int main(){
  while(true){
    cin >> H;
    if(H == 0)break;
    b.resize(H*6);
    for(int i=0;i<H;i++){
    cin >> b[i*6] >> b[i*6+1] >> b[i*6+2] >> b[i*6+3] >> b[i*6+4];
    b[i*6+5]=-1;
    }
    solve();
    b.clear();
    cout << ct << endl;
    ct = 0;
  }

  return 0;
}

Measured memory_bytes: 2984
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

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

ll W, H, x, y;

int main(){
    cin >> W >> H >> x >> y;
    
    double ox = W / 2.0;
    double oy = H / 2.0;
    
    ll num = 0;
    if(x == ox && y == oy)  num = 1;
    
    double ans = (W * H / 2.0);
    
    cout << setprecision(20) << ans;
    cout << " " << num << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a=0,b;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'&&a==0) a=i+1;
        if(s[i]=='Z') b=i;
    }
    cout<<b-a+2<<endl;
}

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

int main() {

	ll n, m; cin >> n >> m;
	priority_queue<ll> pq;
	for (int i = 0; i < n; i++) {
		ll a; cin >> a;
		pq.push(a);
	}
	while (m--) {
		ll top = pq.top();
		pq.pop();
		top /= 2;
		pq.push(top);
	}
	ll ans = 0;
	while (!pq.empty()){
		ans += pq.top();
		pq.pop();
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n;cin>>n;
  ll ln[n];rep(i,n)cin>>ln[i];
  sort(ln, ln+n);
  ll ans = 0;
  rep(i,n-2) for(int j=i+1;j<n-1;j++) for (int k=j+1;k<n;k++) {
    if (ln[i]<ln[j] && ln[j]<ln[k] && ln[i]+ln[j] > ln[k]) ans++;
    //cout<<i<<j<<k<<endl;
  }
  cout<<ans;
}


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

# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ;

# define ll long long
# define C continue;

# define pb push_back
# define vi vector < int >
# define vll vector < ll >

# define I insert

# define pii pair < int , int >
# define pll pair < ll , ll >
# define F first
# define S second

# define vpii vector < pair < int , int > >
# define vpll vector < pll >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define ld long double
# define PQ priority_queue

# define vc vector < char >
# define vb vector < bool >
# define vs vector < string >

# define vvi vector < vector < int > >
# define vvll vector < vector < ll > >
# define vvc vector < vector < char > >
# define vvb vector < vector < bool > >

# define allcomp(v) v.begin() , v.end() , comp

# define pp(n) printf("%.10Lf",n);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
/// Start using lower bound !!

const int N = 2002 ;
int dp[N] ;

int f ( int s )
{
    int &ans = dp[s] ;

    if ( ans != -1 )
        return ans ;

    ans = 0 ;

    for ( int j = 3 ; ; j ++ )
    {
        int other = s - j ;
        if ( other >= 3 )
        {
            ans += 1 + f ( other ) ;
            ans %= mod ;
        }

        else break ;
    }

    return ans ;
}

void solve ( int test_case )
{
    int s ;
    cin >> s ;

    if ( s <= 2 )
    {
        cout << 0 ; line ;
        return ;
    }

    memset ( dp , -1 , sizeof ( dp ) ) ;
    dp[0] = 1 ;

    int ans = 1 + f ( s ) ;
    ans %= mod ;

    cout << ans ; line ;
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


Measured memory_bytes: 3664
from collections import deque

N = int(input())
H = list(map(int,input().split()))

cost = 0

d = deque()
d.append((0,N,0))
while len(d):
    l,r,mm = d.pop()
    if l == r:
        continue
    m = min(H[l:r])
    cost += m - mm
    i = l
    while True:
        if H[i] == m:
            d.append((l,i,m))
            l = i + 1
        if i + 1 == r:
            d.append((l,r,m))
            break
        i += 1

print(cost)

Measured memory_bytes: 3444
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

S = list(readline().rstrip())
K = int(readline())
N = len(S)
for i in range(N):
    t = ord(S[i])-97
    if t == 0:
        continue
    if 26 - t <= K:
        S[i] = 'a'
        K -= 26-t
S[-1] = chr((ord(S[-1])-97 + K%26)%26 + 97)
print(''.join(S))





Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    set<int> s;
    rep(i,n){
        cin>>d[i];
        s.insert(d[i]);
    }
    cout<<s.size()<<endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_b
//
#![allow(unused_imports)]
use std::io::*;
use std::io::Write;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
        n: i64
    };


    for w in 1..n+1 {
        let price = w * 108 / 100;
        if price == n {
            println!("{}", w);
            return;
        }
    }
    println!(":(");
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <cstdio>
#include <utility>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;

int main(void)
{
    std::string S;
    int w;
    cin >> S >> w;
    std::string answer;
    int i = 0;
    int j = w;
    while (i < (int)S.size())
    {
        if (j == w)
        {
            answer += S[i];
            j = 0;
        }
        i++;
        j++;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
	"math"
)

func min(x, y int) int {
	if x <= y {
		return x
	}
	return y
}

func main() {
	var n, x, y int
	fmt.Scan(&n, &x, &y)
	x--
	y--

	count := make(map[int]int)
	for i := 0; i < n-1; i++ {
		for j := i + 1; j < n; j++ {
			d := min(j-i, int(math.Abs(float64(x-i)))+1+int(math.Abs(float64(j-y))))
			count[d]++
		}
	}

	for k := 1; k < n; k++ {
		fmt.Println(count[k])
	}
}


Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60; 
#define MOD 1000000007

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}


int main() {
	string s;
	cin >> s;
	cout << s.at(0) << s.size() - 2 << s.at(s.size() - 1) << endl;
}



Measured memory_bytes: 256
N,M=map(int,input().split())
PY=[[0,0,0] for i in range(M)] 
for i in range(M):
  P,Y=map(int,input().split())
  PY[i]=[P,Y,i]
PY.sort(key=lambda x:x[1])
PY.sort(key=lambda x:x[0])
prev=0
for i in range(M):
  if PY[i][0] != prev:
    count = 1
  else:
    count+=1
  prev=PY[i][0]
  ans=["0" for i in range(6 - len(str(prev)))]
  temp=["0" for i in range(6 - len(str(count)))]
  ans+=list(str(prev))+temp+list(str(count))
  PY[i][0]="".join(ans)
PY.sort(key=lambda x:x[2])
for i in range(M):
  print(PY[i][0])

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

void solve(){
	int n, a, b;
	cin >> n >> a >> b;
	int mx = -1, mn = INF;
	REPN(i, 0, min(a, b)) {
		if (i + (a - i) + (b - i) <= n) {
			mn = min(mn, i);
			mx = max(mx, i);
		}
	}
	printf("%d %d\n", mx, mn);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a+b>=c)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


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

int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0) break;
    vector<pair<double,string> > lis;
    lp(i,n){
      string l;
      int p,a,b,c,d,e,f,s,m;
      cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
      double ans;
      ans=(double)((f*m*s)-p)/(a+b+c+(d+e)*m);
      lis.push_back(make_pair(-ans,l));
    }
    sort(lis.begin(),lis.end());
    reverse(lis.begin(),lis.end());
    while(!lis.empty()){
      pair<double,string> gege = lis.back();
      cout<<gege.second<<endl;
      lis.pop_back();
    }
    cout<<"#"<<endl;
  }
  return 0;
}
	   



Measured memory_bytes: 3116
import java.util.*;
import java.io.*;
public class Main {
    static int n;
    static int capacity;
    static int wei[];
    static long val[];
    static long dp[][];
    public static void main(String args[]) {
        Scanner input=new Scanner(System.in);
        n=input.nextInt();
        capacity=input.nextInt();
        wei=new int[n];
        val=new long[n];
        dp=new long[n][(int)capacity+1];
        for(int i=0;i<n;i++) {
            wei[i]=input.nextInt();
            val[i]=input.nextLong();
        }
        for(int i=0;i<dp.length;i++) {
            for(int j=0;j<dp[0].length;j++) {
                dp[i][j]=-1L;
            }
        }
        System.out.println(solve(n-1,capacity));
    }
    public static long solve(int n,int cap) {
        if(n==-1 || cap==0) {
            return 0;
        }
        if(dp[n][cap]==-1L) {
            long tmp=Integer.MIN_VALUE;
            if(cap>=wei[n]) {
                tmp=Math.max(tmp, solve(n-1,cap-wei[n])+val[n]);
            }
            tmp=Math.max(tmp, solve(n-1,cap));
            dp[n][cap]=tmp;
        }
        return dp[n][cap];
    }
}


Measured memory_bytes: 125776
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
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
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define N 100005
#define vi vector<int>
#define all(v) v.begin(),v.end()
int dp[105][N];
signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,w;
   cin>>n>>w;
   int x[n+1],y[n+1];
   for(int i=1;i<=n;i++)
   {
       cin>>x[i]>>y[i];

   }
   for(int i=1;i<=n;i++)
   {
       for(int j=0;j<=w;j++)
       {   if(j >= x[i])
           dp[i][j]=max(dp[i-1][j],(dp[i-1][j-x[i]]+y[i]));
           else
            dp[i][j]=dp[i-1][j];
       }
   }
   cout<<dp[n][w]<<endl;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    lint x; cin >> x;
    lint ans = (x/500)*1000;
    x -= (x/500)*500;
    ans += (x/5)*5;
    out(ans);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)

typedef long long LL;
const int N=100005;

std:: priority_queue <LL> heap;

struct edge {int y,w,next;} e[N*2];

int mx[N],size[N],rt,rt2;
int ls[N],edCnt,n;

LL dis[N];

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):(v),ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void add_edge(int x,int y,int w) {
	e[++edCnt]=(edge) {y,w,ls[x]}; ls[x]=edCnt;
	e[++edCnt]=(edge) {x,w,ls[y]}; ls[y]=edCnt;
}

void dfs(int x,int fa) {
	size[x]=1;
	for (int i=ls[x];i;i=e[i].next) {
		if (e[i].y==fa) continue;
		dis[e[i].y]=dis[x]+e[i].w;
		dfs(e[i].y,x); size[x]+=size[e[i].y];
		mx[x]=std:: max(mx[x],size[e[i].y]);
	}
	mx[x]=std:: max(mx[x],n-size[x]);
	if (mx[x]<mx[rt]) rt=x;
}

int main(void) {
	n=read();
	rep(i,2,n) {
		int x=read(),y=read(),w=read();
		add_edge(x,y,w);
	}
	mx[rt]=n;
	dfs(1,0);
	dis[rt]=0;
	dfs(rt,0);
	LL ans=0,sum=0; bool flag=false;
	rep(i,1,n) sum+=dis[i]*2;
	for (int i=ls[rt];i;i=e[i].next) {
		if (mx[e[i].y]==mx[rt]) {
			ans=sum-e[i].w;
			flag=true;
		}
	}
	if (!flag) rep(i,1,n) if (i!=rt) {
		ans=std:: max(ans,sum-dis[i]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
#define double long double
#define int long long 
#define f(z) for(int i=1;i<=z;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define vi vector<int>
#define pb push_back
#define si set<int>
int cl(int n ,int m) { if(n%m)return n/m + 1 ;else return n/m ;}
int pw(int a,int b,int M){a%=M;int r=1;while(b>0){if(b&1)r=r*a%M;a=a*a%M;b>>=1;}return r;}
#define mod  1000000007
#define T() int TT; cin>>TT; while(TT--)
#define P pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e6 + 5  ;
int a[N] , b[N]; 
signed main(){
	int k , n ;
	cin >> k >> n; 
	f(n) cin>> a[i] ;	
	int mn = LLONG_MAX ;
	int s = 0;

	b[n+1] = a[1] + (k-a[n]);
	b[1] = a[1] ;
	for ( int i= 2;i<=n ;i++){
		b[i] = a[i] - a[i-1] ; 
	}
	f(n+1) mn = min( mn , k-b[i]) ;
	cout << mn ;
}

Measured memory_bytes: 5888
#include <map>
#include <string>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;

const int N = 2e5 + 10;
long long a[N];
bool cmp(long long x, long long y) {
    return x > y;
}

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n, cmp);
    long long ans = a[0];
    int t = (n + 1) / 2;
    for (int i = 1; i < t; i++) {
        ans = ans + 2 * a[i];
    }
    if (n % 2) ans -= (a[t - 1]);
    cout << ans << endl;
    return 0;
}


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

int main(){
  string b;
  cin >> b;
  if(b == "A"){
    cout << "T";
  }else if(b == "T"){
    cout << "A";
  }else if(b == "C"){
    cout << "G";
  }else if(b == "G"){
    cout << "C";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

vector<ll> d(100500);
vector<vector<pii>> g(100500);

void dfs(int i, int p, ll dis) {
  d[i] = dis;

  for (auto&& j : g[i]) {
    if (j.first != p) {
      dfs(j.first, i, dis+j.second);
    }
  }
}

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

  int n;
  cin >> n;
  rep(i, n-1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--; v--;
    g[u].push_back(pii(v, w));
    g[v].push_back(pii(u, w));
  }

  dfs(0, -1, 0);

  rep(i, n) {
    cout << d[i]%2 << endl;
  }
}


Measured memory_bytes: 8832
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int main(){
    int n;
    scanf("%d", &n);
    int a[n+2], sum[n+2];
    a[0] = 0; sum[0] = 0;
    rep(i, 1, n+1){
        scanf("%d", &a[i]);
        sum[i] = sum[i-1] + abs(a[i] - a[i-1]);
    }
    a[n+1] = a[n-1]; sum[n+1] = sum[n-1];
    /*rep(i, 0, n+2){
        printf("%d ", a[i]);
    }
    printf("\n");
    rep(i, 0, n+2){
        printf("%d ", sum[i]);
    }
    printf("\n");*/
    rep(i, 1, n+1){
        int ans, l = n;
        if(i==n){
            l = n-1;
        }
        int x = sum[i-1], y = abs(a[i-1] - a[i+1]), z = sum[l] - sum[i+1];
        ans = x + y + z + abs(a[l]);
        printf("%d\n", ans);
    }

    return 0;
}

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

def main():
    N = int(input())
    P = [int(x) for x in input().split()]
    ls = [0 for _ in range(N)]
    ans = 0
    mins = 10**10
    for i in range(N):
        mins = min(mins,P[i])
        if mins==P[i]:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 80464
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = Integer.parseInt(sc.next());
		int N = 1_000_005;
		int value=s;
		int[] array = new int[N];
		HashSet<Integer> set = new HashSet<Integer>();
		array[0]=s;
		set.add(s);
		for (int i=0;i<N;i++) {
			array[i+1]=f(array[i]);
			if  (set.contains(array[i+1])) {
				System.out.println(i+2);
				break;
			} else {
				set.add(array[i+1]);
			}
		}
	}

	static int f(int n) {
		if (n%2==0) {
			return n/2;
		} else {
			return n*3+1;
		}
	}
}

Measured memory_bytes: 27732
h,w,K =  map(int,input().split())
masu = [input() for _ in range(h)]
ans = 0
for i in range(2**h):
    for j in range(2**w):
        cnt = 0
        for k in range(h):
            for l in range(w):
                if ((i >> k) & 1) and ((j >> l) & 1) and masu[k][l] == "#":
                    cnt += 1
        if cnt == K:
            ans += 1

print(ans)

Measured memory_bytes: 9156
x,y,a,b,c = map(int,input().split())
p = input().split()
p = [int(s) for s in p]
q = input().split()
q = [int(s) for s in q]
r = input().split()
r = [int(s) for s in r]
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
s = p[:x] + q[:y] + r
s.sort(reverse=True)
print(sum(s[:x+y]))

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int n, d, x, p[11], dp[100010];

int main() {
	cin >> n >> d >> x;
	for_(i,0,n) cin >> p[i];
	
	for_(i,0,d-1) {
		memset(dp, 0, sizeof(dp));
		
		for_(j,0,n) {
			int np; cin >> np;
			for_(k,0,x+1) if (k >= p[j]) dp[k] = max(dp[k], dp[k - p[j]] + np - p[j]);
			p[j] = np;
		}
		
		x += dp[x];
	}
	
	cout << x << endl;
}

Measured memory_bytes: 1560
#include <bits/stdc++.h>
using namespace std;
const uint64_t seed = std::chrono::system_clock::now().time_since_epoch().count();
mt19937_64 rnd(seed);
const int MOD = 998244353;

#ifdef VIPJML_LOCAL
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << "{";
    for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << *vi;
    }
    os << "}";
    return os;
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const vector<pair<A, B>> &v)
{
    os << "{";
    for (typename vector<pair<A, B>>::const_iterator vi = v.begin(); vi != v.end(); ++vi)
    {
        if (vi != v.begin())
            os << ", ";
        os << '(' << vi->first << " " << vi->second << ")";
    }
    os << "}";
    return os;
}

template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T)
{
    cerr << ' ' << H;
    dbg_out(T...);
}
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

vector<long long> tree;
vector<long long> delay;
vector<long long> T;
vector<long long> T2;

void pushDown(int node, int ts, int te)
{
    if (delay[node] > 0)
    {
        int m = (ts + te) / 2;
        tree[2 * node + 1] = T[m - ts] * delay[node] % MOD;
        tree[2 * node + 2] = T[te - m] * delay[node] % MOD;
        delay[2 * node + 1] = delay[node];
        delay[2 * node + 2] = delay[node];
        delay[node] = 0;
    }
}
void update(int node, int ts, int te, int s, int e, int v)
{
    if (ts >= e || te <= s)
        return;
    if (ts >= s && te <= e)
    {
        tree[node] = T[te - ts] * v % MOD;
        delay[node] = v;
        return;
    }
    pushDown(node, ts, te);
    int m = (ts + te) / 2;
    update(2 * node + 1, ts, m, s, e, v);
    update(2 * node + 2, m, te, s, e, v);
    tree[node] = (tree[2 * node + 1] * T2[te - m] % MOD + tree[2 * node + 2]) % MOD;
}

void solve()
{
    int n, q;
    cin >> n >> q;
    tree.resize(4 * n, 0);
    delay.resize(4 * n, 0);
    T.resize(n + 1, 0);
    T2.resize(n + 1, 1);
    for (int i = 1; i <= n; i++)
    {
        T[i] = (T[i - 1] * 10 + 1) % MOD;
        T2[i] = T2[i - 1] * 10 % MOD;
    }
    update(0, 0, n, 0, n, 1);
    for (int i = 0; i < q; i++)
    {
        int l, r, d;
        cin >> l >> r >> d;
        l--;
        update(0, 0, n, l, r, d);
        cout << tree[0] << "\n";
    }
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
    int T = 1;
    //cin >> T;
    for (int i = 1; i <= T; i++)
    {
        solve();
    }
    cout.flush();
    return 0;
}


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const unsigned int mod = 1e9 + 7;

using namespace std;

int32_t main() {
	fastio;

	int r;
	cin >> r;
	cout << 2.0 * 3.14 * r;

	return 0;
}


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

int main(){
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int64_t>> A(n, vector<int64_t>(m)), B(m, vector<int64_t>(l)), C(n, vector<int64_t>(l));
    int64_t sum;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> A.at(i).at(j);
        }
    }
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < l; j++)
        {
            cin >> B.at(i).at(j);
        }
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            sum = 0;
            for (int k = 0; k < m; k++)
            {
                sum += A.at(i).at(k) * B.at(k).at(j);
            }
            C.at(i).at(j) = sum;
        }
    }
    
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < l; j++)
        {
            cout << C.at(i).at(j);
            if(j==l-1) cout << endl;
            else cout << " ";
        }
    }
}


Measured memory_bytes: 3284
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    int n,m,a;
    cin >> n >> m;
    rep(i,m){
        cin >> a;
        n-=a;
    }
    
    if(n>=0)cout << n;
    else cout << -1;
    
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
typedef long long ll;
typedef long double ld;
using namespace std;
template<class T> using minheap = priority_queue<T, vector<T>, greater<T>>;



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

  int n;
  string s;
  cin >> n >> s;
  if (n & 1) {
    cout << "No\n";
  } else {
    string L(s.begin(), s.begin() + n / 2);
    string R(s.begin() + n / 2, s.end());
    if (L == R) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }

  return 0;
}

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

using namespace std;
#define int long long
const int INF = 200000000007;


  
signed main(){
    int h,w,n,sr,sc;
    cin>>h>>w>>n>>sr>>sc;
    int l=0,r=w+1,u=0,d=h+1;
    int z=0;
    string s,t;
    cin>>s>>t;
    for(int i=n-1;i>0;i--){
        if(s[i]=='L'&&l!=w)l++;
        if(s[i]=='R'&&r!=1)r--;
        if(s[i]=='U'&&u!=h)u++;
        if(s[i]=='D'&&d!=1)d--;
        if(t[i-1]=='R'&&l!=w)l--;
        if(t[i-1]=='L'&&r!=1)r++;
        if(t[i-1]=='D'&&u!=h)u--;
        if(t[i-1]=='U'&&d!=1)d++;
        l=max(z,l);
        r=min(w+1,r);
        u=max(u,z);
        d=min(h+1,d);
    }
    if(s[0]=='L'&&l!=w)l++;
    if(s[0]=='R'&&r!=1)r--;
        if(s[0]=='U'&&u!=h)u++;
        if(s[0]=='D'&&d!=1)d--;

    //cerr<<l<<' '<<r<<' '<<u<<' '<<d<<endl;
    if((sc<=l||sc>=r)||(sr<=u||sr>=d))cout<<"NO";
    else cout<<"YES";
    return 0;
}

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

int dp[1000000];
int INF = 1001001001;

int main() {
    int N; cin >> N;
    rep(i, N+1){
        dp[i] = i;
    }
    for (int i = 0; i < N; i++){
        int now6 = 6;
        while(now6 <= N){
            dp[i+now6] = min(dp[i+now6], dp[i] + 1);
            now6 *= 6;
        }
        int now9 = 9;
        while(now9 <= N){
            dp[i+now9] = min(dp[i+now9], dp[i] + 1);
            now9 *= 9;
        }
    }

    cout << dp[N] << endl;

    return 0;
}

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

using namespace std;

int main(){
    long N,ans=0;
    string S;
    cin>>S;

    for (auto &x : S)
    {
        if(x=='o'){
            ans++;
        }
    }
    


if(ans+15-S.size()>=8){
    cout<<"YES"<<endl;
}else{
    cout<<"NO"<<endl;
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

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

template <typename _T>
inline void read(_T &f) {
    f = 0; _T fu = 1; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar(); }
    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
    f *= fu;
}

template <typename T>
void print(T x) {
    if (x < 0) putchar('-'), x = -x;
    if (x < 10) putchar(x + 48);
    else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
    print(x); putchar(t);
}

const int N = 55, INF = 0x7fffffff;

struct edge_t { int u, v, next, cap, flow, cost; } G[N * N * 8];

int dis[N * N], head[N * N], fr[N * N], used[N * N], maxflow[N * N];
char c[N][N];
int n, m, s, t, tot = 1, ans;

inline void addedge(int u, int v, int cap, int cost) {
    G[++tot] = (edge_t) {u, v, head[u], cap, 0, cost}, head[u] = tot;
    G[++tot] = (edge_t) {v, u, head[v], 0, 0, -cost}, head[v] = tot;
}

int spfa() {
    memset(dis, -0x3f, sizeof(dis));
    queue <int> q; q.push(s);
    used[s] = 1, dis[s] = 0, maxflow[s] = INF;
    while (!q.empty()) {
        int u = q.front(); q.pop(); used[u] = 0;
        for (int i = head[u]; i; i = G[i].next) {
            int v = G[i].v;
            if (G[i].cap > G[i].flow && dis[v] < dis[u] + G[i].cost) {
                dis[v] = dis[u] + G[i].cost; fr[v] = i;
                maxflow[v] = min(maxflow[u], G[i].cap - G[i].flow);
                if (!used[v]) {
                    q.push(v);
                    used[v] = 1;
                } 
            }
        }
    }
    return dis[t] != dis[t + 1];
}

void solve() {
    int tmp = t;
    while (tmp != s) {
        int i = fr[tmp];
        G[i].flow += maxflow[t];
        G[i ^ 1].flow -= maxflow[t];
        tmp = G[i].u;
    }
    ans += maxflow[t] * dis[t];
}

void EK() {
    while (spfa()) solve();
}

inline int ss(int x, int y) { return (x - 1) * m + y; }

int main() {
    read(n); read(m); s = 0; t = n * m + 1;
    for (int i = 1; i <= n; i++) scanf("%s", c[i] + 1);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (c[i][j] == '#') continue;
            if (c[i][j] == 'o') addedge(s, ss(i, j), 1, 0);
            if (i != n) addedge(ss(i, j), ss(i + 1, j), INF, 1);
            if (j != m) addedge(ss(i, j), ss(i, j + 1), INF, 1);
            addedge(ss(i, j), t, 1, 0);
        }
    }
    EK();
    print(ans, '\n');
    return 0;
}

Measured memory_bytes: 4076
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,i,j;
    bool flg=false;
    cin >> N;
    for(i=1;i<10;i++){
        for(j=1;j<10;j++){
            if(N==(i*j)){
                flg=true;
            }
        }
    }
    if(flg == true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    string S;
    cin >> N >> S;

    int cnt = 0;
    int tmp = 0;
    REP(i, N) {
        if (S[i] == '(') cnt++;
        else {
            cnt--;
            if (cnt < 0) tmp = max(tmp, -cnt);
        }
    }

    REP(i, tmp) {
        S = "(" + S;
    }

    N += tmp;

    cnt = 0;
    REP(i, N) {
        if (S[i] == '(') cnt++;
        else cnt--;
    }

    REP(i, cnt) S = S + ")";

    cout << S << endl;

    // cout << S << endl;
    // cout << S.insert(0, "sss") << endl;
    // cout << S.insert(S.end()-S.begin(), "sss") << endl;
    
    

    return 0;
}

Measured memory_bytes: 256