akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <utility>
#include <map>

#define MAX_N (1000)
#define MAX_BITS (41)  // 10^12

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  long N, K, a[MAX_N];
  scanf("%ld %ld", &N, &K);
  for (int i = 0; i < N; i++)
    scanf("%ld", &a[i]);

  // calculate accumulated sum
  long accumulated_sums[MAX_N];
  accumulated_sums[0] = a[0];
  for (int i = 1; i < N; i++)
    accumulated_sums[i] = accumulated_sums[i - 1] + a[i];
  
  // calculate point for every section
  vector<long> points;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (i > 0)
        points.push_back(accumulated_sums[j] - accumulated_sums[i - 1]);
      else
        points.push_back(accumulated_sums[j]);
    }
  }
  int M = N * (N + 1) / 2;
  // printf("points\n");
  // for (long sum : points)
  //   printf("%lx\n", sum);

  // wrong...
  // need to record all 1 bits
  int use[MAX_N * (MAX_N + 1) / 2];
  map<long, long> count_msbs;
  long ans = 0, last = MAX_BITS + 1;
  for (int i = 0; i < M; i++)
    use[i] = 1;
  while (1) {
    long found = 0, msb = 0;
    for (long k = last - 1; k >= 0; --k) {
      const long x = 1L << k;
      long count = 0;
      // printf("try x = %lx\n", x);
      for (int i = 0; i < M; i++) {
        if (use[i] && (x & points[i]) != 0) {
          count++;
        }
      }
      // printf("tried x = %lx, count = %ld (k = %ld)\n", x, count, K);
      if (count >= K) {
        found = 1;
        msb = x;
        last = k;
        break;
      }
    }

    if (found) {
      // printf("found: msb = %ld\n", msb);
      ans += msb;
      // update
      for (int i = 0; i < M; i++) {
        if (points[i] & msb) {
          points[i] -= msb;
        } else {
          use[i] = 0;
        }
      }
      // printf("points\n");
      // for (long sum : points)
      //   printf("%lx\n", sum);
    } else {
      break;
    }
  }

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


Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
typedef long long ll;
int n,tot,d,a[N],f[N];
struct node
{
    int u,v;
    node(int u=0,int v=0,ll w=0):u(u),v(v),w(w){}
    ll w;
    bool operator<(const node&o)const
    {
        return w<o.w;
    }
}e[N*20];
void solve(int l,int r)
{
    if(l==r) return;
    int m=l+r>>1;
    ll p1=l,p2=m+1,s=1e18;
    for(ll i=l;i<=m;i++)
        if(-i*d+a[i]<s)
        s=-i*d+a[i],p1=i;
    s=1e18;
    for(ll i=m+1;i<=r;i++)
        if(i*d+a[i]<s)
        s=i*d+a[i],p2=i;
    for(ll i=l;i<=m;i++)
    {
        tot++;
        e[tot]=node(i,p2,-i*d+a[i]+p2*d+a[p2]);
    }
    for(ll i=m+1;i<=r;i++)
    {
        tot++;
        e[tot]=node(p1,i,-p1*d+a[p1]+i*d+a[i]);
    }
    solve(l,m);solve(m+1,r);
}
int getf(int x){return f[x]==x?x:f[x]=getf(f[x]);}
int main()
{
    scanf("%d%d",&n,&d);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    solve(1,n);
    sort(e+1,e+1+tot);
    for(int i=1;i<=n;i++) f[i]=i;
    ll ans=0;
    for(int i=1;i<=tot;i++)
    {
        int fu=getf(e[i].u),fv=getf(e[i].v);
        if(fu==fv) continue;
        ans+=e[i].w;
        f[fu]=fv;
    }
    printf("%lld\n",ans);
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var T = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var M = int.Parse(Console.ReadLine());
            var PX = new Tuple<int, int>[M];

            for (var i = 0; i < M; i++)
            {
                var tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                PX[i] = new Tuple<int, int>(tmp[0], tmp[1]);
            }

            var sum = T.Sum();
            for (var i = 0; i < M; i++)
            {
                Console.WriteLine(sum-(T[PX[i].Item1 - 1]- PX[i].Item2));
            }
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using v = vector<ll>;
using p = pair<ll,ll>;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T> void chmin(T &a, T b){ return a = min(a,b);}
template<typename T> void chmax(T &a, T b){ return a = max(a,b);}
bool comp(ll i, ll j){
	return abs(i) < abs(j);
}

int main(){
    ll n;
    cin >> n;
    auto a= v(n,0);
    rep(i,n) cin >> a[i];
  	sort(a.begin(),a.end(),comp);
  	ll ans =0;
  	rep(i,n) ans += abs(a[i]);
  
  	auto m = count_if(a.begin(),a.end(),[](ll i){
    	return i < 0;
    });
    cout << (m%2==0?ans:ans-abs(a[0])*2);
    
  	return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, A[3], L[10];

	cin >> N;
	rep(i, 0, 3)cin >> A[i];
	rep(i, 0, N)cin >> L[i];
	sort(L, L + N);

	int ans = INF;
	rep(i, 0, (int)(pow(3, N)))
	{
		vector<int> s[3];

		int ti = i;
		rep(j, 0, N)
		{
			s[ti % 3].push_back(j);
			ti /= 3;
		}

		sort(A, A + 3);
		do {
			int res = 0;
			rep(j, 0, 3)
			{
				int bk = 0;
				rep(k, 0, SZ(s[j]))
				{
					if (A[j] <= L[s[j][k]])
					{
						bk = k;
						break;
					}
					if (k == SZ(s[j]) - 1)
					{
						bk = k + 1;
					}
				}

				int rres = INF;
				if (bk < SZ(s[j]))
				{
					rres = L[s[j][bk]] - A[j];
				}
				rep(k, 0, 1LL << bk)
				{
					int sum = 0;
					int sumn = 0;
					rep(l, 0, bk)
					{
						if ((k&(1LL << l)))
						{
							sum += L[s[j][l]];
							sumn++;
						}
					}
					if (sumn > 0)
					{
						chmin(rres, (sumn - 1) * 10 + abs(sum - A[j]));
					}
				}
				res += rres;
			}
			chmin(ans, res);
		} while (next_permutation(A, A + 3));
	}

	cout << ans << endl;

	return 0;
}

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


int main(){
    int n;
    cin>>n;
    vector<int> height;
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        height.push_back(temp);
    }

    vector<int> cost(n+1,0);
    cost[2] = abs(height[1]-height[0]);
    for(int i=3;i<n+1;i++){
        cost[i] = min(cost[i-2]+abs(height[i-1]-height[i-3]),cost[i-1]+abs(height[i-1]-height[i-2]));
    }

    cout<<cost[n];
    return 0;
}

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

