akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll a, b, c;
	cin>>a>>b;
	cout<<a*a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int a,b; cin >> a >> b;
    if (a > 8 || b > 8) {
        cout << ":(" << endl;
    }
    else {
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 3640
S=str(input())
 
if S.count('R')==0:
  print(0)
if S.count('R')==1 :
  print(1)
if S.count('R')==2 and not S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)

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

using namespace std;

typedef long long int ll;

int a[101][101], ans;
int main() {
    int w, h, n;
    cin >> w >> h >> n;
    
    for (int i = 0; i < n; i++) {
        int x1, y1, a1;
        cin >> x1 >> y1 >> a1;
        //x is col , y is row
        if (a1 == 1) {
            for (int i = 0; i < h; i++)
                for (int j = 0; j < x1; j++)
                    a[i][j] = 1;
                    
        }
        
        else if (a1 == 2) {
            
            for (int i = 0; i < h; i++)
                for (int j = x1; j < w; j++)
                    a[i][j] = 1;
            
        }
        
        else if (a1 == 3) {
            for (int i = 0; i < y1; i++)
                for (int j = 0; j < w; j++)
                    a[i][j] = 1;
            
        }
        
        else if (a1 == 4) {
            for (int i = y1; i < h; i++)
                for (int j = 0; j < w; j++)
                    a[i][j] = 1;
            
        }
    }
    
    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
            if (a[i][j] == 0)
                ans++;
    
    cout << ans;
    
    
}


Measured memory_bytes: 256
while True:
    N=int(input())
    if(N==0):
        break
    ans=0
    for i in range((N//2)+1,0,-1):
        SUM=i
        k=i-1
        while SUM<=N and k>0:
            SUM+=k
            if SUM==N:
                ans+=1
            k-=1
    print(ans)


Measured memory_bytes: 5588
n,k = list(map(int,input().strip().split()))

dic= {}
for i in range(n):
  a,b = list(map(int,input().strip().split()))
  if a in dic:
    dic[a] += b
  else:
    dic[a] = b

arr = sorted(dic.items())
leng = 0
for i in arr:
  leng += i[1]
  if leng >= k:
    print(i[0])
    exit()

Measured memory_bytes: 14568
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string kaibun;
  cin >> kaibun;
  bool judge = 1;
  for(int i=0;i<kaibun.size();i++){
    if(kaibun[i]!=kaibun[kaibun.size()-i-1]){
      judge = 0;
      break;
    }
  }
  for(int i=0;i<(kaibun.size()-1)/2;i++){
    if(kaibun[i]!=kaibun[(kaibun.size()-1)/2-i-1]){
      judge = 0;
      break;
    }
  }
  for(int i=0;i<(kaibun.size()-1)/2;i++){
    if(kaibun[(kaibun.size()-1)/2+i+1]!=kaibun[kaibun.size()-i-1]){
      judge = 0;
      break;
    }
  }
  if(judge){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        var inputs = ReadInts();
        var a = inputs[0];
        var b = inputs[1];

        Console.WriteLine(b % a == 0 ? a + b : b - a);
    }


    public static string Read() { return Console.ReadLine(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read()); }

    public static string[] Reads() { return Console.ReadLine().Split(' '); }
    public static int[] ReadInts() { return Reads().Select(_ => int.Parse(_)).ToArray(); }
    public static long[] ReadLongs() { return Reads().Select(_ => long.Parse(_)).ToArray(); }
    public static double[] ReadDoubles() { return Reads().Select(_ => double.Parse(_)).ToArray(); }
}



Measured memory_bytes: 13396
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    String s = sc.next();

    if (s.equals("ABC")) {
      // 出力
      System.out.println("ARC");
    } else {
      System.out.println("ABC");
    }
  }
}

Measured memory_bytes: 35608
#include <iostream>
using namespace std;
 
