akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

struct node {
    int c;
    vector<int> to;
};

using graph = vector<node>;

void propagate(graph& g) {
    function<void(int, int)> rec = [&](int v, int bv) {
        for(int u : g[v].to) {
            if(u != bv) {
                g[u].c += g[v].c;
                rec(u, v);
            }
        }
    };

    rec(0, -1);
}

int main() {
    int n, q; cin >> n >> q;
    graph g(n);

    REP(i, n-1) {
        int a, b; cin >> a >> b;
        --a; --b;
        g[a].to.push_back(b);
        g[b].to.push_back(a);
    }

    REP(i, q) {
        int p, x; cin >> p >> x;
        --p;
        g[p].c += x;
    }

    propagate(g);
    
    REP(i, n) {
        cout << g[i].c << " ";
    }

    return 0;
}


Measured memory_bytes: 30464
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    int N = input<int>();
    vector<int> L(N, 0);
    input(L);

    sort(L.begin(), L.end(), greater<int>());

    long res = 0;
    for (int i = 0; i < N - 2; i++)
    {
        int c = L[i];
        for (int j = i + 1; j < N - 1; j++)
        {
            int b = L[j];
            if (c == b)
            {
                res += (N - 1) - j;
                continue;
            }
            for (int k = j + 1; k < N; k++)
            {
                int a = L[k];
                if (c < a + b)
                {
                    res++;
                }
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int n, m, l;
  
  long long A[100][100] = {0};
  long long B[100][100] = {0};
  long long C[100][100] = {0};
  
  cin >> n >> m >> l;
       
  for(int i = 0; i < n; i++)
  {
        for(int j = 0; j < m; j++)
            {
                cin >> A[i][j];
            }
       }
       
  for(int i = 0; i < m; i++)
  {
        for(int j = 0; j < l; j++)
            {
               cin >> B[i][j];
            }
  }
  
  for(int i = 0; i < n; i++)
  {
      for(int j = 0; j < l; j++)
      {
          for(int k = 0; k < m; k++)
          {
            C[i][j] += A[i][k] * B[k][j];
          }
      }
  }
  
  for(int i = 0; i < n; i++)
  {
      for(int j = 0; j < l; j++)
      {
        if(j){cout << " ";}  
        cout << C[i][j];
      }
      cout << endl;
  }
  
  
   return 0;
}



Measured memory_bytes: 3368
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int MAX=30010;

bool step[16001][2];

void ans(bool x){
	if(x)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

bool ok(bool fixed, vi v, int rc){
	int l=sz(v);
	bitset<20001> step[4010];
	step[0][10000]=1;
	rep(i,l)rep(x,20001)if(step[i][x]){
		step[i+1][x+v[i]]=1;
		if(!fixed || i!=0)step[i+1][x-v[i]]=1;
	}
	if(step[l][rc+10000])return true;
	else return false;
}

int main(){
	string S;
	cin>>S;
	int x,y;
	cin>>x>>y;
	vi fx, fy;
	int nowF=0;;
	int dir=1;
	bool xfixed=false;
	if(S[0]=='F') xfixed=true;
	
	rep(i,sz(S)){
		if(S[i]=='F')nowF++;
		else{
			if(nowF!=0){
				if(dir==1)fx.push_back(nowF);
				else fy.push_back(nowF);
				nowF=0;
			}
			dir*=-1;
		}
	}
	if(nowF>0){
		if(dir==1)fx.push_back(nowF);
		else fy.push_back(nowF);
	}
	
	bool okx=ok(xfixed,fx,x);
	bool oky=ok(false,fy,y);
	bool all=okx & oky;
	ans(all);
}

Measured memory_bytes: 10112
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
char s[200000][40];
char c[] = { 'M','A','R','C','H' };
ll d[5];
int main(){
	cin >> n;
	REP(i,n) {
		cin >> s[i];
	}

	ull ans = 0;
	REP(i,5) {
		ll cou = 0;
		REP(j,n) {
			if(s[j][0] == c[i]) {
				cou++;
			}
		}
		d[i] = cou;
	}

	REP(i,5) {
		FOR(j,i + 1,5) {
			FOR(k,j + 1,5) {
				ans += d[i] * d[j] * d[k];
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4352
n,m = map(int, input().split())
link = [[] for _ in range(n)]
for i in range(m):
    a,b = list(map(int,input().split()))
    link[a-1].append(b-1)
    link[b-1].append(a-1)

from collections import defaultdict
from collections import deque
visited = [0] * n

Q = deque()
Q.append([0,1]) # 1:black, 2: white
while Q:
    now,color = Q.popleft()
    if color==1:
        nxt_c = 2
    else:
        nxt_c = 1

    for nxt in link[now]:
        if visited[nxt] == nxt_c:
            continue
        if visited[nxt] != 0 and visited[nxt] !=nxt_c:
            ans = n*(n-1)//2 - m
            print(ans)
            exit()
        visited[nxt] = nxt_c
        Q.append([nxt,nxt_c])

b_cnt=0
w_cnt=0
for c in visited:
    if c==1:
        b_cnt+=1
    else:
        w_cnt+=1

print(b_cnt*w_cnt - m)

Measured memory_bytes: 66924
<?php
list($x, $y) = ints();
foreach ([1, 3, 5, 7, 8, 10, 12] as $v) $g[$v] = 0;
foreach ([4, 6, 9, 11] as $v) $g[$v] = 1;
foreach ([2] as $v) $g[$v] = 2;
echo $g[$x] === $g[$y] ? 'Yes' : 'No';
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
vector <long long int> v;
vector <double> vd;
 
vector <char> vc;
vector <string> vs;
map <string,int> sm;
map <int,int> mp;
map <char,int>cm;
set <int> st;
#define For(n) for(int i=0; i<n; i++)
//#define sort(v) sort(v.begin(),v.end());
#define vecprint(v){for(int i=0; i<v.size(); i++)cout << v[i];}
//int string_to_int(string s){stringstream x(s);double a=0; x>>a; return a;}
long long int gcd(long long int a, long long int b){if(a%b==0)return b;return gcd(b, a%b);}
long long int lcm(long long int a, long long int b){return (a*b)/gcd(a, b);}
//int string_sum(string s){int b = 0;auto k =s.size();for(int j=0; j<k; j++){b +=(s[j]-48);}return b;}
//long long int factorial(long long int n){if (n == 0)return 1;return n * factorial(n - 1);}
 
//int cnt =0;
 
void SieveOfEratosthenes(int n=20000000)
{
   // v.push_back(1);
 
//    bool prime[n+1];
//    memset(prime, true, sizeof(prime));
 
    vector <bool>prime(n+1,true);
 
    for (int p=2; p*p<=n; p++)
    {
 
        if (prime[p] == true)
        {
 
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
 
 
    for (int p=2; p<=n; p++)
       if (prime[p])
          mp[p]++;
}
 
 
//int mod(string num, int a)
//{
//    // Initialize result
//    int res = 0;
//
//    // One by one process all digits of 'num'
//    for (int i = 0; i < num.length(); i++)
//         res = (res*10 + (int)num[i] - '0') %a;
//
//    return res;
//}
 
//vector <int> arr(100,-1);
//
//int fib(int n)
//{
//    if(n<=1)return 1;
//
//    if(arr[n]==-1)
//    {
//        arr[n] = fib(n-1)+fib(n-2);
//    }
//    //else return arr[n];
//
//   return arr[n];
//}
 
 
//int arr[1050][1050];
//
//int mx=0;
//int LCS(string s, string p)
//{
//    for(int i=1; i<=s.size(); i++)
//    {
//        for(int j=1; j<=p.size(); j++)
//        {
//
//            if(s[i-1]==p[j-1])
//                arr[i][j]=1+arr[i-1][j-1];
//            else
//                arr[i][j]=max(arr[i-1][j],arr[i][j-1]);
//
//        }
//    }
//    return arr[s.size()][p.size()];
//}
//
//
//void primeFactors(long double n)
//{
//
//    while(fmod(n, 2)==0)
//    {
//        x++;
//        n /= 2;
//    }
//    h+=x;
//    x=0;
//
//    for(int i=3; i<=sqrt(n); i+=2)
//    {
//
//        while(fmod(n, i)==0)
//        {
//            x++;
//            n /= i;
//        }
//        h+=x;
//        x=0;
//
//    }
//
//    if(n>2){
//        h++;
//    }
//
//}
 
int main()
{

     int a,b,c=0,n;
    
    
    cin >> a >> b;
    
    
    cout << lcm(a,b) << endl;
    
    
  
    return 0;
}
 


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

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var l = int.Parse(_[1]);

            var a = new List<int>();
            for(var i = 1; i <= n; i++){
                a.Add(l + i - 1);
            }

            var sum = a.Sum();
            var val = sum - (sum - (a[0] < 0 ? a[0] * -1 : a[0]));
            var ans = 0;
            for(var i = 1; i < n; i++){
                var v = a[i] < 0 ? a[i] * -1 : a[i];
                if(val > sum - (sum - v)){
                    val = sum - (sum - v);
                    ans = i;
                }
            }

            Console.WriteLine(sum - a[ans]);
        }
    }
}


Measured memory_bytes: 13268
require 'prime'
require 'set'
require 'tsort'
include Math
ALP = ('a'..'z').to_a
INF = 0xffffffffffffffff
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def pr?(num);              Prime.prime?(num)                          end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

def f k,a,b,c
  return a+b+c if $k==k
  return [f(k+1,a*2,b,c),f(k+1,a,b*2,c),f(k+1,a,b,c*2)].max
end

a,b,c=gi
$k=gif
puts f 0,a,b,c



Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
int main(){
  	int a ,b ,c ,sum ,mx ,mi;
  cin >> a >> b >> c;
  sum = a + b + c;
  mx = max(a ,max(c ,b));
  mi = min(a ,min(c ,b));
  
  cout << (mx * 10 + (sum - mx - mi) + mi) << '\n';
  	
  
  
 return 0; 
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    cout << n + 1 - i << '\n';
    return 0;
}


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

using namespace std;

void rec(long long d, long long base, vector<long long>& res) {
    if (d == 0) {
        res.push_back(base);
        return;
    }
    int ld = base % 10;
    for (int i = -1; i <= 1; i++) {
        int nd = ld + i;
        if (nd < 0 || nd > 9) {
            continue;
        }
        rec(d - 1, base * 10 + nd, res);
    }
}

vector<long long> list_lunlun(long long d) {
    vector<long long> res;
    for (int i = 1; i < 10; i++) {
        rec(d - 1, i, res);
    }
    return res;
}

long long calc(long long k) {
    for (int i = 1; i <= 10; i++) {
        vector<long long> l = list_lunlun(i);
        if (k <= l.size()) {
            return l[k - 1];
        } else {
            k -= l.size();
        }
    }
    return 0;
}

int main() {
    long long k;
    cin >> k;
    cout << calc(k) << endl;
    return 0;
}

Measured memory_bytes: 1824
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
using namespace std;
signed main(){
	int n,x=1,ans=0,j=0;
	cin >> n;
	vec(a,n);
	vec(s,n);
	cin >> a[0];
	s[0]= a[0];
	FOR(i,1,n){
		cin >> a[i];
		s[i] = s[i-1] + a[i];
	}
	sort(s.begin(),s.end());
	REP(j,n){
        if(s[j]== 0){
            ans++;
        }
    }
	REP(i,n-1){
		if(s[i] == s[i+1]){
			x += 1;
		}
		else{
			ans = ans + x * (x-1) / 2;
			x = 1;
		}
	}
    if(x != 1){
        ans = ans + x * (x-1) / 2;
    }
	cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <deque>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
int main(){
    int k;
    cin >> k;
   int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    for(int i = 0;i < 32;i++){
        if(i == k -1){
            cout << a[i] << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using dijkstra = priority_queue<T, vector<T>, greater<T>>;

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fbo find_by_order  // k th index
#define ook order_of_key   // strictly smaller than k
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define max_ull 18446744073709551615
#define max_ll 9223372036854775807
#define lead_zero(x) __builtin_clzll(x)
#define trail_zero(x) __builtin_ctzll(x)
#define total_1s(x) __builtin_popcountll(x)
#define first_1(x) __builtin_ffsll(x)
#define log2_(x) __builtin_clz(1) - __builtin_clz(x)
#define isLeap(x) ((x % 400 == 0) || (x % 100 ? x % 4 == 0 : false))
#define QUERY           \
    int test;           \
    scanf("%d", &test); \
    for (int _T = 1; _T <= test; _T++)
#define FAST ios_base::sync_with_stdio(0), cin.tie(0)
#define all(v) v.begin(), v.end()
#define reunique(v) v.resize(std::unique(all(v)) - v.begin())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define ff first
#define ss second
#define MERGE(v1, v2, v) merge(all(v1), all(v2), back_inserter(v))
#define MP make_pair
#define EB emplace_back
#define read freopen("input.txt", "r", stdin)
#define write freopen("output.txt", "w", stdout)
#define in_range(v, r, l) upper_bound(all(v), r) - lower_bound(all(v), l)
#define LCM(a, b) (a / __gcd(a, b)) * b;

ll rdn(int y, int m, int d) {
    /* Rata Die day one is 0001-01-01 */
    if (m < 3)
        y--, m += 12;
    return 365 * y + y / 4 - y / 100 + y / 400 + (153 * m - 457) / 5 + d - 306;
}
/* Direction arrays */
/*int dx[] = {1,-1,0,0}, dy[] = {0,0,1,-1};                             */  // 4Direction
/*int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1};         */  // 8Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1};     */  // KnightDirection
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1};                */  // HexagonalDirection
/* int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; */


int main() {
    ll n,k;
    cin>>n>>k;   
    n%=k;
    ll mini = min(n,abs(n-k));
    cout<<mini<<"\n";
}


Measured memory_bytes: 256
a, b, k = map(int, input().split())


while k > 0:
    if a % 2 == 1:
        a -= 1
    a, b = a // 2, b + a // 2
    k -= 1
    if k > 0:
        if b % 2 == 1:
            b -= 1
        b, a = b // 2, a + b // 2
        k -= 1

print(a, b)


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

#define task "E"
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
#define Rep(i, r, l) for (int i = (r); i >= (l); --i)
#define DB(X) { cerr << #X << " = " << (X) << '\n'; }
#define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; }
#define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; }
#define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; }
#define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';}
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define pf push_front
#define F first
#define S second
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a));
#define next ___next
#define prev ___prev
#define y1 ___y1
#define left ___left
#define right ___right
#define y0 ___y0
#define div ___div
#define j0 ___j0
#define jn ___jn

using ll = long long;
using ld = long double;
using ull = unsigned long long;
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vl;
const int N = 1e5 + 2;
struct Node
{
    Node *child[26];
    int sz, leaf;
    Node() {rep(i, 0, 25) child[i] = nullptr; sz = leaf = 0;}
};
Node *root;
void addString(const string &s)
{
    Node *u = root;
    rep(i, 0, SZ(s) - 1)
    {
        if (u->child[s[i] - 'a'] == nullptr) u->child[s[i] - 'a'] = new Node();
        u = u->child[s[i] - 'a'];
    }
    u->sz++;
    u->leaf = 1;
}
void dfs(Node *u)
{
    rep(i, 0, 25) if (u->child[i] != nullptr)
    {
        dfs(u->child[i]);
        u->sz += (u->child[i])->sz;
    }
}
int n, q, cnt[26][26][N], prf[N];
string s[N];
void cal(int id)
{
    Node *u = root;
    rep(i, 0, SZ(s[id]) - 1)
    {
        rep(j, 0, 25) if (j != s[id][i] - 'a' && u->child[j] != nullptr) cnt[j][s[id][i] - 'a'][id] += (u->child[j])->sz;
        u = u->child[s[id][i] - 'a'];
        prf[id] += u->leaf;

    }
}

int main()
{
#ifdef HynDuf
    freopen(task".in", "r", stdin);
    //freopen(task".out", "w", stdout);
#else
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif
    cin >> n;
    root = new Node();
    rep(i, 1, n)
    {
        cin >> s[i];
        addString(s[i]);
    }
    dfs(root);
    rep(i, 1, n) cal(i);
    cin >> q;
    while (q--)
    {
        int k, ans = 0;
        string t;
        cin >> k >> t;
        ans = prf[k];
        rep(i, 0, 24) rep(j, i + 1, 25) ans += cnt[t[i] - 'a'][t[j] - 'a'][k];
        cout << ans << '\n';
    }
    return 0;
}


Measured memory_bytes: 286908
#include <iostream>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 2000
#define MOD 1000000007
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, K;
  cin >> N >> K;
  int A[MAX_N];
  int64_t Inv0;
  int64_t Inv1;
  rep(i, N) { cin >> A[i]; }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (A[i] > A[j]) {
        if (i < j) {
          Inv0++;
        }
        Inv1++;
      }
    }
  }

  int64_t Ans0 = (Inv0 * K) % MOD;
  int64_t Ans1 = ((K-1) * K / 2) % MOD;
  Ans1 = (Ans1 * Inv1) % MOD;
  int64_t Ans = (Ans0 + Ans1) % MOD;
  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#define PI acos(-1.0)
using namespace std;
int main(){
	int a,b;
	cin >> a >> b;
	cout << a * b;
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define fr(i,a,b) for(int i=a;i<b;i++)
#define maxe(a,b,c) max(a,max(b,c))
#define eb emplace_back
#define em emplace
#define print(x) cout<<x<<endl;
#define in(k) int k;cin>>k
#define edl cout<<"\n"
typedef long long int ll;
const ll mod=1e9+7;
int main()
{
    fastio;
    string s,t;
    cin>>s>>t;
    int sl=s.size();
    int tl=t.size();
    int d[sl+1][tl+1];
    string a="";
    fr(i,0,sl+1)
    fr(j,0,tl+1)
    {
        if(i==0||j==0)
        d[i][j]=0;
        else if(s[i-1]==t[j-1])
        d[i][j]=d[i-1][j-1]+1;
        else
        d[i][j]=max(d[i-1][j],d[i][j-1]);
    }
    int i=sl;int j=tl;
    while(i&&j)
    {
        if(s[i-1]==t[j-1])
        {
            a+=s[i-1];
            i--;j--;
        }
        else if(d[i-1][j]>d[i][j-1])
        i--;
        else
        j--;
    }
    reverse(a.begin(),a.end());
    cout<<a;
    return 0;
}

Measured memory_bytes: 35456
N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for i in range(M)]
PQ = [[int(_) for _ in input().split()] for i in range(Q)]

x = [[0] * (N+1) for i in range(N+1)]
for l, r in LR:
    x[l][r] += 1

from itertools import accumulate

t = [list(accumulate(row)) for row in x]
s = [list(accumulate(row)) for row in zip(*t)]

for p, q in PQ:
    result = s[q][q] -s[q][p-1] - s[p-1][q] + s[p-1][p-1]
    print(result)


Measured memory_bytes: 64764
#include<bits/stdc++.h>
using namespace std;
int kai(int n){
  int count=0;
  bool flag=true;
  while(flag){
    if(n%2==0){
      count=count+1;
      n=n/2;
    }
    else{
      flag=false;
    }
  }
  return count;
}
int main(){
  int N;
  cin>>N;
  vector<pair<int,int>>A(N);
  for(int i=0;i<N;i++){
    A.at(i).first=kai(i+1);
    A.at(i).second=i+1;
  }
  sort(A.begin(),A.end());
  cout<<A.at(N-1).second<<endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;

#[derive(Debug)]
struct Graph {
    maze: Vec<Vec<usize>>,
    queue: VecDeque<usize>,
    prev: Vec<i64>,
}

impl Graph {
    fn new(maze: Vec<Vec<usize>>, N: usize) -> Graph {
        Graph {
            maze: maze,
            queue: VecDeque::new(),
            prev: vec![-1; N],
        }
    }

    fn bfs(&mut self, start: usize) {
        self.prev[start] = 0;
        self.queue.push_back(start);

        while !self.queue.is_empty() {
            let next_start = self.queue.pop_front().unwrap();
            for i in self.maze[next_start as usize].iter() {
                if self.prev[*i] != -1 {continue;}
                self.prev[*i] = next_start as i64;
                self.queue.push_back(*i);
            }
        }
    }
}

#[fastout]
fn main() {
    input!{
        N: usize,
        M: usize,
        ab: [[usize; 2]; M],
    }

    let mut maze: Vec<Vec<usize>> = vec![vec![]; N];

    for i in 0..M {
        // dbg!(&maze);
        maze[ab[i][0] - 1].push(ab[i][1] - 1);
        maze[ab[i][1] - 1].push(ab[i][0] - 1);
    }

    let mut graph = Graph::new(maze, N);
    
    graph.bfs(0);

    println!("Yes");
    println!("{}", graph.prev[1..N].iter().map(|x| (x+1).to_string()).collect::<Vec<String>>().join("\n"))
}


Measured memory_bytes: 30680
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <iostream>
//end of libraries ;
#define INF 9999999999
#define N 300003
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
ll ans, x , n;
int main(){
fcin;
	cin>>n;
	cout.precision(16);
	if(n%3==0){
		ans = n/3 * n/3 * n/3;
		cout<<ans<<endl;
	}
	else if(n%3==2){
		double x1 = n / 3 ;
		double ans1 = (x1+0.666666664) * (x1+0.666666663) * (x1+0.666666663);
		cout<<ans1<<endl;
	}
	else{
		double x1 = n / 3 ;
		double ans1 = (x1+0.33333334) * (x1+0.33333333) * (x1+0.33333333);
		cout<<ans1 <<endl;
	}
	// cout<<ans1<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

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

struct Data {
  int x,y,v;
  Data(int x, int y, int v):x(x),y(y),v(v) {}
};

int main(){
    int h,w;
    cin >> h >> w;
    int si,sj,fi,fj;
    cin >> si >> sj >> fi >> fj;
    si--,sj--,fi--,fj--;
    vector<vector<int>> f(h,vector<int>(w,INF));
    vector<string> s(h);
    rep(i,h)cin >> s[i];
    deque<Data> dq;
    vector<vector<int>> d(h,vector<int>(w,INF));
    d[si][sj]=0;
    dq.push_back(Data(si,sj,0));
    while(!dq.empty()){
        int i = dq.front().x;
        int j = dq.front().y;
        int v = dq.front().v;
        dq.pop_front();
        //if(d[i][j]!=v)continue;
        for(int _=0;_<4;_++){
            int ni=i+dx[_],nj=j+dy[_];
            if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
            if (s[ni][nj] == '#') continue;
            if (d[ni][nj] <= v) continue;
            dq.push_front(Data(ni,nj,v));
            d[ni][nj]=d[i][j];
        }
        for(int ei=-2;ei<=2;ei++){
            for(int ej=-2;ej<=2;ej++){
                int ni=i+ei,nj=j+ej;
                if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
                if (s[ni][nj] == '#') continue;
                if (d[ni][nj] <= v+1) continue;
                dq.push_back(Data(ni,nj,v+1));
                d[ni][nj]=d[i][j]+1;
            }
        }
    }
    int ans = d[fi][fj];
    if (ans == INF) ans = -1;
    cout << ans << endl;
}

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

int place[100];
int num[100];
void sort(int);


main(){
  int m, n, i, j;

  while(1){
    scanf("%d %d", &n, &m);
    if(n==0 && m==0) break;

    for(i=0;i<m;i++){
      place[i]=i;
      num[i]=0;
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
        int temp;
        cin >> temp;
        if(temp) num[j]++;
      }
    }

    sort(m);


    cout << place[0]+1;
    for(i=1;i<m;i++){
      cout << ' ' << place[i]+1;
    }
    cout << endl;
  }

  return 0;
}

void sort(int size){
  for(int end=size-1;end>0; end--){
    for(int j=0;j<end;j++){
      if(num[j+1] > num[j]){
        int temp = num[j];
        num[j]=num[j+1];
        num[j+1]=temp;

        temp=place[j];
        place[j]=place[j+1];
        place[j+1]=temp;
      }
    }
  }
}

Measured memory_bytes: 908
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const ll MOD=1e9+7;
const ll INF=1ll<<60;

/* Knapsack2 */

const int MAX_N = 110;
const int MAX_V = 100100;

int N; // 1<= N個 <= 100
ll W;
ll w[MAX_N]; 
ll v[MAX_N]; 
ll dp[MAX_N][MAX_V];

int main(){


    // 入力スタンダード（複数指定）
    cin >> N >> W; // 1<= ナップザック容量W <= 10^9 
    for(int i=0; i<N; i++){
        cin >> w[i] >> v[i] ;
    } 
    // **************************************

    
    // dp[i][sum_v] i-1番目までの品物から価値がsum_v以上を達成するように
    //              選んだ時の重さの総和の最小値
    
    //初期化
    for(int i=0; i<MAX_N; i++){
        for(int j=0; j<MAX_V; j++){
            dp[i][j] = INF;
        }
    }

    dp[0][0]=0;

    for(int i=0; i<N; i++){
        for(int sum_v =0; sum_v < MAX_V; sum_v++){
            // i番目を選ぶ場合
            if(sum_v - v[i] >= 0){
                chmin(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i]);
            }

            // i番目を選ばない場合
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }

    
    
    ll res = 0;
    for(int sum_v=0; sum_v<MAX_V; sum_v++ ){
        if(dp[N][sum_v] <= W){
            res = sum_v;
        }
    }

    cout << res <<endl;

    return 0;
}

Measured memory_bytes: 86272
#include <iostream>
#include <string>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b == c){cout << "Yes" << endl;}
    else if(a+c == b){cout << "Yes" << endl;}
    else if(b+c == a){cout << "Yes" << endl;}
    else cout << "No" << endl;

    return 0;
}

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

#include<iostream>
#include<string>
#include<vector>
#include<algorithm> 
#include<functional> 
#include<cassert>
#include<numeric>
// std::accumulate(vec.begin(),vec.end(),0) sum of element
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>


using namespace std;

typedef long long ll;
typedef std::pair<int, int> pii;
typedef vector<int> vi;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(c) c.begin(),c.end()
#define show(x) cout << #x << " = " << x << endl

#define fi first
#define se second
#define pb push_back
#define mk make_pair


template <class X>
void unique_vector(std::vector<X> &t);
template <class X>
void print_vector(const std::vector<X> &t);

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


  rep(i, s.size()){
    if(k == 0) break;
    int n = abs(s.at(i) - 'z') + 1;
    int t = k - n;
    if(t < 0 || s.at(i) == 'a'){
      continue;
    }else if(t >= 0){
      k -= n;
      s.at(i) = 'a';
    }
  }
  k %= 26;
  rep(i, k){
    if (s.at(s.size()-1) > 'z') s.at(s.size()-1) = 'a';
    s.at(s.size()-1)++;
   
  }

  cout << s << endl;
}


template <class X>
void unique_vector(std::vector<X> &t)
{
  std::sort(t.begin(), t.end());
  t.erase( std::unique(t.begin(), t.end()), t.end() );
}

template <class X>
void print_vector(const std::vector<X> &t){
  for(auto itr=t.begin(); itr != t.end(); itr++){
    std::cout << *itr;
    if(itr != t.end()-1) std::cout << ' ';
  }
  std::cout << std::endl;
}



Measured memory_bytes: 576
import java.util.*;

class Main {
        public static void main(String args[]) {
                Scanner sc = new Scanner(System.in);
                if (sc.nextInt()+sc.nextInt()*2+sc.nextInt()*4>=3) {
                        System.out.println("Open");
                } else {
                        System.out.println("Close");
                }
        }
}

Measured memory_bytes: 26308
N, K = [int(_) for _ in input().split()]

S = input()

xs = []

i = 0

while i < N :
    l = 0
    while i < N and S[i] == '1':
        i += 1
        l += 1
    xs.append(l)
    l = 0
    while i < N and S[i] == '0':
        i += 1
        l += 1
    xs.append(l)

xs += [0] * (K * 2)

#print(xs)

result = 0

l = (K * 2) + 1
result = r = sum(xs[0:l])
#print("*", result, r)

i = 0
while i + l + 1 < len(xs):
    r = r - xs[i] - xs[i+1] + xs[i+l] + xs[i+l+1]
    result = max(result, r)
    #print(result, r)
    i += 2

print(result)


Measured memory_bytes: 6388
N,M = map(int,input().split())
A = []
B = []
C = []
D = []
for i in range(N) :
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
for j in range(M) :
    c,d = map(int,input().split())
    C.append(c)
    D.append(d)
for k in range(N) :
    distance = 10**17
    answer = -1
    for l in range(M) :
        p = abs(A[k]-C[l])
        q = abs(B[k]-D[l])
        d = p+q
        if d < distance :
            distance = d
            answer = l+1
    print(answer)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))





int main(){
	
	int q;
	cin >> q;
	multiset<int> se;
	FOR(i,0,q){
		ll k,x,L,R;
		cin >> k >> x;
		if(k==0){
			se.insert(x);
			cout << se.size() << "\n";
		}else if(k==1){
			cout << se.count(x) << "\n";
		}else if(k==2){
			se.erase(x);
		}else if(k==3){
			L = x;
			cin >> R;
			auto it = se.lower_bound(L);
			auto end = se.upper_bound(R);
			for(;it!=end;it++){
				cout << (*it) << endl;
			}
		}
	}
}



Measured memory_bytes: 12272
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    int X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    
    pq1<int> apple;
    
    vi red(A),blue(B),other(C);
    in(A,red);
    in(B,blue);
    in(C,other);
    sort(all(red));reverse(all(red));
    sort(all(blue));reverse(all(blue));
    sort(all(other));reverse(all(other));

    rep(i,X) apple.push(red[i]);
    rep(i,Y) apple.push(blue[i]);
    int k = 0;
    ll ans = 0;
    while (!apple.empty()) {
        int a = apple.top();
        if(a < other[k]){
            apple.pop();
            ans += other[k];
            k++;
        }else break;
    }
    
    while (!apple.empty()) {
        ans += (ll)(apple.top());
        apple.pop();
    }
    
    cout << ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 2552
import java.math.BigInteger;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigInteger a = BigInteger.valueOf(sc.nextLong());
        BigInteger b = BigInteger.valueOf(sc.nextLong());
        BigInteger c = BigInteger.valueOf(sc.nextLong());
        BigInteger d = BigInteger.valueOf(sc.nextLong());
        BigInteger mul = a.multiply(c);
        if (mul.compareTo(a.multiply(d)) < 0)
            mul = a.multiply(d);
        if (mul.compareTo(b.multiply(c)) < 0)
            mul = b.multiply(c);
        if (mul.compareTo(b.multiply(d)) < 0)
            mul = b.multiply(d);

        System.out.println(mul);
    }
}

