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

typedef long long ll;

int main() {
    int n; cin >> n;
    int k; cin >> k;
    vector<int> b(k);
    bitset<18> bs(0);
    for(int i=0; i<k; i++){
        cin >> b[i];
        bs.set(b[i]);
    }
    
    for(int bit=0; bit < (1<<n); bit++){
        bitset<18> tmp=bs;
        for(int i=0; i<n; i++){
            if(bit & (1<<i)){
                tmp.reset(i);
            }
        }
        if(tmp.any()) continue;
        
        cout << bit <<":";
        for(int i=0; i<n; i++){
            if(bit & (1<<i)){
                cout <<" "<< i;
            }
        }
        cout << endl;
    }

}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 1000030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

int main()
{
		ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	double a,b;
	cin>>a>>b;
	double x=0.0,y=0.0,z=0.0;
	int t=0;
	
	while(t<a*1000)
	{
		t++;
		int u=t*0.08;
		int s=t*0.1;
		if(a==u&&b==s)
		{
			cout<<t;
			return 0;
		}
	}
	cout<<"-1";

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
int main()
{
    int A, B, K;
    std::cin >> A >> B >> K;

    std::vector<int> ans;
 
    for (int i = 1; i <= 100; i++) {
        if (A<i||B<i)break;
        if (A%i==0&&B%i==0) {
           ans.push_back(i);
        }
    }

    std::cout << ans[ans.size()-K] << std::endl;
}

Measured memory_bytes: 256
import collections

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

c = collections.Counter(a)
dup = c.most_common()[0][0]

id = [i for i, x in enumerate(a) if x == dup]
L = id[0]
R = id[1]

MOD = 10**9 +7
factorial = [1]
inverse = [1]

for i in range(1, N+2):
    factorial.append(factorial[i-1] * i % MOD)
    inverse.append(pow(factorial[i], MOD-2, MOD))
    

def C(n, r):
    if n < r:
        return 0
    return (factorial[n] * inverse[r] * inverse[n-r]) % MOD

print(N)
for i in range(2, N+2):
    ans = (C(N+1, i) - C(L+(N-R), i-1)) % MOD
    print(ans)

Measured memory_bytes: 24460
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 #define PI acos(-1)
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
 
 
 
const int N=2e5+100;
//ll a[200000];
 

#define lop(i,n) for(int i=0;i<n;++i)
//ll n,m,mod;
ll prefix[20000];ll prefi[20000];
int main()
{
    ll n;cin>>n;
    vector<pair<ll,ll>>v;
for(int i=0;i<n;i++){
    ll x,y;
   cin>>x>>y;
   v.push_back({y,x});
}
sort(v.begin(),v.end());ll sum=0;
for(int i=0;i<n;i++){
  
 sum+=v[i].second;
 if(sum>v[i].first){
     cout<<"No";return 0;
 }
} cout<<"Yes";

}

Measured memory_bytes: 6512
n = int(input())
h = list(map(int, input().split()))

ans = 0
tmp = 0
for i in range(n - 1):

    if h[i] >= h[i + 1]:
        tmp += 1
    else:
        if ans < tmp:
            ans = tmp
        tmp = 0
    
else:
    if ans < tmp:
        ans = tmp

print(ans)


Measured memory_bytes: 14252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace panasonic2020_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var a = CIn.ReadInt();
      var b = CIn.ReadInt();
      var c = CIn.ReadInt();

      if (c >= a + b && 4L * a * b < (long)(c - a - b) * (c - a - b))
      {
        Console.WriteLine("Yes");
      }
      else
      {
        Console.WriteLine("No");
      }
    }
  }

  static class CIn
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }
      return fieldBuffer.Dequeue();
    }

    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());

    public static string[] ReadStringArray(int n)
    {
      var array = new string[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }
      return array;
    }

    public static int[] ReadIntArray(int n)
    {
      var array = new int[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadInt();
      }
      return array;
    }

    public static long[] ReadLongArray(int n)
    {
      var array = new long[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadLong();
      }
      return array;
    }

    public static double[] ReadDoubleArray(int n)
    {
      var array = new double[n];
      for (var i = 0; i < n; i++)
      {
        array[i] = ReadDouble();
      }
      return array;
    }

    public static char[,] ReadCharMatrix(int h, int w)
    {
      var array = new char[h, w];
      for (var i = 0; i < h; i++)
      {
        var l = Console.ReadLine().ToCharArray();
        for (var j = 0; j < w; j++)
        {
          array[i, j] = l[j];
        }
      }
      return array;
    }
  }
}


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