int main() {
	int D, N; 
    cin >> D >> N;
	int S = 1; 
    for (int i = 0; i < D; i++) 
        S *= 100;
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long double PI = 3.14159265358979323846;

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

    int n, l;
    cin >> n >> l;
    vector<string> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < n; ++i) {
        cout << a[i];
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll x; cin >> n >> x;
  vector<ll> cnt(51), cntAll(51);
  cnt[0] = cntAll[0] = 1;
  rep(i, 51) {
    if(i) {
      cnt[i] = cnt[i-1]*2+1;
      cntAll[i] = cntAll[i-1]*2+3;
    }
  }
  auto dfs = [&](auto dfs, int n, ll x, ll sum) -> ll {
    if(n == 0) return sum+1;
    if(x == 1) {
      return sum;
    } else if(x < (cntAll[n]+1)/2) {
      return dfs(dfs, n-1, x-1, sum);
    } else if(x == (cntAll[n]+1)/2) {
      return sum + cnt[n-1] + 1;
    } else if(x < cntAll[n]) {
      return dfs(dfs, n-1, x-2-cntAll[n-1], sum+cnt[n-1]+1);
    } else {
      return sum + cnt[n];
    }
  };
  cout << dfs(dfs, n, x, 0LL) << "\n";
  return 0;
}


Measured memory_bytes: 3532
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}
void print(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printl(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}

signed main (){
    int n,q;
    cin>>n>>q;
    string s;cin>>s;
    vector<int> v(n,0);
    rep(i,0,n){
        if(i>0 and s[i]=='C' and s[i-1]=='A'){
            v[i]++;
        }
    }
    rep(i,0,n)if(i)v[i]+=v[i-1];
    //print(v);
    rep(i,0,q){
        int a,b;cin>>a>>b;
        a--;b--;
        cout<<(v[b]-v[a])<<endl;
    }
}

/*
*/


Measured memory_bytes: 1792
/*
	DATE:		2020-03-11 11:08:25
	NAME:		
	PROBLEM:	ABC158F
*/
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 2e5;

int x[MAXN + 7];
int d[MAXN + 7];
int xd[MAXN + 7];
int dp[MAXN + 7];

const int MOD = 998244353;

int add(long long x, long long y) {
  return ((x % MOD) + (y % MOD)) % MOD;
}

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

  {
    vector<pair<int, int> > v(n);

    for (int i = 0; i < n; i++) {
      scanf("%d %d", &v[i].first, &v[i].second);
    }

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

    for (int i = 0; i < n; i++) {
      x[i + 1] = v[i].first;
      d[i + 1] = v[i].second;
    }
  }
  {
    vector<pair<int, int> > v;

    for (int i = n; i >= 1; i--) {
      xd[i] = x[i] + d[i] - 1;
      while (v.size() > 0 and v.back().first <= xd[i]) {
        xd[i] = max(xd[i], v.back().second);
        v.pop_back();
      }
      v.push_back({x[i], xd[i]});
    }
  }

  dp[n + 1] = 1;

  for (int i = n; i >= 1; i--) {
    dp[i] = dp[i + 1];
    int j = upper_bound(x + i + 1, x + n + 1, xd[i]) - x;
    dp[i] = add(dp[i], dp[j]);
  }

  cout << dp[1] << "\n";

  return 0;
}

Measured memory_bytes: 5220
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const int MAXN = 1 + 1e5;
const ll oo = 1  +1e18;
typedef pair < int, int > II;
typedef pair < int, II > III;



int main(){
    vector < string > a;
    a.push_back("MON");
    a.push_back("TUE");
    a.push_back("WED");
    a.push_back("THU");
    a.push_back("FRI");
    a.push_back("SAT");
    a.push_back("SUN");
    string s;
    cin >> s;
    for (int i = 0; i < a.size(); i++){
        if (a[i] == s){
            cout << (6 - i > 0 ? 6 - i : 7);
            return 0;
        }
    }
    
    
    return 0;
}


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

