akhauriyash/Code-Regression huggingface dataset:
while 1:
    n, x = map(int, input().split())
    if n == 0 and x == 0:    break

    i = 1
    s = 0
    while i < n+1:
        j = 2
        while j < n+1:
            k = 3
            while k < n+1:
                if i < j < k:
                    #print('*', i, j, k) 
                    if i + j + k == x:
                        s = s + 1
                k = k + 1
            j = j + 1
        i = i + 1
    print(int(s))


Measured memory_bytes: 5592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;



int main()
{
    string s;
    cin >> s;
    int n = s.size();
    bool a = true;
    for(int i = 0; i < n/2; i++){
        if(s[i] != s[n-i-1]) a = false;
    }
    int k = n/2;
    for(int i = 0; i < k/2; i++){
        if(s[i] != s[k-i-1]) a = false;
        if(s[k + i + 1] != s[n-i-1]) a = false;
    }
    if(a) cout << "Yes";
    else cout << "No";
} 

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

int main()
{
  int a, b, t;
  scanf("%d %d %d", &a, &b, &t);
  int ans = 0;
  if (a <= t){
    ans = (t/a)*b;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cout << "booga" << endl
#define ll long long int
#define pb push_back
#define mp make_pair
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " -> " << a << endl;
	err(++it, args...);
}

void testcase(){
	ll n,x[200005],y[200005];
	cin >> n;
	ll c1[200005],c2[200005];
	for(int i{0};i < n;i++){
		cin >> x[i] >> y[i];
		c1[i] = x[i] + y[i];
		c2[i] = x[i] - y[i];
	}
	sort(c1,c1+n);sort(c2,c2+n);
	cout << max(c1[n-1] - c1[0],c2[n-1]-c2[0]);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t = 1;
	while(t--){
		testcase();
	}
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  for (int i = 1; i < n-1; i++) {
    if (a[i-1]<a[i]&&a[i]<a[i+1]) {
      ans++;
    }
    if (a[i-1]>a[i]&&a[i]>a[i+1]) {
      ans++;
    }
  }
  cout << ans << endl;
}


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

void solve(){
    int n;
    cin >> n;
    vector <int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    vector <int> dp(n, INT_MAX);
    dp[0] = 0;
    for(int i = 0; i < n; ++i){
        for(int j : {i+1, i+2}){
            if(j < n){
                dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]));
            }
        }
    }
    cout << dp[n-1];
}

int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("error.txt","w",stderr);
    #endif
    */
    solve();
    return 0;
}

Measured memory_bytes: 1024
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod=MOD):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

######################################################

N,A=ilint()
C=counter()
C.add(-1,3)
ans=1
for a in A:
    C.add(a)
    if a-1 not in C or C[a]>3:
        ans=0
        break
    ans*=C[a-1]-C[a]+1
    ans%=MOD
print(ans)

Measured memory_bytes: 99624
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<iostream>
#include<cctype>
#include<set>
#include<map>
#include<limits.h>
#include<cmath>
#include<stack>
#define LL long long 
#define mp(a,b) make_pair(a,b)
#define mid ((l+r)>>1)
#define For(i,p,n) for(int i=p;i<=N;i++)

#define NN 200010
#define MM 400010
using namespace std;
int N,M,T;