Measured memory_bytes: 27184
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	string S;
	cin >> S;

	int N = S.size();
	vector<int> l2r( N );
	int cnt = 0;
	for( int i = 0; i < N; i++ ) {
		if( S[i] == 'R' ) cnt = 0;
		else l2r[i] = cnt;
		cnt++;
	}
	vector<int> r2l( N );
	cnt = 0;
	for( int i = N - 1; i >= 0; i-- ) {
		if( S[i] == 'L' ) cnt = 0;
		else r2l[i] = cnt;
		cnt++;
	}
	vector<int> ans( N );
	for( int i = 0; i < N; i++ ) {
		if( S[i] == 'L' ) {
			int idx = i - l2r[i];
			if( l2r[i] % 2 ) idx++;
			ans[idx]++;
		}
		else {
			int idx = i + r2l[i];
			if( r2l[i] % 2 ) idx--;
			ans[idx]++;
		}
	}

	for( int i = 0; i < N; i++ ) {
		if( i ) cout << " ";
		cout << ans[i];
	}
	cout << endl;
}


Measured memory_bytes: 4588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 998244353;
constexpr double PI = 3.14159265358979323846;

int main(){
    ll a,b,c,d;
    cin >> a >> b >>c >> d;
    vector<vector<ll>> dp(c-a+1,vector<ll>(d-b+1,0));
    dp[0][0] = 1;
    ll p = b;
    for(int i=1;i<=c-a;i++) dp[i][0] = p,p = (p*b)%MOD;
    p = a;
    for(int i=1;i<=d-b;i++) dp[0][i] = p,p = (p*a)%MOD;
    for(int i=1;i<=c-a;i++){
        for(int j=1;j<=d-b;j++){
            dp[i][j] = ((dp[i-1][j] * (b+j))%MOD + (dp[i][j-1] * (a+i))%MOD - ((((b+j-1)*(a+i-1))%MOD)*dp[i-1][j-1])%MOD + MOD)%MOD;
            //cout << dp[i-1][j] << " " << b+j << " " << dp[i][j-1] << " " << a+i << endl;
        }
    }
    /*
    rep(i,c-a+1){
        rep(j,d-b+1) cout << dp[i][j] << " ";
        cout << endl;
    }
    */
    cout << dp[c-a][d-b] << endl;
    return 0;
}