int main(void){
   int H,W,i,j,k,l;
   while(true){
       cin >> H;
       cin >> W;

       if(H == 0 && W == 0){
           break;
       }
       for(i = 1;i <= W;i++){
           cout << "#" ;
       }
       cout << endl;
       for(l = 1;l <= H-2;l++){
           cout << "#" ;
           for(j = 1;j <= W-2;j++){
               cout << "." ;
           }
           cout << "#" << endl;
       }
       for(k =1;k <= W;k++){
           cout << "#" ;
       }
       cout << endl;
       cout << endl;
   }
}


Measured memory_bytes: 3056
n=int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
ans=set(make_divisors(n-1))
for k in make_divisors(n)[1:]:
    if k==1:
        continue
    m=n
    while m>=k:
        if m%k==0:
            m=m//k
        else:
            m=m%k
    if m==1:
        ans.add(k)
print(len(ans)-1)

Measured memory_bytes: 3188
#!/usr/bin/env python3
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
ACMOD = 1000000007
INF = 1 << 62



def solve(T: str):
    T = T.replace('?','D')
    print(T)



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    T = next(tokens)  # type: str
    solve(T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 68056
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	int a,b,c;
	string s;
	cin>>  a;

	if(a<1200)cout<<"ABC";
	else if(a<2800)cout<<"ARC";
	else cout<<"AGC";
    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define 	pb	push_back 
#define 	ff	first 
#define 	ss	second 
#define sz(x) (int)x.size()
#warning Remeber to change t
using namespace std;
typedef long long ll;
inline void setIO(string name="") {
	#ifndef ONLINE_JUDGE 
	freopen((name+".in").c_str(), "r", stdin); 
	freopen((name+".out").c_str(), "w", stdout);
	#endif
	}
  const ll mx=1e5;
int main(){
	Speed_UP
	ll t;
	t=1;
	while(t--){
    ll h,w,m;
    cin>>h>>w>>m;
    
    map<pair<ll,ll>,ll>arr;
    ll rows[h+1],col[w+1];
    fill(rows,rows+h+1,0);
    fill(col,col+w+1,0);
    for(int i=0;i<m;i++){
      ll x,y;
      cin>>x>>y;
      arr[{x,y}]=1;
      rows[x]++;
      col[y]++;
      //cout<<col[y]<<" "<<y<<" \n";
    }
    //for(int i=1;i<=h;i++)
      //cout<<rows[i]<<" ";
      //cout<<"\n";
     //for(int i=1;i<=w;i++)
      //cout<<col[i]<<" ";
      
    pair<ll,ll>candr[h],candc[w];
    for(int i=1;i<=h;i++){
      candr[i-1]={rows[i],i};
    }
    for(int i=1;i<=w;i++){
      candc[i-1]={col[i],i};
    }
    sort(candr,candr+h);
    sort(candc,candc+w);
    //for(auto u:candr)
      //cout<<u.ff<<" ";
    ll ans=0;
    for(int i=0;i<h;i++){
      ll val=candc[w-1].ff+candr[i].ff-arr[{candr[i].ss,candc[w-1].ss}];
      if(val>ans){
        ans=val;
      }
    }
    for(int i=0;i<w;i++){
      ll val=candr[h-1].ff+candc[i].ff-arr[{candr[h-1].ss,candc[i].ss}];
      //cout<<val<<" "<<candr[h-1].ff<<" ";
      if(val>ans){
        ans=val;
      }
    }
    cout<<ans;
		
		
		
	}





}


Measured memory_bytes: 73912
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
ll mod;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=3005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll n,a[M],dp[M][M];

int main(){
	cin>>n>>mod;
	Init();
	a[0]=2;
	for(int i=1;i<M;i++) a[i]=(a[i-1]*a[i-1])%mod;
	for(int i=0;i<M;i++) dp[i][0]=1;
	for(int i=1;i<M;i++) for(int j=1;j<=i;j++) dp[i][j]=(dp[i-1][j-1]+(1+j)*dp[i-1][j])%mod;
	ll res=a[n];
	for(int i=1;i<=n;i++){
		ll tmp=0;
		for(int j=0;j<=i;j++) (tmp+=dp[i][j]*Pow(2,j*(n-i)))%=mod;
		(tmp*=nCk(n,i))%=mod;
		(tmp*=a[n-i])%=mod;
		if(i%2==1) (tmp*=mod-1)%=mod;
		(res+=tmp)%=mod;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 69248
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-01 20:03:18
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

int dp[1 << 13];

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

  int n, m; cin >> n >> m;

  fill(all(dp), 1e9);

  dp[0] = 0;

  for (int i = 0; i < m; ++i) {
    int a, b; cin >> a >> b;
    int t = 0;
    for (int j = 0; j < b; ++j) {
      int c; cin >> c; --c;
      t += (1 << c);
    }
    for (int bit = 0; bit < (1 << n); ++bit) {
      int64 next = bit | t;
      dp[next] = min(dp[next], dp[bit] + a);
    }
  }

  int ans = dp[(1 << n) - 1];
  if (ans == 1e9) ans = -1;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename S, typename T>
void xmin(S&a, T const&b){if(b<a) a=b;}
template<typename S, typename T>
void xmax(S&a, T const&b){if(b>a) a=b;}

constexpr int maxsum = 2000*2000+10;

signed main()
{
    #ifdef LOCAL_RUN
    freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int TTT; cin >> TTT; while(TTT--){
    #else
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    #endif // LOCAL_RUN

    int n; cin >> n;
    int sum = 0;
    bitset<maxsum> v;
    v[0] = 1;
    while(n--){
        int a; cin >> a;
        sum+=a;
        v|=v<<a;
    }
    sum = (sum+1)/2;
    while(!v[sum]) ++sum;
    cout << sum << "\n";


    #ifdef LOCAL_RUN
    }
    #endif // LOCAL_RUN
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>

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

  std::map<std::string, int> dict;

  std::string s;
  int max = 1;
  for (int i=0; i<n; ++i)
    {
      std::cin >> s;
      if (dict.count(s) == 0)
        {
          dict[s] = 1;
        }
      else
        {
          dict[s]++;
          if (dict[s] > max)
            ++max;
        }
    }

  std::vector<std::string> maxstr;
  // for (const auto& [key, value] : dict)
  //   {
  //     if (value == max)
  //       maxstr.push_back(key);
  //   }
  for( auto i = dict.begin(); i != dict.end() ; ++i ) {
    if( i->second == max)
      maxstr.push_back(i->first);
  }
  std::sort(maxstr.begin(), maxstr.end());

  for (auto s : maxstr)
    std::cout << s << std::endl;


}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define step(i,s,n,c) for(int i=(s);i<(n);i+=(c))
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define each(i,vec) for(auto i:vec)
#define cinv(n,vec) VL vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define eb emplace_back
#define m_p make_pair
#define m_t make_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (signed)(a.size())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(auto [k,v]:a)cout<<k<<":"<<v<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define ENDL cout<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define PQ priority_queue
#define cont const auto
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const signed INF = (1LL<<30);
const long long MOD = (1e9+7);
const long long LINF = (1LL<<60);
const long long LMAX = LLONG_MAX;
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(10);
  
  str s;
  cin>>s;
  VL a(3,0);
  each(c,s){
    if(c=='a')a[0]++;
    if(c=='b')a[1]++;
    if(c=='c')a[2]++;
  }
  SORT(a);
  if(a[1]-a[0]>1 || a[2]-a[1]>1 || a[2]-a[0]>1)NO;
  else YES;

  
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

void debug_queue(queue<ll> q)
{
        cout << "vvvvvv" << endl;
        while (! q.empty()) {
                cout << q.front() << ' ';
                q.pop();
        }
        cout << "\n^^^^^^" << endl;
}

int main()
{
        ll K;
        cin >> K;
        queue<ll> q;
        rep(i, 1, 10) {
                q.push(i);
        }

        ll cnt = 9;

        if (K <= 9) {
                cout << K << endl;
                return 0;
        }

        ll ans;
        while (not q.empty()) {

                //debug_queue(q);
                ll now = q.front();
                q.pop();
                if (now % 10 != 0) {
                        q.push(now*10 + now%10 - 1);
                        cnt++;
                        if (cnt == K) { ans = now; break; }
                }

                q.push(now* 10 + now%10);
                cnt++;
                if (cnt == K) { ans = now; break; }  

                if (now % 10 != 9) {
                        q.push(now*10 + now%10 + 1);
                        cnt++;
                        if (cnt == K) { ans = now; break; }
                }         
        }

        while (not q.empty()) {
                ans = q.front();
                q.pop();
        }
        cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int x, y, z;
  scanf("%d %d %d", &x, &y, &z);
  int ans = (x - z) / (y + z);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A,B,C,D,E,F;
    int mW=0,mS=0;
    cin >> A >> B >> C >> D >> E >> F;

    for(int ia=0; ia*100*A<=F; ++ia) {
        for(int ib=0; ia*100+ib*100*B<=F; ++ib) {
            if(ia+ib==0) continue;
            for(int ic=0; ia*100*A+ib*100*B+ic*C<=F; ++ic) {
                for(int id=0; ia*100*A+ib*100*B+ic*C+id*D<=F; ++id) {
                    if((ic*C+id*D)*(100+E)>E*(100*A*ia+100*B*ib+C*ic+D*id)) break;
                    if( mW==0 || (ic*C+id*D)*(mW+mS)>mS*(100*A*ia+100*B*ib+C*ic+D*id)) {
                        mW=100*(ia*A+ib*B);
                        mS=ic*C+id*D;
                    }
                }
            }
        }
    }
    cout << mW+mS << " " << mS << endl;

    return 0;
}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};

int main( void ){
	initialize();
	int N, M;
	cin >> N >> M;
	vector <int> vec( N, -1 );
	rep( i, 0, M ){
		int a, b;
		cin >> a >> b;
		a--;
		if (vec[ a ] == -1 || vec[ a ] == b){
			vec[ a ] = b;
		}
		else {
			cout << "-1\n";
			return 0;
		}
	}
	if (vec[0] == 0 && N != 1){
		cout << "-1\n";
		return 0;
	}
	if (vec[0] == -1 && N != 1)
		vec[0] = 1;
	for(auto v:vec){
		if (v == -1)
			cout << 0;
		else
			cout << v;
	}
	cout << endl;
}

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;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
	cin.tie( 0 );
	ios::sync_with_stdio( false );
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] d = new int[N];
        for (int i = 0; i < N; i++) {
            d[i] = scan.nextInt();
        }
        if (d[0] != 0) {
            System.out.println(0);
            return;
        }
        if (N == 1) {
            System.out.println(1);
            return;
        }
        int max = Arrays.stream(d).max().getAsInt();
        long[] x = new long[N];
        for (int i = 1; i < N; i++) {
            x[d[i]] += 1;
        }
        if (0 < x[0]) {
            System.out.println(0);
            return;
        }
        long MOD = 998244353;
        long answer = 1;
        if (x[1] == 0) {
            System.out.println(0);
            return;
        }
        for (int i = 2; i <= max; i++) {
            if (x[i] == 0) {
                answer = 0;
                break;
            }
            answer *= pow(x[i-1], x[i], MOD);
            answer %= MOD;
        }
        System.out.println(answer);
    }
    private long pow(long x, long y, long MOD) {
        if (y == 0) {
            return 1;
        }
        if (y == 1) {
            return x;
        }
        if (y % 2 == 1) {
            long z = x * pow(x, y - 1, MOD);
            z %= MOD;
            return z;
        }
        long z = pow(x, y / 2, MOD);
        z %= MOD;
        z = z * z;
        z %= MOD;
        return z;
    }
}


