akhauriyash/Code-Regression huggingface dataset:
use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;

fn exec() {
    let mut sc = Scanner::new();
    let (n, a, b): (i64, i64, i64) = (sc.ne(), sc.ne(), sc.ne());
    if a > b {
        println!("0");
    } else if n == 1 {
        println!("{}", if a == b { 1 } else { 0 });
    } else {
        let mi = a + b + (n - 2) * a;
        let ma = a + b + (n - 2) * b;
        println!("{}", ma - mi + 1);
    }
}

fn main() {
    const STACK: usize = 16 * 1024 * 1024;
    let _ = std::thread::Builder::new()
        .stack_size(STACK)
        .spawn(|| { exec(); })
        .unwrap()
        .join()
        .unwrap();
}

#[allow(dead_code)]
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r])
                  .ok()
                  .unwrap()
                  .parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => {
                panic!("parse error, {:?}",
                       String::from_utf8(self.buf[l..r].to_owned()))
            }
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


Measured memory_bytes: 8572
def gcd(x, y) #x >= y
  mod = x % y
  if mod == 0
    return y
  else
    x = y
    y = mod
    gcd(x, y)
  end
end

def getStrToInt()
  return gets.split(" ").map(&:to_i)
end

array = getStrToInt
x = array.max
y = array.min
puts gcd(x, y)

Measured memory_bytes: 8668
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  int n;
  cin>>n;
  int a[n];
  rep(i,0,n) cin>>a[i];
  sort(a,a+n);
  int ans=0;
  rep(i,0,n){
    rep(j,i+1,n){
      if(a[j]==a[i]) continue;
      rep(k,j+1,n){
        if(a[k]==a[j]) continue;
        vector<int> v3={a[i],a[j],a[k]};
        sort(all(v3));
        if(v3[0]+v3[1]>v3[2]) ans++;
      }
    }
  }
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


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

using namespace std;

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

const ll mod = 1000000007;
const ll INF = 1000000000000;

ll N, K, dp[210][210];
char change[210];

int main()
{
	cin >> N;

	for (int i = 1; i <= N; i++)
	{
		cin >> change[i];
	}

	if (change[1] == '-')
	{
		dp[1][0] = 1;
	}
	if (change[1] == 'U')
	{
		dp[1][1] = 1;
	}

	for (int i = 1; i < N; i++)
	{
		for (int j = 0; j <= i; j++)
		{
			if (change[i + 1] == '-')
			{
				dp[i + 1][j] += dp[i][j];
			}
			else if (change[i + 1] == 'U')
			{
				dp[i + 1][j + 1] += dp[i][j];
				dp[i + 1][j] += dp[i][j] * j % mod;
			}
			else
			{
				dp[i + 1][j] += dp[i][j] * j % mod;
				if (j != 0)
				{
					dp[i + 1][j - 1] += j * j * dp[i][j] % mod;
				}
			}
		}
	}

	cout << dp[N][0] << endl;

	int www;
	cin >> www;
}


Measured memory_bytes: 3428
import java.util.Scanner;

class Main {
	public static void main (String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a==25)
			System.out.println("Christmas");
		if(a==24)
			System.out.println("Christmas Eve");
		if(a==23)
			System.out.println("Christmas Eve Eve");
		if(a==22)
			System.out.println("Christmas Eve Eve Eve");
		
	}
}

Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (true) {
			Integer a = sc.nextInt();
			String op = sc.next();
			Integer b = sc.nextInt();

			if (op.equals("+")) {
				System.out.println(a + b);
			} else if (op.equals("-")) {
				System.out.println(a - b);
			} else if (op.equals("*")) {
				System.out.println(a * b);
			} else if (op.equals("/")) {
				System.out.println(a / b);
			} else {
				return;
			}

		}

	}
}



Measured memory_bytes: 26264
#include <bits/stdc++.h>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 65536 * 2
#define REP(i, n) for (long long i = 0; i < n; ++i)
int cnter[200000] = {};
void solve(long long N, long long Q, std::string S, std::vector<long long> l, std::vector<long long> r)
{
    for (int i = 1; i < S.length(); ++i)
    {
        if (S[i] == 'C' && S[i - 1] == 'A')
            cnter[i]++;
        cnter[i] += cnter[i - 1];
    }
    REP(i, Q)
    {
        r[i]--;
        l[i]--;
        cout << cnter[r[i]] - cnter[l[i]] << endl;
    }
    return;
}

// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long Q;
    scanf("%lld", &Q);
    std::string S;
    std::cin >> S;
    std::vector<long long> l(Q);
    std::vector<long long> r(Q);
    for (int i = 0; i < Q; i++)
    {
        scanf("%lld", &l[i]);
        scanf("%lld", &r[i]);
    }
    solve(N, Q, S, std::move(l), std::move(r));
    return 0;
}


Measured memory_bytes: 3072
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<cstring>
#include<cctype>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

const ll INF = 1ll<<29;
const ll MOD = 1000000007;

int m, n;
bool leave[1123];
int next[1123];

int nex(int x) {
	if (leave[next[x]]) return next[x];
	return next[x] = nex(next[x]);
}

int main()
{
	while (cin >> m >> n, m || n) {
		memset(leave, -1, sizeof(leave));
		REP(i, m) next[i] = (i + 1) % m;
		
		int p = 0, cnt = m;
		FOR(t, 1, n + 1) {
			string s; cin >> s;
			if (cnt == 1) continue;
			
			bool ok = true;
			if (t % 15 == 0) {
				if (s != "FizzBuzz") ok = false;
			}
			else if (t % 5 == 0) {
				if (s != "Buzz") ok = false;
			}
			else if (t % 3 == 0) {
				if (s != "Fizz") ok = false;
			}
			else {
				bool f = true;
				REP(i, s.size()) if (!isdigit(s[i])) f = false;
				if (!f) ok = false;
				else {
					int num = atoi(s.c_str());
					if (num != t) ok = false;
				}
			}
			
			if (!ok) { leave[p] = false; cnt--; }
			if (cnt != 0) p = nex(p);
		}
		
		vector<int> ans;
		REP(i, m) if (leave[i]) ans.push_back(i + 1);
		REP(i, ans.size()) printf("%d%c", ans[i], i == ans.size() - 1 ? '\n' : ' ');
	}
}


// 5

Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

ll N;
void start_check(ll a, ll b, vector<vector<bool>>& ans, vector<vector<char>>& board)
{
  for (ll i = 0; i < N; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      if (board.at(a + i).at(b + j) == board.at(a + j).at(b + i))
      {
        continue;
      }
      else
      {
        ans.at(a).at(b) = false;
        ll bad_num = min(i, j);
        for (ll k = 0; k < bad_num + 1; ++k)
        {
          if (a + k >= N || b + k >= N)
          {
            break;
          }
          ans.at(a + k).at(b + k) = false;
        }
        return;
      }
    }
  }
}

void check(ll a, ll b, vector<vector<bool>>& ans, vector<vector<char>>& board)
{
  for (ll i = 0; i < N - 1; ++i)
  {
    if (board.at(a + i).at(b + N - 1) == board.at(a + N - 1).at(b + i))
    {
      continue;
    }
    for (ll j = 0; j < i + 1; ++j)
    {
      ans.at(a + j).at(b + j) = false;
    }
    return;
  }
  return;
}