Measured memory_bytes: 73528
use std::io;

pub trait ExRead {
    fn read_line(&mut self) -> io::Result<String>;
}

impl ExRead for io::StdinLock<'_> {
    fn read_line(&mut self) -> io::Result<String> {
        let mut buf = String::new();
        io::BufRead::read_line(self, &mut buf).map(|_| buf)
    }
}

pub trait SplitAndParse<T: std::str::FromStr> {
    type Result;
    fn split_and_parse(self) -> Self::Result;
}

impl<'a, T: std::str::FromStr> SplitAndParse<T> for &'a str {
    type Result = Result<Vec<T>, <T as std::str::FromStr>::Err>;
    fn split_and_parse(self) -> Self::Result {
        self.split_whitespace()
            .map(|e| e.parse())
            .fold(Ok(Vec::new()),
                |acc, e| acc.and_then(|mut v| e.map(|parsed| {v.push(parsed); v})))
    }
}

fn main() {
    let k: usize;
    let bound: (usize, usize);

    {
        let stdin = std::io::stdin();
        let mut lkin = stdin.lock();
        k = lkin.read_line().unwrap().trim().parse().ok().unwrap();
        let mut input = lkin.read_line().unwrap().split_and_parse().unwrap().into_iter();
        bound = (input.next().unwrap() - 1, input.next().unwrap());
    }


    if bound.0 / k != bound.1 / k {
        println!("OK");
    } else {
        println!("NG");
    }
}