Measured memory_bytes: 50368
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int l=s.length();
    if(s[0]==s[l-1])
	{
        if(l%2==0)
		{
            cout<<"First";
            return 0;
        }
        else
		{
            cout<<"Second";
            return 0;
        }
    }
    else
    {
        if(l%2==0)
		{
            cout<<"Second";
            return 0;
        }
        else
		{
            cout<<"First";
            return 0;
        }
    }
}

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

int main() {
    int N, K; cin >> N >> K;
    vector<long long> a(N), S1(N+1, 0), S2(N+1, 0);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        S1[i+1] = S1[i] + a[i];
        S2[i+1] = S2[i] + (a[i] >= 0 ? a[i] : 0);
    }
    long long res = -(1LL<<60);
    for (int i = 0; i + K <= N; ++i) {
        int left = i, right = i + K;
        long long tmp = (S2[left] - S2[0]) + max(0LL, S1[right] - S1[left]) + (S2[N] - S2[right]);
        res = max(res, tmp);
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 4e5 + 5, M = 2 * N + 5;


int cnt[N];

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    while(k--){
        int sz;
        scanf("%d", &sz);
        while(sz--){
            int x;
            scanf("%d", &x);
            cnt[x] = 1;
        }
    }
    int ans = 0;
    for(int i = 1 ; i <= n ; ++i)
        ans += !cnt[i];
    printf("%d\n", ans);
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE 100100
#define NIL -1
#define MAX_N 100100

double sq(double num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;
ll a[10010], b[10010];

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	ll suma = 0;
	rep(i, n) {
		suma += max((ll)0, a[i] - b[i]);
	}
	rep(i, n) {
		if (a[i] < b[i])suma -= (b[i] - a[i]) / 2;
		if (suma <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int>V(N);
  vector<int>C(N);
  for(int i = 0; i < N; i++){
    cin >> V.at(i);
  }
  for(int i = 0; i < N; i++){
    cin >> C.at(i);
  }
  
  int profit;
  
  for(int i = 0; i < N; i++){
    if(V.at(i) > C.at(i)){
      profit = profit + (V.at(i)-C.at(i));
    }
  }
  cout << profit << endl;
}

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

int main(){
	string s; cin>>s;
	vector<int> c(2);
	for(int i=0; i<s.size(); ++i) c[s[i]-'0']++;
	cout<< min(c[0], c[1])*2 <<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, ans = 0;
	scanf("%d", &n);
	int pmi = 2147483647, pma = -2147483648, nmi = 2147483647, nma = -2147483648, x[n], y[n];
	for (int i = 0; i < n; i++){
		scanf("%d %d", &x[i], &y[i]);
		pmi = min(pmi, y[i] - x[i]), pma = max(pma, y[i] - x[i]);
		nmi = min(nmi, y[i] + x[i]), nma = max(nma, y[i] + x[i]);
	}
	for (int i = 0; i < n; i++){
		ans = max(ans, y[i] - x[i] - pmi);
		ans = max(ans, pma - y[i] + x[i]);
		ans = max(ans, y[i] + x[i] - nmi);
		ans = max(ans, nma - y[i] - x[i]);
	}
	printf("%d\n", ans);
}

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

int main(){
  int a,b;	cin >> a >> b;
  if(a<b){
    for(int i=0;i<b;i++)	cout << a;
    return 0;
  }else if(b<=a){
    for(int i=0;i<a;i++)	cout << b;
    return 0;
  }
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;
struct action {
	int ac;
	int time;
};
int main() {
	int a, b, c; cin >> a >> b >> c;
	vector<action>acs;
	int atime = 0;
	while (atime<10000) {
		atime += a;
		acs.push_back(action{ 2, atime });
		atime += b;
		acs.push_back(action{0,atime });
	}
	atime = c;
	while (atime<10000) {
		acs.push_back(action{ 1, atime });
		atime += 60;
		
	}
	sort(acs.begin(), acs.end(), [](const action&l, const action&r) {return l.time == r.time ? l.ac < r.ac : l.time < r.time; });
	bool awake = true;
	for (int i = 0; i < acs.size(); ++i) {
		int type = acs[i].ac;
		int atime = acs[i].time;
		if (type == 2) {
			awake = false;
		}
		else if (type == 1) {
			if (awake) {
				cout << atime << endl;
				return 0;
			}
		}
		else {
			awake = true;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 3168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int main(){
    ll a,b,n;
    cin >> n >> a >> b;
    ll x = n/(a+b);
    ll y = n%(a+b);
    cout << x*a+min(y,a) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    int n;
    cin >>n;
    cout<<(n-1)/2<<endl;
}


Measured memory_bytes: 256
str = input().split()
str2 = input().split()

a = int(str[0])

i = 1
b = int(str2[0])

for j in range(a-1):
    if b <= int(str2[j+1]):
        i = i + 1
        b = int(str2[j+1])
 
print(i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll N, A, B;
  cin >> N >> A >> B;
  if(N>=2){
    if(A<=B){
      cout << B*(N-2)+A*(2-N)+1 << endl;
    }else{
      cout << 0 << endl;
    }
  }else{
    if(A==B){
      cout << 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)

A = []
B = []
N.times{ A.push( gets.chomp ) }
M.times{ B.push( gets.chomp ) }


ans = "No"
(0..(N-M)).each do |i|
  (0..(N-M)).each do |j|
    ans = "Yes" if B == A.map{ |a| a[j,M] }[i,M]
  end
end

puts ans



Measured memory_bytes: 2044
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";var r=n(1);n(2)(r.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,n){"use strict";var r=n(3),i=n(5);t.exports=function(t){var e=new r(t);i(e)}},function(t,e,n){"use strict";var r=n(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new r(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,n){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,n){"use strict";t.exports=function(t){for(var e=t.in(),n=new Map,r="",i=0;i<e;i++){var o=t.inr();if(""!=r&&r!=o[0]||1==n[o])return void console.log("No");r=o[o.length-1],n[o]=1}console.log("Yes")}}]);


Measured memory_bytes: 7372
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, M;
    cin >> N >> M;
    struct A {
        ll Y, P, index, ID;
    };
    vector<A> As(M);
    for (ll i = 0; i < M; i++) {
        cin >> As[i].P >> As[i].Y;
        As[i].index = i;
    }
    sort(As.begin(), As.end(), [&](const A& lhs, const A& rhs) {
        return (lhs.Y < rhs.Y);
    });
    vector<ll> num(N + 1, 0);
    for (ll i = 0; i < M; i++) {
        As[i].ID = ++num[As[i].P];
    }
    sort(As.begin(), As.end(), [&](const A& lhs, const A& rhs) {
        return (lhs.index < rhs.index);
    });

    cout << setfill('0');
    for (auto a : As) {
        cout << setw(6) << a.P << setw(6) << a.ID << endl;
    }
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;

int main() {
  int n, m, a=0;
  cin >> n;
  
  rep(i,1,10) {
    m=n/i;
    if(n/i<=9 && m*i==n){
      break;
    }
    a++;
  }
  if(a!=9) co("Yes");
  else co("No");
  return 0;
}


Measured memory_bytes: 256
char s[65536],t[65536];int main(n,i,r,w,c){for(;scanf("%d",&n),n;puts(s))for(i=!scanf("%s",s);i++<n;t[w]=0,strcpy(s,t))for(r=w=0;r<strlen(s);t[w++]=s[r],r+=c){for(c=0;s[++c+r]==s[r];);for(sprintf(t+w,"%d\0",c);t[++w];);}exit(0);}

Measured memory_bytes: 492
#[macro_export]
// #[snippet(name = "input")]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[doc(hidden)]
#[macro_export]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::BTreeMap;

fn main() {
    input! {
        n: usize,
        k: usize,
        l: usize,
        pq: [(usize1, usize1); k],
        rs: [(usize1, usize1); l],
    }

    let f = |es: &[(usize, usize)]| -> Vec<usize> {
        let mut g = vec![vec![]; n];

        for &(u, v) in es.iter() {
            g[u].push(v);
            g[v].push(u);
        }

        let mut grp = vec![None; n];

        for i in 0..n {
            dfs(i, i, &g, &mut grp);
        }

        grp.iter().map(|r| r.unwrap()).collect()
    };

    let g1 = f(&pq);
    let g2 = f(&rs);

    let mut mm = BTreeMap::new();
    for i in 0..n {
        *mm.entry((g1[i], g2[i])).or_insert(0) += 1;
    }

    for i in 0..n {
        println!("{}", mm[&(g1[i], g2[i])]);
    }
}

fn dfs(col: usize, cur: usize, g: &Vec<Vec<usize>>, grp: &mut Vec<Option<usize>>) {
    if grp[cur].is_some() {
        return;
    }
    grp[cur] = Some(col);
    for &next in g[cur].iter() {
        dfs(col, next, g, grp);
    }
}


Measured memory_bytes: 24744
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define MAX_V 200005
//lower_bound使え


int main(void){
	int n,inp,memo;
	int left[105], ok[105];
	vector<int> b;
	vector< queue<int> > kata;
	cin>>n;
	memo = 0;
	rep(i,n+2){
		left[i] = 999;
		ok[i] = 1;
	}
	kata.push_back(queue<int>());
	rep(i,n){
		cin>>inp;
		b.push_back(inp);
		if(memo < inp){
			memo = inp;
			kata[kata.size()-1].push(inp);
		}else{
			memo = inp;
			kata.push_back(queue<int>());
			//cout<<i<<" ";
			kata[kata.size()-1].push(inp);

		}
	}
	/*REP(i,kata.size()){
		REP(j,kata[i].size()){
			cout<<kata[i].front()<<" ";
			kata[i].pop();
		}
		cout<<endl;
	}*/
	vector<int> ans;
	//left 1index
	int mj;
	reps(i,n){
		//cout<<left[4];
		REP(j,kata.size()){
			if(kata[j].size() == 0){
				//left[j]++;
				mj = j;
				//cout<<"hoge"<<j<<endl;
				continue;
			}
			bool sayo = false;
			for(int hoge = j+1; hoge<kata.size(); hoge++){
				if(kata[j].front() > left[hoge]){
					sayo = true;
					break;
				}
			}
			if(sayo) continue;
			if(kata[j].front() <= i){
				//if(kata[6].size()!=0) cout<<"hoge"<<kata[6].front()<<endl;
				//cout<<j<<" "<<kata[j].front()<<" "<<left[j+1]<<" "<<left[2]<<endl;
				ans.push_back(kata[j].front());

				if(left[j] >= 998){
					left[j] = kata[j].front();
				}else{
					//left[j]++;
				}
				kata[j].pop();
				mj=j;
				//cout<<j<<" ";
				for(int hoge=j+1; hoge<kata.size();hoge++){
					left[hoge]++;
				}
				break;
			}
			//left[j]++;
		}
		//cout<<mj<<" ";
	}
	//cout<<endl;
	if(ans.size() != n){
		cout<<-1<<endl;
	}else{
		rep(i,n){
			cout<<ans[i]<<endl;
		}
	}
	return 0;

}

Measured memory_bytes: 256
def main():
    n = int(input())
    inlis = list()
    inlis2_x = list()
    inlis2_y = list()
    for _ in range(n):
        x, y = map(int, input().split())
        inlis.append([x,y])
        inlis2_x.append(x-y)
        inlis2_y.append(x+y)
    
    sa_x = max(inlis2_x) - min(inlis2_x)
    sa_y = max(inlis2_y) - min(inlis2_y)
    print(max(sa_x, sa_y))

if __name__ == "__main__":
    main()

Measured memory_bytes: 55032
N = int(input())
waters = list(map(int, input().split()))
ans = []
x = sum(waters) - sum([waters[i] for i in range(1, N-1, 2)])*2
ans.append(x)
for i in range(N-1):
    ans.append(waters[i] * 2 - x)
    x = ans[-1]
output = [str(num) for num in ans]
print(' '.join(output))

Measured memory_bytes: 21316