akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;




namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var second = Console.ReadLine();
            var dt = new DateTime();

            dt=dt.AddSeconds(int.Parse(second));

            Console.WriteLine("{0}:{1}:{2}", dt.Hour, dt.Minute,dt.Second);

        }  
    }
}

Measured memory_bytes: 19996
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n,Q;
    scanf("%d%d", &n, &Q);

    vector<pair<int, pair<int,int> > > z;   // x, s-x, t-x
    int i;
    for(i=0; i<n; i++) {
        int s, t, x;
        scanf("%d%d%d", &s, &t, &x);
        z.push_back( make_pair(x, make_pair(s-x, t-x)));
    }
    sort(z.begin(), z.end());

    map<int, vector<int> > dd;
    for(i=0; i<Q; i++) {
        int tmp;
        scanf("%d", &tmp);
        dd[tmp].push_back(i);
    }
    vector<int> ans(Q, -1);

    for(i=0; i<n; i++) {
        auto it0 = dd.lower_bound( z[i].second.first );
        auto it1 = dd.lower_bound( z[i].second.second );
        auto it = it0;
        for(; it!=it1; ++it) {
            vector<int>& vv = it->second;
            int k;
            for(k=0; k<(int)vv.size(); k++) {
                ans[vv[k]] = z[i].first;
            }
        }
        dd.erase( it0, it1 );
    } 

    for(i=0; i<Q; i++) {
        printf("%d\n", ans[i]);
    }
  
    return 0;
}


Measured memory_bytes: 27504
#include<cstdio>
int main() {
	int face[6], i = 0, tmp;
	char cmd[101];
	scanf("%d%d%d%d%d%d%s", &face[0], &face[1], &face[2], &face[3], &face[4], &face[5], cmd);
	while (cmd[i] != '\0') {
		if (cmd[i] == 'N') {
			tmp = face[0];
			face[0] = face[1];
			face[1] = face[5];
			face[5] = face[4];
			face[4] = tmp;
		}
		else if (cmd[i] == 'S') {
			tmp = face[0];
			face[0] = face[4];
			face[4] = face[5];
			face[5] = face[1];
			face[1] = tmp;
		}
		else if (cmd[i] == 'E') {
			tmp = face[0];
			face[0] = face[3];
			face[3] = face[5];
			face[5] = face[2];
			face[2] = tmp;
		}
		else {
			tmp = face[0];
			face[0] = face[2];
			face[2] = face[5];
			face[5] = face[3];
			face[3] = tmp;
		}
		i++;
	}
	printf("%d\n", face[0]);
	return 0;
}


Measured memory_bytes: 2752
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; ll A, B, X[int(1e5 + 5)], ans = 0;