Measured memory_bytes: 2108
#include<stdio.h>

int main(){
	
	int x,y,X,Y,z;
	
	while( scanf("%d",&x) != EOF ){
		scanf("%d",&y);
		
		if(x>=y){
			X=x;
			Y=y;
		}
		else if(x<y){
			X=y;
			Y=x;
		}
		
		while(1){
			z=X%Y;
			X=Y;
			Y=z;
			if(z==0){
				printf("%d\n",X);
				break;
			}
		}
	}
	
return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] nums = new int[n];
        for(int i = 0; i < n; i++){
            nums[i] = scanner.nextInt();
        }
        if(n  < 2){
            System.out.println(0);
            return;
        }
        int[] dp = new int[n];
        dp[1] = Math.abs(nums[0] - nums[1]);

        for(int i = 2; i < n; i++){
            int a = dp[i - 2] + Math.abs(nums[i] - nums[i - 2]);
            int b = dp[i - 1] + Math.abs(nums[i] - nums[i - 1]);
            dp[i] = Math.min(a, b);
        }
        System.out.println(dp[n - 1]);
    }
}


Measured memory_bytes: 50372
#include<stdio.h>

int main(){
  int i,d,m,w[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  char week[7][11]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  do{
    scanf("%d %d",&m,&d);
    if(!m&&!d) break;
    m--; d--;
    for(i=0;i<m;i++) d+=w[i];
    printf("%s\n",week[d%7]);    
  }while(1);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
  string s, t;
  cin >> s >> t;
  
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());
  
  cout << (s < t ? "Yes" : "No") << endl;
}

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

