akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c,d; cin>>a>>b>>c>>d; a--;
    ll cnum = b/c-a/c;
    ll dnum = b/d-a/d;
    ll g = c*d/__gcd(c,d);
    ll cdnum = b/g-a/g;
    cout<<b-a-cnum-dnum+cdnum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007

using namespace std;

int main(void){
  int n;
  string s;

  cin >> n >> s;

  for (int i = 0; i < s.size(); i++){
    cout << (char)('A' + (((s[i] - 'A') + n) % 26));
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
N,Q=map(int,input().split())
S="#"+input()+"#"
qs=[[i for i in input().split()] for i in range(Q)]
L,R=0,N+1
for t,d in qs[::-1]:
  if d=="L":
    if S[L+1]==t:
      L+=1
    if S[R]==t:
      R+=1
  else:
    if S[L]==t:
      L-=1
    if S[R-1]==t:
      R-=1
print(R-L-1)

Measured memory_bytes: 93740
import math
a, b, c = map(int, input().split())

print("%.8f" % (a*b*math.sin(c*math.pi/180)/2))
print("%.8f" % (a + b + math.sqrt(a**2 + b**2 - 2*a*b*math.cos(c*math.pi/180))))
print("%.8f" % (b*math.sin(c*math.pi/180)))


Measured memory_bytes: 5704
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A;
int B;
int main(){
  int res;
  rd(N);
  rd(A);
  rd(B);
  res =min_L(A*N, B);
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190707-1

// --- original code ---
// int N, A, B;
// {
//   int res;
//   rd(N,A,B);
//   res = min(A*N,B);
//   wt(res);
// }


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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main(){
    int s, w;
    cin >> s >> w;
    cout << (s <= w ? "unsafe" : "safe") << endl;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if(a + b >= a * b && a + b >= a - b){
    cout << a + b;
  }else if ( a*b >= a+b && a*b >= a - b){
    cout << a * b;
  }else if(a - b >= a+b && a - b >= a*b){
    cout << a - b;
  }
  cout << endl;
  
  return 0;
}

Measured memory_bytes: 256
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

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

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

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

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

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

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

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

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let a = vec![
        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,
    ];
    let k: usize;
    input!(k);
    println!("{}", a[k - 1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

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

const int mod = 1000000007;

int n;
vector<int> G[10005];
int c[10005];
int d[10005];
int idx;
map<int, int> ranks;

void dfs(int x) {
  if(d[x]) return;

  d[x] = c[idx++];

  sort(G[x].begin(), G[x].end(),[](auto const& lhs, auto const& rhs) {
    return ranks[lhs] > ranks[rhs];
  });
  rep(i, G[x].size()) {
    dfs(G[x][i]);
  }
}

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

  cin >> n;

  rep(i, n-1) {
    int a, b;
    cin >> a>>b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  rep(i, n) {
    cin >> c[i];
  }
  sort(c, c+n, greater<int>());

  int mx = 0;
  int mxi;
  rep(i, n) {
    ranks[i] = G[i].size();
    if (ranks[i] > mx) {
      mxi = i;
      mx = ranks[i];
    }
  }

  dfs(mxi);
  long res = 0;
  rep(i, n-1) {
    res += c[n-i-1];
  }
  cout << res << endl;

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


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N,M;
  cin>>N>>M;
  vector<bool> vec(N,false);
  vector<ll> pena(N,0);
  ll pe=0;
  ll ans=0;
  
  for(ll i=0;i<M;i++) {
ll p;
    string S;
    cin>>p>>S;
    if(vec[p-1]) {
continue;
    }
    if(S=="AC") {
ans++;
      vec[p-1]=true;
      pe+=pena[p-1];
    }
    
    else {
pena[p-1]++;
    }
  }
  
  
cout<<ans<<" "<<pe<<endl;
}

Measured memory_bytes: 4064
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
using namespace std;

int main() {
    int n, num = 1;
    while (cin >> n, n) {
        vector<int> x(n), y(n);
        for (int i=0; i<n; ++i) {
            cin >> x[i] >> y[i];
        }
        double area = 0;
        for (int i=0; i<n; ++i) {
            area += (x[(i+1)%n] * y[i] - x[i] * y[(i+1)%n]) / 2.0;
        }
        cout.precision(1);
        cout << fixed << num << " " << abs(area) << endl;
        num ++;
    }
    return 0;
}

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

using ll = long long;
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N), B(N);
  REP(i, N){
    cin >> A[i] >> B[i];
  }
  ll ans = 0;
  REP(i, N){
    bool flag = true;
    REP(j, 30){
      if((K>>j & 1)==0&&(A[i]>>j & 1)){
        flag = false;
        break;
      }
    }
    if(flag){
      ans+= B[i];
    }
  }
  cerr << ans << endl;
  REP(b, 31){
    if((K >> b & 1) ==0) continue;
    ll value = 0;
    REP(i, N){
      if(A[i] >> b & 1) continue;
      bool flag = true;
      FOR(j, b, 31){
        if((K >> j & 1)==0 && (A[i]>>j & 1)){
          flag = false;
          break;
        }
      }
      if(flag){
        value += B[i];
      }
    }
    cerr << "b:" << b << " value:" << value << endl;
    ans = max(ans, value);
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    int N, K;
    cin >> N >> K;
    if(N >= 2 * K - 1) cout << "YES";
    else cout << "NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int n, m, x;
	cin >> n >> m >> x;
	int cntl = 0, cntr = 0;
	for(int i=0; i<m; i++){
		int a;
		cin >> a;
		if(a<x) cntl++;
		if(a>x) cntr++;
	}
	cout << min(cntl, cntr) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
#define POW2(n) (1LL << (n))

constexpr lint MOD = 1000000007;
vector<lint> fac, facInv, inv;
void facInit(int nmax)
{
    fac = facInv = inv = vector<lint>(nmax + 1, 1);
    for (int i = 2; i <= nmax; i++)
    {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        facInv[i] = facInv[i-1] * inv[i] % MOD;
    }
}
lint nPr(int n, int r)
{
    if (n<r || r<0) return 0;
    if (n >= (int)fac.size()) facInit(n);
    return fac[n] * facInv[n-r] % MOD;
}


int main()
{
    facInit(POW2(16));
    int N, M;
    cin >> N >> M;
    vector<lint> A(M);
    cin >> A;
    reverse(A.begin(), A.end());

    vector<vector<lint>> dp(2, vector<lint>(POW2(N)));
    dp[0][0] = 1;
    int now = 0;
    for (auto a : A)
    {
        REP(S, POW2(N)) if (dp[now][S])
        {
            (dp[1 - now][S] += dp[now][S]) %= MOD;
            REP(n, N) if ((S & POW2(n)) == 0)
            {
                (dp[1 - now][S + POW2(n)] += dp[now][S] * nPr(POW2(N) - a - S, POW2(n) - 1) % MOD * POW2(n)) %= MOD;
            }
        }
        dp[now].assign(POW2(N), 0);
        now = 1 - now;
    }
    lint ans = 0;
    REP(S, POW2(N)) ans += (1 - __builtin_popcount(S) % 2 * 2) * dp[now][S] * fac[POW2(N) - S - 1] % MOD;
    cout << (ans % MOD + MOD) % MOD * POW2(N) % MOD << endl;
}


Measured memory_bytes: 3328
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

-- n := V.length v + 1
-- v ! i = 表が i 枚、裏が n - i 枚出る確率
solve :: [Double] -> U.Vector Double
solve ps = go ps (U.singleton 1)
  where
    go [] !vec = vec
    go (!p:ps) !vec = go ps $
      -- U.zipWith (\u v -> p * u + (1 - p) * v) (0 `U.cons` vec) (vec `U.snoc` 0)
      U.create $ do
        let !n = U.length vec
        vec2 <- UM.new (n + 1)
        UM.write vec2 0 $ (1 - p) * vec U.! 0
        U.copy (UM.init $ UM.tail vec2) $ U.zipWith (\u v -> p * u + (1 - p) * v) vec (U.tail vec)
        UM.write vec2 n $ p * vec U.! (n - 1)
        return vec2

main = do
  n :: Int <- readLn
  -- 1 <= n <= 2999, n is odd
  ps :: [Double] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  let result = solve ps
  -- U.length result == n + 1
  print $ U.sum $ U.drop (n `quot` 2 + 1) result


Measured memory_bytes: 2428
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define fastAF ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
#define int ll
#define ull unsigned ll
#define ld long double
#define pb push_back
#define pf push_front
#define dll deque<ll>
#define vll vector<ll>
#define pll pair<ll,ll>
#define mapll map<ll,ll>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;
void swap(auto*,auto*);
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fastAF
    ll d,t,s; cin>>d>>t>>s; if(s*t>=d) cout<<"Yes\n"; else cout<<"No\n";
    return 0;
}
void swap(auto &a,auto &b)
{
    auto temp=a; a=b; b=temp;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
int main() {
int n, m;
std::cin >> n >> m;
std::vector<std::string> a(n);
std::vector<std::string> b(m);
for (int i = 0; i <n;i++) {
    std::cin >> a[i];
}
for (int i = 0; i <m;i++) {
    std::cin >> b[i];
}
bool flag;
for (int i = 0; i < n-m+1; i++) { //a's row; n-m+1 = 2
      int row = i;
      int col = 0;
      flag = false;
      for (int j = 0; j< m; ) { // b's row
               if (a[row].substr(col, m) == b[j]) {
                        row++;
                        j++;
                        flag = true;
               } else if (col < n-m) {
                      col++;
                      row = i; // reset
                      j = 0; // reset
                      flag = false;
              } else {
                     flag = false;
                      break;
              }
        }
    if (flag) {
             break;
}
}
 
if (flag) {
 std::cout << "Yes" << std::endl;
} else {
  std::cout << "No" << std::endl;
}
return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    double a,b,x;
    int c;
    cin >> a >> b;
    x = (a+b)/2;
    c = x;
    if(x > c) c++;
    cout << c << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> h(N);

	for (auto &x : h) {
		cin >> x;
	}

	int ans = count_if(h.begin(), h.end(), [K](auto x) { return x >= K; });
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
using ll = long long;
using plong = pair<ll,ll>;

const long MOD = 1000000007;


int main(){
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    ll res=0;
    if(K<=(A+B)){
        if(K<=A)res=K;
        else res=A;
    }else{
        res = A-(K-A-B);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--)
#define REP(i,n) rep(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = 998244353;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;


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;
}

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


//約数
void divisor(ll n, vector<ll>& ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
}

void solve() {

	ll n;
	cin >> n;
	Array a(n);
	REP(i, n) cin >> a[i];

	Array ret;
	divisor(a[0], ret);
	for (auto i : ret) {
		bool flag = true;
		rep(j, 1, n) if (a[j] % i != 0) flag = false;
		if (flag) cout << i << en;
	}
}

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

	solve();
	//int t; cin >> t; REP(i, t) solve();

	return 0;
}



Measured memory_bytes: 3224
while True:
    a,b,c=input().split()
    a=int(a)
    c=int(c)
    if b=='?':
        break
    elif b=='+':
        print(a+c)
    elif b=='-':
        print(a-c)
    elif b=='/':
        print(int(a/c))
    else:
        print(a*c)


Measured memory_bytes: 5596
def C_Make_a_Rectangle(lst):
    N = lst[0]
    A = lst[1:]

    from collections import Counter, deque
    c = sorted(Counter(A).items(), reverse=True)  # リストの要素が何回現れたか
    # cの0番要素は値、1番要素は度数

    ans = deque([])
    for k, v in c:
        if v == 1:
            continue
        elif v == 2 or v == 3:
            ans.append(k)
            if len(ans) == 2:
                break
        else:
            ans.append(k)
            ans.append(k)
            break

    if len(ans) < 2:
        return 0
    else:
        return ans[0] * ans[1]

n = int(input())
l = [int(i) for i in input().split()]
x = [n] + l
print(C_Make_a_Rectangle(x))

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

int main(){
    int N,A; cin >> N >> A;
    int F[100],L[100];
    F[1]=0;
    int cnt=1;
    
    for (int i=1; i<=N; i++){
        cin >> L[i];
    }
    for (int i=2; i<=N+1; i++){
        F[i]=F[i-1]+L[i-1];
        if (A>=F[i]) cnt++;
    }
    
    cout << cnt;
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int x = in();

  cout << "ai1333" << string(x / 100, '3') << endl;
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
vector<int> ans;
vector<bool> seen;


void dfs(const Graph &G,int v){
    seen[v]=true;
    for(auto nv:G[v]){
        if(seen[nv]) continue;
        ans[nv]+=ans[v];
        dfs(G,nv);
    }
}



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

    int N,Q;
    cin>>N>>Q;
    int a[N-1],b[N-1];
    int p[Q],x[Q];
    
    Graph G(N);
    ans.assign(N,0);
    seen.assign(N,false);
    rep(i,N-1){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    rep(i,Q){
        cin>>p[i]>>x[i];
        p[i]--;
        ans[p[i]]+=x[i];
    }

    dfs(G,0);
    rep(i,N){
        cout << ans[i] << " ";
    }
    cout << endl;



}


Measured memory_bytes: 30592
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

const ll MOD = 1000000007;
const ll MAX = 670000;
// const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	ll x, y;
	cin >> x >> y;

	COMinit();

	ll ans = 0;
	bool cond1 = ((2*x - y) % 3 == 0);
	bool cond2 = ((2*y - x) % 3 == 0);
	if (cond1 && cond2){
		ll m = (2*x - y) / 3;
		ll n = (2*y - x) / 3;
		ans = COM(m+n, m);
	}

	cout << ans << "\n";

	return 0;
}


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

using namespace std;

int main()
{
  int n, w;
  while(cin >> n >> w, n || w){
    int h[11] = {0};
    int div = 0;
    for(int i = 0; i < n; i++){
      int v;
      cin >> v;
      h[v/w]++;
      div = max(div, v/w);
    }
    double ans = 0.01;
    int maxbar = *max_element(h, h + 11);
    for(int i = 0; i < div; i++){
      ans += (double)h[i]/maxbar * (double)(div-i)/div;
    }
    printf("%.10f\n", ans);
  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
typedef long long ll;

const int    INF = 1000000000;
const int    MOD = 1000000007;
const double EPS = 1e-8;

double dist(double x, double y){
    return sqrt(x * x + y * y);
}

int main(){
    double R, X, Y;
    int N;
    while(cin >> R >> X >> Y >> N){
        vector<double> P(N + 1, 0);
        for(int i = 0; i < N; i++){
            cin >> P[i + 1];
            P[i + 1] = P[i + 1] / 100 * 2 * M_PI;
            P[i + 1] += P[i];
        }
        const int LOOP = 1000000;
        for(int i = 0; i < N; i++){
            double ARG = P[i + 1] - P[i];
            double S = ARG * R * R / 2.0;
            double newS = 0;
            for(double p = P[i]; p < P[i + 1]; p += ARG / LOOP){
                double x1 = R * cos(M_PI/2.0 - p);
                double y1 = R * sin(M_PI/2.0 - p);
                double x2 = R * cos(M_PI/2.0 - (p + ARG/LOOP));
                double y2 = R * sin(M_PI/2.0 - (p + ARG/LOOP));
                newS += abs( (x1 - X) * (y2 - Y) - (x2 - X) * (y1 - Y) ) / 2.0;
            }
            printf("%d", int(newS/S*100 + EPS));
            if(i == N - 1) putchar('\n');
            else putchar(' ');
        }
    }
    return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        if (a > b) {
            if(b==1){
                System.out.println("Bob");
            }else
            System.out.println("Alice");
        } else if (a < b) {
            if(a==1){
                System.out.println("Alice");
            }else
            System.out.println("Bob");
        }else if (a == b) {
            System.out.println("Draw");
        }

        }
    }


Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map> 
#include<iostream>
#include<time.h>
using namespace std;
typedef long long ll;
const double pi=acos(-1.0);
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
//ll begin_time=clock();
//ll end_time=clock();printf("time=%lldms\n",end_time-begin_time);

int main()
{
	ll a,b,c,d;
	cin>>a;
	b=100;
	c=0;
	while(b<a)
	{
		b+=b/100;c++;
	}
	cout<<c<<endl;
}




Measured memory_bytes: 3640
#include <stdio.h>
#include <limits.h>

using namespace std;

int main()
{
    int len;
    scanf("%d", &len);

    int tmp, min=INT_MAX, dif_max=INT_MIN;
    for (int i=0;i<len;i++) {
        scanf("%d", &tmp);
        if (dif_max < tmp - min) {
            dif_max = tmp - min;
        }
        if (tmp < min) {
            min = tmp;
        }
    }
    printf("%d\n", dif_max);
}


Measured memory_bytes: 2752
#include <stdio.h>
#include <algorithm>

int ans[1005];

using namespace std;

int main(void)
{
	int n, k, a, b;
	int i, j, s;
	int lenl, lenr, lent, lenb;
	
	scanf("%d", &n);
	scanf("%d", &k);
	
	for (i = 0; i < k; i++){
		scanf("%d %d", &a, &b);
		lenl = a - 1;
		lenr = n - a;
		lent = b - 1;
		lenb = n - b;
		
		s = min(min(lenl, lenr), min(lent, lenb));
		ans[i] = s % 3 + 1;
	}
	
	for (i = 0; i < k; i++){
		
		printf("%d\n", ans[i]);
	}
	return (0);
}
	
		
	

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

using namespace std;
using i64 = int64_t;

signed main(){
    
    vector<int> b(3);
    for(auto& x : b)
        cin >> x;
    if((b[0] && b[1] && !b[2]) || (!b[0] && !b[1] && b[2]))
        cout << "Open" << endl;
    else
        cout << "Close" << endl;
    
    
    return 0;
}


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

int main() {
	string s; cin>>s;
	long long l=s.size(), ret=0;
	for(int bt=0; bt<1<<(l-1); bt++) {
		long long val=0, cur=0;
		for (int j=0; j<l; j++) {
			val*=10; val+=s[j]-'0';
			if(j<l-1 && bt&(1<<j))
				cur+=val, val=0;
		}
		cur+=val;
		ret+=cur;
	}
	cout<<ret<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=401;
vector<ll> sum(N);
ll dp[N][N];
ll calc(int l,int r)
{
    if(dp[l][r]!=-1)
        return dp[l][r];
    dp[l][r]=LLONG_MAX;
    for(int k=l;k<r;k++)
    {
        ll tr=sum[k];
        if(l!=0)
            tr-=sum[l-1];
        tr+=sum[r]-sum[k];
        if(k!=l)
            tr+=calc(l,k);
        if(k!=r-1)
            tr+=calc(k+1,r);
        dp[l][r]=min(dp[l][r],tr);
    }
    return dp[l][r];
}
int main()
{
    for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
            dp[i][j]=-1;
    int n;
    scanf("%i",&n);
    vector<ll> niz(n);
    for(int i=0;i<n;i++)
        cin >> niz[i];
    sum[0]=niz[0];
    for(int i=1;i<n;i++)
        sum[i]=sum[i-1]+niz[i];
    printf("%lld\n",calc(0,n-1));
    return 0;
}


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

int main() {
	while (1) {
		int book, num[9];
		cin >> book;
		if (book == 0) {
			break;
		}
		for (int i = 0; i < 9; i++) {
			cin >> num[i];
			book = book - num[i];
		}
		cout << book << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

constexpr int LIM = 1000000;

static char isprime[LIM];
static int numofprime[LIM];

void setprime(int N) {
    fill(isprime, isprime + N + 1, 1);
    isprime[0] = isprime[1] = 0;
    for(int x = 2, lim = (int)sqrt(N); x <= lim; ++x) {
        if(isprime[x]) {
            for(int y = x * x; y <= N; y += x) {
                isprime[y] = 0;
            }
        }
    }
    numofprime[0] = 0;
    for(int x = 0; x < N; ++x) {
        numofprime[x + 1] = numofprime[x] + isprime[x + 1];
    }
}

int main() {
    setprime(999999);
    int n;
    while(scanf("%d", &n) != EOF) {
        printf("%d\n", numofprime[n]);
    }
    return 0;
}

Measured memory_bytes: 6052
using System;
					
public class Program
{
	public static void Main()
	{
		String str = Console.ReadLine();
		String A = str.Substring(0,1);
		String B = str.Substring(1,1);
		String C = str.Substring(2);

		if(A=="7" || B=="7"|| C=="7")
		{
			Console.WriteLine("Yes");
		}else{
			Console.WriteLine("No");
		}		
	}
}

Measured memory_bytes: 25880
#include <algorithm>
#include <vector>
#include <cmath>
#include <tuple>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#include <iostream>

using namespace std;


int main() {

    int N, M;
    cin >> N >> M;

    long long A, B;

    map<long long, long> map;
    for (int i = 0; i < N; i++) {
        cin >> A >> B;
        map[A] += B;
    }

    long long result = 0;
    long long m = 0;
    bool ok = false;
    for (auto kv:map) {
        if (ok) {
            break;
        }
        for (long long i = 0; i < kv.second; i++) {
            m += 1;
            result += kv.first;
            if (m >= M) {
                ok = true;
                break;
            }
        }
    }

    cout << result << "\n";

    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int k;
    cin >> k;
    vector<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};
    cout << a[k-1];
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

constexpr lnt MOD = 1e9+7;
struct mint
{
	lnt v;
	mint():v(0){}
	mint(lnt v):v((v+MOD)%MOD){}
	mint operator-()const{ return mint(0) - *this; }
	mint& operator+=(const mint& a){ if((v+=a.v)>=MOD) v-=MOD; return *this; }
	mint& operator-=(const mint& a){ if((v+=MOD-a.v)>=MOD) v-=MOD; return *this; }
	mint& operator*=(const mint& a){ (v*=a.v)%=MOD; return *this; }
	mint& operator/=(const mint& a){ (*this) *= a.inv(); return *this; }
	mint operator+(const mint& a)const{ return mint(*this) += a; }
	mint operator-(const mint& a)const{ return mint(*this) -= a; }
	mint operator*(const mint& a)const{ return mint(*this) *= a; }
	mint operator/(const mint& a)const{ return mint(*this) /= a; }
	bool operator<(const mint& a)const{ return v < a.v; }
	bool operator==(const mint& a)const{ return v == a.v; }
	mint pow(lnt k)const{ mint r(1),t(v); while(k){ if(k&1) r*=t; t*=t; k>>=1; } return r; }
	mint inv()const{ return pow(MOD-2); }
	static mint comb(lnt n, lnt k) { if(n-k<k) k=n-k; mint num(1), dom(1); for(int i=0;i<k;i++) { num*=n-i; dom*=i+1; } return num/dom; }
	static std::vector<mint> construct_comb(int n) {
		std::vector<mint> c(n+1); mint a = 1; c[0] = a; for(int i=1;i<=n;i++) { a = a*mint(n+1-i)/i; c[i] = a; } return c;
	}
	static std::vector<mint> construct_fact(int n) { std::vector<mint> f(n+1,1); for(int i=2;i<=n;i++) f[i]=f[i-1]*i; return f; }
};
std::istream& operator>>(std::istream&i,mint&a){ lnt t; i>>t; a=mint(t); return i; }
std::ostream& operator<<(std::ostream&o,const mint&a){ o<<a.v; return o; }


int main() {
	int n,k;
	std::cin >> n >> k;
	std::vector<lnt> a(n);
	rep(i,n) std::cin >> a[i];
	std::sort(all(a));
	mint ans=1;
	if(a[n-1]<0&&k%2) {
		rep(i,k) ans*=a[n-i-1];
		print(ans);
		return 0;
	}
	int l=0,r=n;
	rep(i,k) {
		if(-a[l]>a[r-1]) l++;
		else r--;
	}
	debug(l,r);
	if(l%2==0||l==r) {
		rep(i,l) ans*=a[i];
		for(int i=r;i<n;i++) ans*=a[i];
		print(ans);
		return 0;
	}
	if(r!=n&&(l==0||a[l]*a[l-1]>=a[r-1]*a[r])) {
		rep(i,l+1) ans*=a[i];
		for(int i=r+1;i<n;i++) ans*=a[i];
	} else {
		rep(i,l-1) ans*=a[i];
		for(int i=r-1;i<n;i++) ans*=a[i];
	}
	debug(l,r);
	print(ans);
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 100000000;
const int MOD = 1000000007;

int main(){
  int k;
  std::cin >> k;
  std::cout << (k/2)*((k+1)/2) << std::endl;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
const double INF = 1e10;
//const ll INF = 1001001001;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

int main() {
    int p, q, r;
    cin >> p >> q >> r;

    int m = max(p, q);
    m = max(m, r);

    cout << p + q + r - m << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1.2e7+10;
int trie[maxn][4], tot;
int val[maxn], len;
char op[20], s[20];

int idx(char ch){
	switch(ch){
		case 'A': return 0;
		case 'C': return 1;
		case 'G': return 2;
		case 'T': return 3;
	}
}

void insert(){
	int u = 0;
	for(int i=0; i<len; i++){
		int c = idx(s[i]);
		if(!trie[u][c])
			trie[u][c] = ++tot;
		u = trie[u][c];
	}
	val[u] ++;
}

bool find(){
	int u = 0;
	for(int i=0; i<len; i++){
		int c = idx(s[i]);
		if(!trie[u][c])
			return false;
		u = trie[u][c];
	}
	return val[u];
}

int main(){
	int n;
	scanf("%d", &n);
	while(n--){
		scanf("%s", op);
		scanf("%s", s);
		len = strlen(s);
		if(op[0]=='i')
			insert();
		if(op[0]=='f'){
			if(find())
				printf("yes\n");
			else
				printf("no\n"); 
		}
	}
	return 0;
}


Measured memory_bytes: 9892
n=int(input())
graph={}

def show(nums):
    for i in range(len(nums)):
        if i!=0:
            if i!=len(nums)-1:
                print(nums[i],end=" ")
            else:
                print(nums[i])

for i in range(n):
    tmp=list(map(int,input().split()))
    graph[tmp[0]]=[0 for j in range(n+1)]
    for k in range(tmp[1]):
        graph[tmp[0]][tmp[2+k]]=1
    show(graph[tmp[0]])


Measured memory_bytes: 5688
/*
 * main3.cpp
 *
 *  Created on: 12 באפר׳ 2020
 *      Author: Dell
 */



/*
 * main2.cpp
 *
 *  Created on: 11 באפר׳ 2020
 *      Author: Dell
 */




#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <cstring>
#include <vector>
#include<stack>
#include<list>
#include <algorithm>
#include <unordered_map>
using namespace std;
int gcd_rec(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;
    if (a > b)
        return gcd_rec(a-b, b);
    return gcd_rec(a, b-a);
}
int gcd(int a,int b,int c)
{
	return gcd_rec(gcd_rec(a,b),c);
}

int main()
{
	int N;
	cin>>N;
	long long result=0;
	for(int a=1;a<N+1;a++)
	{
		for(int b=1;b<N+1;b++)
		{
			for(int c=1;c<N+1;c++)
			{
				result+=gcd(a,b,c);
			}
		}
	}


	cout<<result;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
void print(int x) {
    cout << x << endl;
}
int main(void) {
    int a, b;
    cin >> a >> b;
    if(a>12) print(b);
    else if(a>5) print(b/2);
    else print(0);
}


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

int main()
{
  int count=0;
  string s;
  string m[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
  
  cin>>s;
  
  for(int i=0;i<7;i++)
  {
    if(s==m[i])
    {
      count=i;
    }
  }
  
  cout<<7-count<<endl;

  return 0;
}

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

int main(){
    ll N,Q; 
    cin >> N;
    vector<ll> A(N);
    for(ll i=0;i<N;i++)cin >> A[i];
    cin >> Q;
    vector<ll> B(Q),C(Q);
    for(ll i=0;i<Q;i++)cin >> B[i] >> C[i];

    unordered_map<ll ,ll> D;
    //for(ll i=0;i<=100004;i++)D[i] = 0;
    for(ll i=0;i<N;i++)D[A[i]] += 1;
    ll sum = 0;
    for(ll i = 0;i<N;i++)sum += A[i];
    for(ll q=0;q<Q;q++){
        sum -= B[q]*D[B[q]];
        sum += C[q]*D[B[q]];
        D[C[q]] += D[B[q]];
        D[B[q]] = 0;
        cout << sum << endl;
    }
}

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

int main() {
  int N;
  int sum1 = 0;
  int sum2 = 0; 
  cin >> N;
  vector<int> card(N);
  for (int i = 0; i < N; i++) cin >> card[i];
  
  sort(card.begin(), card.end(), greater<int>());

  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) {
    	sum1 += card[i];
    } else {
        sum2 += card[i];
    }
  }

  if(sum2 > sum1) cout <<  sum2-sum1 << endl;
  else cout << sum1 - sum2 << endl;

}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String str = sc.next();
        int count = 0;
        for (int i = 0; i < a-2; i++) {
            String res = str.substring(i, i + 3);
            if (res.equals("ABC")){
                count++;
            }
        }
        System.out.print(count);
    }
}

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

int main(){
  int R;
  cin>>R;
  string ans;
  if(R<1200){
    ans="ABC";
  }
  else if(R<2800){
    ans="ARC";
  }
  else{
    ans="AGC";
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int n,m,k;
    vector<int> fr[100100];
    set<pair<int,int> > bl;
    set<pair<int,int> > frf;
    vector<int> blb[100100];
    int ans[100100];
    REP(i,100100)ans[i]=-1;
    cin>>n>>m>>k;
    REP(i,m){
        int a,b;
        cin>>a>>b;a--;b--;
        fr[a].PB(b);
        fr[b].PB(a);
        frf.insert(MP(a,b));
        frf.insert(MP(b,a));
    }
    REP(i,k){
        int c,d;
        cin>>c>>d;c--;d--;
        bl.insert(MP(c,d));
        bl.insert(MP(d,c));
        blb[c].PB(d);
        blb[d].PB(c);
    }
    // cout <<"ok"<<endl;
    REP(i,n){
        if(ans[i]!=-1)continue;
        queue<int> q;
        set<int> used;
        used.insert(i);
        q.push(i);
        map<int,int> cnt_b;
        REP(k,blb[i].size())
        {
            cnt_b[blb[i][k]]++;
        }
        while(q.size())
        {
            int now=q.front();q.pop();
            REP(j,fr[now].size())
            {
                int to=fr[now][j];
                if(used.count(to)==0)
                {
                    q.push(to);
                    used.insert(to);
                    REP(k,blb[to].size())
                    {
                        cnt_b[blb[to][k]]++;
                    }
                }
            }
        }
        // cout<<"--"<<endl;
        // REP(j,n)cout<<cnt_b[j]<<endl;
        for (set<int>::iterator it1=used.begin();it1!=used.end();it1++)
        {
            // int cnt=0;
            // for (set<int>::iterator it2=used.begin();it2!=used.end();it2++)
            // {
            //     if(it1==it2)continue;
            //     if(frf.count(MP(*it1,*it2))==0&&bl.count(MP(*it1,*it2))==0){
            //         // cout << *it1 <<" "<<*it2<<endl;;
            //         cnt++;
            //     }
            // }
            ans[*it1]=used.size();
            ans[*it1]=ans[*it1]-1-fr[*it1].size()-cnt_b[*it1];
        }
    }
    REP(i,n)cout << ans[i] <<" ";cout <<endl;
}

Measured memory_bytes: 40316
#include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int ws=0,ks=0;
	int w[10],k[10];
	rep(i,10){cin>>w[i];}
	rep(i,10){cin>>k[i];}
	sort(w,w+10);
	sort(k,k+10);
//	rep(i,10)cout<<w[i]<<endl;
	loop(i,7,10)ws+=w[i];
	loop(i,7,10)ks+=k[i];
	
	cout<< ws << " " <<ks << endl;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  int Y;
  cin >> N >> Y;
  
  for(int i = 0; i <= N ; i++){
    for(int j = 0; j <= N - i ; j++){
      if((10000*i + 5000*j + 1000*(N - i - j)) == Y){
        cout << i << " " << j << " " << N - i - j << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var inputs = Console.ReadLine().Split(' ').Select(input => int.Parse(input)).ToArray();
			var h = inputs[0];
			var w = inputs[1];
			var cells = new byte[h, w];
			for (int i = 0; i < h; i++)
			{
				var tmp = Console.ReadLine().Split(' ').Select(input => byte.Parse(input)).ToArray();
				for (int j = 0; j < w; j++)
				{
					cells[i, j] = tmp[j];
				}
			}

			var operations = new List<Tuple<Tuple<int, int>, Tuple<int, int>>>();

			bool flag = false;
			var operation = new List<Tuple<Tuple<int, int>, Tuple<int, int>>>();
			for (int i = 0; i < h; i++)
			{
				int j = i % 2 == 0 ? 0 : w - 1;
				int diff = i % 2 == 0 ? 1 : -1;

				while (j >= 0 && j < w)
				{
					if (cells[i, j] % 2 != 0)
					{
						if (flag)
						{
							operations.AddRange(operation);
							operation.Clear();
							flag = false;
						}
						else
						{
							flag = true;
						}
					}

					if (flag)
					{
						Tuple<int, int> nextPosition;
						if ((diff == 1 && j == w - 1) || (diff == -1 && j == 0))
						{
							nextPosition = new Tuple<int, int>(i + 1, j);
						}
						else
						{
							nextPosition = new Tuple<int, int>(i, j + diff);
						}

						operation.Add(new Tuple<Tuple<int, int>, Tuple<int, int>>(new Tuple<int, int>(i, j), nextPosition));
					}

					j += diff;
				}
			}

			Console.WriteLine(operations.Count());
			foreach (var o in operations)
			{
				Console.WriteLine($"{o.Item1.Item1 + 1} {o.Item1.Item2 + 1} {o.Item2.Item1 + 1} {o.Item2.Item2 + 1}");
			}

			return;
		}
	}

}


Measured memory_bytes: 31820
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;

int main(){
    ios;
    int N; cin >> N;
    int ans = 0;
    rep1(i,N){
        string s = to_string(i);
        if(s.size() % 2 != 0) ans++;
    }
    cout << ans;
    return 0;
}


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

from fractions import gcd
from functools import reduce

A = [x >> 1 for x in A]

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n

x = reduce(merge, A)
if x == 0:
    ans = 0
else:
    ans = (M//x) - (M//(2*x))

print(ans)

Measured memory_bytes: 88672