int main(){
	scanf("%d%lld%lld", &N, &A, &B);
	for (int i = 0; i < N; i++) scanf("%lld", X + i);

	for (int i = 1; i < N; i++){
		ans += min(B, A * (X[i] - X[i - 1]));
	}
	printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 1024
s=input()[::-1]
n=len(s)
p=2019
S=[0 for i in range(n+1)]
ans=[0]*p

x10=1
for j, i in enumerate(s):
  S[j+1]=(S[j]+(x10*int(i)))%p
  x10*=10
  x10%=p
  ans[S[j+1]]+=1

cnt=ans[0]
for a in ans:
  cnt+=(a*(a-1))//2
  
print(cnt)


Measured memory_bytes: 16568
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

int main(){
  int A, B, C;
  cin >> A >> B >> C;
  cout << max(A, max(B, C)) * 9 + A + B + C << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
#define N (100)
int ans[N+10][N+10];
int a, b, base;
int main(){
    scanf("%d%d", &a, &b); 
    int mn = min(a,b), mx=max(a,b);
    if (a > b){
        base = 1;
    }
    int x=1, y=1;
    for (int i = 1; i < mn; ++i){
        for (int p = x; p <= x+2; ++p){
            for (int q = y; q <= y+2; ++q){
                ans[p][q] = 1;
            }
        }
        ans[x+1][y+1] = 0;
        if (y == 97){
            y = 1;
            x += 4;
        }
        else {
            y += 4;
        }
    }
    for (int i = 1; i <= mx-mn+1; ++i){
        ans[x+1][y+1] = 1;
        if (y == 97){
            y = 1;
            x += 4;
        }
        else {
            y+=4;
        }
    }
    printf("100 100\n");
    for (int i = 1; i <= 100; ++i){
        for (int j = 1; j <= 100; ++j){
            printf("%c", ".#"[ans[i][j] != base]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 256
import math
n = int(input())
s = 0
for i in range(n):
    j = int(input())
    flg = False
    for p in range(2, int(math.sqrt(j)) + 1):
        if j % p == 0:
            flg = True
            break
    if flg == False:s += 1
print(s)


Measured memory_bytes: 5676
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		int[] b = new int[n+1];
		for (int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();
			if(i > n/2) {
				b[i] = a[i];
			}
		}
		for(int i= n/2;i>0;i--) {
			if(a[i]==0) {
				b[i] = calc(i,n,b);
			}else {
				b[i] = Math.abs(calc(i,n,b)-1);
			}
			
		}
		int sum = 0;
		for(int i=1;i<=n;i++) {
			sum +=b[i];
		}
		System.out.println(sum);
		for(int i=1;i<=n;i++) {
			if(b[i] == 1) {
				System.out.println(i);
			}
		}
	}
	static int calc(int i,int n,int[] b) {
		int val = 0;
		for(int k = i*2;k<=n;k=k+i) {
			val+=b[k];
		}
		val = val%2;
		return val;
	}
}

Measured memory_bytes: 94232
#include <stdio.h>
int main(void){
   int H, W, i, j;
   while(scanf("%d %d", &H, &W)){
   if(H == 0 && W == 0)break;
for ( i = 0; i < H; i++ ){
    for ( j = 0; j < W; j++ ){
       if((i+j)%2 == 0)
              printf("#");
             else
              printf(".");
            }
    printf("\n");
}
printf("\n");
}
return 0;
}



Measured memory_bytes: 2144
import kotlin.math.max

fun main() {
    val (n, limit) = readLine()!!.split(" ").map { it.toInt() }
    val items = mutableListOf<Item>()

    repeat(n) {
        val (w, v) = readLine()!!.split(" ").map { it.toInt() }
        items.add(Item(w, v))
    }

    val dp = LongArray(limit + 1) { 0 }

    items.forEach {
        for (j in limit - it.weight downTo 0) {
            dp[j + it.weight] = max(dp[j + it.weight], dp[j] + it.value)
        }
//        dp.forEach { print("$it ") }
//        println()
//        println("-----------------------------------------")
    }
//    dp.forEach { print("$it ") }
//    println()

    println(dp.max())

}

private data class Item(
        var weight: Int = 0,
        var value: Int = 0
)

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  ll n,k;
  cin>>n>>k;
  vll a(n);
  REP(i,n)cin>>a[i];

  for(ll i=k; i<n; i++){
    if(a[i-k]<a[i])
      yes;
    else
      no;
  }
}



Measured memory_bytes: 4780
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;



// B- YYMM or MMYY
#define MM (1)
#define YY (2)

string output[4] = {"YYMM", "MMYY", "AMBIGUOUS", "NA" };

int hantei(int n)
{
	 
	if (0 <= n && n <= 99) {
		if (1 <= n && n <= 12) {
			return MM;
		}
		return YY;
	}
	
	return 0;
}

void solve_main()
{
	int all, front, back;
	int front_ans, back_ans;
	int ans = 0;

	string input;
	cin >> input;

	all = stoi(input);

	front = all / 100;
	back = all - (front * 100);

	front_ans = hantei(front);
	back_ans = hantei(back);
	
	if (front_ans == YY && back_ans == MM){
		ans = 0;
	} else if (front_ans == MM && back_ans == YY) {
		ans = 1;
	} else if (front_ans == MM && back_ans == MM) {
		ans = 2;
	} else {
		ans = 3;
	}

	cout << output[ans] << endl;
}


int main()		
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}


signed main(void) {
	int n;
	cin >> n;
	vector<pair<int, int>>xy(n+1);
	vector<int>t(n+1);
	t[0] = 0;
	xy[0].first = 0;
	xy[0].second = 0;
	rep1(i, n+1) {
		int tmpx, tmpy;
		cin >> t[i] >> tmpx >> tmpy;
		xy[i] = make_pair(tmpx, tmpy);
	}
	rep1(i, n+1) {
		int dist = abs(xy[i - 1].first - xy[i].first) + abs(xy[i - 1].second - xy[i].second);
		if (t[i] - t[i - 1] < dist || ((t[i] - t[i - 1]) - dist) % 2 != 0) {
			print("No");
			return 0;
		}
	}
	print("Yes");
}

Measured memory_bytes: 5560
import sys
input = lambda : sys.stdin.readline().rstrip()

from heapq import heappush, heappop

q = int(input())
left = []
right = []
bias = 0
sum_left = 0
sum_right = 0

for _ in range(q):
    query = input().split()
    if len(query) == 3:
        n, a, b = [int(x) for x in query]
        bias += b
        if not right:
            if not left:
                heappush(left, -a)
                sum_left += a
            else:
                l = -heappop(left)
                if l > a:
                    heappush(left, -a)
                    heappush(right, l)
                    sum_right += l
                    sum_left += (a - l)
                else:
                    heappush(left, -l)
                    heappush(right, a)
                    sum_right += a
            continue
        l, r = -heappop(left), heappop(right)
        if len(left) == len(right):
            if a > r:
                heappush(right, a)
                heappush(left, -l)
                heappush(left, -r)
                sum_left += r
                sum_right += (a - r)
            else:
                heappush(left, -l)
                heappush(left, -a)
                heappush(right, r)
                sum_left += a
        else:
            if a < l:
                heappush(right, r)
                heappush(right, l)
                heappush(left, -a)
                sum_left += (a - l)
                sum_right += l
            else:
                heappush(right, r)
                heappush(right, a)
                heappush(left, -l)
                sum_right += a
    else:
        median = -heappop(left)
        print(median, -sum_left + sum_right + (-len(right) + len(left) + 1)*(median) + bias)
        heappush(left, -median)

Measured memory_bytes: 96600
//----------------------Shanu Garg here---------------------
//-------------Search on youtube : Shanu Garg---------------
//-Studying at National Institute of Technology Delhi(NITD)-
//---------------------From Delhi, India--------------------

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

#define f(i,n) for(auto i=0;i<n;i++)
#define fr(i,n) for(auto i=n-1;i>=0;i--)
#define fs(i,a,b,c) for(auto i=a;i!=b;i+=c)
#define fl(i,x) for(auto i : x)
#define memset(a,first,last,val) fs(i,first,last,1) a[i]=val
#define nl cout<<"\n";
#define chk(x) cout<<#x<<x<<" ", nl
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vvi vector<vi>
#define pr pair<ll, ll>
#define vii vector<pair<int, int>>
#define vll vector<pr>
#define vl vector<ll>
#define m(a,b) map<a, b>
#define mid(a,b) ((a+b)/2)
#define pb push_back
#define LCM(a,b) ((a*b)/__gcd(x,y))
const int INF = 0x3f3f3f3f, mod = 1e9 + 7;

class triplet{
    public:
    ll f, s, t;};

vl in(ll n){vl v;ll x;
    f(i,n)
    cin>>x, v.pb(x);
    return v;}

vll in_pr(ll n){
    vll ar;
    ll x,y;
    f(i,n)
    {cin>>x>>y;
    ar[i]={x,y};
    }return ar;
}
void out(vl v, char ch='\0'){
    fl(i,v)
    cout<<i<<ch;
}

void solve(){
    ll N,count=0;
    char prev='4';
    string S;
    cin>>N;
    cin>>S;
    f(i, N){
        if(S.at(i) != prev){
            count++;
        }
        prev=S.at(i);
    }
    cout<<count;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
   return 0;
}




Measured memory_bytes: 3744
module Main where

-- import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
-- import Data.Array.IO
import Data.Maybe
import qualified Data.Map as M
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad
import Text.Printf

solve :: Int -> [Int] -> Int
solve m ls = iter 1 initialTable where
    iter n tbl  
        | n < m = iter (n+1) (next n tbl)
        | otherwise = tbl!(1, m)

    initialTable = accumArray (+) 0 ((1,1), (m, m)) []

    matrixSizeVector = listArray (0, m) ls
    product3 x y z = (matrixSizeVector!x) * (matrixSizeVector!y) * (matrixSizeVector!z)

    next n tbl = iter 1 [] where
        iter i ac
            | j <= m = iter (i+1) (updateAssociation:ac)
            | otherwise = tbl // ac where
                j = i + n
                updateAssociation = iter 0 maxBound where
                    iter k minProducts
                        | i + k < j = iter (k+1) (min minProducts products)
                        | otherwise = ((i, j), minProducts) where
                            products = tbl!(i, i+k) + tbl!(i+k+1, j) + product3 (i-1) (i+k) j

readIntLn:: IO Int
readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

readIntList:: IO [Int]
readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

main :: IO() 
main = do
    n <- readIntLn
    l <- replicateM n readIntList
    let l' = if n > 0
                then (head (head l)):foldr (\[x, y] b-> y:b) [] l
                else []
    if n < 2 then print 0 else print $ solve n l'



Measured memory_bytes: 30692
// #include<bits/stdc++.h>
// #define lli long long int
// #define MOD 1000000007
// #define KING 1000000002
// #define queen 1000002
// #define fi first
// #define se second
// #define se second
// #define lsb(i) (i & -i)
// #define nl cout<<'\n'
// #define TEST cout<<"TEST",nl
// #define pr pair<lli,lli>
// #define pb push_back
// #define eb emplace_back
// #define mp make_pair
// #define vi vector<lli>
// #define vpi vector<pr> 
// #define P pair<lli,pr>
// #define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
// #define NA(i,s,n) for(lli i=s;i<n;i++)
// using namespace std;

// void solve(){
//     lli n; cin>>n;
//     vi a(n+1), b(n+1, 0), c(n+1, 0);
//     set<lli> s1, s2;
//     NA(i,1,n+1) {
//         cin>>a[i];
//         s1.insert(a[i]);
//         if(*(s1.rbegin()) == i && s1.size()==i) b[i] = 1;
//     }
//     for(lli i=n; i>0; --i){
//         s2.insert(a[i]); 
//         if(*(s2.rbegin()) == (n-i+1) && s2.size()==(n-i+1)) c[i]=1;
//     }
//     lli res = 0; vi ans;
//     NA(i,1,n) if(b[i] && b[i]==c[i+1]) ++res, ans.pb(i);
//     cout<<res; nl;
//     for(lli i:ans) cout<<i<<' '<<n-i<<'\n';
//     return; 
// }
// int main(){
//     fastIO;
//     lli t = 1; cin>>t; 
//     NA(i,0,t) {
//         // cout<<"Case #"<<(i+1)<<": ";
//         solve();
//     }
//     return 0;
// }


#include<bits/stdc++.h>
#define lli long long int
#define NA(i,s,n) for(lli i=s; i<n; ++i)
using namespace std;

int main(){

    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

    lli n,res; cin>>n;
    queue<lli> q;
    NA(i,1,10) q.push(i);
    while(n--){
        res = q.front(); q.pop();
        if(res%10) q.push((res*10) + (res%10) - 1);
        q.push(res*10 + (res%10));
        if(res%10 != 9) q.push((res*10) + (res%10) + 1);
    }
    cout<<res<<'\n';
    return 0;
}


Measured memory_bytes: 1792
from heapq import heappush, heappop
from math import floor
N, M = map(int, input().split())
A = []
for a in map(int, input().split()):
    heappush(A, -a)
    
for _ in range(M):
    l = heappop(A) / 2
    
    heappush(A, l)
    
print(sum([floor(-heappop(A)) for _ in range(N)]))

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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)1e5+1;
int N, dp[MAXN][3], vals[MAXN][3];


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    for(int i=0; i<N; i++)
    {
        for(int j=0; j<3; j++)
        {
            cin >> vals[i][j];
        }
    }
    dp[0][0] = vals[0][0];
    dp[0][1] = vals[0][1];
    dp[0][2] = vals[0][2];
    for(int i=1; i<N; i++)
    {
        for(int j=0; j<3; j++)
        {
            for(int k=0; k<3; k++)
            {
                if(j==k)
                    continue;
                dp[i][j] = max(dp[i][j], dp[i-1][k] + vals[i][j]);
            }
        }
    }
    cout << max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
using namespace std;
int main(){
	long long int k=1;
	int n;
	cin>>n;
	int mod=1000000007;
	for(int i=1;i<=n;i++){
		k*=i;
		k%=mod;
	}
	cout<<k<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e3+9;
const double ep=1e-7;
const int mod=998244353;
const double pi=acos(-1);
const int INF=-1e9;
#define mk make_pair
#define PII pair<int,int>
#define PIII pair<int,PII >
#define PIL pair<int,ll>
#define PLI pair<ll,int>
#define eb emplace_back
typedef long long ll;
ll r,c,k;
ll a[maxn][maxn];
ll dp[maxn][maxn][4];
int main()
{
	scanf("%lld%lld%lld",&r,&c,&k);
	for(int i=1;i<=k;i++)
	{
		ll r1,c1,v1;
		scanf("%lld%lld%lld",&r1,&c1,&v1);
		a[r1][c1]=v1;
	}
	for(int i=1;i<=r;i++)
	{
		for(int j=1;j<=c;j++)
		{
			dp[i][j][0]=dp[i][j-1][0];
			for(int kk=0;kk<=3;kk++)
			{
				dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][kk]);
				dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][kk]+a[i][j]);
			}
			for(int k1=1;k1<=3;k1++)
			{
				dp[i][j][k1]=max(dp[i][j-1][k1],dp[i][j-1][k1-1]+a[i][j]);
				for(int kk=0;kk<=3;kk++)
				{
					dp[i][j][k1]=max(dp[i][j][k1],dp[i-1][j][kk]+a[i][j]);
				}
			}
		}
	}
	ll ans=0;
	for(int i=0;i<4;i++)ans=max(ans,dp[r][c][i]);
	printf("%lld\n",ans);
}