int main()
{
  cin >> N;
  vector<vector<char>> board(2 * N - 1, vector<char>(2 * N - 1));
  for (ll i = 0; i < N; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      char s;
      cin >> s;
      board.at(i).at(j) = s;
      if (i + N < 2 * N - 1)
      {
        board.at(i + N).at(j) = s;
        if (j + N < 2 * N - 1)
        {
          board.at(i + N).at(j + N) = s;
        }
      }
      if (j + N < 2 * N - 1)
      {
        board.at(i).at(j + N) = s;
      }
    }
  }
  vector<vector<bool>> ans(N, vector<bool>(N, true));
  // start_check(0, 0, ans, board);
  for (ll i = 0; i < N; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      if (!ans.at(i).at(j))
      {
        continue;
      }
      if (i == 0 || j == 0)
      {
        start_check(i, j, ans, board);
      }
      else if (ans.at(i - 1).at(j - 1))
      {
        check(i, j, ans, board);
      }
      else
      {
        start_check(i, j, ans, board);
      }
    }
  }
  // for (ll i = 0; i < N; ++i)
  // {
  //   for (ll j = 0; j < N; ++j)
  //   {
  //     if (ans.at(i).at(j))
  //     {
  //       cout << 1;
  //     }
  //     else
  //     {
  //       cout << 0;
  //     }
  //   }
  //   cout << endl;
  // }
  //
  //
  // for (ll i = 0; i < 2 * N - 1; ++i)
  // {
  //   for (ll j = 0; j < 2 * N - 1; ++j)
  //   {
  //     cout << board.at(i).at(j);
  //   }
  //   cout << endl;
  // }
  ll cnt = 0;
  for (ll i = 0; i < N; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      if (ans.at(i).at(j))
      {
        cnt += 1;
      }
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 640
fun main() {
    val num500 = readLine()!!.toInt()
    val num100 = readLine()!!.toInt()
    val num50 = readLine()!!.toInt()
    val totalCost = readLine()!!.toInt()
    var pattern = 0

    for (i in 0..num500) {
        for (j in 0..num100) {
            for (k in 0..num50) {
                if(totalCost == 500*i + 100*j + 50*k) pattern ++
            }
        }
    }
    println (pattern)
}


Measured memory_bytes: 34388
#include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; (q) > i; i++)
int main(){
  int N;cin>>N;
  string s;cin>>s;
  int alz[30];
  int alk[30];
  int mx = 0;
  for(int i = 0; N-1 > i;i++){
    int tmp = 0;
    rep(j,'z'-'a'+1){
      alz[j] = 0;
      alk[j] = 0;
    }
    rep(j,N){
      if(i >= j) alz['z'-s[j]]++;
      else alk['z'-s[j]]++;
    }
    rep(k,'z'-'a'+1){
      if(alk[k]>0 && alz[k]>0){
        tmp++;
      }
    }
    mx = max(mx,tmp);
  }
  cout << mx << endl;
}

Measured memory_bytes: 256
// ConsoleApplication2.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include"stdafx.h"
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {
	
	int n;
	string s;
	cin >> n >> s;

	string a, b;

	if (n % 2 == 1) {
		cout << "No" << endl;
	}
	else {
		for (int i = 0; i < n / 2; i++) {
			a+= s[i];
			b += s[i + n / 2];
		}

		if (a == b) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

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

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, M, S;
    cin >> N >> M >> S;
    vector<int> U(M+N), V(M+N), A(M+N), B(M+N);
    for (int m = 0; m < M; ++m) {
        cin >> U[m] >> V[m] >> A[m] >> B[m];
        --U[m]; --V[m];
    }
    for (int n = 0; n < N; ++n) {
        int C, D;
        cin >> C >> D;
        U[M+n] = n;
        V[M+n] = n;
        A[M+n] = -C;
        B[M+n] = D;
    }
    
    int SMax = 10000;
    vector<vector<ll>> DP(N, vector<ll>(SMax, INFLL));
    for (int s = 0; s <= min(S, SMax-1); ++s) {
        DP[0][s] = 0;
    }
    
    while (1) {
        bool b = false;
        for (int m = 0; m < M+N; ++m) {
            for (int s = 0; s < SMax; ++s) {
                if (s+A[m] < SMax &&
                    s+A[m] >= 0 &&
                    DP[U[m]][s+A[m]] < INFLL &&
                    DP[V[m]][s] > DP[U[m]][s+A[m]] + B[m]) {
                    b = true;
                    DP[V[m]][s] = DP[U[m]][s+A[m]] + B[m];
                }
                if (U[m] == V[m]) continue;
                if (s+A[m] < SMax &&
                    s+A[m] >= 0 &&
                    DP[V[m]][s+A[m]] < INFLL &&
                    DP[U[m]][s] > DP[V[m]][s+A[m]] + B[m]) {
                    b = true;
                    DP[U[m]][s] = DP[V[m]][s+A[m]] + B[m];
                }
            }
        }
        
        if (!b) {
            break;
        }
    }
    
    for (int n = 1; n < N; ++n) {
        ll Tmp = INFLL;
        for (int s = 0; s < SMax; ++s) {
            if (DP[n][s] < Tmp) {
                Tmp = DP[n][s];
            }
        }
        cout << Tmp << endl;
    }

    return 0;
}


Measured memory_bytes: 7220
<?php
fscanf(STDIN, "%d",$n);
$a=explode(" ", rtrim(fgets(STDIN)));
$b=explode(" ", rtrim(fgets(STDIN)));
$over=0;
$under=0;
$result=0;
for ($i=0; $i < $n; $i++)
{ 
	if($a[$i]>=$b[$i])
		$over+=$a[$i]-$b[$i];
	else
	{
		$under+=$b[$i]-$a[$i];
		$result++;
	}
	$err[$i]=$a[$i]-$b[$i];
}
$i=0;
rsort($err);
while($under>0)
{
	$under-=$err[$i];
	$result++;
	$i++;
	if($i==$n)
	{
		$result=-1;
		break;
	}

}

printf("%d\n",$result);

Measured memory_bytes: 27248
def solve(N, As):
    # print(N, ",", As)
    n4 = len([n for n in As if n % 4 == 0])
    n2 = len([n for n in As if n % 4 != 0 and n % 2 == 0])
    n0 = len([n for n in As if n % 2 != 0])
    if n2 >= 2:
        return "Yes" if n4 >= n0 else "No"
    else:
        return "Yes" if (n4 + 1) >= (n0 + n2) else "No"


if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))


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