int main() {
int x,y,a,b,c;
cin >> x >> y >> a >> b >>c;
vector<long> p(a);
vector<long> q(b);
vector<long> r(c);
for(int i=0;i<a;i++){
    cin >> p[i];
}
for(int i=0;i<b;i++){
    cin >> q[i];
}
for(int i=0;i<c;i++){
    cin >> r[i];
}
sort(p.begin(),p.end(),greater<long>());
sort(q.begin(),q.end(),greater<long>());
sort(r.begin(),r.end(),greater<long>());
for(int i=0;i<a-x;i++){
    p.pop_back();
}
for(int i=0;i<b-y;i++){
    q.pop_back();
}
for(int i=0;i<y;i++){
    p.push_back(q[i]);
}
for(int i=0;i<c;i++){
    p.push_back(r[i]);
}
sort(p.begin(),p.end(),greater<long>());
long long ans=0;
for(int i=0;i<x+y;i++){
ans+=p[i];
}
cout << ans;
}


Measured memory_bytes: 6000
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P[i];

    int mn = INF;
    int ans = 0;
    rep(i, N) {
        mn = min(mn, P[i]);
        ans += P[i] <= mn;
    }
    write(ans);
}

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

int main() {
  long N, K, d, a, ans = 0;
  cin >> N >> K;
  vector<int> people(N);
  
  for (int i = 0; i < K; i++) {
    cin >> d;
    for (int j = 0; j < d; j++) {
      cin >> a;
      people.at(a-1) += 1;
    }
  }
  
  for (int x = 0; x < N; x++) {
    if (people.at(x) == 0) ans += 1;
  }
  
  cout << ans << endl;
}

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