Measured memory_bytes: 356460
/*
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
typedef mp::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


int main()
{
    li a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]%2 && a[1]%2 && a[2]%2) cout<<a[0]*a[1]<<endl;
    else cout<<0<<endl;

    return 0;
}

Measured memory_bytes: 256
// Patience kam ho gya bc!
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[20][4];
int dp[N];
int ans;
int q;
void solve(int pos, int last , vector<int> v , int m , int n){
	if(pos==n){
		int cur =0;
		if(v.size()==0)return ;
		for(int i = 0 ; i <q;i++){
			if(v[ar[i][1]]-v[ar[i][0]]==ar[i][2])cur+=ar[i][3];
		}
		ans = max(ans,cur);
		return ;
	}
	for(int i=last;i<=m;i++){
		v.pb(i);
		solve(pos+1,i,v,m,n);
		v.pop_back();
	}
}
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n , m;
		cin >> n >> m >> q;
		for(int i =0 ;i <q ;i++){
			for(int j =0 ;j < 4;j++){
				cin >> ar[i][j];
				if(j<2)ar[i][j]--;
			}
		}
		vector<int>c;
		solve(0,1,c,m,n);
		cout <<ans<<endl;
	
	}
	return 0;
}

Measured memory_bytes: 3660
#include <cstdio>

int n, a[110], b[110], c[110], ans;

int main(){
	
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++)
		scanf("%d", &b[i]);
	for(int i = 1; i < n; i++)
		scanf("%d", &c[i]);
	for(int i = 1; i <= n; i++){
		ans += b[a[i]];
		if(a[i] - a[i - 1] == 1)
			ans += c[a[i] - 1];
	}
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << p.first << " " << p.second;
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll r, D;
  std::vector<ll> vx(2050, 0LL);
  std::cin >> r >> D >> vx[2000];

  for (ll i = 2001; i <= 2010; i++) {
    vx[i] = vx[i-1] * r - D;
    print(vx[i]);
  }

  return 0;
}


Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n,k;
	cin>>n>>k;
	ll fac[2*n+1];
	fac[0] = 1;
	fac[1] = 1;
	repa(i,2,2*n+1){
		fac[i] = fac[i-1]*i;
		fac[i] %= mod;
	}	
	ll inv[2*n+1];
	inv[2*n] = inverse(fac[2*n]);
	repr(i,2*n){
		inv[i] = inv[i+1]*(i+1);
		inv[i] %= mod;
	}
	repa(i,1,k+1){
		ll x = n-k+1;
		if(x < i){
			cout<<0<<"\n";
			continue;
		}
		ll ans = fac[x];
		ans *= inv[i];
		ans %= mod;
		ans *= inv[x-i];
		ans %= mod;
		ans *= fac[k-1];
		ans %= mod;
		ans *= inv[i-1];
		ans %= mod;
		ans *= inv[k-i];
		ans %= mod;
		cout<<ans<<"\n";
	}
	return 0;
}

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

class UnionFind {
  public:
    vector<int> Parent;

    UnionFind(int N) {
      Parent = vector<int>(N, -1);
    }

    int root(int A) {
      if(Parent[A] < 0) return A;
      return Parent[A] = root(Parent[A]);
    }

    int size(int A) {
      return -Parent[root(A)];
    }

    bool connect(int A, int B) {
      A = root(A);
      B = root(B);
      if(A==B) {
        return false;
      }

      if(size(A) < size(B)) swap(A, B);
      Parent[A] += Parent[B];
      Parent[B] = A;

      return true;
    }
};

int main() {
  int N, M; cin >> N >> M;
  int ans = 0;
  vector<int> p(N);
  vector<int> x(M), y(M);
  UnionFind Uni(N);
  for(int i = 0; i < N; ++i) {
    cin >> p[i];
    p[i]--;
  }
  for(int i = 0; i < M; ++i) {
    cin >> x[i] >> y[i];
    Uni.connect(p[x[i]-1], p[y[i]-1]);
  }
  for(int i = 0; i < N; ++i) {
    if(Uni.root(i) == Uni.root(p[i])) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n;cin>>n;
    vector<ll>l;l.push_back(2);l.push_back(1);
    for(int i=2;i<n+1;i++){
        l.push_back(l[i-2]+l[i-1]);
    }
    co(l[n]);
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
   static int digits(int n ) {
	   int sum = 0; 
	   while( n != 0) {
		   sum += n%10; 
		   n/=10; 
	   }
	   return sum; 
   }
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int n = in.readInt();
		if(n % digits(n) == 0) {
			System.out.println("Yes"); 
		    return ; 
		}
		System.out.println("No");
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

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


Measured memory_bytes: 21204
import sys
r=sys.stdin.readline
for e in iter(r,'0 0\n'):
 N,M=map(int,e.split())
 k,p=1,0
 S=[int(r())for _ in[0]*N]
 for d in[int(r())for _ in[0]*M]:
  p+=d;
  if p<N:p+=S[p]
  if N<=p+1:break
  k+=1
 print(k)


Measured memory_bytes: 5648
<?php
 
# 文字列の入力
fscanf(STDIN, "%s", $s);
 
switch($s){
  case 'Sunny':
    echo 'Cloudy';
    break;
   
  case 'Cloudy':
    echo'Rainy';
    break;
    
  case 'Rainy':
    echo 'Sunny';
    break;
}


?>

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

  
int main() {
int N;
cin >> N;
vector<int>a(N);
REP(i, N) cin >> a.at(i);
sort(all(a));
reverse(all(a));
int bob = 0;
int alice = 0;

REP(i, N){
  if((i + 1) % 2 == 1) alice += a.at(i);
  else bob += a.at(i);
}

int ans = alice - bob;
print(ans);

}

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

int main(){
    int64_t H,W,K;
    int64_t ans = 0;
    int64_t cnt = 0;
    cin >> H >> W >> K;
    vector<vector<char>> m(H,vector<char>(W));
    vector<vector<char>> m_copy(H,vector<char>(W));

    for(int64_t i = 0; i < H; i++){
        for(int64_t j = 0; j < W; j++){
            cin >> m.at(i).at(j);
        }
    }

    m_copy = m;

    for(int64_t tmp_tate = 0; tmp_tate < (1 << H); tmp_tate++) {
        for(int64_t tmp_yoko = 0; tmp_yoko < (1 << W); tmp_yoko++){
            bitset<6> tate(tmp_tate);
            bitset<6> yoko(tmp_yoko);
            cnt = 0;
            m_copy = m;
            for(int64_t i = 0; i < H; i++){
                if(tate.test(i)){
                    for(int64_t j = 0; j < W; j++){
                        m_copy.at(i).at(j) = '.';
                    }
                }
            }
            for(int64_t j = 0; j < W; j++){
                if(yoko.test(j)){
                    for(int64_t i = 0; i < H; i++){
                        m_copy.at(i).at(j) = '.';
                    }
                }
            }
            for(int64_t i = 0; i < H; i++){
                for(int64_t j = 0; j < W; j++){
                    if(m_copy.at(i).at(j) == '#'){
                        cnt++;
                    }
                }
            }
            if(cnt == K){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    ll ans=0;
    fr(i,s.size()){
        if(s[i]!=t[i]){
            ++ans;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3764
import java.io.BufferedReader;
import java.io.InputStreamReader;
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 A = scan.nextInt();
        int B = scan.nextInt();
        String S = scan.next();
        char[] data = S.toCharArray();
        boolean[] results = new boolean[N];
        int national = 0;
        int international = 0;
        int total = 0;
        for (int i = 0; i < N; i++) {
            if (data[i] == 'c') {
                continue;
            }
            if (data[i] == 'a') {
                national += 1;
                total += 1;
                if (total <= A + B) {
                    results[i] = true;
                }
                continue;
            }
            if (total < A + B && international < B) {
                international += 1;
                total += 1;
                results[i] = true;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.println(results[i] ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 42104
ans = ""
for i in range(10000):
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    else:
        for j in range(H):
            for _ in range(W):
                if j%2 == 0:
                    if _%2 == 0:
                        ans += "#"
                    else:
                        ans += "."
                else:
                    if _%2 == 0:
                        ans += "."
                    else:
                        ans += "#"
            print(ans)
            ans = ""
            if j == H-1:
                print("")


Measured memory_bytes: 5612
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }


int main() {
  int K, X; std::cin >> K >> X;
  for(int i = X-K+1; i < X+K-1; ++i) std::cout << i << " ";
  fin(X+K-1);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(10);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
using P = pair< ll,pair<ll , ll> >; using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
////////////////

vvi g;

void dfs(int cur , int par , int val , vi& d){
  d[cur] = val;
  each(dst , g[cur]){
    if(par != dst) dfs(dst , cur , val + 1 , d);
  }
}

void solve(){
  ini(N); g.resize(N);
  ini(T , A); T--; A--;
  rep(i , N - 1){
    ini(x , y); x--; y--; g[x].pb(y); g[y].pb(x);
  }

  vi td(N) , ad(N);
  dfs(T , -1 , 0 , td);
  dfs(A , -1 , 0 , ad);
  
  vi ok(N);
  rep(i , N) 
    ok[i] = td[i] < ad[i];
  
  auto efs = [&](auto rec, int cur,int par , int pval) -> void{
    ok[cur] &= pval;
    each(dst , g[cur]){
      if(dst != par) rec(rec , dst , cur , ok[cur]);
    }
  };

  efs(efs , T , -1 , 1);
  trc(ok);
  ll ans = 0;
  rep(i , N){
    if(ok[i]) amax(ans , ad[i] - 1);
  }
  out(ans);



}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A, B, math;
	cin >> A >> B;
	
    int c0, c1, c2, c3 ,c4;
    int count = 0;
    for (int i=A; i<=B; i++){
        math = i;
        c0 = math %10;
        math = math /10;
        c1 = math %10;
        math = math /10;
        c2 = math %10;
        math = math /10;
        c3 = math %10;
        math = math /10;
        c4 = math %10;
        if((c0 == c4) && (c1 == c3)){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int  MAX_OF_N = 200000;

int main() {
	int R[MAX_OF_N], n;
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> R[i];
	}
	
	int maxv = R[1] - R[0];
	int minv = R[0];

	for (int j = 1; j < n; j++) {
		maxv = max(maxv, R[j] - minv);
		minv = min(minv, R[j]);
	}
	
	cout << maxv << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;

void solve() {
	
}

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

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll mx = a*c;
    mx = max(mx, a*d);
    mx = max(mx, b*c);
    mx = max(mx, b*d);
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;
unsigned gcd(unsigned a, unsigned b) {
    if (a == 0) return b;
    if (b == 0) return a;
    if (a < b) gcd(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n;
    cin >> n;
    vector<LL> a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vector<LL> l_gcd(n, 0), r_gcd(n, 0);

    l_gcd[0] = a[0];
    for (LL i = 1; i < n; i++) {
        l_gcd[i] = gcd(l_gcd[i - 1], a[i]);
    }

    r_gcd[n - 1] = a[n - 1];
    for (LL i = n - 2; i >= 0; i--) {
        r_gcd[i] = gcd(r_gcd[i + 1], a[i]);
    }

    LL ans = r_gcd[1];
    for (LL i = 1; i < n - 1; i++) {
        ans = max(ans, (LL)gcd(l_gcd[i - 1], r_gcd[i + 1]));
    }
    ans = max(ans, l_gcd[n - 2]);
    cout << ans << endl;
}


Measured memory_bytes: 2560
using System;
    using System.Collections.Generic;
    /*using System.Linq;
    using System.Text;
    using System.Threading.Tasks;*/
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] sarray = s.Split(' ');          //?????????????????????????´?
            int [] iarray = new int[3];

            for (int i = 0;i < sarray.Length;i++)
            {
                iarray[i] = int.Parse(sarray[i]);    //???????????????????????°????????????
            }

            Array.Sort(iarray);                     //?????????

            for (int i = 0;i < sarray.Length;i++)
            {
                sarray[i] = iarray[i].ToString();    
            }

            s = string.Join(" ", sarray);           //iarray??????????????\????????£???
            Console.WriteLine(s);
        }
    }