int main()
{
	LL a,b,c;
	
	while(cin>>a>>b)
	{
		LL ans=1;
		if(a==0||b==0||(a<0&&b>0))
		{
			ans=0;	
		}
		else 
		{
			if(((b-a)&1)||a>0)
			{
				ans=1;
			}
			else 
			{
				ans=-1;	
			}
		}
	
		
		if(ans>0)cout<<"Positive\n";
		else if(ans<0)cout<<"Negative\n";
		else cout<< "Zero\n"; 
	}
	
	
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys

sys.setrecursionlimit(10**9)

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

total = sum(A)
A.sort(reverse=True)

def check():
    for i in range(M):
        if A[i]*4*M < total:
            return 'No'
    return 'Yes'

print(check())


Measured memory_bytes: 3060
#include <stdio.h>
int a,i,t;
int main() {
 scanf("%d",&a); 
 int s[a];
 for(i=0;i<a;i++)
  {
   scanf("%d",&s[i]);
  }
 for(i=0;i<a;i++) 
  {
   if(s[i]%2==0)
   {
     if(s[i]%3==0)
      {
        s[i]=0;
      }
     else
     {
       if(s[i]%5==0)
       {
         s[i]=0;
       }  
       else
       {
         s[i]=1;
       }
     }
   }
   else
   {
     s[i]=0;
   }
  }
  for(i=0;i<a;i++) 
  {
    if(s[i]>t)
    {
     t=s[i];
    }
  }
  if(t==0)
  {
   printf("APPROVED");
  }
  if(t!=0)
  {
   printf("DENIED");
  }
  return 0;
}

Measured memory_bytes: 1724
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var s = consoleReader.String;
            var K = consoleReader.Int;
            var hashset = new HashSet<string>();
            for (int i = 0; i < s.Length; i++)
                for (int j = Math.Min(s.Length - i, K); j > 0; j--)
                    hashset.Add(s.Substring(i, j));
            return hashset.OrderBy(ss => ss).Take(K).Last();
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }
#pragma warning disable
    public class ConsoleReader
    {
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = textReader.ReadLine().Split();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.textReader.ReadLine().Split(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerable<T> Select<T>(Func<ConsoleReader, T> func) { for (int i = 0; i < count; i++) yield return func(cr); }
            public IEnumerable<string> String { get { for (int i = 0; i < count; i++) yield return cr.String; } }
            public IEnumerable<int> Int { get { for (int i = 0; i < count; i++) yield return cr.Int; } }
            public IEnumerable<double> Double { get { for (int i = 0; i < count; i++) yield return cr.Double; } }
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
}

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

int main() {
    int N;
    cin >> N;
    vector <int> A(N);
    for (int i=0; i<N; i++) cin >> A.at(i);
    int p=0;
    for (int i=0; i<N; i++) {
        if (A.at(p)==2) {
            cout << i+1 << "\n";
            return 0;
        }
        p = A.at(p)-1;
    }
    cout << "-1\n";
}

Measured memory_bytes: 640
N=input()
S=input()
Sn=[]
R=0
G=0
B=0
for i in range(len(S)):
    if S[i]=='R':
        R+=1
        Sn.append(1)
    elif S[i]=='G':
        G+=1
        Sn.append(2)
    else:
        B+=1
        Sn.append(3)

count=0
for start in range(len(S)):
        for diff in range(1,int((len(S)-start+1)/2)):
            #int(start,diff)
            if (Sn[start]-Sn[start+diff])*(Sn[start+diff]-Sn[start+(2*diff)])*(Sn[start]-Sn[start+(2*diff)])!=0: 
                count+=1
                
print(str((R*G*B)-count))

Measured memory_bytes: 68352
import java.util.Scanner;

public class Main{

	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int k = sc.nextInt();
		int result = 0;
		
		int m = Math.max(a, b);
		int max =Math.max(m, c);
		int maxt = max;
				
		for(int i = 0; i < k; i ++) {
			max *= 2;
		}
		
		result = max + a + b + c - maxt;
		
		System.out.println(result);
	}
}


Measured memory_bytes: 21076
while True:
    n = int(raw_input())
    if n == 0: break
    move = raw_input().split()
    l,r,go,count = 0,0,1,0
    for c in move:
        if c == 'lu':
            l = 1
        if c == 'ru':
            r = 1
        if c == 'ld':
            l = 0
        if c == 'rd':
            r = 0
        if l == r and l == go:
            count += 1
            go = -l + 1
    print count

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


int main() {
 string S;
  cin >> S;
  if (S == "Sunny"){
   cout << "Cloudy" <<endl; 
  }
  else if (S == "Cloudy"){cout << "Rainy"<<endl;
  
  }
  else {
   cout <<"Sunny" << endl; 
  }
  
   
}
  


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

using namespace std;

typedef long long ll;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename K, typename V> ostream& operator << (ostream& os, unordered_map<K, V> m) {
  for (auto& i : m) os << i.first << ":" << i.second << endl; return os;
}

int main() {
  int n;
  cin >> n;
  unordered_map<int, int> m;
  for (int i=0; i<n; i++) {
    int a;
    cin >> a;
    m[a]++;
  }

  if (n % 2 != 0) {
    if (m[0] != 1) {
      cout << 0;
      return 0;
    }
    for (int i=2; i<=n-1; i+=2) {
      if (m[i] != 2) {
        cout << 0;
        return 0;
      }
    }
  } else {
    for (int i=1; i<=n-1; i+=2) {
      if (m[i] != 2) {
        cout << 0;
        return 0;
      }
    }
  }
  ll mod = 1e+9+7;
  ll res = 1;
  for (int i=0; i<n/2; i++) {
    res *= 2;
    res %= mod;
  }
  cout << res << endl;
  return 0;
}


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

Measured memory_bytes: 3728
#include<iostream>

using namespace std;