using namespace std;

const int N = 1e6 + 9;

int n, k;
int a[N];

int dp[N];

int main(){
  	ios_base::sync_with_stdio(0);
  	cin.tie(0), cout.tie(0);
    cin>> n>> k;
    for(int i = 1; i <= n; i++){
        cin>> a[i];
    }
    sort(a + 1, a + n + 1);
    for(int i = k - a[1]; i >= 0; i--){
        for(int j = 1; j <= n; j++){
            if(i + a[j] > k)break;
            if(dp[i + a[j]] == 0){
                dp[i] = 1;
                break;
            }
        }
    }
    if(dp[0] == 0)cout<< "Second";
    else cout<< "First";
}


Measured memory_bytes: 2688
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>
#include<iostream>
#include<map>
using namespace std;
long long sum;
int main(){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	sum=0;
	for(int i=1;i<=n;i++){
		if((i/10000+i/1000%10+i%10+i/100%10+i/10%10)>=a&&(i/10000+i/1000%10+i%10+i/100%10+i/10%10)<=b){
			sum=sum+i;
		}
	}
	printf("%lld\n",sum);
}

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

static const int MOD = 1e9+7;

vector<pair<int,int> > prime_factorize(int N){
    vector<pair<int,int>> ans;

    for(int a=2; a*a<=N; a++){
        if(N % a != 0) continue;
        int ex = 0;
        while(N % a == 0){
            ex++;
            N /= a;
        }
        ans.push_back({a,ex});
    }
    if(N != 1) ans.push_back({N,1});

    return ans;
}