int main(){
    string a,b;
    cin >> a >> b;
    string num = a + b;
    int n = stoi(num);
    bool flag = false;
    for(int i = 0; i <= n; i++){
        if(i*i == n){
            flag = true;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n=int(input())
g = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    g[a-1].append((b-1,i))
node_color = [0]*n
branch_color = [0]*(n-1)
for start_node, goal  in enumerate(g):
    #スタートの色
    color = 1
    for goal_node , i in goal:
        if node_color[start_node] == color:
            color += 1
        node_color[goal_node] = color
        branch_color[i] = color
        color += 1
        
print(max(branch_color))
for i in branch_color:
    print(i)

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

#define INF 123456789

int N, M, a[5000], b[5000], c[5000];
int dist[100][100], ans;
bool shortest;

int main(void)
{
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i) { scanf("%d%d%d", &a[i], &b[i], &c[i]); }

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < N; ++j)
		{
			if (i == j)
			{
				dist[i][j] = 0;
			}
			else
			{
				dist[i][j] = INF;
			}
		}
	}
	for (int i = 0; i < M; ++i)
	{
		dist[a[i] - 1][b[i] - 1] = std::min(dist[a[i] - 1][b[i] - 1], c[i]);
		dist[b[i] - 1][a[i] - 1] = std::min(dist[b[i] - 1][a[i] - 1], c[i]);
	}
	for (int k = 0; k < N; ++k)
	{
		for (int i = 0; i < N; ++i)
		{
			for (int j = 0; j < N; ++j)
			{
				dist[i][j] = std::min(dist[i][j], dist[i][k] + dist[k][j]);
			}
		}
	}
	ans = M;
	for (int i = 0; i < M; ++i)
	{
		shortest = false;
		for (int j = 0; j < N; ++j)
		{
			if (dist[j][a[i] - 1] + c[i] == dist[j][b[i] - 1])
			{
				shortest = true;
			}
		}
		if (shortest == true)
		{
			--ans;
		}
	}

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

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BPowerSocket solver = new BPowerSocket();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPowerSocket {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt(), c = 1, ans = 0;
            while (c < b) {
                c += a - 1;
                ans++;
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 23380
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element


//10^32

int N;
int A[200010];

signed main()
{
	cin >> N;
	REP(i, N) cin >> A[i];

	int S = 0;
	REP(i, N)
	{
		S ^= A[i];
	}

	REP(i, N)
	{
		int a = S ^ A[i];
		cout << a << " ";
	}
	cout << endl;
}



Measured memory_bytes: 5164
#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

//10進数1桁の文字を整数型にする
int toInt(char c){
	return c - '0';
}

int main(){
	const char buttonTable[10][5]={{},//確定ボタン　0
							{'.', ',' ,'!', '?', ' '},//1 (5)
							{'a','b','c'},//2 (3)
							{'d','e','f'},//3 (3)
							{'g','h','i'},//4 (3)
							{'j','k','l'},//5 (3)
							{'m','n','o'},//6 (3)
							{'p','q','r','s'},//7 (4)
							{'t','u','v'},//8 (3)
							{'w','x','y','z'}};//9(4)
	const int bsize[10] = {0,5,3,3,3,3,3,4,3,4};//ボタンの文字の種類
	
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		char command[1025];//char command[1025];
		cin >> command;
		int len = strlen(command);
		char result[76];//作ったメッセージ。サイズは[1,76) \0を忘れずに
		int idx = 0;//resultの入力場所
		int row=0;//ボタンを押した場所。表の行(row)
		int col=0;//同じボタンを押した回数。表の列(column)
		for(int j=0;j<len;j++){
			int button = toInt(command[j]);
			if(button == 0){
				if(row != 0){//文字を入力できる
					result[idx] = buttonTable[row][col];
					idx++;
					row = 0;
					col = 0;
				}
			}else if(button == row){
				col = (col+1)%bsize[button];
				
			}else{//文字を決定した次のコマンド
				row = button;
				//colの値は必ず0
			}
		}
		result[idx] = '\0';
		cout <<result << endl;
		/*for(int i=0;i<idx;i++){//文字列はidx文字ある
			cout << result[i];
		}
		cout << endl;
		*/
	}
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(void) {
    string s;
    cin >> s;
    cout << s.substr(0,5)+' '+s.substr(6,7)+' '+s.substr(14,5);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#define MAXN 200006
#define MOD 1000000007
using namespace std;
int n,X,Y,c,p,fa[MAXN],cnt,a[MAXN],minone,tot,sum[MAXN],co,mintwo;
long long fac[MAXN],inv[MAXN];
vector<int> v[MAXN];
long long ksm(long long x,int p)
{
	if(!p) return 1;
	long long nex=ksm(x,p/2);
	nex=nex*nex%MOD;
	if(p%2) nex=nex*x%MOD;
	return nex;
}
void waiting()
{
	fac[0]=1;
	for(int i=1;i<MAXN;i++)
		fac[i]=1ll*fac[i-1]*i%MOD;
	inv[MAXN-1]=ksm(fac[MAXN-1],MOD-2);
	for(int i=MAXN-2;i>=0;i--)
		inv[i]=1ll*inv[i+1]*(i+1)%MOD;
}
int root(int x)
{
	if(fa[x]==x) return x;
	fa[x]=root(fa[x]);
	return fa[x];
}
int main()
{
	//freopen("colorball.in","r",stdin);
	//freopen("colorball.out","w",stdout);
	waiting();
	scanf("%d%d%d",&n,&X,&Y);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&c,&p);
		v[c].push_back(p);
		fa[i]=i;
	}
	long long ans;
	for(int i=1;i<MAXN;i++)
		if(v[i].size()) sort(v[i].begin(),v[i].end());
	for(int i=1;i<MAXN;i++)
	{
		for(int j=0;j<(int)v[i].size();j++)
		{
			a[++cnt]=v[i][j];
			v[i][j]=cnt;
			if(a[cnt]+a[cnt-j]<=X) fa[cnt]=cnt-j;
		}
	}
	a[0]=MOD;
	co=0;
	minone=0;
	for(int i=1;i<MAXN;i++)
		if(v[i].size())
		{
			if(a[v[i][0]]<a[minone])
			{
				co=i;
				minone=v[i][0];
			}
		}
	for(int i=1;i<MAXN;i++)
	{
		if(co==i) continue;
		for(int j=0;j<(int)v[i].size();j++)
			if(a[minone]+a[v[i][j]]<=Y) fa[root(v[i][j])]=minone;
	}
	for(int i=1;i<MAXN;i++)
	{
		if(co==i||v[i].size()==0) continue;
		if(a[v[i][0]]<a[mintwo]) mintwo=v[i][0];
	}
	if(a[mintwo]+a[minone]>Y) mintwo=0;
	if(mintwo)
	{
		for(int j=0;j<(int)v[co].size();j++)
			if(a[mintwo]+a[v[co][j]]<=Y) fa[root(v[co][j])]=minone;
	}
	for(int i=1;i<MAXN;i++)
		for(int j=0;j<(int)v[i].size();j++)
			if(root(v[i][j])==minone)
			{
				tot++;
				sum[i]++;
			}
	ans=fac[tot];
	for(int i=1;i<MAXN;i++)
		if(sum[i]) ans=ans*inv[sum[i]]%MOD;
	printf("%lld",ans);
}

Measured memory_bytes: 14720
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include<bits/stdc++.h>

using namespace std;

typedef long long  ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;

#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define ins insert
#define pi  3.14159265359
#define mod 1000000007
#define si(x) int(x.size())
#define FOOR(i, a, b)  for (int i=a; i<=(b); i++)
#define FOR(i, a)  for (int i=0; i<(a); i++)
#define FOORd(i,a,b)  for (int i = (b)-1; i >= a; i--)
#define FORd(i,a)  for (int i = (a)-1; i >= 0; i--)




int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    string s;
    cin>>s;
    int maxx=0,cnt=0;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='R')cnt++;
        else cnt=0;
        maxx=max(cnt,maxx);
    }
    cout<<maxx<<endl;




}