int A, B, C, D, E;
int A0, B0, C0, D0, E0;

int main(){
  cin >> A >> B >> C >> D >> E;
  int X[5] = {A, B, C, D, E};
  int ANS = 200*5;
  do{
    int ans = 0;
    rep(i, 4){
      if (X[i] % 10 != 0){
        ans += X[i] + (10 - (X[i] % 10));
      }
      else ans += X[i];
    }
    ans += X[4];
    ANS = min(ANS, ans);
  }
  while (next_permutation(X, X+5));

  cout << ANS << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  int n;
  cin>>n;
  int w;
  cin>>w;
  v(pil) a(n);
  cin>>a;

  vv(ll) dp(n+1,vl(w+1,0));

  rep(i,n) rep(j,w+1){
    dp[i+1][j] = dp[i][j];
    if(a[i].fi<=j) dp[i+1][j] = max(dp[i+1][j], dp[i][j-a[i].fi]+a[i].se);
  }
  cout<<dp[n][w]<<endl;

} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010;
const double eps = 1e-6;

int n;
deque<int> Q;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        if(i & 1) Q.push_back(x);
        else Q.push_front(x);
    }

    if(n & 1) reverse(Q.begin(), Q.end());

    for(int i = 0; i < n; i++) cout << Q[i] << ' ';
    puts("");

    return 0;
}


Measured memory_bytes: 2944
T = input()+"Z"  #T=ATCODERZ
x=["A","C","G","T"]
count=0
stock=[]

for i in range(len(T)):
  if T[i] in x:
    count += 1
  else:
    stock.append(count)
    count = 0

stock.sort()
print(stock[-1])

Measured memory_bytes: 3060
Scanf.scanf "%d" (fun n ->
    let s = Array.init n (fun _ -> Scanf.scanf " %s" (fun a -> a)) in

    let rec loop i ac wa tle re =
        if i = n then Printf.printf "AC x %d\nWA x %d\nTLE x %d\nRE x %d\n" ac wa tle re else
            match s.(i) with
            | "AC"  -> loop (i + 1) (ac + 1) wa tle re
            | "WA"  -> loop (i + 1) ac (wa + 1) tle re
            | "TLE" -> loop (i + 1) ac wa (tle + 1) re
            | "RE"  -> loop (i + 1) ac wa tle (re + 1)
            | _ -> failwith "??"
    in
    loop 0 0 0 0 0
)

Measured memory_bytes: 8600
#include<iostream>
using namespace std;
int main(){
    int x,y,i;
    i=0;
    while(i==0){
        cin>>x;
        cin>>y;
        if(x==0 && y==0){break;}
        else{if(x<y){
            cout<<x<<" "<<y<<endl;}
        
            if(y<x){
                cout<<y<<" "<<x<<endl;
            }
            if(x==y){
                
                cout<<x<<" "<<y<<endl;
            }
                 }
    }

    return 0;}

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

int main() 
{
    ll x; cin >> x;
    ll c = 100;
    for (int i = 1; ; i++) {
        c = (ll)(1.01*(double)c);
        if (c >= x) {
            cout << i << '\n';
            return 0;
        }
    }
}



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