int main(){
    int N;
    cin>>N;
    vector<int> ex(N+1,0);

    for(int i=2; i<=N; i++){
        auto ans = prime_factorize(i);
        for(auto a : ans){
            ex[a.first] += a.second;
        }
    }

    long long ans = 1;

    for(int i=2; i<=N; i++){
        ans *= (ex[i]+1);
        ans %= MOD;
    }

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

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

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            var n = int.Parse(Console.ReadLine());

            var s = new string[n];

            for(int i = 0; i < n; i++) {
                s[i] = Console.ReadLine();
            }

            var m = int.Parse(Console.ReadLine());

            var t = new string[m];

            for (int i = 0; i < m; i++) {
                t[i] = Console.ReadLine();
            }

            var dic = new Dictionary<string, int>();

            foreach(var x in s) {
                if (dic.ContainsKey(x) == false) {
                    var count = s.Count(y => x == y);
                    count -= t.Count(y => x == y);
                    dic.Add(x, count);
                }
            }

            foreach (var x in t) {
                if (dic.ContainsKey(x) == false) {
                    var count = s.Count(y => x == y);
                    count -= t.Count(y => x == y);
                    dic.Add(x, count);
                }
            }
            var result = dic.Values.Max();

            if(result < 0) {
                result = 0;
            }

            Console.WriteLine(result);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13280
#include <stdio.h>

void turn90( char input[8][9], char output[8][9] );
void show( char input[8][9] );
void copy( char input[8][9], char output[8][9] );

int main( void )
{
	char pattarn[8][9] = {""};
	char pattarnbuf[8][9] = {""};
	int i;
	int j;
	
	for( i = 0; i < 8; i++ )
	{
		scanf( "%s", pattarn[i] );
	}
	
	for( i = 0; i < 3; i++ )
	{
		printf( "%d\n", ( i + 1 ) * 90 );
		turn90( pattarn, pattarnbuf );
		copy( pattarnbuf, pattarn );
		show( pattarn );
	}
	
	return (0);
}

void turn90( char input[8][9], char output[8][9] )
{
	int i;
	int j;
	
	for( i = 0; i < 8; i++ )
	{
		for( j = 0; j < 9; j++ )
		{
			output[i][j] = input[ j + ( 7 - j * 2 ) ][ i ];
		}
	}
	for( i = 0; i < 8; i++ )
	{
		output[i][8] = '\0';
	}
}

void show( char input[8][9] )
{
	int i;
	for( i = 0; i < 8; i++ )
	{
		printf( "%s\n", input[i] );
	}
}

void copy( char input[8][9], char output[8][9] )
{
	int i;
	int j;
	
	for( i = 0; i < 8; i++ )
	{
		for( j = 0; j < 9; j++ )
		{
			output[i][j] = input[i][j];
		}
	}
}

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

const int mod = 998244353,
          iv2 = 499122177;

ll modExp2(int e) {
    ll r = 1;
    for (ll b = 2; e; e >>= 1, b = b * b % mod) {
        if (e & 1) r = r * b % mod;
    }
    return r;
}

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

    int n, s;
    cin >> n >> s;
    vt<int> a(n);
    for (int &i : a) cin >> i;

    vt<ll> dp(s + 1);
    dp[0] = modExp2(n);

    for (int i : a) {
        for (int j = s; j >= i; j--) {
            dp[j] = (dp[j] + dp[j - i] * iv2) % mod;
        }
    }

    cout << dp.back();
}


Measured memory_bytes: 3656