akhauriyash/Code-Regression huggingface dataset:
a,l,$,=:+,:<,' '
puts [6484,a,0,1,3,l,2,3,3]+[0,1].map{|x|[a,x,3,x]+(0..29).map{|t|v=x+4;u=x*60+9+t;[a,v,v,v,a,v,3,6,*[a,6,6,6]*(29-t),l,6,x,u,a,v,u,v]}}+(0..59).map{|t|[a,2,2,2]+(0...t).map{[a,8+t-_1,69+_1,5,l,3,5,6,a,2,6,2]}}

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

using namespace std;

typedef long long ll;

int main() {
  string s;
  cin>>s;
  string S;
  for (int i = 0; i < s.size(); i++) {
    if (i == 0) S = S + s[i];
    else {
      if (s[i - 1] == 'B' && s[i] == 'C') {
        S.pop_back();
        S = S + 'D';
      } else S = S + s[i];
    }
  }
  ll cur = 0;
  ll ans = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'A') cur++;
    if (S[i] == 'B' || S[i] == 'C') cur = 0;
    if (S[i] == 'D') ans += cur;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1436
#include <iostream>
using namespace std;
int main()
{
	int n;
	int p[100000];
	int a = 0;
	cin >> n;
	for(int i=0;i < n;i++)
	{
		cin >> p[i];
	}
	for(int i=0;i < n;i++)
	{
		if(p[i] == (i + 1))
		{
			a++;
			i++;
		}
	}
	cout << a << endl;
}

Measured memory_bytes: 640
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> k)
    {
		ans = 1;

		for(ll i = k; i <= n; i++)
		{
			ll add = (n * (n + 1)) / 2;
			add -= ((n - i) * (n - i + 1)) / 2;

			ll add2 = (i * (i - 1)) / 2;

			ans = (ans + (add - add2 + 1)) % 1000000007;
		}

		cout << ans << "\n";
    }


}





Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#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++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,c;
  cin>>n>>c;
  int cost[31][31];
  rep(i,c)rep(j,c)cin>>cost[i][j];
  vector<vector<int>>cnt(3,vector<int>(c));
  rep(i,n)rep(j,n)
  {
    int col;
    cin>>col;
    col--;
    cnt[(i+j)%3][col]++;
  }
  ll res=1e15;
  rep(i,c)
  {
    rep(j,c)
    {
      if(j==i)continue;
      rep(k,c)
      {
        if(k==j||k==i)continue;
        ll tres=0;
        rep(l,c)
        {
          tres+=cost[l][i]*cnt[0][l];
          tres+=cost[l][j]*cnt[1][l];
          tres+=cost[l][k]*cnt[2][l];

        }
        chmin(res,tres);
      }
    }
  }
  cout<<res<<endl;

  return 0;

}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    int N;
    std::cin >> N;
    std::string judge[N];
    for(int i=0; i<N; i++){
        std::cin >> judge[i];
    }


    int ac=0, wa=0, tle=0, re=0;
    for(int i=0; i<N; i++){
        if(judge[i] == "AC"){
            ac++;
        }else if(judge[i] == "WA"){
            wa++;
        }else if(judge[i] == "TLE"){
            tle++;
        }else if(judge[i] == "RE"){
            re++;
        }else{
            //not reached
        }
    }

    std::cout << "AC" << " " << "x" << " " << ac << std::endl;
    std::cout << "WA" << " " << "x" << " " << wa << std::endl;
    std::cout << "TLE" << " " << "x" << " " << tle << std::endl;
    std::cout << "RE" << " " << "x" << " " << re << std::endl;

    //int end;
    //std::cin >> end;
    return 0;
}

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


int main(){
  string s,t ;
  cin >> s >> t;

  //choose one char of s and replace with different character 
  int ops=0;
  vector<char> v(s.begin(),s.end());
    
  vector<char> v1(t.begin(),t.end());

  for(size_t i=0;i<v.size();i++){
    if(v[i]!=v1[i]){
        v[i]=v1[i];
      ops++;
    }
    
  }
cout << ops <<"\n";
return 0;

  

}


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

using namespace std;