public class  Main{
	static int mod=(int)1e9+7;
    public static void main(String[] args) throws Exception{
        //MScanner sc = new MScanner("chess.in");
        MScanner sc = new MScanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int n=sc.nextInt();
        int max=-1;int maxi=-1;int max2=-1;
        int[]in=new int[n];
        for(int i=0;i<n;i++) {
        	in[i]=sc.nextInt();
        	if(in[i]>max) {
        		max=in[i];maxi=i;
        	}
        }
        for(int i=0;i<n;i++) {
        	if(in[i]>=max2 && maxi!=i) {
        		max2=in[i];
        	}
        }
        for(int i=0;i<n;i++) {
        	if(maxi!=i) {
        		pw.println(max);
        	}
        	else {
        		pw.println(max2);
        	}
        }
        pw.flush();
    }
    static class MScanner {
		StringTokenizer st;
		BufferedReader br;
 
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

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

namespace contest
{
    class Program
    {
        static void Main(string[] args)
        {

            string a = Console.ReadLine();
            string b = Console.ReadLine();
            string c = Console.ReadLine();

            string result = "";
            string turn = "a";
            while(true)
            {
                if (turn == "a")
                {
                    if (a == "")
                    {
                        result = "A";
                        break;
                    }
                    turn = a.Substring(0, 1);
                    a = a.Remove(0, 1);
                    continue;
                }
                if (turn == "b")
                {
                    if (b == "")
                    {
                        result = "B";
                        break;
                    }
                    turn = b.Substring(0, 1);
                    b = b.Remove(0, 1);
                    continue;
                }
                if (turn == "c")
                {
                    if (c == "")
                    {
                        result = "C";
                        break;
                    }
                    turn = c.Substring(0, 1);
                    c = c.Remove(0, 1);
                    continue;
                }
            }
            Console.WriteLine(result);
            Console.ReadLine();
            return;
        }
    }
}


Measured memory_bytes: 11092
n, k = map(int,input().split())
p = list(map(int,input().split()))

cumsum = [0]*(n+1)
for i in range(n):
    cumsum[i+1] = cumsum[i] + p[i]

maxe = 0
idx = 0
for i in range(n-k+1):
    if cumsum[i+k] - cumsum[i] > maxe:
        maxe = cumsum[i+k] - cumsum[i]
        idx = i

def ex(n):
    return 0.5 * n + 0.5

res = 0
for i in range(k):
    res += ex(p[i+idx])

print(res)

Measured memory_bytes: 24548
import sys

def main():
    input = sys.stdin.readline
    A, B = map(int, input().split())
    
    ans = 0
    
    if A > B:
        ans = A + A - 1
    elif A == B:
        ans = A + B
    else:
        ans = B + B - 1
    
    print(ans)
   
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int maxn = 402;

int n, d[maxn];
long long sum[maxn], f[maxn][maxn];

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> d[i];
        sum[i] = sum[i-1] + d[i];
    }

    for (int j = 1; j <= n; ++j) {
        for (int i = j-1; i >= 1; --i) {
            long long cur = 1e16;
            for (int k = i; k < j; ++k)
                cur = min(cur, f[i][k] + f[k+1][j]);

            f[i][j] = sum[j] - sum[i-1] + cur;
        }
    }