Measured memory_bytes: 3592
module Main where

import Control.Applicative
import Text.Printf
import Numeric

main :: IO ()
main = do
  { [r] <- getDoubles
  ; let area = pi * r ^ 2
  ; let peri = 2 * pi * r
  ; putDoubles [area, peri]
  }

--

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine

putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble x = showFFloat Nothing x ""



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

using namespace std;

int main(void) {
  string S;
  cin >> S;

  if (S.length() % 2 == 1)
  {
    cout << "No" << endl;
    return 0;
  }

  for (size_t i = 0; i < S.length(); i += 2)
  {
    if (S[i] != 'h' || S[i + 1] != 'i')
    {
      cout << "No" << endl;;
      return 0;
    }
  }

  std::cout << "Yes" << endl;

  return 0;
}


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

using namespace std;
int n,k,a,sn,arr[1000],ans=0;
int main(){
 
  cin>>n>>k;
  
  for(int i=0;i<k;i++)
  {
    cin>>sn;
    for(int j=0;j<sn;j++)
    {
      cin>>a;
      arr[a]++;
    }
  }
  for(int i=1;i<=n;i++)
  {
    if(arr[i]==0)
      ans++;
  }
  cout<<ans<<endl;
return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pi;

#define fi first
#define se second

int read() {
  int res = 0, w = 1; char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), w = -1;
  while (isdigit(c)) res = (res << 1) + (res << 3) + c - '0', c = getchar();
  return res * w;
}