int main()
{
    int m, a, k;
    int su=0;
    cin>>m>>a;
    for (int i=1;i<=a;i++){
        cin>>k;
        su=su+k;
    }
    if(su>m){
        cout<<"-1\n";
    }
    else{
        cout<<m-su<<endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
#include<map>

using namespace std;

const int maxn = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long ll;

/*
ll modpow(ll a, ll n,int md) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % md;
        a = a * a % md;
        n >>= 1;
    }
    return res;
}
*/

//const int N=200005;
ll A,B,N,maxxx,buff;
int main(){
    if(B <= N){
        maxxx = 0;
        cin >> A >> B >> N;
        ll x = ((ll)(N/B) * B) - 1;
        maxxx = ((ll)((A*x)/B)) - ( A * ((ll)(x/B)) );
        buff = ((ll)((A*N)/B)) - ( A * ((ll)(N/B)) );
        if(maxxx < buff)maxxx = buff;
        printf("%lld\n",maxxx);
    }else{
        maxxx = 0;
        cin >> A >> B >> N;
        maxxx = ((ll)((A*N)/B)) - ( A * ((ll)(N/B)) );
        printf("%lld\n",maxxx);
    }
    return 0;
}

Measured memory_bytes: 3732
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

const int MOD = 1e+9 + 7;


int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> x(n), y(m);
    for( int i = 0; i < n; ++i ) cin >> x[i];
    for( int i = 0; i < m; ++i ) cin >> y[i];


    // Δx = 1 のときの y 方向の全通りに対する面積の和を求める
    int t = m-1, b = 0;
    long long areay = 0;
    while( m > 0 ){
        areay += (long long) (m - 1) * (y[t] - y[b]) % MOD;
        areay %= MOD;
        m -= 2;
        --t, ++b;
    }

    /* Editorial と同じ回答法
    int l = 0, r = n-1;
    long long areax = 0;
    while( n > 0 ){
        areax += (long long) (n - 1) * (x[r] - x[l]) % MOD;
        areax %= MOD;
        n -= 2;
        ++l, --r;
    }
    cout << areax * areay % MOD << endl;
    */

    // x 方向の幅をかけて実際の面積にして累積和をとっておく
    vector<long long> sumAreaX(n, 0);
    for( int i = 1; i < n; ++i ){
        sumAreaX[i] = areay * (x[i] - x[i-1]) % MOD;
        sumAreaX[i] += sumAreaX[i-1] % MOD;
    }

    // sumAreaX について、上でやったのと似たことをする
    int l = 0, r = n-1;
    long long ans = 0;
    while( n > 0 ){
        ans += (long long) (n - 1) * (sumAreaX[r] - sumAreaX[l]) % MOD;
        ans %= MOD;
        n -= 2;
        ++l, --r;
    }
    cout << (ans + MOD) % MOD<< endl;
    

    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;

class Myon
{
    static Scanner cin;
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    public bool calc2()
    {

        int N = cin.nextInt();
        long[] num = new long[N];
        long sum = 0;
        for (int i = 0; i < N; i++)
        {
            num[i] = cin.nextLong();
            sum += num[i];
        }
        long div = N * (long)(N + 1) / 2;
        if (sum % div != 0) return false;
        long need = sum / div;
        long cnt = 0;

        for (int i = 0; i < N; i++)
        {
            long diff = num[i] - (num[(i + N - 1) % N] + need);
            if (diff > 0) return false;
            if (diff == 0) continue;
            if ((-diff) % N != 0) return false;
            long add = (-diff) / N;
            cnt += add;
            if (num[i] < add) return false; 
        }
        if (cnt != need) return false;
        return true;

    }

    public void calc()
    {
        if (calc2()) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
    
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        while (i >= s.Length)
        {
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
        }
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  
  for(int i = 0; i < n; i++){
    cin >> l[i];
  }

  int ans = 0;
  for(int i = 0; i < n-2; i++){
    for(int j = i+1; j < n-1; j++){
      for(int k = j+1; k < n; k++){
        vector<int> g(3);
        g[0] = l[i];
        g[1] = l[j];
        g[2] = l[k];

        sort(g.begin(), g.end());

        if(g[0] != g[1] && g[1] != g[2]){
          if(g[2] < g[0] + g[1]){
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 3632
<?php
$x=trim(fgets(STDIN));
$ans=1;
$i=floor(sqrt($x));
while($i>1){
$n=1;
while(pow($i,$n)<=$x){
$p=pow($i,$n);
++$n;
}
$ans=max($ans,$p);
--$i;
}
echo $ans;

Measured memory_bytes: 4728
#include <iostream>
#include <string>
#define inf 30000

using namespace std;

int S, T;
string s, t;
int succS[4005][2], succT[4005][2];
short dp[4005][4005], dp2[4005][4005];

void calc(string &s, int succ[4005][2])
{
	int n = (int)s.size() - 1;
	int nx[2] = {n+1, n+1};
	succ[n+1][0] = succ[n+1][1] = n+1;
	for(int i = n; i >= 0; i--){
		for(int j = 0; j < 2; j++){
			succ[i][j] = nx[j];
		}
		if(i > 0) nx[s[i]-'0'] = i;
	}
}

int main(void)
{
	cin >> s >> t;
	S = s.size(), T = t.size();
	s = "#" + s, t = "#" + t;
	
	calc(s, succS), calc(t, succT);
	
	for(int i = 0; i <= S+1; i++){
		for(int j = 0; j <= T+1; j++){
			dp[i][j] = inf;
		}
	}
	dp[0][0] = 0;
	
	for(int i = 0; i <= S+1; i++){
		for(int j = 0; j <= T+1; j++){
			if(i == S+1 && j == T+1) continue;
			for(int k = 0; k < 2; k++){
				int ni = succS[i][k];
				int nj = succT[j][k];
				dp[ni][nj] = min(dp[ni][nj], (short)(dp[i][j] + 1));
			}
		}
	}
	int dist = dp[S+1][T+1];
	
	dp2[S+1][T+1] = 0;
	for(int i = S+1; i >= 0; i--){
		for(int j = T+1; j >= 0; j--){
			if(i == S+1 && j == T+1) continue;
			dp2[i][j] = inf;
			for(int k = 0; k < 2; k++){
				int ni = succS[i][k];
				int nj = succT[j][k];
				dp2[i][j] = min(dp2[i][j], (short)(dp2[ni][nj] + 1));
			}
		}
	}
	
	int pi = 0, pj = 0; string ans;
	while(pi != S+1 || pj != T+1){
		for(int k = 0; k < 2; k++){
			int ni = succS[pi][k];
			int nj = succT[pj][k];
			if(dp[ni][nj] > dp[pi][pj] && dp[ni][nj] + dp2[ni][nj] == dist){
				pi = ni, pj = nj;
				ans += (char)(k+'0');
				break;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 65724
#include<bits/stdc++.h>
            using namespace std;
            #define rep(i,b) for(i=0;i<b;++i)
            #define repp(i,a,b) for(i=a;i<b;++i)
            #define endl "\n"
            //#define LLONG_MAX 99999999999999
            typedef long long int lli;
            int main(){
                ios_base::sync_with_stdio(false);
                cin.tie(NULL);
                lli t,n,i,j,b,a,q,m;
                lli r;
                cin>>r;
                double d=r;
                double ans=6.282*d;
                cout<<ans<<endl;

            }



Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int n, m;
	cin>>n>>m;
	
	vector<long> heights(n+1);
	
	for(int i = 1;i<=n ;i++){
		cin>>heights[i];
	}
	
	vector<vector<int> >adj_list(n+1);
	
	while(m--){
		int x1, x2;
		cin>>x1>>x2;
		adj_list[x1].push_back(x2);
		adj_list[x2].push_back(x1);
	}
	
	int ct = 0;
	
	for(int i = 1; i<=n; i++){
		if(adj_list[i].empty()){
			ct++;
			continue;
		}
		
		bool isok = true;
		for(int j = 0; j<adj_list[i].size(); j++){
			if(heights[adj_list[i][j]] >= heights[i]){
				isok = false;
				break;
			}
		}
		if(isok){
			ct++;
		}
		
	}

	cout<<ct;
	return 0;
}

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

using namespace std;

#define reg register
#define ge getchar()
#define Re read()
#define FI "a.in"
#define FO "a.out"
#define MAXN 1000

inline int read() {
	int x = 0, t = 0, ch;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = ge;
	return t ? -x : x;
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	cout << (n - a + 1) * (n - b + 1) << endl; 
	return 0;
}

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

int main(){
	int n;
	int x = 100000;
	cin >> n;
	for(int i = 0; i < n; i++){
		x = x*21/20;
		if(x % 1000 != 0){
			x = (floor(x/1000)+1)*1000;
		}
	}
	cout << x << endl;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <climits> 
#include <numeric> 
#include <iomanip> 
//#include <iterator>

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

const int MOD = 1e9+7;

string winner(vector<int>& A, int N, int K) {
    sort (A.begin(), A.end());
    vector<bool> dp(K+1, false); // remaining stones, and the current player outcome
    for (int i = 1; i <= K; ++ i) {
        if (i < A.front()) dp[i] = false; 
        else {
            // current = i, go all the way until we reach A.front, check result..
            auto p = upper_bound (A.begin(), A.end(), i);
            for (auto t = A.begin(); t != p; ++ t) {
                if (!dp[i-*t]) {
                    dp[i] = true;
                    break;
                }
            }
        }
    }
    return dp[K]?"First":"Second";
}

int main() {
    int N, K; 
    cin>>N>>K;
    vector<int> A(N);
    for (auto& s : A) cin>>s;
    cout<< winner(A, N, K)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[100003];
int main()
{
	int N, t, imax = 0;
	cin >> N;
	while (N--)
	{
		cin >> t;
		a[t]++;
		a[t + 1]++;
		a[t + 2]++;
	}
	cout << *max_element(a, a + 100003) << endl;
	return 0;
}

Measured memory_bytes: 3792
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> dp(N+1,LINF);
    dp[0] = 0;
    for(int i = 0; i < N;i++){
        dp[i+1] = min(dp[i+1],dp[i] + 1);
        ll x = 6;
        while(i+x<=N){
            dp[i+x] = min(dp[i+x],dp[i]+1);
            x *= 6;
        }
        x = 9;
        while(i+x<=N){
            dp[i+x] = min(dp[i+x],dp[i]+1);
            x *= 9;
        }
    }
    cout << dp[N] << endl;
    return 0;
}


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

long long N, H, W;
long long a, b;

int main()
{
	while(cin>>N>>H>>W)
	{
		int count=0;
		for(int i=0;i<N;i++)
		{
			cin>>a>>b;
			if(a>=H && b>=W)
				count++;
		}
		cout<<count<<endl;

	}




	return 0;
}


Measured memory_bytes: 256
n,m=map(int, input().split())
red = [False for i in range(n)]
red[0] = True
cnt = [1 for i in range(n)]
for i in range(m):
    x,y=map(int, input().split())
    x -= 1
    y -= 1
    red[y] |= red[x]
    cnt[y] += 1
    cnt[x] -= 1
    if cnt[x] == 0:
        red[x] = False
print(red.count(True))

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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int lcm(int a, int b) { return a * b / gcd(a, b); }

int main(){
    string a;
    cin >> a;
    int n = 0, s = 0, e = 0, w = 0;
    for (int i = 0; i < a.size(); i++){
        if (a[i] == 'N'){
            n++;
        }else if(a[i] == 'S'){
            s++;
        }else if(a[i] == 'E'){
            e++;
        }else{
            w++;
        }
    }
    if(n > 0 && s == 0){
        cout << "No" << endl;
    }else if(s> 0 && n == 0){
        cout << "No" << endl;
    }else if(e > 0 && w == 0){
        cout << "No" << endl;
    }else if(w > 0 && e == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

const int N=1e5+5;

int n;
int a[N], b[N];
set<int> s;

int32_t main()
{
    IOS;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        s.insert(a[i]);
    }
    sort(a+1, a+n+1);
    cout<<a[n]<<" ";
    int ans2=a[1];
    for(int i=2;i<=n;i++)
    {   
        int store1=min(abs(a[i]-a[n]/2), abs(a[i]-(a[n]-a[n]/2)));
        int store2=min(abs(ans2-a[n]/2), abs(a[i]-(ans2-a[n]/2)));
        if(store1<store2)
        {
            ans2=a[i];
        }
    }
    cout<<ans2;
    return 0;
}

Measured memory_bytes: 5376
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
Discussion Solution Statistics Submit

Dynamic Programming - Fibonacci Number
Time Limit : 1 sec, Memory Limit : 65536 KB
=end
class Fib
  def initialize
    @fib = Hash.new
  end

  def fib(i)
    if @fib.key?(i) then
      @fib[i]
    elsif i==0 then
      @fib[0] = 1
    elsif i==1 then
      @fib[1] = 1
    else
      @fib[i] = fib(i-1) + fib(i-2)
    end
  end

end

class Main

  def initialize()
    fh=STDIN
    n = fh.gets.to_i
    f = Fib.new
    puts f.fib(n)
  end

end

if $0 == __FILE__ then
  Main.new
end

Measured memory_bytes: 8656
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, W;
	ll dp[N] = {0};
	cin >> n >> W;
	for (int i=1; i<=n; i++) {
        ll x, y;
        cin >> x >> y;
        for (int j=W-x; j>=1; j--) {
            if (dp[j]) dp[j+x] = max(dp[j+x], dp[j]+y);
        }
        dp[x] = max(dp[x], y);
	}
	ll ans = 0;
	for (int i=1; i<=W; i++) {
        ans = max(ans, dp[i]);
	}
	cout << ans;
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(auto i = k; i != n; i++)
#define rrep(i, n) RREP(i, n, 0)
#define RREP(i, n, k) for(auto i = n; i != k; i--)
#define all(x, r) (x), (x)+(r)
#define ALL(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " " << x << endl
#define exst(x, data) (data).find(x) != (data).end()
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define np next_permutation
#define b32 bitset<32>

using ll = long long;
using Pii = pair<int,int>;
using Tiii = tuple<int, int, int>;
template<class T>using V = vector<T>;

// class Kruskal {
// private:
//
//
// public:
//     int node_n;
//     vector<vector<int>> cost;
//
//
//     Kruskal(int n) {
//         node_n = n;
//     }
//
// };

const int MAX_V = 101;
int cost[MAX_V][MAX_V];
int mincost[MAX_V];
bool used[MAX_V];
int node_n;

int prim() {
    for(int i=0; i<node_n; i++) {
        mincost[i] = INT_MAX;
        used[i] = false;
    }
    mincost[0] = 0;
    int res = 0;

    while(true) {
        int v = -1;

        for(int u=0; u<node_n; u++) {
            if (!used[u] && (v == -1 || mincost[u] < mincost[v]))
                v = u;
        }
        if (v == -1) break;
        used[v] = true;
        res += mincost[v];

        for(int u=0; u<node_n; u++) {
            mincost[u] = min(mincost[u], cost[v][u]);
        }
    }
    return res;
}

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

    int n; cin >> n; node_n = n;
    rep(i,n) rep(j,n) cost[i][j] = INT_MAX;
    rep(i,n) rep(j,n) {
        int c;
        cin >> c;
        if(c != -1) cost[i][j] = c;
    }

    cout << prim() << endl;

    // rep(i,n) {rep(j,n) cout << cost[i][j] << " "; cout << endl;}
    return 0;
}



Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstring>
#include<cmath>
#include <numeric>
#include<queue>
#include<climits>
#include<cstdio>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
//#define INF ((LLONG_MAX) / (2))
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
typedef pair<ll,int> LL_IP;
#define INF 1e9+7




int main(){

    ll a,b,c;
    bool flag = true;
    ll count = 0;

    cin >> a >> b >> c;

    if(a == b && b == c){
        if(a == 1){
            count = 0;
        }else{
            count = -1;
        }
        flag = false;
    }


    while(flag){
      
        ll tmp_a = a,tmp_b = b,tmp_c = c;
        if(tmp_a % 2 == 1 || tmp_b % 2 == 1 || tmp_c % 2 == 1){
            flag = false;
        }else{
            a = tmp_b/2 + tmp_c/2;
            b = tmp_a/2 + tmp_c/2;
            c = tmp_a/2 + tmp_b/2;
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

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


using namespace std;
using ll = long long;

unordered_map<string, int> mp;
void print(string st) {
    cout << st << " "
         << "x"
         << " " << mp[st] << "\n";
}
int main() {
    int n;
    cin >> n;
    string st;
    for(int i = 0; i < n; i++) {
        cin >> st;
        mp[st]++;
    }
    print("AC");
    print("WA");
    print("TLE");
    print("RE");



    return 0;
}



Measured memory_bytes: 3628
using System;

namespace atcoder_practice1
{
    class _169D
    {
        static void Main()
        {
            long N; 
            int count;
            int answer = 0;

            string x = Console.ReadLine();

            N = long.Parse(x);

            long max_iter = (long) Math.Sqrt(N);

            for (long i = 2; i <= max_iter; i++)
            {
                count = 0;
                while (N % i == 0)
                {
                    N /= i;
                    count++;
                }
                answer += (int)((-1 + Math.Sqrt(1 + 8 * count)) / 2);
            }
            if(N!=1)
            {
                answer += 1;
            }
            
            Console.WriteLine(answer);
        }
    }
}

Measured memory_bytes: 27536
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define INF (1 << 30)
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
const long long mod = 1e9+7;

using namespace std;
using ll = __int64_t;
using ull = unsigned long long;

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

bool comp(const pair<int, ll>& p1, const pair<int, ll>& p2){
    return p1.second > p2.second;
}

const int limit = 50;

int n, m;
int a[limit], b[limit];

bool graph[limit][limit];
bool visited[limit];

void dfs(int v){
    visited[v] = true;
    for(int v2 = 0; v2 < n; v2++){
        if(!graph[v][v2]) continue;
        if(visited[v2]) continue;
        dfs(v2);
    }
}
void solve(){
    cin >> n >> m;

    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    int ans = 0;

    for(int i = 0; i < m; i++){
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

        for(int j = 0; j < n; j++) visited[j] = false;
        dfs(0);

        bool bridge = false;
        for(int j = 0; j < n; j++) if(!visited[j]) bridge = true;
        if(bridge) ans++;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    cout << ans << endl;
}

int main() {
    solve();
    return 0;
}

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

using pii = pair<int,int> ;
using pll = pair<long,long> ;
using umpii = unordered_map<int,int> ;
using mpii = map<int,int> ;

#define f first
#define s second

int32_t main(){
	double a , b ;
	cin >> a >> b;
	cout << ceil((b-1)/(a-1)) ;
	return 0 ;
}



Measured memory_bytes: 256
import java.util.InputMismatchException;
import java.util.Scanner;

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

		try {
			int num = sc.nextInt();

			int[] values = new int[num];
			int count = 0;

			for(int i = 0; i < values.length; i++) {
				values[i] = sc.nextInt();

				if(isPrime(values[i])) {count++;}
			}

			System.out.println(count);
		} catch(InputMismatchException ex) {
			ex.printStackTrace();
		} finally {
			sc.close();
		}
	}

	private static boolean isPrime(int val) {
		if(val == 2 || val == 3) {return true;}
		if(val % 2 == 0) {return false;}

		for(int i = 3; i <= Math.sqrt((double)val); i += 2) {
			if(val % i == 0) {return false;}
		}

		return true;
	}
}



Measured memory_bytes: 41128
#include <bits/stdc++.h>
using namespace std;
long long const Mod = 1e9 + 7;
int main() {
	int n ;
	scanf("%d",&n);
	int arr[1000005] , num;
	memset(arr,0,sizeof arr);
	long long ans = 1;
	for(int i = 0 ; i < n ; ++i){
		scanf("%d",&num);
		arr[num]++;
		if(n % 2 == 0){
			if(num >= n || num % 2 == 0 || arr[num] > 2){
				 puts("0");	return 0;
			}
			if(arr[num] == 1){
				 ans *= 2;
				 ans %= Mod;
				 //cout<<"num : "<<num<<"\n";
			}
		}
		else{
			if(num >= n || num % 2 != 0 || arr[num] > 2 || arr[0] > 1){
				 puts("0");	return 0;
			}
			if(num != 0 && arr[num] == 1){
				 ans *= 2;
				 ans %= Mod;
				 //cout<<"num : "<<num<<"\n";
			}
		}
	}
	printf("%lld", ans);
	return 0;
}
/*
First of all, this question should be discussed according to the parity of n.
When n is even:
The data given must be an odd number, because the number of people on the left and right must be a strange one. The difference is definitely odd.
When n is odd:
The data given must be even, because the number of people on the left and right must be two odd or the difference between two even must be even. In addition, pay attention to zero when the data is 0 is only one possibility that this person is standing in the middle and another 0 can only appear once. If there are two times, the data is wrong.
*/

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

int main()
{

  int h=0;
  int m=0;
  int s=0;
  int S=0;

  cin>>S;
  
  while(1){
    if(S>=3600){
      S=S-3600;
      h++;
    }
    else break;
  }  
  
  while(1){
    if(S>=60){
      S=S-60;
      m++;
    }
    else break;
  }

  s=S;

  cout<< h << ":" <<  m << ":" << s <<endl;

  return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>

using namespace std;

int main(void){

  int a,b;

  cin>>a;
  cin>>b;

  if(a>b) cout << a-1 << endl;
  else cout << a << endl;
  
  return 0;
}


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

long long N;
//           point   , position
vector<pair<long long, long long> >P;
set<long long> position;

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long point;
		cin >> point;
		P.push_back(make_pair(point, i));
	}
	sort(P.begin(), P.end(), greater<pair<long long, long long>>());


	long long num = 0;
	for(long long i = 0; i < P.size(); i++){
		long long pos = P[i].second;
		long long point = P[i].first;
		//cout << "point = " << point << endl;

		//左で大きいのを取る
		set<long long>::iterator it = position.upper_bound(pos);
		if(position.begin() != it){
			//取れる右の最大値
			long long rightMin = pos;
			long long rightMax = N - 1;
			if(it != position.end()){
				rightMax = *(it) - 1;
			}

			//取れる左の最小値
			long long leftMin = 0;
			long long leftMax = *(prev(it));
			if(position.begin() != prev(it)){
				leftMin = *(prev(prev(it))) + 1;
			}
			//cout << "get left left" << leftMin << " - " << leftMax << " right " << rightMin << " - " << rightMax << endl;
			num += (point) * (leftMax - leftMin + 1) * (rightMax - rightMin + 1);
		}


		//右で大きいのを取る
		if(position.end() != it){
			//取れる右の最大値
			long long rightMin = *it;
			long long rightMax = N - 1;
			if((next(it)) != position.end()){
				rightMax = *(next(it)) - 1;
			}

			//取れる左の最小値
			long long leftMin = 0;
			long long leftMax = pos;
			if(it != position.begin()){
				leftMin = (*(prev(it))) + 1;
			}
			//cout << "get right left" << leftMin << " - " << leftMax << " right " << rightMin << " - " << rightMax << endl;
			num += (point) * (leftMax - leftMin + 1) * (rightMax - rightMin + 1);
		}
		position.insert(pos);
	}

	cout << num << endl;
}



Measured memory_bytes: 6512
h,w,n=map(int,input().split())
dic={}
s=set()
dx=[-2,-1,0]
dy=[-2,-1,0]
for i in range(n):
  a,b=map(int,input().split())
  a-=1
  b-=1
  for i in range(3):
    for j in range(3):
      ny=a+dy[i]
      nx=b+dx[j]
      if 0<=ny<h and 0<=nx<w and ny+2<h and nx+2<w:
        if not (ny,nx) in s:
          s.add((ny,nx))
          dic[(ny,nx)]=1
        else:
          dic[(ny,nx)]+=1
l=list(dic.values())
cnt=[0]*10
for i in range(len(l)):
  cnt[l[i]]+=1
print((h-2)*(w-2)-len(l))
for i in range(1,10):
  print(cnt[i])

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll N;
  cin >> N;

  ll result = 1e13;
  ll j = 0;
  for (int i = 1; i <= sqrt(N); ++i) {
    j = N / i;

    if (i * j == N) {
      result = min(result, static_cast<ll>(i + j - 2));
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
sh, sw = 1,1
gh, gw = H,W

S = [0]*(H+2)
S[0] = '*'*(W+2)
S[H+1] = '*'*(W+2)
white = 0
for h in range(1,H+1):
    S[h] = '*' + input() + '*'
    white += S[h].count('.')

visited = [[False]*(W+2) for _ in range(H+2)]
dh = [0,1,0,-1]
dw = [1,0,-1,0]

from collections import deque
d = deque()

visited[sh][sw]=True
d.append((sh,sw,1))

while len(d)>0:
    h,w,cnt = d.popleft()
    for i in range(4):
        h0 = h+dh[i]
        w0 = w+dw[i]
        if (h0,w0) == (gh,gw):
            print(white-cnt-1)
            break
        if S[h0][w0]=='.' and visited[h0][w0]==False:
            visited[h0][w0]=True
            d.append((h0,w0,cnt+1))
    else:
        continue
    break
else:
    print(-1)

Measured memory_bytes: 40560
#include <bits/stdc++.h>
using namespace std ;
unsigned long long temp,a[200010];
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	if(m>=n){
		cout<<0<<endl;
	}
	else{
		for(int i=0;i<n-m;i++){
			temp+=a[i];
		}
		cout<<temp<<endl;
	}
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const int INF = 100100100;
typedef long long ll;
 
int main() {
   string s;
   cin >> s;
   vector<char> ans;

   rep(i,s.size()){
      if(s[i]=='0')
      ans.push_back('0');
      else if(s[i]=='1')
      ans.push_back('1');
      else if(s[i]=='B' && ans.size()!=0)
      ans.pop_back();
   }

   rep(i,ans.size())
   cout << ans[i];
   cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,m,a[10001],sum=0;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("test.inp","r",stdin);
    //freopen("test.out","w",stdout);
    cin>>n>>m;
    for (int i=1;i<=m;i++) { cin>>a[i]; sum+=a[i];}
    if (n-sum>=0)
    cout<<n-sum;
    else
    {
        cout<<-1;
    }
    
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int N, T;
int A[3000], B[3000];
int dp[3001][3001];

using int3 = tuple<int, int, int>;

int main() {
	cin >> N >> T;
	REP(i, N) scanf("%d %d", A + i, B + i);
	vector<int3> ord(N);
	REP(i, N) ord[i] = make_tuple(A[i], -B[i], i);
	sort(ALL(ord));
	
	memset(dp, -1, sizeof(dp));
	dp[0][0] = 0;
	REP(i, N) {
		int idx = get<2>(ord[i]);
		
		REP(j, T + 1) {
			if (dp[i][j] == -1) continue;
			chmax(dp[i + 1][j], dp[i][j]);
			if (j < T) chmax(dp[i + 1][T], dp[i][j] + B[idx]);
			if (j + A[idx] <= T) chmax(dp[i + 1][j + A[idx]], dp[i][j] + B[idx]);
		}
	}
	
	cout << dp[N][T] << endl;
	
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define alpha_size 26


int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  
   string s, t;
   cin >> s >> t;
   for (int i = 0; i < s.size(); i++){
    if (s[i] != t[i]){
      cout << "No" << endl;
      return 0;
    }
   }
  cout << "Yes" << endl;
}

Measured memory_bytes: 3636
import sys
readline = sys.stdin.readline
N, Q = map(int, readline().split())
S = readline()
C = [readline().strip().split() for i in range(Q)]
C.reverse()
l = -1; r = N
for t, d in C:
    if d == 'L':
        if l+1 < N and S[l+1] == t:
            l += 1
        if r < N and S[r] == t:
            r += 1
    else:
        if r-1 >= 0 and S[r-1] == t:
            r -= 1
        if l >= 0 and S[l] == t:
            l -= 1
print(r-l-1)

Measured memory_bytes: 81072
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    ll H, W;
    cin >> H >> W;
    if(H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << (H * W) / 2 + ((H * W) % 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
using namespace std;
vector<vector<int>> dp;
vector<vector<bool>> edges;
#define TMP 9

ll memo(int a, int p, int end){
    if(dp[a][p] != -1){
        return dp[a][p];
    }
    if(p == end){
        return dp[a][p] = 1;
    }
    ll ans = 0;
    rep(i, edges.size()){
        bitset<TMP> pb = (p);
        if(edges[a][i] && !(pb[i])){
            pb.set(i);
            int p_n = pb.to_ulong();
            ans += memo(i, p_n, end);
        }
    }
    return (dp[a][p] = ans);
}


int main(){
    int N, M;
    cin >> N >> M;
    int size = (1 << (N));
    dp = vector<vector<int>>(N, vector<int>(size, -1));
    edges = vector<vector<bool>>(N, vector<bool>(N, false));
    rep(i, M){
        int a, b;
        cin >> a >> b;
        a --;
        b --;
        edges[a][b] = edges[b][a] = true;
    }

    ll ans = memo(0, 1, size - 1);

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	char S[10];scanf("%s",S);
	bool d[30]={};
	for(int i=0;i<3;i++)
	{
		if(d[S[i]-'a'])
		{
			puts("No");
			return 0;
		}
		d[S[i]-'a']=true;
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 128
/*
[abc134] A - Dodecagon
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

int r;

ll solve() { return 3 * r * r; }

int main() {
    cin >> r;

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 256
#nとk進数
n, k = map(int, input().split())

#nをkで割った時の商
#s = n//k
dm = [n,0]
ha = ''
#nをkで割った余りをつなげることの繰り返し
while dm[0] > 0:
	dm = divmod(dm[0],k)
	ha += str(dm[1])


print(len(ha))

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
long long a[n];
for(long long i=0;i<n;i++){
    cin>>a[i];
}
long long b[n];
long long sum=0;
for(long long i=0;i<n;i++){
    sum^=a[i];
}
for(long long i=0;i<n;i++){
    b[i]=sum^a[i];
}
for(long long i=0;i<n;i++){
    if(i==n-1){
        cout<<b[i]<<endl;
    }
    else{
        cout<<b[i]<<' ';
    }
}
    return 0;
}


Measured memory_bytes: 6612