int main()
{
	string s;
	cin >> s;

	map<char, int> dic;
	for (int i = 0; i < s.size(); i++)
	{
		if (dic.count(s.at(i)))
		{
			dic.at(s.at(i))++;
		}
		else
		{
			dic[s.at(i)] = 1;
		}
	}

	bool flag = true;
	for (auto item : dic)
	{
		if (item.second % 2 != 0)
		{
			flag = false;
			break;
		}
	}
	if (flag)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <queue>
#include <assert.h>
#include <cmath>
#include <stack>
#include <deque>
#include <set>
#include <unordered_map>
#include <complex>
#include <fstream>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
const int mxn = 20020;
const int mod = 1e9+7;

struct cmp1
{
	bool operator() (const pair<long long, long long> &A, const pair<long long, long long> &B) const {
		return A.first+A.second<B.first+B.second;
	}
};

struct cmp2
{
	bool operator() (const pair<long long, long long> &A, const pair<long long, long long> &B) const {
		return A.first-A.second<B.first-B.second;
	}
};


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

	set<pair<long long, long long>, cmp1> Set1;
	set<pair<long long, long long>, cmp2> Set2;

	int n; cin>>n;
	long long x, y; cin>>x>>y; Set1.insert(make_pair(x, y)); Set2.insert(make_pair(x, y));
	long long ans = 0;
	for(int i=1; i<n; i++) {
		cin>>x>>y;
		ans = max(abs(x-Set1.begin()->first)+abs(y-Set1.begin()->second), ans);
		ans = max(abs(x-Set1.rbegin()->first)+abs(y-Set1.rbegin()->second), ans);
		ans = max(abs(x-Set2.begin()->first)+abs(y-Set2.begin()->second), ans);
		ans = max(abs(x-Set2.rbegin()->first)+abs(y-Set2.rbegin()->second), ans);
		Set1.insert(make_pair(x, y)); Set2.insert(make_pair(x, y));
	}

	cout << ans << '\n';

	return 0;
}
//comparator function in sorting
//swapping arguments
//missing cases in dp
//dividing in modulo
//Beware of overflow and modulo
//Be mindful of overflow
//s is a matrix but forget
//length of ranges
//working with bit using ull

Measured memory_bytes: 28604
#include <stdio.h>

int main()
{
  int ret, a1, a2, a3;
  ret = scanf("%d %d %d", &a1, &a2, &a3);
  if ( a1 + a2 + a3 > 21 )
    printf("bust\n");
  else
    printf("win\n");

}




Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	char x;
	cin >> x;

	if ('a' <= x) {
		cout << 'a';
	}
	else {
		cout << 'A';
	}


EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3116
#include <iostream>

int main(int argc, char ** argv)
{
  int n;
  std::cin >> n;

  int org = static_cast<int>((n / 1.08) + 0.9);
  if (n == static_cast<int>(org * 1.08)) {
    std::printf("%d\n", org);
  } else {
    std::printf(":(\n");
  }
  return 0;
}


Measured memory_bytes: 888
import java.util.*;
import java.io.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main {
  static int[][] dp;
	static String x;
	static String y;

  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.nextLine());

    for (int i = 0; i < n; i++) {
      x = sc.nextLine();
      y = sc.nextLine();

      dp = new int[x.length()+1][y.length()+1];
      int ans = lcs(x.length(),y.length());
      out.println(ans);
    }
  }

  static int lcs(int i, int j){
    if (dp[i][j] != 0) return dp[i][j];
    if (i==0 || j==0) return 0;

		if (x.charAt(i-1) == y.charAt(j-1)) return dp[i][j] = lcs(i-1,j-1)+1;
		else return dp[i][j] = Math.max(lcs(i-1,j), lcs(i,j-1));
  }
}


Measured memory_bytes: 71308
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        Set<String> prize = new HashSet<>();

        for (int i = 0 ; i < N ; i++) {
            prize.add(scanner.next());
        }

        System.out.println(prize.size());
    }
}


Measured memory_bytes: 77328
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * 不安なら ll を使う.
 * 小数は double を忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
 * 比較するときは型まで注意
*/

/* ===== コーナーケースに気をつけろ ===== */
int main()
{
    int N, K;
    cin >> N >> K;
    double maxK = -1;
    vector<int> p(N);
    vector<long double> kitai(N);
    // 期待値の計算
    REP(i, N)
    {
        cin >> p.at(i);
        kitai.at(i) = (1.0 + p.at(i)) / 2.0;
    }
    vector<double> s(N + 1, 0);
    // 累積和
    REP(i, N)
    {
        s.at(i + 1) = s.at(i) + kitai.at(i);
    }
    // 区間の計算
    REP(i, N - K + 1)
    {
        maxK = max(maxK, s.at(i + K) - s.at(i));
    }

    printf("%.7lf\n", maxK);

    return 0;
}

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

// lib/detail/ceil_and_floor.hpp
#ifndef DETAIL_CEIL_AND_FLOOR_HPP
#define DETAIL_CEIL_AND_FLOOR_HPP