const int N= 510;

int n, m, dp[N][N];
pi val[N];

void add(int &a, int b) {
  if ((a += b) >= m) a -= m;
}

void sub(int &a, int b) {
  if ((a -= b) < 0) a += m;
}

int mul(int a, int b) {
  return 1ll * a * b % m;
}

int main() {
#ifdef dream_maker
//  freopen("tst.in", "r", stdin);
#else
  //freopen(".in", "r", stdin);
  //freopen(".out", "w", stdout);
#endif
  n = read(), m = read();
  int a = 2 * n - 1, b = 2 * n - 1;
  for (int i = 0; i < 2 * n; i++) {
    while (i * i + a * a >= n * n && a >= 0) a--;
    while (i * i + b * b > 4 * n * n && b >= 0) b--;
    if (a < 0) val[i + 1] = pi(b + 1, 0);
    else val[i + 1] = pi(a + 1, b + 1);
  }
  sort(val + 1, val + 2 * n + 1);
//  for (int i = 1; i <= 2 * n; i++) cout << val[i].first << " : " << val[i].second << endl;
  int ans = 0;
  for (int k = 0; k <= n; k++) {
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    int f = 0, g = 0;
    for (int i = 1; i <= 2 * n; i++) {
      for (int j = 0; j <= k; j++) {
        if (val[i].second) {
          if (j) add(dp[i][j], mul(dp[i - 1][j - 1], val[i].first - j - g + 1));
          add(dp[i][j], mul(dp[i - 1][j], val[i].second - k - n - (f - j)));
        } else {
          add(dp[i][j], mul(dp[i - 1][j], val[i].first - j - g));
        }
      }
      f += val[i].second != 0;
      g += val[i].second == 0;
    }
//    cout << k << " " << dp[2 * n][k] << endl;
    if (k & 1) sub(ans, dp[2 * n][k]);
    else add(ans, dp[2 * n][k]); 
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	VI a(n+1), b(n);
	rep(i, n+1) cin >>a[i];
	rep(i, n) cin >>b[i];
	
	ll sm = accumulate(all(a), 0LL);
	ll ans=0;
	rep(i, n){
		if(b[i]>0){
			if(a[i] >= b[i]){
				a[i] -=b[i]; b[i]=0;
			}else {
				b[i] -=a[i]; a[i]=0; 
			}
		}
		if(b[i]>0){
			if(a[i+1] >= b[i]){
				a[i+1] -=b[i]; b[i]=0;
			}else{
				b[i] -=a[i+1]; a[i+1]=0;
			}
		}
	}
	ll zn = accumulate(all(a), 0LL);
	cout << sm - zn <<"\n";
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    cout << 48 - n << endl;
    return 0;
}



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

int main() {
  vector<string> s(1);
  cin >> s.at(0);
  int cnt = 0;
  for (int i = 0; i < s.at(0).size(); i++) {
  	if (s.at(0).at(i) == '1') {
  		cnt++;
  	}
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
'use strict';

const permutation = ({ result = [], pre = [], post, n = post.length }) => {
  if (n > 0) {
    post.forEach((_, i) => {
      const rest = [...post];
      const elem = rest.splice(i, 1);
      permutation({ result, pre: [...pre, ...elem], post: rest, n: n - 1});
    });
  } else {
    result.push(pre);
  }
  return result;
};

function Main(inputs) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const input = inputs.split("\n");
  const n = Number(input[0]);
  const p = input[1];
  const q = input[2];

  const perm = permutation({ post: (new Array(n)).fill(0).map((_, i) => (i + 1)) }).map((v) => (v.join(' ')));
  const a = perm.indexOf(p);
  const b = perm.indexOf(q);

  console.log(Math.abs(a - b));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

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

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

	return false;
}

const int MAX_N = 1e2 + 10;
const int MAX_W = 1e5 + 10;
const long long INF = 1LL << 60;

int N, W, w[MAX_N], v[MAX_N];
long long dp[MAX_N][MAX_W];
int main()
{
	cin >> N >> W;
	for (int i = 0; i < N; ++i)
	{
		cin >> w[i] >> v[i];
	}

	for (int i = 0; i < MAX_N; ++i)
	{
		for (int j = 0; j < MAX_W; ++j)
		{
			dp[i][j] = -INF;
		}
	}

	dp[0][0] = 0;

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

	long long res = 0;
	for (int i = 0; i <= W; ++i)
	{
		if (res < dp[N][i])
		{
			res = dp[N][i];
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 86144
m, n = map(int, input().split())

a = list(map(int, input().split()))
b = []


for i in range(n - 1):
  ss = a[i + 1] - a[i]
  b.append(ss)

b.append((m + a[0]) - a[n - 1])

b.sort()
res = 0
for i in range(len(b) - 1):
  res += b[i]
print(res)


Measured memory_bytes: 25832
using System;
using System.Collections.Generic;

class MainClass
{
    public static void Main(string[] args)
    {
        List<int> input=new List<int>(10000);
        int tmp=0;

        while(true){
            tmp=Convert.ToInt32(Console.ReadLine());
            if(tmp==0) break;
            input.Add(tmp);
        }
        
        for(int i=0;i<input.Count;i++)
        {
            Console.WriteLine("Case {0}: {1}",i+1,input[i]);
        }
    }
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

ll N,M;
vector<PLL> tasks;

template <typename T>
class SegTree {
 private:
    int _n;
    T _init_val;
    std::vector<T> _data;
    std::function<T(T, T)> _f;

    T _query(int a, int b, int k, int l, int r) {
        // [a b)と[l r]が交差しない
        if (r <= a || b <= l) return _init_val;

        // [a b)が[l r]を含む
        if (a <= l && r <= b) return _data[k];

        T vl = _query(a, b, k*2+1, l, (l+r)/2);
        T vr = _query(a, b, k*2+2, (l+r)/2, r);

        return _f(vl, vr);
    }

 public:
    SegTree(int n, T init_val, std::function<T(T, T)> f) {
        _init_val = init_val;
        _n = 1;
        _f = f;

        while (_n < n)
            _n *= 2;
        _data.resize(2 * _n, init_val);
    }

    T get(int k) {
        return _data[k + _n - 1];
    }

    void update(int k, T a) {
        k += _n-1;
        _data[k] = a;
        while (k > 0) {
            k = (k-1)/2;
            _data[k] = _f(_data[k*2+1], _data[k*2+2]);
        }
    }

    // [a b)の範囲でfを適用
    T query(int a, int b) {
        return _query(a, b, 0, 0, _n);
    }

    // 先頭からチェックし，はじめてxを満たしたインデックス
    int lower_bound(T x) {
        return _lower_bound(x, 0);
    }

    int _lower_bound(T x, int k) {
        if (k >= _n-1) {
            return k - (_n - 1);  // 葉
        } else if (_data[k] < x) {
            return _n;  // 該当なし
        } else if (x <= _data[k * 2 + 1]) {
            return _lower_bound(x, k * 2 + 1);
        } else {
            return _lower_bound(x - _data[k * 2 + 1] , k * 2 + 2);
        }
    }
};

signed main() {
  cin>>N>>M;
  tasks.resize(N);
  // used.resize(M+1, false);

  SegTree<ll> st(M+1, -1, [](const ll &x, const ll &y) { return max(x,y); });
  rep(i,M+1)
    st.update(i,i);

  rep(i,N)
    cin>>tasks[i].first>>tasks[i].second;
  sort(begin(tasks), end(tasks), [](const PLL &l, const PLL &r) {
      if (l.second == r.second) {
        return r.first < l.first;
      }
      return l.second > r.second;
      });

  ll ans = 0;
  rep(i,N) {
    // ll pos = f(0, M-tasks[i].first);
    ll pos = st.query(0, M-tasks[i].first+1);
    if (pos != -1) {
      // printf("%d %d %d\n", tasks[i].first, tasks[i].second, pos);
      st.update(pos, -1);
      ans += tasks[i].second;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

//関数
//main関数
int main() {
    
    
    //入力
    long N,M;
    cin>>N>>M;
    
    vector<pair<long,long>> pairs(N);
    for(int i=0;i<N;i++){
        long a,b;
        cin>>a>>b;
        pairs.at(i)=make_pair(a,b);
    }
    //計算
    
    sort(pairs.begin(),pairs.end());
    
    
    long ans=0,remain=M,count;
    for(int i=0;i<N;i++){
        long buynum=min(remain,pairs.at(i).second);
        ans+=pairs.at(i).first*buynum;
        remain-=buynum;
        
        //cout<<pairs.at(i).first<<" "<<buynum<<endl;
        if(remain==0) break;
    }
    
    //出力
    cout<<ans<<endl;
}





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

int main(){

    long N;
    cin >> N;

    long dx = 0;
    long dy = 0;

    for(long i = 1 ; i*i <= N ; i++){

        if( N%i == 0 ){
            dx = N/i;
            dy = i;
        }
    }

    dx--; dy--;
    long dist = dx + dy;
    cout << dist << endl;

}

Measured memory_bytes: 256
-- Getting Started - Watch

import Control.Applicative
import Text.Printf

main :: IO ()
main = do
  [h, m, s] <- timeConvert <$> readLn
  printf "%d:%d:%d\n" h m s

timeConvert :: Int -> [Int]
timeConvert x = [h, m, s]
  where
    (y, s) = divMod x 60
    (h, m) = divMod y 60



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

int main(){
    int N;
    cin >> N;
    int value[N];
    int cost[N];
    int ans = 0;
    
    for(int i = 0; i < N; i++){
        cin >> value[i];
    }

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

    for(int i = 0; i < N; i++){
        if((value[i] - cost[i]) > 0){
            ans += value[i] - cost[i];
        }
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
 
/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 
 
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
 
/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;
 
/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
/* func */
 
/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;
 
/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
 
//#define int ll
//#define int long long
 
signed main()
{
  int n,x;cin>>n>>x;
  vi v1(n);
  REP(i,n)
    cin>>v1[i];
  sort(ALL(v1));
  int sum = 0;
  int cnt = 0;
  
  REP(i,n){
/*
    sum += v1[i];
    if(x < sum)
     break;
    ++cnt;
*/
    x -= v1[i];
    
    if(x == 0){
     ++cnt;
      break;
    }
    
    else if(x < 0)
      break;
    
    else if(i == n-1)
      break;
    
    ++cnt;
  }
  
  cout << cnt;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        string s = Console.ReadLine();
        Console.WriteLine((s.Length == 2?s:strReverce(s)));
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static long LCM(long a, long b)
    {
        long c = a * b;
        if (a < b) Swap(ref a, ref b);
        long d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
    public static int[] SpIntRead(char c)
    {
        return Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
    }
    public static string ToConvertBit(int N, int e)
    {
        string ret = "";
        int r = 0;
        while (N != 0)
        {
            r = N % e;
            ret += r.ToString();
            N -= r;
            N /= e;
        }
        ret = strReverce(ret);
        return ret;
    }

}


Measured memory_bytes: 11220
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> P;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef __gnu_pbds::priority_queue<int,greater<int>,pairing_heap_tag> pq;
int n,m;
int a[MAXN];
int p[MAXN],r[MAXN];
set<int> s[MAXN];
void init(int n)
{
    for(int i=1;i<=n;i++)
    {
        p[i]=i;
        r[i]=0;
    }
}
int find(int x)
{
    if(p[x]==x) return x;
    else return p[x]=find(p[x]);
}
void unite(int x,int y)
{
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) p[x]=y;
    else
    {
        p[y]=x;
        if(r[x]==r[y]) r[x]++;
    }
}
bool same(int x,int y)
{
    return find(x)==find(y);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    init(n);
    for(int i=0;i<m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        unite(u,v);
    }
    for(int i=1;i<=n;i++) s[find(i)].insert(i);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(!s[i].size()) continue;
        for(auto x:s[i]) if(s[i].count(a[x])) ans++;
    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 10752
import java.io.BufferedReader;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) throws Exception {
		
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String line2 = br.readLine();
        
        String boxx[] = line.split("");
        
        
        
        int n = boxx.length;
        int k = Integer.parseInt(line2);
        String ans =("");
        
        for(int i=0;i<n;i++){
        //    System.out.println(i);
        	if((i-1)%k == 0){
        		ans+=boxx[i];
        	}
        	
        	
        }
        System.out.println(ans);
	}

}


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

typedef int i ;
typedef double d ;
typedef string s ;

int main ()
{
    i num1 , num2 ;
    cin >> num1 >> num2 ;
    if (num1 >= num2 )
        cout << 10 << endl ;
    else
        cout << 0 << endl ;
    //its_Rashid
    return 0 ;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define F first
#define S second
#define OUT(x) cout << x << "\n"
using namespace std;
using point = pair< int,int >;
using ll = long long;

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

    OUT((k == 1 ? 0 : n - k));
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifndef ONLINE_JUDGE
#define debug(a) cout<<#a<<" --> "<<(a)<<"\n";
#define debug2(a) cout<<#a<<" --> "<<(a)<<" ";
#define HERE cout<<"here - "<<__LINE__<<"\n";
#else
#define debug(a)
#define debug2(a)
#define HERE
#endif
const ll mod = 998244353  ;
const int N = 1e5+2;


void TEST_CASES(int cas)
{
    int x,n;
    scanf("%d %d",&x,&n);
    if(n==0)
    {
        printf("%d\n",x);
        return;
    }
    vector<int>a(n);
    map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        mp[a[i]]= 1;
    }
    int mini = 1e9, ans = -1;

    for(int i=x;;i--)
    {
        if(mp[i]==0)
        {
            if(x-i<mini)
            {
                mini = x-i;
                ans = i;

            }
            break;
        }
    }
    for(int i=x;;i++)
    {
        if(mp[i]==0)
        {
            if(i-x<mini)
            {
                mini = i-x;
                ans = i;

            }
            break;
        }
    }
    printf("%d\n",ans);

}


/*

*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }

    return 0;
}



//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    string S;
    cin >> S;

    if (S == "ABC") {
        cout << "ARC\n";
    }
    else {
        cout << "ABC\n";
    }
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3616
import math
def resolve():
    A, B, H, M = map(int, input().split())
    #短針が1時間で進む角度 30c
    deg_H = 360/12
    # 長針が1分間で進む角度 6c
    deg_M = 360/60

    hr = deg_H*H + (deg_H/60)*M
    mr = deg_M*M
    deg = abs(hr-mr)
    if deg>180:
        deg = 360- deg

    # 角度をラジアンに直す
    red = (deg/180)*math.pi
    ans = math.sqrt(A*A + B*B - 2*A*B*math.cos(red))
    print(ans)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 9540
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

const int MAX_N = 2e3 + 6, MOD = 1e9 + 7;
int n, k;
int F[MAX_N * MAX_N];
int D[MAX_N * MAX_N];
int dp[MAX_N][MAX_N];

int _sum(int a, int b) {
	int c = a + b;
	if (MOD <= c)
		c -= MOD;

	return c;
}

int _mul(int a, int b) {
	int res = 1LL * a * b % MOD;
	return res;
}

int _pow(int a, int b) {
	if (!b)
		return 1;

	int res = _pow(a, b >> 1);
	res = _mul(res, res);

	if (b & 1)
		res = _mul(res, a);

	return res;
}

int choose(int a, int b) {
	if (b < a || min(a, b) < 0)
		return 0;

	return _mul(F[b], _mul(D[a], D[b - a]));
}

void pre_process() {
	F[0] = 1;
	for (int i = 1; i < MAX_N * MAX_N; i++)
		F[i] = _mul(F[i - 1], i);

	D[0] = 1;
	for (int i = 1; i < MAX_N * MAX_N; i++)
		D[i] = _pow(F[i], MOD - 2);
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	pre_process();
	cin >> n >> k;
	
	if (k == 1) {
		cout << "1\n";
		return 0;
	}

	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][0] = 1;
		for (int j = 1; j <= i; j++)
			dp[i][j] = _sum(_mul(dp[i][j - 1], choose(k - 2, n * k - i - (j - 1) * (k - 1) - 1)), dp[i - 1][j]);
	}

	cout << _mul(dp[n][n], F[n]) << "\n";
	return 0;
}


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

#define pb push_back

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 12345 + 10;
const ll INF = (ll) 9223372036854775;
const ld EPS = (ld) 1e-8;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll A,B,C;
	cin >> A >> B >> C;
	ll s = A + B+ C;
	ll mx = max({A,B,C});
	if(mx == min({A,B,C})) cout << "Yes";
	else cout << "No";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;

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

int arr[32]={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};
int n;
cin>>n;
cout<<arr[n-1];
	
}

Measured memory_bytes: 256
from math import floor

m=0
M=10**9+1

N,K=map(int,input().split())
A=list(map(int,input().split()))

def OK(p):
    if sum([(a-1)//p for a in A])<=K:
        return True
    else:
        return False

while M-m>1:
    p=(m+M)//2
    if OK(p):
        M=p
    else:
        m=p
print(M)

Measured memory_bytes: 31108
#include<stdio.h>
int length(const char s[])
{
  int i,j=0,len=0,count=0,max=0;
  
  while(s[len])
    len++;
  for(i=0;i<len;i++){
     
   if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
        count++;
        j=count;
   }else{
    if(max<j){
      j=count;
      max=j;
    } 
    count=0;
   }
  }
   if(max<j)
      max=j;
      
   return max;
   
} 
int main(void){
  char str[10];
  
  scanf("%s",str);
  printf("%d\n",length(str));
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

int main()
{
  string S;
  cin >> S;
  for (int i = 0; i < S.size(); i += 2) {
    cout << S.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define reg register

using namespace std;

typedef long long ll;
const int maxn = 100005;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

struct man { int id, num; } p[maxn];

inline bool cmp(man x, man y) { return x.num < y.num; }

int main() {
    reg int n = read();
    for (reg int i = 1; i <= n; i++) p[i].num = read(), p[i].id = i;
    sort(p + 1, p + n + 1, cmp);
    for (reg int i = 1; i <= n; i++) cout << p[i].id << " ";
    cout << endl;
    return 0;
}

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

const int N = 1 << 18, H = 1 << 10, MX = 1E5 + 5, INF = 1E9 + 7;

int n, q, l, u, v[N], w[N], dp[H][MX];
vector<int> nod;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> v[i] >> w[i];
    }
    for (int i = 1; i < H && i <= n; i++) {
        for (int j = 1; j < MX; j++) {
            dp[i][j] = max(dp[i][j - 1], dp[i / 2][j]);
            if (j >= w[i]) {
                dp[i][j] = max(dp[i][j], dp[i / 2][j - w[i]] + v[i]);
            }
        }
    }
    cin >> q;
    while (q--) {
        cin >> u >> l;
        int ans = 0;
        nod.clear();
        while (u >= H) {
            nod.push_back(u);
            u /= 2;
        }
        for (int msk = 0; msk < (1 << nod.size()); msk++) {
            int sv = 0, sw = 0;
            for (int i = 0; i < nod.size(); i++) {
                if (msk >> i & 1) {
                    sv += v[nod[i]];
                    sw += w[nod[i]];
                    if (sw > l) {
                        break;
                    }
                }
            }
            if (sw > l) {
                continue;
            }
            ans = max(ans, sv + dp[u][l - sw]);
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 405348
// AOJ 0092: Square Searching
// 2017.8.12 bal4u@uu
// 2017.11.1 retry

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

int dp[1001][1001];
char map[1001][1005];

int main()
{
    int n, r, c, t, ans;
    char buf[10];

    while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);
		for (r = 0; r < n; r++) fgets(map[r], 1005, stdin);

		memset(dp, 0, sizeof(dp));
		for (r = 0; r < n; r++) if (map[r][0] != '*') dp[r][0] = 1;
		for (c = 0; c < n; c++) if (map[0][c] != '*') dp[0][c] = 1;
		for (ans = 0, r = 1; r < n; r++) for (c = 1; c < n; c++) {
			if (map[r][c] == '*') dp[r][c] = 0;
			else {
				t = dp[r-1][c  ];
				if (dp[r  ][c-1] < t) t = dp[r  ][c-1];
				if (dp[r-1][c-1] < t) t = dp[r-1][c-1];
				dp[r][c] = ++t;
				if (t > ans) ans = t;
			}
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 6536
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a;
	cin>>a;
	if(a==7||a==5||a==3){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int p[101000],a[1010000];
int Find(int x){
    if(x == p[x]) return x;
    else return p[x] = Find(p[x]); // 경로 압축
}
void Union(int x, int y){
    x = Find(x);
    y = Find(y);
    p[y] = x;
}
int main(){
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=n;i++) p[i] = i;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        Union(a,b);
    }
    int cnt = 0;
    for(int i=1;i<=n;i++){
        if(Find(a[i]) == Find(i)) cnt++;
    }
    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define mp make_pair
#define maxn 200005
using namespace std;
const int inf = 0x3f3f3f3f;
const int neginf = 0xc0c0c0c0;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
char s[maxn];
vector <int> adj[maxn];
bool inque[maxn];
int cnt[maxn][2],cntt[2];//0 for A,1 for B.
int main(){
	scanf("%d%d",&n,&m);
	scanf("%s",s + 1);
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		adj[u].push_back(v);
		adj[v].push_back(u);
		cnt[u][s[v] - 'A']++;
		cnt[v][s[u] - 'A']++;
	}
	queue <int> que;
	for(int i=1;i<=n;i++){
		if(cnt[i][0] == 0 || cnt[i][1] == 0){
			que.push(i);
			inque[i] = true;
		}
	}
	while(!que.empty()){
		int u = que.front();que.pop();
		for(int i=0;i<(int)adj[u].size();i++){
			int v = adj[u][i];
			cnt[u][s[v] - 'A']--;
			cnt[v][s[u] - 'A']--;
			if((cnt[v][0] == 0 || cnt[v][1] == 0 ) && !inque[v]){
				que.push(v);
				inque[v] = true;
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!inque[i]) cntt[s[i] - 'A']++;
	}
	if(cntt[0] == 0 || cntt[1] == 0) puts("No");
	else puts("Yes");
	return 0;
}


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

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<min(a,b)<<" ";
    cout<<max(0,a-(n-b))<<endl;
    return 0;
}

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

int main() {
  int a, b; cin >> a >> b;

  cout << max(0, a - b * 2) << endl;
}

Measured memory_bytes: 256
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

lis = [i for i in range(1, N+1)]
m = []

for i in itertools.permutations(lis, len(lis)):
    m.append(i)

print(abs(m.index(P) - m.index(Q)))

Measured memory_bytes: 8052