    cout << f[1][n] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
int gcd(int a, int b);
int main(void){
    int x, i, j, k;
    long int sum=0;
    scanf("%d",&x);
    for(i=1; i<=x; i++){
        for(j=1; j<=x; j++){
            for(k=1; k<=x; k++){
                if(i==1||j==1||k==1){
                    sum+=1;
                    continue;
                }
                sum+=gcd(gcd(i, j), gcd(j, k));
            }
        }
    }

    printf("%ld\n",sum);
    return 0;
}

int gcd(int a, int b){
    int tmp, r;
    if(b>a){
        tmp=a;
        a=b;
        b=tmp;
    }
    r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}



Measured memory_bytes: 1708
#include <cctype>
#include <iostream>
#include <string>
using namespace std;

void solve() {
	string order, message;
	cin >> order >> message;
	for (int i = order.size() - 1; i >= 0; i--) {
		int l;
		switch (order[i]) {
		case 'J':
			message = (*message.rbegin()) + message.substr(0, message.size() - 1);
			break;
		case 'C':
			message = message.substr(1) + message[0];
			break;
		case 'E':
			l = message.size() / 2;
			if (message.size() & 1) {
				message = message.substr(message.size() - l) + message[l] + message.substr(0, l);
			}
			else {
				message = message.substr(message.size() - l) + message.substr(0, l);
			}
			break;
		case 'A':
			message = string(message.rbegin(), message.rend());
			break;
		case 'P':
			for (unsigned j = 0; j < message.size(); j++) {
				if (isdigit(message[j])) {
					if (message[j] == '0') {
						message[j] = '9';
					}
					else {
						message[j]--;
					}
				}
			}
			break;
		case 'M':
			for (unsigned j = 0; j < message.size(); j++) {
				if (isdigit(message[j])) {
					if (message[j] == '9') {
						message[j] = '0';
					}
					else {
						message[j]++;
					}
				}
			}
			break;
		}
	}
	cout << message << endl;
}

int main () {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		solve();
	}
	return 0;
}

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

int main(){
  int N, S;
  cin >> N;
  int M = N;
  while(true){
    S += N%10;
    N = N/10;
    if(N==0){
      if(S == 0){
        cout << "No" << endl;
      } else if(M%S == 0){
        cout << "Yes" << endl;
      } else{
        cout << "No" << endl;
      }
      return 0;
    }
  }
  
 return 0; 
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

long long int pow(long long int x, long long int n, long long int mod) {
    long long int ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

long long int inv(long long int x, long long int p) {
    return pow(x, p - 2, p);
}

int main() {
    const long long int p = 1000000007;
    long long int h, w, a, b, ret = 0;
    std::cin >> h >> w >> a >> b;

    auto m = std::max({ h - a + b - 2, h + w - b - 2 });
    auto factTable = new long long int[m+1];
    factTable[0] = 1;
    for (long long int i = 1; i <= m; i++) {
        factTable[i] = (factTable[i-1] * i) % p;
    }
    auto invTable = new long long int[m+1];
    invTable[m] = inv(factTable[m], p);
    for (long long int i = m; i > 0; i--) {
        invTable[i-1] = (invTable[i] * i) % p;
    }

    for (int i = 1; i <= h - a; i++) {
        /* (i+b-2)C(i-1) */
        auto routes1 = (((factTable[i+b-2] * invTable[i-1]) % p) * invTable[b-1]) % p;
        /* (h-i + w-b-1)C(h-i) */
        auto routes2 = (((factTable[h+w-i-b-1] * invTable[h-i]) % p) * invTable[w-b-1]) % p;
        ret = (ret + ((routes1 * routes2) % p)) % p;
    }

    std::cout << ret << std::endl;

    delete[] factTable;
    delete[] invTable;
    return 0;
}

Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
        string[] temp = Console.ReadLine().Split(' ');
        int N = int.Parse(temp[0]);
        int Q = int.Parse(temp[1]);
        char[] input = Console.ReadLine().ToArray();
        int[] dp = new int[N];
        for(int i = 1; i < input.Length; i++)
        {
            if (input[i-1] == 'A' && input[i] == 'C') { dp[i] = dp[i - 1] + 1; }
            else { dp[i] = dp[i - 1]; }
        }
        int[] L = new int[Q];
        int[] R = new int[Q];
        for (int i = 0; i < Q; i++)
        {
            temp = Console.ReadLine().Split(' ');
            L[i] = int.Parse(temp[0]);
            R[i] = int.Parse(temp[1]);
            Console.WriteLine((dp[R[i]-1])-dp[L[i]-1]);
        }
    }
}


Measured memory_bytes: 17992
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>

using namespace std;

const int Max = 1e9 + 7;
typedef long long ll;
ll ans;