Measured memory_bytes: 9308
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<int> tower; tower.clear();
	int h = 0;
	for (int i = 1; i <= 999; ++i){
		h += i;
		tower.push_back(h);
	} // end for

	int a, b; cin >> a >> b;

	int res = 0;
	for (int i = 1; i < (int)tower.size(); ++i){
		int tower_west = tower[i-1];
		int tower_east = tower[i];
		int curr1 = tower_west - a;
		int curr2 = tower_east - b;
		if (curr1 == curr2 && curr1 >= 1){
			res = curr1;
			break;
		} // end if
	} // end for

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    string s;
    cin >> s;
    int n=s.size();
    
    fff(i,n)
    cout << "x";


	return 0;
    
}

Measured memory_bytes: 8832
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        // 整数aの入力
        int a = sc.nextInt();
        // 整数bの入力
        int b = sc.nextInt();
        // 出力
        System.out.println(((a % 2)==0 || (b % 2) == 0) ? "Even" : "Odd");
        sc.close();
    }
}


Measured memory_bytes: 23764
from bisect import bisect_right
a, b, q = map(int, input().split())
s = [-float("inf")] + [int(input()) for i in range(a)] + [float("inf")]
t = [-float("inf")] + [int(input()) for i in range(b)] + [float("inf")]
x = [int(input()) for i in range(q)]
for i in range(q):
    X = x[i]
    l, r = bisect_right(s, X), bisect_right(t, X)
    ans = float("inf")
    ans = min(ans, abs(s[l - 1] - X) + abs(t[r - 1] - s[l - 1]), abs(t[r - 1] - X) + abs(s[l - 1] - t[r - 1]))
    ans = min(ans, abs(s[l - 1] - X) + abs(t[r] - s[l - 1]), abs(t[r] - X) + abs(s[l - 1] - t[r]))
    ans = min(ans, abs(s[l] - X) + abs(t[r - 1] - s[l]), abs(t[r - 1] - X) + abs(s[l] - t[r - 1]))
    ans = min(ans, abs(s[l] - X) + abs(t[r] - s[l]), abs(t[r] - X) + abs(s[l] - t[r]))
    print(ans)

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int sum = 0;
    if(a < b){
        sum += a;
    }else {
        sum += b;
    }

    if(c < d ){
        sum += c;
    }else{
        sum += d;
    }

    cout << sum << "\n";
}


Measured memory_bytes: 256