template<typename T, typename U> void cmax(T &a, U b) { if (a < b) a = b; }
template<typename T, typename U> void cmin(T &a, U b) { if (a > b) a = b; }

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  string S;
  map<string, int> MA;
  while (cin >> S) {
    MA[S]++;
  }
  cout << "AC" << " x " << MA["AC"] << "\n";
  cout << "WA" << " x " << MA["WA"] << "\n";
  cout << "TLE" << " x " << MA["TLE"] << "\n";
  cout << "RE" << " x " << MA["RE"] << "\n";
}

Measured memory_bytes: 3668
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

struct Zahyo{
    ll x;
    ll y;
    ll h;
};

int main() {

    ll N;

    vector<Zahyo> zahyo;

    cin >> N;

    for (int i = 0; i < N; ++i) {
        Zahyo z;
        cin >> z.x >> z.y >> z.h;
        zahyo.push_back(z);
    }

    sort(zahyo.begin(),
            zahyo.end(),
            [](const Zahyo& a, const Zahyo& b){return (a.h == b.h) ? (a.x > b.x) : (a.h > b.h);}
    );


    for (int cx = 0; cx <= 100; ++cx) {
        for (int cy = 0; cy <= 100; ++cy) {
            bool f = true;
            ll H = 0;
            for (int i = 0; i < N; ++i) {
                if(zahyo[i].h > 0) {
                    ll ans = zahyo[i].h + abs(zahyo[i].x - cx) + abs(zahyo[i].y - cy);
                    if(H == 0){
                        H = ans;
                    }
                    else if(H != ans){
                        f = false;
                        break;
                    }
                }else{
                    ll ans2 = abs(zahyo[i].x - cx) + abs(zahyo[i].y - cy);
                    if(H <= ans2){
                        continue;
                    } else{
                        f = false;
                        break;
                    }
                }
            }
            if(f){
                cout << cx << " " << cy << " " << H << endl;
                return 0;
            }

        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main(void){
    int i;
    char str[1200];
    scanf("%[^\n]",str);
    
    for(i=0;i<=strlen(str);i++){
        if(str[i]>=97&&str[i]<=122){
            str[i]=str[i]-32;
        }
        else if(str[i]>=65&&str[i]<=90){
            str[i]=str[i]+32;
        }
        else{
            str[i]=str[i];
        }
    }printf("%s\n",str);
    return 0;
}



Measured memory_bytes: 2516
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  private static final long MOD = 1000000007L;


  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    long l = sc.nextLong();
    long r = sc.nextLong();

    if (2019 <= r - l) {
      os.println("0");
      return;
    }

    long min = Long.MAX_VALUE;
    for (long i = l; i < r; i++) {
      for (long j = i + 1; j <= r; j++) {
        min = Math.min(min, i * j % 2019);
      }
    }

    os.println(min);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
ll x, y;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> x >> y;
  ll ans = 0;
  while(x <= y){
    ans++;
    x <<= 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def dfs(nums: list) -> int:
    if len(nums) == 1:
        return nums[0]

    # + を先頭の数字の後ろに入れる
    n1 = nums[0] * (1 << (len(nums) - 2)) + dfs(nums[1:])

    # + をいれない。
    headless = nums[1:]
    headless[0] += nums[0] * 10
    n2 = dfs(headless)

    return n1 + n2


def many_formulas(s: str) -> int:
    nums = list(map(int, s))
    return dfs(nums)


if __name__ == "__main__":
    s = input()
    ans = many_formulas(s)
    print(ans)


Measured memory_bytes: 3064
n = int(input())
s = input()
bcnt = [0]*n
wcnt = [0]*n
result = 2 * 10 ** 5

# 累積和
if s[0] == "#":
    bcnt[0] = 1
if s[n-1] == ".":
    wcnt[n-1] = 1

for i in range(1,n):
    bcnt[i] = bcnt[i-1]
    if s[i] == "#":
        bcnt[i] += 1
for i in range(n-2,-1,-1):
    wcnt[i] = wcnt[i+1]
    if s[i] == ".":
        wcnt[i] += 1

# 最小コストを求める
for i in range(0,n-1):
    result = min(bcnt[i] + wcnt[i+1],result)

result = min(result,bcnt[n-1])
result = min(result,wcnt[0])

print(result)


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D) {
    cout << "Left" << endl;
  } else if(A + B == C + D) {
    cout << "Balanced" << endl;
  } else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100000

struct Node{
  int parent;
  int left;
  int right;
};

struct Node tree[N];
int n, d[N];

void depth(int, int);
void print(int);
 
int main(){
  int i, j, id, k, c, left = 0, right = 0;

  scanf("%d", &n);
  for(i = 0;i < n;i++) tree[i].parent = tree[i].left = tree[i].right = -1;
  for(i = 0;i < n;i++){
    scanf("%d%d", &id, &k);
    for(j = 0;j < k;j++){
      scanf("%d", &c);
      if(j == 0) tree[id].left = c;
      else tree[left].right = c;
      left = c;
      tree[c].parent = id;
    }
  }
  for(i = 0;i < n;i++){
    if(tree[i].parent == -1) right = i;
  }
  depth(right, 0);
  for(i = 0;i < n;i++) print(i);
  return 0;
}

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, tree[u].parent, d[u]);
  if(tree[u].parent == -1) printf("root, ");
  else if(tree[u].left == -1) printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(i = 0, c = tree[u].left;c != -1;i++, c = tree[c].right){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

void depth(int u, int p){
  d[u] = p;
  if(tree[u].right != -1) depth(tree[u].right, p);
  if(tree[u].left != -1) depth(tree[u].left, p + 1);
}

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

ll dp[101010];

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

    fill(dp, dp+H+1, 1e9);

    dp[H] = 0;
    for (int i=H; i>=0; --i) {
        if (dp[i] != 1e9) {
            rep(j, N) {
                dp[max(0LL, i-A[j])] = min(dp[max(0LL, i-A[j])], dp[i] + B[j]);
            }
        }
    }

    cout << dp[0] << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
string solve(string s) {
	string ans;
	int l = s.size();
	long long res = 0;
	for (int i = 0; i < l; i++) {
		res = res + (s[i] - '0');
	}
	if (res % 9)
		ans = "No";
	else
		cout << "Yes";

	return ans;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	/*	int t;
		cin >> t;
		while (t--) { */
	string s;
	cin >> s;
	//cin >> x1 >> y1 >> z1;
	cout << solve(s) << "\n";

	return 0;
}






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

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

    std::vector<int> p;
    for (int i = 0; i < n; ++i) {
        int buf;
        std::cin >> buf;
        p.push_back(buf);
    }

    std::sort(p.begin(), p.end(), std::greater<int>());

    int sum = p[0] / 2;
    for (std::size_t i = 1; i < p.size(); ++i) {
        sum += p[i];
    }

    std::cout << sum << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(){
	char s[3],t[3];
	int count=0;

	scanf("%s",s);
	scanf("%s",t);

	for(int i=0;i<3;i++){
		if(s[i]==t[i]){
			count++;
		}
	}
	printf("%d\n",count);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		
		Scanner scan = new Scanner(System.in);
		
		int h1 = scan.nextInt();
		int m1 = scan.nextInt();
		int h2 = scan.nextInt();
		int m2 = scan.nextInt();
		int k = scan.nextInt();
		
		int total = (h2 * 60 + m2) - (h1 * 60 + m1);
		int ans = total -k;
		
		System.out.println(ans);
	}

}


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

int main(){
    int m,d;
    cin>>m >>d;
    
    int ans=0;
    for(int i=2;i<=m;i++){
        for(int j=22;j<=d;j++){
            int a=j/10, b=j%10;
            if(a>=2&&b>=2){
                if(i==a*b)ans++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static long[] ans = new long[]{-1,-1,-1};
	public static void main(String[] args) throws Exception {


		int N=nextInt();
		int K=nextInt();
		int[] A = nextInts();
		int ans = 0;
//		int idx=0;
//		for(int i=0;i<N;i++){
//			if(A[i]==1){
//				idx=i;
//			}
//		}
//		int i=idx+1;
//		while(i>1){
//			i-=K;
//			ans++;
//			if(i>0){
//				i++;
//			}else{
//				idx+=i*-1;
//			}
//		}
//
//		i=idx;
//		while(i<=N){
//			i+=K;
//			ans++;
//		}
		ans=(N-1)/(K-1);
		if((N-1)%(K-1)!=0){
			ans++;
		}

		System.out.println(ans);
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

struct UnionFind {
  vector<LL> data;
  UnionFind(LL size) : data(size, -1) { }
  bool unionSet(LL x, LL y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(LL x, LL y) {
    return root(x) == root(y);
  }
  LL root(LL x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  LL size(LL x) {
    return -data[root(x)];
  }
};

void solve(long long N, long long M, std::vector<long long> p, std::vector<long long> x, std::vector<long long> y){
    UnionFind uf(N);
    REP(i, M) {
        uf.unionSet(x[i]-1, y[i]-1);
    }

    int ans = 0;
    REP(i, N) {
        ans += uf.findSet(i, p[i]-1);
    }

    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, M, std::move(p), std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int main(void)
{
	int i;
	char ch = '\0';
	char T[1200];

	for(i = 0; i < 1200; i++)
	{
		T[i] = '\0';
	}
	
	for(i = 0; i < 1200; i++)
	{
		ch = '\0';
		scanf("%c", &ch);
		if(ch >= 'A' && ch <= 'Z')
		{
			printf("%c", ch + 32);
		}
		else if(ch >= 'a' && ch <= 'z')
		{
			printf("%c", ch - 32);
		}
		else
		{
			printf("%c", ch);
		}
		
		if(ch == '\n')
		{
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define all(a) (a).begin(),(a).end()
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

#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__) << "] "

inline int val(int a,int b,int c){
    return a*a+b*b+c*c+a*b+b*c+a*c;
}

int fun(int n){
    int cnt = 0;
    for(int i=1;i*i<=n;i++){
        for(int j=1;j*j+i*i+j*i<=n;j++){
            for(int k=1;val(i,j,k)<=n;k++){
                if(val(i,j,k) == n) cnt++;
            }
        }
    }
    return cnt;
}

signed main(){
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
        cout << fun(i) << endl ;
    }
    return 0;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    ll n, p = 1, q = 1, t, a, m;
    scanf("%lld", &n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld%lld", &t, &a);
        m = max((p - 1) / t + 1, (q - 1) / a + 1);
        p = t * m, q = a * m;
    }
    printf("%lld\n", p + q);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  const int inf=1000000000;
  int n;
  cin >> n;
  vector<int> a(3*n);
  priority_queue<int> qd,q;
  vector<ll> kiremeM(n+1);
  vector<ll> kiremem(n+1);
  rep(i,3*n)
    cin >> a.at(i);
  rep(i,n)
    qd.push(inf-a.at(i));
  rep(i,n)
    q.push(a.at(3*n-i-1));
  ll sum=0;
  rep(i,n)
    sum+=a.at(i);
  kiremeM.at(0)=sum;
  rep(i,n){
    qd.push(inf-a.at(i+n));
    sum+=a.at(i+n);
    sum-=inf-qd.top();
    qd.pop();
    kiremeM.at(i+1)=sum;
  }
  sum=0;
  rep(i,n)
    sum+=a.at(3*n-i-1);
  kiremem.at(n)=sum;
  rep(i,n){
    q.push(a.at(2*n-i-1));
    sum+=a.at(2*n-i-1);
    sum-=q.top();
    q.pop();
    kiremem.at(n-i-1)=sum;
  }
  ll ans=-4000000000000000000;
  rep(i,n+1)
    ans=max(ans,kiremeM.at(i)-kiremem.at(i));
  cout << ans << endl;
}
  
  

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

int main(){
  ll  a ; cin>>a  ;
  
  
  
  cout<<  3*pow(a,2) <<endl;
  
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d%d",&a,&b);
	if(a>b){
		c=a-b;
	}
	else if(a<b){
		c=b-a;
	}
	else
		c=a-b;
	printf("%d\n",c);
	return 0;
}



Measured memory_bytes: 2140
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


from collections import defaultdict
import sys

sys.setrecursionlimit(100000)

def main():
    N, M = readi(2)
    edges = readi(M, 3)
    dist = arr(N + 1, fill_value=float("-inf"))
    dist[1] = 0
    for i in range(N - 1):
        for a, b, c in edges:
            new_d = dist[a] + c
            if new_d > dist[b]:
                dist[b] = new_d
    
    ans = dist[N]

    for i in range(N - 1):
        for a, b, c in edges:
            new_d = dist[a] + c
            if new_d > dist[b]:
                dist[b] = new_d

    if ans != dist[N]:
        print('inf')
    else:
        print(dist[N])


if __name__ == "__main__":
    main()


Measured memory_bytes: 4168
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int n, m;
multiset<long> a;
long s, t;

int main(){
	cin >> n >> m;
	for (int i = 0; i < n; ++i){
		cin >> t;
		a.insert(t);
	}
	for (int i = 0; i < m; ++i){
		auto iter = --a.end();
		t = *iter;
		if (t == 0) break;
		a.erase(iter);
		a.insert(t/2);
	}
	s = 0;
	for (auto& e: a){
		s += e;
	}
	printf("%ld\n", s);
}

Measured memory_bytes: 4992
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<typeinfo>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    vector<ll> A(11000,0);
    ll n;
    cin>>n;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        A[a]++;
    }
    bool f=true;
    for(int i=0;i<A.size();i++){
        for(int t=0;t<A[i];t++){
            if(f){cout<<i; f=false;}
            else{cout<<" "<<i;}
        }
    }
    cout<<endl;
    
    return 0;
}



Measured memory_bytes: 3200
order = list(map(str, input()))

ans_list = []
for i in range(len(order)):
    if i % 2 == 1:
        if order[i] in ['L', 'U', 'D']:
            ans = True
        else:
            ans = False
        ans_list.append(ans)
    else:
        if order[i] in ['R', 'U', 'D']:
            ans = True
        else:
            ans = False
        ans_list.append(ans)
        
if False in ans_list:
    print('No')
else:
    print('Yes')

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


int main(){
    ll n,m;cin>>n>>m;
    if(n<=m)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
    
}
    









Measured memory_bytes: 3632
while 1:
    try:
        count=0
        x=int(input())
        for i in reversed(range(10)):
            if 0<=x-i<=27:
                for j in reversed(range(10)):
                    if 0<=x-i-j<=18:
                        for z in reversed(range(10)):
                            if 0<=x-i-j-z<=9:
                                for y in reversed(range(10)):
                                    if x-i-j-z-y==0:
                                        count+=1
        print(count)
    except EOFError:
        break

Measured memory_bytes: 7620
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  print(a[n-1]);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;
char mp[55][55];
bool vis[55][55];
int dir[4][2]= {{0,1},{0,-1},{1,0},{-1,0}};
int h,w;///h wei hang ,w wei lie
struct node
{
    int x,y;
    int step;
};
queue<node>q;
int bfs(int x,int y)
{
    while(!q.empty())
        q.pop();
    node start,now,next;
    start.x=x;
    start.y=y;
    start.step=1;
    vis[x][y]=true;
    q.push(start);
    while(!q.empty())
    {
        now=q.front();
        q.pop();
        if(now.x==h-1&&now.y==w-1)
            return now.step;
        for(int i=0;i<4;i++)
        {
            next.x=now.x+dir[i][0];
            next.y=now.y+dir[i][1];
            if(next.x<0||next.y<0||next.x>=h||next.y>=w||vis[next.x][next.y])
                continue;
            if(mp[next.x][next.y]=='#')
                continue;
            vis[next.x][next.y]=true;
            next.step=now.step+1;
            q.push(next);
        }

    }
    return -1;
}
int main()
{
    scanf("%d %d",&h,&w);
    int lz=0;
    for(int i=0;i<h;i++)
    {
        scanf("%s",mp[i]);
    }
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(mp[i][j]=='.')
                lz++;
        }
    }
    int x=bfs(0,0);
    if(x==-1)
        printf("-1\n");
    else
        printf("%d\n",lz-x);
    return 0;
}

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

vector<vector<int>> edge;
vector<bool> visited;

void dfs(int v) {
	visited[v] = true;
  	for(int u : edge[v]) {
    	if(!visited[u])
          dfs(u);
    }
}

int main() {
  int n, m;
  cin >> n >> m;
  
  edge.resize(n);
  visited.resize(n);
  
  while(m--) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    edge[x].push_back(y);
    edge[y].push_back(x);
  }
  
  int j = 0;
  for(int i = 0; i < n; i++) {
  	if(!visited[i]) {
    	int c = 1;
      	dfs(i);
      	j++;
    }
  }
  cout << j - 1;
}
  
  

Measured memory_bytes: 9296