int main(){
	int i, j, n, m;
	while(~scanf("%d", &n)){
		ans = 1;
		for(i = 1; i <= n; i++){
			ans *= i;
			ans %= Max;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
int main(){
  int n;
  std::cin >> n;
  int cnt = 0;
  for(int i = 1; i <= n; i++){
    int S;
    std::cin >> S;
    for(int j = 1; 2 * j * j <= S; j++){
      if((S - j) % (2 * j + 1) == 0){
	cnt++;
	break;
      }
    }
  }
  std::cout << n - cnt << std::endl;
  return 0;
}



Measured memory_bytes: 3024
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		_n: usize,
		mut cs: Chars,
	}

	let mut ans = 0;
	loop {
		// 先頭から続く赤を右方向に消していく
		loop {
			if 0 < cs.len() && cs[0] == 'R' {
				cs.remove(0);
			}
			else {
				break;
			}
		}
		if cs.len() == 0 {
			println!("{}", ans);
			return;
		}
		// 末尾から続く白を左方向に消していく
		loop {
			if 0 < cs.len() && cs[cs.len()-1] == 'W' {
				cs.remove(cs.len()-1);
			}
			else {
				break;
			}
		}
		if cs.len() == 0 {
			println!("{}", ans);
			return;
		}
		loop {
			// 先頭が白で末尾が赤ならそれぞれ削除して答えを＋＋
			if cs[0] == 'W' && cs[cs.len()-1] == 'R' {
				cs.remove(0);
				cs.remove(cs.len()-1);
				ans += 1;
				if cs.len() == 0 {
					println!("{}", ans);
					return;
				}
			}
			else {
				break;
			}
		}
	}
}



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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, M;
  while ( cin >> N >> M, N ) {

    vector<int> dif(M, 0);
    for ( int i = 0; i < N; i++ ) {
      int d, v;
      cin >> d >> v;
      d--;
      dif[d] = max(dif[d], v);    
    }

    int ans = 0;
    for ( int i = 0; i < M; i++ ) {
      ans += dif[i];    
    }

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



Measured memory_bytes: 3124
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 

#define TRACE
#ifdef TRACE
#define see(...) __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...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
const int INF = 1e18;
const int MX = 1000001;


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    int h,w,m;
    cin>>h>>w>>m;
    int xs[m],ys[m];
    map<int,int> onX,onY; 
    set<pair<int,int>> points;
    for(int i = 0;i<m;i++){
        cin>>xs[i]>>ys[i];
        points.insert({xs[i],ys[i]});
        onX[xs[i]]++;
        onY[ys[i]]++;
    }

    int maxX=0,maxY=0;
    vector<int> candX,candY;
    // for(int x= 0;x<=w;x++) maxX=max(maxX,onX[x]);
    // for(int y= 0;y<=h;y++) maxY= max(maxY,onY[y]);

    // for(int x = 0;x<=w;x++){
    //     if(onX[x]==maxX)candX.push_back(x);
    // }
    // for(int y = 0;y<=h;y++){
    //     if(onY[y]==maxY)candY.push_back(y);
    // }
    for(auto i : onX)maxX=max(maxX,i.second);
    for(auto i : onY)maxY=max(maxY,i.second);
    for(auto i : onX){
        if(i.second==maxX)candX.push_back(i.first);
    }
    for(auto i : onY){
        if(i.second==maxY)candY.push_back(i.first);
    }

    int ans= maxX+maxY-1;
    bool f = false;
    for(auto x : candX){
        for (auto y : candY){
            if(points.find({x,y})==points.end()){
                ans++;
                cout<<ans<<endl;
                return 0;

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


Measured memory_bytes: 72560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double A, B;
  double c;
  int d;
  int e;
  cin >> A >> B;
  c = A * B;
  d = c / 2;
  e = d * 2;
  if(e == c){
    cout << "Even" << endl;
 }
  else{
    cout << "Odd" << endl;
  }
  //cout << c << endl;
  //cout << d << endl;
  //cout << e << endl;
  }

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <string>
#include <float.h>
#include <iomanip>
#define mod 1000000007
using namespace std; 
const double pi = acos(-1);

int main(){
	int a,b; cin >> a >> b;
	cout << a*b << "\n";
}




Measured memory_bytes: 3592
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            string[] input = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            int[] Pn = new int[N];
            for (int i = 0; i < N; i++)
            {
                Pn[i] = Convert.ToInt32(input[i]);
            }
            int result = 0;
            for (int i = 1; i < N - 1; i++)
            {
                if (Pn[i] < Pn[i + 1] && Pn[i] > Pn[i - 1])
                {
                    result++;
                }
                else if (Pn[i] < Pn[i - 1] && Pn[i] > Pn[i + 1])
                {
                    result++;
                }
            }
            Console.WriteLine(result);
        }
    }
}


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

int main() {
    int S;
    cin >> S;;
    int left = S/100;
    int right = S%100;
    if (1 <= left && left <= 12) {
        if (1 <= right & right <= 12) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }
    else {
        if (1 <= right && right <= 12) cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    vector<int> v(k);
    for(int i = 0; i < k; i++) cin >> v[i];
    if(n >= k)
    {
        cout << 0 << endl;
        return 0;
    }
    sort(v.begin(), v.end());
    vector<int> d;
    int ans = 0;
    for(int i = 0; i < v.size() - 1; i++)
    {
        int x = v[i + 1] - v[i];
        d.push_back(x);
        ans += x;
    }
    sort(d.begin(), d.end(), greater<int>());
    for(int i = 0; i < n - 1; i++) ans -= d[i];
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1276
from collections import deque

n,m = map(int,input().split())
outs = [[] for i in range(n)]
ins = [0]*n
ans = []
for i in range(n+m-1):
    a,b = map(int,input().split())
    outs[a-1].append(b-1)
    ins[b-1] += 1
S = deque([])
for i in range(n):
    if ins[i] == 0:
        S.append([i,i])
while len(S) > 0:
    cur = S.popleft()
    ans.append(cur)
    for e in outs[cur[0]]:
        ins[e] -= 1
        if ins[e] == 0:
            S.append([e,cur[0]])
ans.sort()
for i in range(n):
  if ans[i][0] == ans[i][1]:
    print(0)
  else:
    print(ans[i][1]+1)

Measured memory_bytes: 77856
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define xx first
#define yy second
 
#define pii pair <int, int >
#define pll pair < ll, ll >
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii >
 
#define inf  100000000
 
#define f(i, c, n) for(int i = c; i < n; i++)
#define fe(i, c, n) for(int i = c; i <= n; i++)
#define fr(i, n, c) for(int i = n - 1; i >= c; i--)
 
#define be(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())
#define S " "
#define N "\n"

//cout << "Case " << ++cs << ": " <<
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


void solve() {
	int m; cin >> m;
	cout << 24 + 24 - m << N;
}

int main() {
    // FILE;
    fast;
    // int t; cin >> t; while(t--)
    solve();
}

Measured memory_bytes: 3612
l = list(map(int, input().split()))

t,a=l[0],l[2]
tc,ac=0,0

while t>0:
    t=t-l[3]
    tc+=1
while a>0:
    a=a-l[1]
    ac+=1


if tc>=ac:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9060
s = str(input())
s = list(s)

if s[0] == "A":
    if s[2:-1].count("C") == 1:
        s.remove("C")
        if "".join(s[1:]) == "".join(s[1:]).lower():
            print("AC")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")


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

int main() {
  int N,a,b,c,d;
  cin >> N;
  a = N/1000;
  b = (N-a*1000)/100;
  c = (N - (a*10+b)*100)/10;
  d = N - (N/10)*10;
  if (a==b && b==c){
    cout<<"Yes"<<endl;
  }
  else if(b==c && c==d){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    vector<p> g(m);
    REP(i, m)
    {
        cin >> g[i].first >> g[i].second;
    }

    int minv = 0, maxv = 10000000;
    REP(i, m)
    {
        minv = max(minv, g[i].first);
        maxv = min(maxv, g[i].second);
    }

    cout << max(0, maxv - minv + 1) << endl;


    
}

Measured memory_bytes: 1024
N,T = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(key=lambda x:x[1])

dp1 = [[0]*T for i in range(N+1)]
for n in range(N):
    for w in range(T):
        if w-AB[n][0]>=0:
            dp1[n+1][w] = max(dp1[n][w],dp1[n][w-AB[n][0]]+AB[n][1])
        else:
            dp1[n+1][w] = dp1[n][w]

for n in range(N):
    for w in range(T-1):
        dp1[n][w+1] = max(dp1[n][w+1],dp1[n][w])

dp2 = [[0]*T for i in range(N+1)]
for n in range(N):
    for w in range(T):
        if w-AB[-n-1][0]>=0:
            dp2[n+1][w] = max(dp2[n][w],dp2[n][w-AB[-n-1][0]]+AB[-n-1][1])
        else:
            dp2[n+1][w] = dp2[n][w]

for n in range(N):
    for w in range(T-1):
        dp2[n][w+1] = max(dp2[n][w+1],dp2[n][w])

ans = 0
for n in range(N):
    for w in range(T):
        ans = max(AB[n][1]+dp1[n][w]+dp2[N-n-1][T-1-w],ans)

print(ans)

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N;
    cin >> N;
    vector<lint> A(N, 0);
    rep(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());
    vector<pair<int, int>> x;
    vector<int> C(N);
    for (int i = 0; i < N; i++) {
        if (i == 0)
            C[i] = pow(-1, (i + 1));
        else if (i == N - 1)
            C[i] = pow(-1, (i + 1));
        else
            C[i] = pow(-1, (i + 1)) * 2;
        x.push_back({C[i], i});
    }
    sort(x.rbegin(), x.rend());
    lint ans = 0;
    for (int i = 0; i < N; i++) {
        ans += x[i].first * A[i];
    }

    x.clear();
    for (int i = 0; i < N; i++) {
        if (i == 0)
            C[i] = pow(-1, (i));
        else if (i == N - 1)
            C[i] = pow(-1, (i));
        else
            C[i] = pow(-1, (i)) * 2;
        x.push_back({C[i], i});
    }
    sort(x.rbegin(), x.rend());

    lint ans2 = 0;
    for (int i = 0; i < N; i++) {
        ans2 += x[i].first * A[i];
    }
    cout << max(ans, ans2) << endl;
    return 0;
}

Measured memory_bytes: 5872
fun main(args: Array<String>) {
	val n = (readLine() ?: return).toInt()
	val s = (readLine() ?: return).toCharArray()
	var white = 0
	for (i in s.indices) if (s[i] == '.') white++
	var min = if (white > s.size) s.size - white else white
	var black = 0
	for (i in s.indices) {
		if (s[i] == '#') black++
		else if (s[i] == '.') {
			white--
			min = Math.min(min, black + white)
		}
	}
	print(min)
}

Measured memory_bytes: 37220
#include <bits/stdc++.h>
using namespace std;
 
int a[200005];
 
int main(){
	int n;
	cin >> n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	long long ans=abs(a[n-1]-a[0]);
	int r=n-2,l=1;
	int c=a[n-1],d=a[0];
	while(l<r){
		ans+=max(abs(a[l]-c),abs(a[r]-c));
		ans+=max(abs(a[l]-d),abs(a[r]-d));
		c=a[l];
		d=a[r];
		l++;
		r--;	
	}
	if(n%2)
		ans+=max(abs(c-a[r]),abs(d-a[r]));
	cout<<ans;
 	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <set>

#define M 5

using namespace std;

static set<int>     U;
static set<int>     lis[ M ];
static const char * e;


static set<int> expr ( void );

static set<int>
set_intersection (
  const set<int> & a,
  const set<int> & b
  )
{
  set<int>::iterator ia, ib;
  set<int> res;

  for ( ia = a.begin ( ), ib = b.begin ( )
      ; ia != a.end ( ) && ib != b.end ( ); )
  {
    if ( *ia == *ib )
    {
      res.insert ( *ia );
      ++ia; ++ib;
    }
    else
    {
      ++( *ia < *ib ? ia : ib );
    }
  }

  return ( res );
}

static set<int>
set_union (
  const set<int> & a,
  const set<int> & b
  )
{
  set<int>::iterator it;
  set<int> res;

  for ( it = a.begin ( ); it != a.end ( ); ++it )
  {
    res.insert ( *it );
  }
  for ( it = b.begin ( ); it != b.end ( ); ++it )
  {
    res.insert ( *it );
  }

  return ( res );
}

static set<int>
set_difference (
  const set<int> & a,
  const set<int> & b
  )
{
  set<int>::iterator ia, ib;
  set<int> res;

  for ( ia = a.begin ( ), ib = b.begin ( )
      ; ia != a.end ( ); )
  {
    while ( ib != b.end ( ) && *ib < *ia )
    {
      ++ib;
    }

    if ( ib != b.end ( ) && *ia == *ib )
    {
      ++ia; ++ib;
    }
    else
    {
      res.insert ( *( ia++ ) );
    }
  }

  return ( res );
}

static set<int>
term (
  void
  )
{
  if ( *e == '(' )
  {
    set<int> res;

    ++e;
    res = expr ( );
    ++e;

    return ( res );
  }
  else if ( *e == 'c' )
  {
    set<int> rt;
    set<int>::iterator ia, ib;

    ++e;
    rt = term ( );

    return
    set_difference ( U, rt );
  }

  return ( lis[ *( e++ ) - 'A' ] );
}

static set<int>
expr (
  void
  )
{
  set<int> res;

  res = term ( );

  for ( ; ; )
  {
    char ope;
    set<int> rt;

    if ( *e == ')' || *e == '\0' ) break ;

    ope = *( e++ );
    rt = term ( );
    switch ( ope )
    {
      case 'i':
        res = set_intersection ( res, rt );
        break ;
      case 'u':
        res = set_union ( res, rt );
        break ;
      case 'd':
        res = set_difference ( res, rt );
        break ;
      case 's':
        res = set_union ( set_difference ( res, rt )
                        , set_difference ( rt, res ) );
        break ;
    }
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    set<int> res;
    string s;

    U.clear ( );
    for ( i = 0; i < M; ++i )
    {
      lis[ i ].clear ( );
    }

    for ( ; ; )
    {
      char ch;
      int n;

      if ( !( cin >> ch >> n ) ) goto ESC;
      if ( ch == 'R' ) break ;

      while ( n-- )
      {
        int d;

        cin >> d;
        U.insert ( d );
        lis[ ch - 'A' ].insert ( d );
      }
    }

    cin >> s;
    e = s.c_str ( );
    res = expr ( );
    if ( res.empty ( ) )
    {
      puts ( "NULL" );
    }
    else
    {
      for ( set<int>::iterator it = res.begin ( )
          ; it != res.end ( ); ++it )
      {
        if ( it != res.begin ( ) )  putchar ( ' ' );
        printf ( "%d", *it );
      }
      puts ( "" );
    }
  }

ESC: ;
  return ( 0 );
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	cin>>s;
	char before=s[0];
	int cnt=0;
	for(int i=1;i<s.size();i++){
		if(before!=s[i]){
			before=s[i];
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 512
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define mod 1000000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	string str;
	cin>>str;
	if(str.size()>=6 && str[2]==str[3] && str[4]==str[5])
		cout<<"Yes";
	else
		cout<<"No";
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    string s, t; cin >> s >> t;
    int cnt = 0;
    for (int i = 0 ; i < s.size() ; i++) {
        cnt += (s[i] != t[i]);
    }
    cout << cnt << '\n';
}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
#include <iomanip>      // std::setprecision
using namespace std;
#define what_is(x) cerr << #x << " is " << x << endl;
#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n)) //get the highest bit of x, maybe the fastest
#define IN(i,l,r) (l<i&&i<r) //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)
#define F(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define FF(i,L,R) for (int i = L; i > R; i--)
#define FFE(i,L,R) for (int i = L; i >= R; i--)
#define char2Int(c) (c-'0')
#define lastEle(vec) vec[vec.size()-1] 
#define SZ(x) ((int)((x).size()))
#define REMAX(a,b) (a)=max((a),(b)) // set a to the maximum of a and b
#define REMIN(a,b) (a)=min((a),(b));
#define FENWICK(k) (k&-k)
#define FOREACH(i,t) for (auto i=t.begin(); i!=t.end(); i++) // traverse an STL data structure
#define ALL(c) (c).begin(),(c).end() //handy for function like "sort()"
#define PRESENT(c,x) ((c).find(x) != (c).end()) 
#define CPRESENT(c,x) (find(ALL(c),x) != (c).end()) 
#define LL long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF 1001001001
#define PI 3.1415926535897932384626
//for map, pair
#define mp make_pair
#define fi first
#define se second
//for vectors
#define pb push_back
typedef int elem_t;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
// directions
const int fx[4][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}};
const int fxx[8][2] = {{0,1}, {0,-1}, {1,0}, {-1,0}, {1,1}, {1,-1}, {-1,1}, {-1,-1}};
const int rogi[4][2] = { {1,1}, {1,-1}, {-1,1}, {-1,-1} };

int n;

void dane() {
	int a,b,c;
	cin>>a>>b>>c;
	cout<<max(0,(c-(a-b)))<<endl;

}

int main() {
	IOS
	// int t;
	// cin>>t;
	// F(i,0,t)
	    dane();
    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 std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int n, a[N];
int cnt[N]; 
void solve(){
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> a[i];
        cnt[a[i]] ++;
    }
    int mx = 1;
    for(int i = 1; i <= 1e5; ++i) {
        mx = max(cnt[i] + cnt[i - 1] + cnt[i + 1], mx);
    }
    cout << mx;
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
  int N,D;
  cin >> N >> D;
  
  int a,b;
  a = N / (2*D + 1);
  b = N % (2*D + 1);
  
  if(b==0)
  {
    cout << a << endl;
  }
  else
  {
   	cout << a+1 << endl;
  }
  
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
class Main {
  
    public static void main(String[] args) {
      
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
       Set<String> set = new HashSet();
      
      for(int i=0;i<N;i++){
        set.add(sc.next());
      }
      System.out.println(set.size());
    }
}

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

int main(){
    int n;
    int a[3][3];
    int c[3][3] = {0};
    for (int i = 0; i < 3; i++)
    {
        cin >> a[i][0] >> a[i][1] >> a[i][2] ;
    }
    
    cin >> n;
    if (n < 3){cout << "NO" <<endl;}
    vector<int> b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
   for (int i = 0; i < n; i++)
   {
       for (int j = 0; j < 3; j++)
       {
           for (int k = 0; k <3; k++)
           {
               if(a[j][k] == b[i]){
                   c[j][k] =  1;
               }
           }
           
       }
    
   }
   if(c[1][1]  &&(c[0][0]*c[2][2] || c[1][0] * c[1][2] || c[2][0] * c[0][2] || c[0][1] * c[2][0])){
       cout << "Yes" << endl;
   }
    else if(c[0][0] * (c[1][0] * c[2][0] || c[0][1]* c[0][2]))cout << "Yes" << endl;
    else if(c[2][2] * (c[0][2] * c[1][2] || c[2][0] * c[2][1]))cout << "Yes" << endl;

    else{cout << "No" << endl;}

    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define MAX_V 10000000
#define INF 10000000000

int main(){
    int n; cin >> n;
    vector<vector <ll> > dp(n, vector<ll>(3));
    int a, b, c; cin >> a >> b >> c;
    dp[0][0] = a;dp[0][1] = b; dp[0][2] = c;
    for(int i = 1; i < n; i++){
        int a[3]; cin >> a[0] >> a[1] >> a[2];
        for(int l = 0; l < 3; l++){
            for(int k = 0; k < 3; k++){
                if(l == k){continue;}
                dp[i][l] = max(dp[i-1][k]+ a[l], dp[i][l]);
            }
        }
        /*for(int m = 0; m < 3; m++){
            cout << dp[i][m] << " " ;
        }
        cout << endl;*/
    }
    ll ans = 0;
    for(int i = 0; i < 3; i++){
        ans = max(ans, dp[n-1][i]);
    }
    cout << ans << endl;
}

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

using namespace std;

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

int check(char s[][16], int y, int x, char c)
{
    if (s[y][x] != '.') return (-1);
    
    int num = 0;
    
    for (int r = 0; r < 8; r++){
        bool success = true;
        int i;
        for (i = 1; ; i++){
            int ny = y + i * dy[r], nx = x + i * dx[r];
            if (!(0 <= ny && ny <= 7 && 0 <= nx && nx <= 7) ||
                s[ny][nx] == '.'){
                success = false;
                break;
            }
            if (s[ny][nx] == c) break;
        }
        if (success) num += i - 1;
    }
    return (!num ? -1 : num);
}

void put(char s[][16], int y, int x, char c)
{
    s[y][x] = c;
    for (int r = 0; r < 8; r++){
        bool success = true;
        int i;
        for (i = 1; ; i++){
            int ny = y + i * dy[r], nx = x + i * dx[r];
            if (!(0 <= ny && ny <= 7 && 0 <= nx && nx <= 7) ||
                s[ny][nx] == '.'){
                success = false;
                break;
            }
            if (s[ny][nx] == c) break;
        }
        if (success){
            for (i = 1; ; i++){
                int ny = y + i * dy[r], nx = x + i * dx[r];
                if (s[ny][nx] == c) break;
                s[ny][nx] = c;
            }
        }
    }
}

int main()
{
    char s[16][16];
    
    for (int i = 0; i < 8; i++){
        scanf("%s", s + i);
    }
    
    while (1){
        bool upd = false;
        
        int maxnum = 0, posi = 0, posj = 0;
        for (int i = 0; i < 8; i++){
            for (int j = 0; j < 8; j++){
                if (maxnum < check(s, i, j, 'o')){
                    maxnum = check(s, i, j, 'o');
                    posi = i; posj = j;
                    upd = true;
                }
            }
        }
        if (maxnum) put(s, posi, posj, 'o');
        
        maxnum = posi = posj = 0;
        
        for (int i = 0; i < 8; i++){
            for (int j = 0; j < 8; j++){
                if (maxnum <= check(s, i, j, 'x')){
                    maxnum = check(s, i, j, 'x');
                    posi = i; posj = j;
                    upd = true;
                }
            }
        }
        if (maxnum) put(s, posi, posj, 'x');
        
        if (!upd) break;
    }
    
    for (int i = 0; i < 8; i++){
        printf("%s\n", s[i]);
    }
    
    return (0);
}

Measured memory_bytes: 1112
#include<stdio.h>

int main(void){

    double w,h,x,y;
    scanf("%lf %lf %lf %lf", &w,&h,&x,&y);
    int a = 0;

    if(x==w/2 && y==h/2) a = 1;
    else a = 0;

    printf("%lf %d\n", w*h/2.0, a);

    return 0;
}

Measured memory_bytes: 128
import scala.io.StdIn._

object Main {
    def main(args: Array[String]): Unit = { 
        val seq: Seq[Int] = (0 until 10).map(_ => readInt())
        val rev: Seq[Int] = seq.sorted.reverse
        for(i <- 0 until 3) println(rev(i))
    }   
}

Measured memory_bytes: 43816
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int cnt=0,ans=0;
  
  for(int i=0;i<s.size();i++){
    if(s[i]=='A') cnt++;
    else if(s[i]=='G') cnt++;
    else if(s[i]=='C') cnt++;
    else if(s[i]=='T') cnt++;
    else{
      ans=max(ans,cnt);
      cnt=0;
    }
  }
  ans=max(ans,cnt);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
  double n;cin>>n;
  if((int)n%2==0)
    cout<<n/2/n;
  else
    cout<<(n+1)/2/n;
}

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

int main() {
	string str;
	cin >> str;
	vector<bool> alf(26);
	for (int i = 0; i < str.size(); i++) {
		alf.at((int)str.at(i) - 97) = true;;
	}

	auto itr = find(alf.begin(), alf.end(), false);
	if (itr != alf.end()) {
		cout << (char)(itr - alf.begin() + 97) << endl;
	}
	else {
		cout << "None" << endl;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  double d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

/**
 * @title Union-find
 * @docs unionfind.md
 */
class UnionFind {
  std::vector<int> parent, depth, size;
  int count;

public:
  UnionFind(){}
  UnionFind(int n): parent(n), depth(n, 1), size(n, 1), count(n){
    std::iota(parent.begin(), parent.end(), 0);
  }

  int root_of(int i){
    if(parent[i] == i) return i;
    else return parent[i] = root_of(parent[i]);
  }

  bool is_same(int i, int j){return root_of(i) == root_of(j);}

  int merge(int i, int j){
    const int ri = root_of(i), rj = root_of(j);
    if(ri == rj) return ri;
    else{
      --count;
      if(depth[ri] < depth[rj]){
        parent[ri] = rj;
        size[rj] += size[ri];
        return rj;
      }else{
        parent[rj] = ri;
        size[ri] += size[rj];
        if(depth[ri] == depth[rj]) ++depth[ri];
        return ri;
      }
    }
  }

  int size_of(int i){return size[root_of(i)];}

  int count_group(){return count;}
};



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

  int N, Q; std::cin >> N >> Q;
  UnionFind uf(N);

  for(int i = 0; i < Q; ++i){
    int type, u, v; std::cin >> type >> u >> v;
    if(type == 0) uf.merge(u, v);
    else std::cout << uf.is_same(u, v) << "\n";
  }

  return 0;
}


Measured memory_bytes: 5512