namespace tools {
  template <typename T>
  constexpr T floor(T lhs, T rhs);

  template <typename T>
  constexpr T ceil(T lhs, T rhs);

  template <typename T>
  constexpr T floor(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        lhs / rhs :
      lhs < 0 && rhs >= 0 ?
        -ceil<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -ceil<T>(lhs, -rhs) :
        floor<T>(-lhs, -rhs);
  }

  template <typename T>
  constexpr T ceil(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        (lhs - 1 + rhs) / rhs :
      lhs < 0 && rhs >= 0 ?
        -floor<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -floor<T>(lhs, -rhs) :
        ceil<T>(-lhs, -rhs);
  }
}

#endif

// lib/floor.hpp
#ifndef FLOOR_HPP
#define FLOOR_HPP


/*
usage:

tools::floor(5, 3) // => 1 (i.e., floor(5 / 3))
*/

#endif

// main.cpp

int main() {
  std::int_fast64_t x, y, z;
  std::cin >> x >> y >> z;
  std::cout << tools::floor(x - z, y + z) << std::endl;
  return 0;
}

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

int main(){
    
    int64_t A, B, X;
    cin >> A >> B >> X;

    int64_t temp;

    if (X<B){
        temp = X;
        cout << (int)((A*temp)/B) - (A*(int)(temp/B)) << endl; 
    }
    else{
        temp = B-1;
        cout << (int)((A*temp)/B) - (A*(int)(temp/B)) << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 JENISH MONPARA S.      IIT PATNA      ADITI GOEL IS LOVE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// while(scanf("%d",&n)!=EOF)

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ii int64_t
#define PI 3.14
#define lli long long int
#define li long int
#define deb(x) cout<<"\nhi"<<x<<"\n"
#define mod 1000000007
#define f(x,n) for(int x=0;x<n;++x)
#define ff(x,y,z) for(x=y;x<=z;++x)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;


int main()
 
{
    ios;
    int n,i,j;
    double dp[3000]={0},p,ans=0;
    cin>>n;
    dp[0]=1;
    for(i=1;i<=n;i++)
    {
        cin>>p;
        for(j=i;j>0;--j)
            dp[j]=dp[j-1]*p+dp[j]*(1-p);
        dp[0]*=(1-p);

    }for(i=n/2+1;i<=n;i++)ans+=dp[i];
    cout<<setprecision(9)<<fixed<<ans;
    

}





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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            C();
        }

        static void C()
        {
            var N = ReadInt();
            var An = ReadSplitInt();
            var list = new int[N+1];
            var list2 = new int[N + 1];

            for (int i = 0; i < N; i++)
                list[i+1] = Gcd(list[i], An[i]);

            for (int i = N-1; i >= 0; i--)
                list2[i] = Gcd(list2[i+1], An[i]);

            var ans = 0;
            for (int i = 0; i < N; i++)
                ans = Max(ans, Gcd(list[i], list2[i + 1]));

            Println(ans);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 28636
<?php
$dy = array(1, -1, 0, 0);
$dx = array(0, 0, 1, -1);

function dfs($y, $x) {
  global $ans, $h, $w, $dx, $dy, $visited, $map;

  $ans++;
  $visited[$y][$x] = 1;
  
  for ($i = 0; $i < 4; $i++) {
    $ny = $y + $dy[$i];
    $nx = $x + $dx[$i];
    if (0 > $ny || $ny >= $h) continue;
    if (0 > $nx || $nx >= $w) continue;
    if ($map[$ny][$nx] == '#') continue;
    if ($visited[$ny][$nx]) continue;
    dfs($ny, $nx);
  }
}

while (fscanf(STDIN, "%d %d", $w, $h) && ($w | $h)) {
  for ($i = 0; $i < $h; $i++) {
    fscanf(STDIN, "%s", $str);
    // $map[$i][] = str_split($str);
    for ($j = 0; $j < $w; $j++) {
      $map[$i][$j] = $str[$j];
      if ($str[$j] == '@') {
        $sy = $i;
        $sx = $j;
      }
    }
  }

  $ans = 0;
  for ($i = 0; $i < $h; $i++) {
    for($j = 0; $j < $w; $j++) {
      $visited[$i][$j] = 0;
    }
  }
  dfs($sy, $sx);
  
  print $ans . "\n";
}

Measured memory_bytes: 7020
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Numerics;

namespace AtCoder.C
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var X = (BigInteger)0;
            var K = (BigInteger)0;
            var D = (BigInteger)0;
            (X, K, D) = Read3Longs();

            if (X == 0)
            {
                if (K % 2 == 0)
                {
                    return 0;
                }
                else
                {
                    return D;
                }
            }

            // 負の場合は正の座標とみなしてよい
            if (X < 0) X *= -1;

            // 近づくだけの場合
            if (X >= K * D)
            {
                return X - D * K;
            }

            var k = X / D;
            K -= k;
            X -= k * D;
            if (K % 2 == 0)
            {
                return X;
            }
            else
            {
                return Math.Abs((decimal)(X - D));
            }
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

int main(){
    int N;
    cin >> N;
    int count = 0;
    for (int i = 1; i <= N; i++){
        if(1 <= i && i <= 9){
            count++;
        }
        if(100 <= i && i <= 999){
            count++;
        }
        if(10000 <= i && i <= 99999){
            count++;
        }
    }
    cout << count << endl;
}

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

const int LIM = 1e5;
int N, P[LIM], idx[LIM];
ll ans;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> P[i];
        P[i]--;
    }
    rep(i, N) idx[P[i]] = i;

    set<int> S;
    for (int x = N - 1; x >= 0; x--) {
        int i = idx[x];
        S.insert(i);
        // calc l
        vector<int> l(2, -1);
        auto it = S.find(i);
        rep(j, 2) {
            if (it == S.begin()) break;
            it--;
            l[j] = *it;
        }
        // calc r
        vector<int> r(2, N);
        it = S.find(i);
        rep(j, 2) {
            it++;
            if (it == S.end()) break;
            r[j] = *it;
        }
        // calc ans
        int ls0 = i - l[0], ls1 = l[0] - l[1];
        int rs0 = r[0] - i, rs1 = r[1] - r[0];
        ll c = (ll)ls0 * rs1 + (ll)ls1 * rs0;
        ans += c * (x + 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 5760
A, B, C = map(int, input().split(" "))

A_C = min(A, C)
nokori_C = C - A_C
if nokori_C > 0:
    B_C = min(B, nokori_C)
    nokori_B = B - B_C
    nokori_C2 = min(nokori_C - B_C, 1)
else:
    B_C = 0
    nokori_B = B
    nokori_C2 = 0
#print(A_C, B_C, nokori_B, nokori_C2)
out = A_C + B_C*2 + nokori_B + nokori_C2
print(out)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <numeric>
#include <unordered_map>
using namespace std;


int main() {
	int N, A,B;
	cin >> N >> A >> B;
	cout << (abs(A - B) % 2 == 1 ? "Borys" : "Alice");
	
	
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string S;
	cin>>S;

	//cout<<S.length()<<endl;

	if(S.length()%2 == 0)
	{
		int flag = 1;

		for(int i = 0;i<S.length();i++)
		{
			if(i%2 == 0)
			{
				if(S[i] != 'h')
				{
					flag = 0;
					break;
				}
			}

			else
			{
				if(S[i] != 'i')
				{
					flag = 0;
					break;
				}
			}
		}

		if(flag)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}

	else
		cout<<"No"<<endl;
}

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

int main(){
  int n;
  cin>>n;
  ll a[200005];
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);
  reverse(a,a+n);
  ll ans=0;
  int cnt=0;
  rep(i,n){
    if(cnt==n-1){
      break;
    }
    if(cnt==n-2){
      ans+=a[i];
      break;
    }
    if(cnt==0) {
      ans+=a[i];
      cnt++;
      continue;
    }
    else{
      ans+=a[i]*2;
      cnt+=2;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5208
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

const int MAXN = 100100;

vector<int> g[MAXN];
int used[MAXN];
bool ok;
int p[3];

void dfs(int v, int c) {
  if (used[v] != 0) {
    if (used[v] != c) ok = false;
    return;
  }
  used[v] = c;
  p[c]++;
  for (int u : g[v]) {
    dfs(u, 3 - c);
  }
}

int main() {
#ifdef LOCAL
  freopen("c.in", "r", stdin);
  freopen("c.out", "w", stdout);
#endif

  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }

  ll es = -m;

  for (int i = 0; i < n; i++) {
    if (used[i] == 0) {
      ok = true;
      p[1] = p[2] = 0;
      dfs(i, 1);
      if (ok) {
        es += p[1] * 1LL * p[2];
      } else {
        es += (p[1] + p[2]) * 1LL * (p[1] + p[2] - 1) / 2;
      }
    }
  }

  printf("%lld\n", es);


  return 0;
}


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

import io
import sys
import math

def solve():
    # implement process
    pass

def main():
    # input
    n = int(input())
    s_set = set()
    for _ in range(n):
        s_set.add(input())
    
    # process
    ans = str( len(s_set) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
5
grape
grape
grape
grape
grape
"""
_EXPECTED = """\
1
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 31048
#include <iostream>
#include <vector>
#include <map>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

typedef tuple<int,int,int> T;
typedef pair<int,int> P;
vector<T> Edges;
map<P,int> Stations;//(station,company)->sta_id
vector<P> E[500000];//to,fee
bool isupdated[500000];
int dist[500000];

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

    int N,M;
    cin>>N>>M;
    for(int i=0;i<N;i++) Stations[P(i,0)]=0;
    for(int i=0;i<M;i++){
        int p,q,c;
        cin>>p>>q>>c;
        Edges.emplace_back(p,q,c);
        Stations[P(p,c)]=0;
        Stations[P(q,c)]=0;
    }
    int c=0;
    for(auto &p:Stations) p.second=c++;
    fill(dist,dist+c,100000000);
    for(auto &s:Stations){
        auto p = s.first;
        int station=p.first, company=p.second, sta_id=s.second;
        if(company==0) continue;
        E[Stations[P(station,0)]].emplace_back(sta_id,1);
        E[sta_id].emplace_back(Stations[P(station,0)],0);
    }
    for(auto &e:Edges){
        int p=get<0>(e), q=get<1>(e), c=get<2>(e);
        int sp = Stations[P(p,c)], sq = Stations[P(q,c)];
        E[sp].emplace_back(sq,0);
        E[sq].emplace_back(sp,0);
    }

    deque<P> que;//cost,sta_id
    que.emplace_back(0,Stations[P(1,0)]);
    dist[Stations[P(1,0)]]=0;
    int dest=Stations[P(N,0)];
    while(!que.empty()){
        P p = que.front(); que.pop_front();
        int cost=p.first, sta_id=p.second;
        if(sta_id==dest){
            cout<<cost<<endl;
            return 0;
        }
        if(isupdated[sta_id]) continue;
        isupdated[sta_id]=true;

        for(auto &e:E[sta_id]){
            int to=e.first, fee=e.second;
            if(cost+fee<dist[to]){
                dist[to]=cost+fee;
                if(fee){
                    que.emplace_back(cost+fee,to);
                }else{
                    que.emplace_front(cost+fee,to);
                }
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 59184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi   = vector<int>;
using vll  = vector<ll>;
using vc   = vector<char>;
using vvll  = vector<vll>;
using vvi  = vector<vi>;
using vvc  = vector<vc>;
using vb   = vector<bool>;
using vvb  = vector<vb>;
using pii  = pair<int,int>;
using vpii = vector<pii>;
using posteriority_queue = priority_queue<int, vi, greater<int>>;


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

    if(x == 0) cout << 1;
    if(x==1) cout << 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

ld f(ld a, ld b, ld theta) {
    ld res;
    if (a*tan(theta) > b) {
        res = b*b/tan(theta)*a/2;
    }
    else {
        res = a*a*b - a*a*a*tan(theta)/2;
    }
    return res;
}

int main() {
    int a, b, x;
    ld PI = 3.14159265;
    cin >> a >> b >> x;
    cout << fixed << setprecision(8);
    ld start = 0;
    ld end = PI/2;
    rep(i, 100000) {
        ld mid = (start + end)/2;
        if (f(a, b, mid) < x) {
            end = mid;
        }
        else {
            start = mid;
        }
    }
    cout << end / PI * 180 << endl; 
}

Measured memory_bytes: 384
// problem: "https://atcoder.jp/contests/abc145/tasks/abc145_d"

#include<bits/stdc++.h>
#define ll long long
#define p (ll)(1e9+7)

using namespace std;

ll fact(ll n,vector<ll>&F)
{
    // if(n == 0)
    //     return 1;
    //
    // //cout<<"Fact: "<<n<<'\n';
    //
    // if(F[n] == -1)
    //     F[n] = (fact(n-1,F)*n)%p;

    return F[n];
}

ll Pow(ll a,ll m)
{
    if(m == 0)
        return 1;

    ll b,c;
    b = 1;

    if(m%2)
        b = a;

    c = Pow(a,m/2);
    a = (((c*c)%p)*b)%p;

    return a;
}

int main()
{
    ll x,y;

    cin>>x>>y;

    ll n1,n2,m1,m2;

    m1 = y-x;
    m2 = (y+x)/3;

    n1 = (m1+m2)/2;
    n2 = (m2-m1)/2;

    if(n1+2*n2 != x || 2*n1+n2 != y || n1 < 0 || n2 < 0)
    {
        cout<<0;
        exit(0);
    }

    vector<ll>F(2000001);
    ll i;
    F[0] = 1;
    for(i=1;i!=2000001;i++)
        F[i] = (i*F[i-1])%p;

    ll a,b;
    a = fact(n1+n2,F);
    b = (fact(n1,F)*fact(n2,F))%p;
    b = Pow(b,p-2);

    cout<<(a*b)%p;

    // Test code
    // ll i;
    // for(i=0;i!=2000001;i++)
    //     cout<<i<<' '<<fact(i,F)<<'\n';

    return 0;
}


Measured memory_bytes: 15872
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;



int main() {

	int n;
	cin >> n;
	vector<long long int>s;
	long long int a = 0;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		a += t;
		s.push_back(a);
	}
	long long int ans = 9999999999999999;

	for (int i = 0; i < s.size()-1; i++) {
		ans = min(ans, abs(2 * s[i] - a));
	}
	cout << ans << endl;


	return 0;
	
}


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

#define MAX 2000

using namespace std;

int n,q;
int n_lst[MAX],q_lst[MAX];
static int ans_lst[MAX][MAX];


bool bf(int idx,int x){
    if(x == 0) return true;
    if(idx < n){
        return bf(idx+1,x) || bf(idx+1,x-n_lst[idx]);
    }
    return false;
}

int m_bf(int idx,int x){
    //1:false,2:true

    //定義済み？
    if(ans_lst[idx][x] > 0) return ans_lst[idx][x];


    if(x == 0) ans_lst[idx][x] = 2;
    else if(idx < n){
        if(m_bf(idx+1,x-n_lst[idx]) == 2)
            ans_lst[idx][x] = 2;
        else if(m_bf(idx+1,x) == 2)
            ans_lst[idx][x] = 2;
    }
    else
        ans_lst[idx][x] = 1;

    return ans_lst[idx][x];

}

int main(){
    cin >> n;
    for(int i=0;i<n;i++) cin >> n_lst[i];
    cin >> q;
    for(int i=0;i<q;i++) cin >> q_lst[i];

    for(int i=0;i<q;i++){
        if(bf(0,q_lst[i]))
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}



Measured memory_bytes: 3088
N,M,X = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(N)]
res = float('inf') #無限で初期化
for i in range(2**N):
    tca = [0]*(M+1) #index(0)=totalcost
    for j in range(N):
        if i & (1 << j) > 0:#その本を使うかどうかの判定
            for k in range(M+1):
                tca[k] += ca[j][k]
    if min(tca[1:]) >= X:
        res = min(res, tca[0])

if res != float('inf'):
    print(res)
else:
    print(-1)

Measured memory_bytes: 68492
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

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

unsigned short dp[4010][4010];

int main(){
  int i,j;
  string s,t;

  while(cin >> s >> t){
    int N=s.length(),M=t.length(),res=0;

    rep(i,4010) rep(j,4010) dp[i][j] = 0;
    rep(i,N) rep(j,M){
      if(s[i] == t[j]){
        dp[i+1][j+1] = dp[i][j] + 1;
        res = max(res, (int)dp[i+1][j+1]);
      } else {
        dp[i+1][j+1] = 0;
      }
    }

    cout << res << endl;
//    cout << dp[N][M] << endl;
  }

  return 0;
}

Measured memory_bytes: 31000
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n,a[N];
bool ans[N];

void solve(int i, int p, int c){
    if(i == n){
        if(!ans[n-1] and (ans[n-2] == ans[0]) != a[n-1]) return;
        if(ans[n-1] and (ans[n-2] == ans[0]) == a[n-1]) return;
        if(!ans[0] and (ans[1] == ans[n-1]) != a[0]) return;
        if(ans[0] and (ans[1] == ans[n-1]) == a[0]) return;
        lp(i,0,n-1) printf("%c", ans[i] ? 'W' : 'S');
        exit(0);
    }
    ans[i] = c;
    if(!c) solve(i+1, c, a[i] ? p : !p);
    else solve(i+1, c, a[i] ? !p : p);
}

int main(){
    readi(n);
    lp(i,0,n-1){
        char c;
        scanf(" %c",&c);
        a[i] = c == 'o';
    }

    ans[0] = 0;
    solve(1,0,0);
    solve(1,0,1);

    ans[0] = 1;
    solve(1,1,0);
    solve(1,1,1);

    puts("-1");
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 768
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
using namespace std;

///#include<ext/pb_ds/assoc_container.hpp>
///#include<ext/pb_ds/tree_policy.hpp>
///using namespace __gnu_pbds;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
///(X).order_of_key(value) /// return lower_bound(value)
///(*X).find_by_order(index) /// return value (0 index)

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

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vbb;

const int N = 100001;
const int MOD = 1000000007;
const ll INF = LLONG_MAX;

#define fast() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define next(x) next_permutation(all(x))
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)
#define Case(x) cout<<"Case "<<x<<": "
#define strtoint(a) atoi(a.c_str())
#define dbg(x) cerr<<#x<<" is "<<x<<'\n';
#define fix(x) cout<<fixed<<setprecision(x)
#define leastonepos(x) __builtin_ffs(x)
#define leadingoff(x) __builtin_clz(x)
#define trailingoff(x) __builtin_ctz(x)
#define numofone(x) __builtin_popcount(x)
#define time() cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;

///................Graph's Move.................
///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///



int main()
{
    fast();
    int tc=1,cs=0;
    //cin>>tc;
    while(tc--)
    {
        ll n,W,i,j,ans=0;
        cin>>n>>W;
        vll w(n),val(n),dp(N,INT_MAX);
        for(i=0; i<n; i++)
            cin>>w[i]>>val[i];
        dp[0]=0;
        for(i=0; i<n; i++)
            for(j=N-1; j>=val[i]; j--)
                if(dp[j-val[i]]+w[i]<=W)
                {
                    dp[j]=min(dp[j],dp[j-val[i]]+w[i]);
                    ans=max(ans,j);
                }
        cout<<ans<<nl;
    }
}


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

#define fi first
#define se second
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (a > b) a = b; }

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

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int a, b, c; cin >> a >> b >> c;
  
  cout << a * b / 2 << endl;

  return (0);
}


Measured memory_bytes: 3616
/*
割り算
*/

#include<stdio.h>
int main(void){
  int a,b;
  int d;/*a/bの商(整数)*/
  int r;/*a/bのあまり*/
  double f;/*a/bの商(浮動小数点)*/

  scanf("%d %d",&a,&b);
  d = a/b;
  r = a%b;
  f = (double)a/b;

  printf("%d %d %f\n",d,r,f);
  return 0;
}


Measured memory_bytes: 2080
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), W = in.nextInt();
			int[][] dp = new int[n+1][W+1];

			int[] v = new int[n];
			int[] w = new int[n];
			for (int i = 0; i < n; i++) {
				v[i] = in.nextInt();
				w[i] = in.nextInt();
			}

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

			out.println(dp[n][W]);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}



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

int main() {
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	int ans_x = 0; int ans_y = 0; int n_x = n; int n_y = n;
	while (n_x > 0) { n_x = n_x - a; ans_x = ans_x + b; }
	while (n_y > 0) { n_y = n_y - c; ans_y = ans_y + d; }
	cout << (ans_x > ans_y ? ans_y : ans_x) << endl;
	return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL T[101];

LL gcd(LL a,LL b){
   if(a%b==0)return b;
   return gcd(b,a%b);
}
int main(){
    cin>>N;
    LL ans=1;
    REP(i,N){
        cin>>T[i];
        LL a=gcd(ans,T[i]);
        ans=ans/a*T[i];
    }
    cout<<ans<<endl;
    return(0);
}

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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
//    freopen("in.in", "r", stdin);
//    freopen("out.out", "w", stdout);
}

const int N = 1e5 + 9, M = 2e5 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;

int main(){
    init();

    string s;   cin >> s;
    if(s == "ABC")  cout << "ARC";
    else cout << "ABC";
}

Measured memory_bytes: 3636
n = int(input())
s = [int(i) for i in input().split(" ")]
q = int(input())
t = [int(i) for i in input().split(" ")]
searched = []

def linearSearch(target, t, q):
    res = 0
    t[q] = target
    j = 0
    while target!=t[j]:
        j += 1
    if j != q:
        res += 1
    return res    

cnt = 0
t.append("NIL")
for i in range(n):
    target = s[i]
    if target in searched:
        continue
    searched.append(target)
    
    cnt += linearSearch(target, t, q)
    
print(cnt)


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

int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> vec(n-1);
  vec.at(0) = 0;
  int count = 0;
  rep(i,n-1) {
    if(s.at(i) == 'A' && s.at(i+1) == 'C') {
      count++;
    }
    vec.at(i) = count;
  }
  vector<int> ans(q);
  rep(i,q) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    if(l!=0 && r!=0) ans.at(i) = vec.at(r-1) - vec.at(l-1);
    else if(l == 0 && r!= 0) ans.at(i) = vec.at(r-1);
    else ans.at(i) = 0;
  }
  rep(i,q) cout << ans.at(i) << endl;
  return 0;
}

Measured memory_bytes: 1920
#include<cstring>
#include<iostream>
#include<cmath>
#include<queue> 
#include<vector>
#include<algorithm>
using namespace std;
const int MAX_N=100005;
int dp[MAX_N],in[MAX_N];//dp[i]表示以i点为终点最多可以经过多少个点(多少次传输),in存每个点的入度 
vector<int> G[MAX_N];//存每个点所连接的点 
int main()
{
    queue<int> q;
    int n,m,a,b,ans=0;
	scanf("%d%d",&n,&m);
    for(int i=1;i<=m;++i)
    {
    	scanf("%d%d",&a,&b);//a到b有一条边 
		in[b]++;//b入度++ 
		G[a].push_back(b);//b加入a所连接的点的集合 
	}
    for(int i = 1;i<=n;++i)
	  if(!in[i])//若入度为0，入队 
	    q.push(i);
    while(!q.empty())
    {
        int now=q.front();
        q.pop();//队首元素出队 
        int sz=G[now].size();//队首元素相连接的点的个数 
        for(int i=0;i<sz;++i)//遍历其连接的点 
        {
            dp[G[now][i]]=max(dp[G[now][i]],dp[now]+1);//用其dp值更新其连接的点的dp值 
            in[G[now][i]]--;//其连接的点的入度-- 
            if(in[G[now][i]]==0)//若入度为0了，则入队 
			  q.push(G[now][i]);
        }
    }
    for(int i=1;i<=n;++i)//遍历所有点 
	  ans=max(ans,dp[i]);//保留dp值最大的(以该点为终点可以传输的次数最多) 
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 9864
#include<stdio.h>
#include<string.h>
int main()
{
    char a[60];
    int x,y,z,i;
    scanf("%d %d",&x,&y);
    scanf("%s",a);
    z=strlen(a);
    for(i=1;i<=z;i++)
    {
        if(y==i)
            a[i-1]=a[i-1]+32;
    }
    printf("%s\n",a);
}


Measured memory_bytes: 128
/*    BAJUKA     */
#include<bits/stdc++.h>
#define lld long long int
#define ve vector
#include<ios>
#define rep(i,a,b) for(i=a;i<b;i++) 
#define per(i,a,b) for(i=b;i>=a;i--)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define Max 10000000000000000
#define M 1000000007 
using namespace std;




int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
    lld k,t1,t2;
    cin>>k;
    t1 = k/2;
    t2 = k-t1;
    cout<<t1*t2;



	return(0);
}

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

using namespace std;

const int INF = 1e9;
int n, a, dp[100010];

int main(void) {
    cin >> n;

    fill(dp, dp + n + 1, INF);
    dp[0] = -1;
    for (int i = 0; i < n; i++) {
        cin >> a;
        *(lower_bound(dp, dp + n + 1, a)) = a;
    }

    cout << lower_bound(dp, dp + n + 1, INF) - (dp + 1) << endl;

    return 0;
}


Measured memory_bytes: 3484
import collections

n = int(input())
d = list(map(int, input().split()))

mod = 998244353

if d[0] != 0:
    print(0)
    exit()

m = max(d)

cnt = collections.Counter(d)
if cnt[0] != 1:
    print(0)
    exit()

ans = 1

for i in range(1, m + 1):
    if cnt[i] == 0:
        print(0)
        exit()
    ans *= pow(cnt[i - 1], cnt[i], mod)
    ans %= mod

print(ans)


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

using ll = long long;
#define mod 1000000007
#define init ios::sync_with_stdio(0), cin.tie(0);
typedef vector<int> vi;
typedef pair<int, int> pi;
#define MS(x, y) memset(x, y, sizeof(x))
#define F first
#define S second
#define PB push_back
#define MP make_pair

int main()
{
    init;

    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    cout << max({a * c, a * d, c * b, d * b});
}

Measured memory_bytes: 3620
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    int N, K;
    cin >> N >> K;

    if (K == 0)
    {
        cout << (ll)N * (ll)N << endl;
        return 0;
    }

    ll ans = 0;

    //あまりがK以上・・・bはK+1以上N以下
    reple(b, K + 1, N)
    {
        //割り切れる部分のaの個数
        ans += (N / b) * ((b - 1) - (K - 1));

        //あまり部分のaの個数
        ans += max((N % b) - (K - 1), 0);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256