akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <queue>
using namespace std;

#define INFTY (1 << 30)

//???????????????
enum Color {
	WHITE,
	GRAY,
	BLACK,
};


//SSSP
void Dijkstra(vector<pair<int, int>> *v_w_m, int verNum) {

	//???????¨????
	priority_queue<pair<int, int>> pQ;
	int distance[10000];
	Color color[10000];
	int parent[10000];
	for (int i = 0; i < verNum; i++) {
		color[i] = WHITE;
		distance[i] = INFTY;
		parent[i] = -1;
	}
	distance[0] = 0;
	pQ.push(make_pair(0, 0));


	//SSSP??????
	while (!pQ.empty()) {

		//??°??¬????????????????????????????°?????????????????????¶
//		int min_cost = INFTY;
		int subScript;
		pair<int, int> wei_sub_map = pQ.top();
		pQ.pop();
		subScript = wei_sub_map.second;
		//for (int i = 0; i < verNum; i++) {
		//	if (color[i] != BLACK && distance[i] < min_cost) {
		//		min_cost = distance[i];
		//		subScript = i;
		//	}
		//}

		//?????????????????????
		color[subScript] = BLACK;

		//???????????????????????°??????????????????????????????????????????
		//?????????????????¨4169407B?????¨??????0.01sec????????????
		if (distance[subScript] < wei_sub_map.first * -1)
			continue;

		//??£??\?????°??¬??????
		for (int i = 0; i < v_w_m[subScript].size(); i++) {
			int outV = v_w_m[subScript][i].first;
			if (color[outV] == BLACK) continue;
			if (distance[outV] < distance[subScript] + v_w_m[subScript][i].second) continue;

			distance[outV] = distance[subScript] + v_w_m[subScript][i].second;
			parent[outV] = subScript;
			color[outV] = GRAY;
			pQ.push(make_pair(distance[outV] * -1, outV));
		}
	}

	//??????
	int weight_sum = 0;
	for (int i = 0; i < verNum; i++) {
		cout << i << " " << (distance[i] == INFTY ? -1 : distance[i]) << endl;
	}
}


int main() {

	int verNum;
//	int verValWeight[100][100];
	vector<pair<int, int>> v_w_m[10000];
	int parent[10000];

	//???????¨????
//	v_w_m = new vector<pair<int, int>>();
	cin >> verNum;
	//for (int i = 0; i < verNum; i++)
	//	for (int j = 0; j < verNum; j++)
	//		verValWeight[i][j] = INFTY;

	//??\?????????
	for (int i = 0; i < verNum; i++) {
		int verVal, outNum;
		cin >> verVal >> outNum;
		for (int j = 0; j < outNum; j++) {
			int outVerVal, weight;
			cin >> outVerVal >> weight;
//			v_w_m[verVal].push_back(make_pair(outVerVal, weight));
			v_w_m[verVal].push_back(make_pair(outVerVal, weight));
			//			verValWeight[i][outVerVal] = weight;
		}
	}

	//SSSP
	Dijkstra(v_w_m, verNum);

	return 0;
}

Measured memory_bytes: 8024
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b;
	double h, m;
	cin >> a >> b >> h >> m;
	m /= 5;
	h += m / 12;
	double degree = min(fabs(h - m), 12 - fabs(h - m)) * 360 / 12;
	//cout << degree << '\n';
	double rad = degree *  3.14159265358979323846 / 180;
	printf("%.20f", sqrt(a * a + b * b - 2.0 * a * b * (double)cos(rad)));   
}

Measured memory_bytes: 4156
char a[99],b[99];
int p,q,i,l,r;
#define f(x) (x=='('?')':x==')'?'(':x=='{'?'}':x=='}'?'{':x=='['?']':x==']'?'[':x)
int palindrome(){
	for(i=l=0;i<strlen(a);i++)
		if(p&1<<i)b[l++]=a[i];
	b[l]=0;
	l=strlen(b);
	for(i=0;i<l/2;i++)if(b[i]!=f(b[l-1-i]))return;
	if(b[i]!='w')return;
	r=l>r?l:r;
}
main(){
	scanf("%s",a);q=1<<strlen(a);
	for(p=1;p<q;p++)palindrome();
	printf("%d\n",r);exit(0);
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline  # NOQA
sys.setrecursionlimit(10 ** 7)  # NOQA


def dfs(G, v, p, counter):
    """G: graph, v: vertex, p: parent"""
    # Loop for each child
    counter_v = counter[v]
    for c in G[v]:
        if c == p:
            continue  # Avoid multiple access to parent
        counter[c] += counter_v
        dfs(G, c, v, counter)


def main():
    N, Q = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append(b)
        G[b].append(a)

    counter = [0] * N
    for i in range(Q):
        p, x = map(int, input().split())
        p -= 1
        counter[p] += x

    dfs(G, 0, -1, counter)
    # print(*counter)
    print(" ".join(map(str, counter)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 232212
def main():
    N = int(input())
    S = input()
    RGB = [0]*3
    for s in S:
        if s == "R":
            RGB[0] += 1
        elif s == "G":
            RGB[1] += 1
        else:
            RGB[2] += 1
    ans = RGB[0] * RGB[1] * RGB[2]
    for d in range(1, N):
        for i in range(N-d+1):
            if N <= i + 2*d:
                break
            if S[i] != S[i+d] and S[i] != S[i+2*d] and S[i+d] != S[i+2*d]:
                ans -= 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 68196
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println(n/3);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	long combination(int n, int r, int m) { //nCr mod m
		long[][] Combination = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			Combination[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				Combination[i][j] = (Combination[i - 1][j - 1] + Combination[i - 1][j]) % m;
			}
		}
		return Combination[n][r];
	}

	int gcd(int a, int b) {
		if (a < b) {
			int c = a;
			a = b;
			b = c;
		}
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 21844
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = std::vector<int>;
using VI2D = std::vector<vector<int>>;
using VLL = std::vector<long long>;
using VLL2D = std::vector<vector<long long>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

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

template <typename T, std::size_t N>
struct make_vector_type {
	using type =
		typename std::vector<typename make_vector_type<T, (N - 1)>::type>;
};

template <typename T>
struct make_vector_type<T, 0> {
	using type = typename std::vector<T>;
};

template <typename T, size_t N>
auto make_vector_impl(const std::vector<std::size_t>& ls, T init_value) {
	if constexpr(N == 0) {
		return std::vector<T>(ls[N], init_value);
	} else {
		return typename make_vector_type<T, N>::type(
			ls[N], make_vector_impl<T, (N - 1)>(ls, init_value));
	}
}

template <typename T, std::size_t N>
auto make_vector(const std::size_t (&ls)[N], T init_value) {
	std::vector<std::size_t> dimensions(N);
	for(int i = 0; i < N; i++) {
		dimensions[N - i - 1] = ls[i];
	}
	return make_vector_impl<T, N - 1>(dimensions, init_value);
}

template <typename T>
std::vector<T> make_vector(std::size_t size, T init_value) {
	return std::vector<T>(size, init_value);
}

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max<T>(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min<T>(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int d, t, s;
	cin >> d >> t >> s;
	int metre = t * s;
	cout << (metre >= d ? "Yes" : "No") << endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

vector<int> edges[100010];

void solve() {
  int N, M; cin >> N >> M;
  int A, B;
  rep(i, M) {
    cin >> A >> B;
    edges[A].push_back(B);
    edges[B].push_back(A);
  }
  vector<bool> used(N + 1);
  deque<int> d;
  used[A] = used[B] = true;
  bool front = true;
  function<void(int x)> dfs = [&](int x) {
    used[x] = true;
    if (front) d.push_front(x); else d.push_back(x);
    each(e, edges[x]) {
      if (used[e]) continue;
      dfs(e);
      break;
    }
  };
  dfs(A); front = false; dfs(B);
  vector<int> ans;
  each(v, d) ans.push_back(v);
  cout << ans.size() << '\n';
  cout << ans << '\n';
}


Measured memory_bytes: 13432
using System;
using static System.Console;
using static System.Math;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;


namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var count = int.Parse(ReadLine());
            int ac = 0;
            int wa = 0;
            int tle = 0;
            int re = 0;
            //var s = Console.ReadLine().Split(' ')
            for (int i = 0; i < count; i++)
            {
                var s = Console.ReadLine().Split(' ');
                if (s[0] == "AC")
                { ac++; }
                else if (s[0] == "WA")
                { wa++; }
                else if (s[0] == "TLE")
                { tle++; }
                else
                { re++; }
            }

            WriteLine($"AC x {ac}");
            WriteLine($"WA x {wa}");
            WriteLine($"TLE x {tle}");
            WriteLine($"RE x {re}");
            Out.Flush();
        }



    }

    public static class MyMath
    {
        public static long Factorical(long n)
        { return n <= 1 ? 1L : n * Factorical(n - 1); }
        public static long Permutation(long n, long m)
        { return m == 0 ? 1L : (m == n) ? Permutation(n, m - 1) : n * Permutation(n - 1, m - 1); }
        public static long Combination(long n, long m)
        { return n - m > m ? Permutation(n, m) / Factorical(m) : Permutation(n, n - m) / Factorical(n - m); }
        public static long Gcd(long n, long m)
        { return n % m == 0 ? m : Gcd(m, n % m); }
        public static long Lcm(long n, long m)
        { return n * m / Gcd(n, m); }
        public static long Pow(long n, long m)
        { return (m == 1 || m == 0) ? 1L : n * Pow(n, m - 1); }
    }


}

Measured memory_bytes: 33756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s; cin >> s;
    string ans = "";
    each(c, s) {
        if (c == 'B') {
            if (!ans.empty())ans = ans.substr(0, ans.length() - 1);
        }
        else ans += c;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	int k=0;
	cin >>s>>k;
	set<string>dis;
	string bef="";
	rep(i,s.size()){
		bef="";
		for(int j=i;j<s.size() and j<i+5;j++){
			bef+=s[j];
			dis.insert(bef);
		}
		
	}
	auto ans=dis.begin();
	advance(ans,k-1);
	cout<<(*(ans))<<endl;
}

Measured memory_bytes: 1664
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(a+b+c>=22){
      System.out.println("bust");
    }else{
      System.out.println("win");
    }
    
  }
}

Measured memory_bytes: 26892
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int q = sc.nextInt();
		int[] r = new int[q];
		int[] l = new int[q];
		for (int i = 0; i < q; i++) {
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		TreeSet<Integer> prime = new TreeSet<>();
		TreeSet<Integer> similar = new TreeSet<>();
		prime.add(2);
		for (int i = 3; i <= 100000; i++) {
			boolean bre = false;
			for (int p:
				 prime) {
				if (i % p == 0) {
					bre = true;
					break;
				}
			}
			if (!bre) {
				prime.add(i);
				if (prime.contains((i + 1) / 2)) {
					similar.add(i);
				}
			}
		}
		for (int i = 0; i < q; i++) {
			System.out.println(similar.subSet(l[i], r[i] + 1).size());
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 48756
S=input()

if S=="MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S=="THU":
    print(3)
elif S=="FRI":
    print(2)
elif S=="SAT":
    print(1)
else:
    print(7)

Measured memory_bytes: 38256
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

const long long mod = 1e9 + 7;

int main(){
	long long a , b , c , d;
	cin >> a >> b >> c >> d;
	long long ans = max({(a * c) , (a * d) , (b * c) , (b * d)});
	cout << ans << endl;
	return 0;
}
 


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

using namespace std;

typedef long long ll;

#define newline cout<<"\n"
#define deb(x) cout<<#x<<" "<<x<<endl;

template<typename... T>
void read(T&... args){
    ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
    ((cout<<args<<" "), ...);
}

void printarr(vector<ll> &v){
    for(ll x: v){
        cout<<x<<" ";
    }
    newline;
}

const ll MOD = 1e9+7;
const ll nax = 1e7+7;

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    
    ll x, k, d; read(x,k,d);

    x = abs(x);

    if(x>0 && x/d>=k){
        x -= k*d;
        cout<<x<<endl;
        return 0;
    }
    ll steps_taken = x/d;
    x-=d*steps_taken;
    k-=steps_taken;
    
    if(k%2==0){
        cout<<abs(x)<<endl;
    }
    else{
        cout<<min(abs(x-d), abs(x+d))<<endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >>y2;
  int yoko = x2-x1;
  int tate = y2-y1;
  int y3= y2+yoko;
  int x3 = x2-tate;
  int x4 = x3-yoko;
  int y4 = y3-tate;
  cout << x3 << " " << y3 << " " << x4 << " " <<  y4 << endl;
  }


Measured memory_bytes: 256
l=[]
for i in range(3):
    a,b=map(int,input().split())
    l.append(a)
    l.append(b)
l.sort()
if l[0]!=l[1] and l[1]!=l[2] and l[2]==l[3] and l[3]!=l[4] and l[4]==l[5]:
    print("YES")
elif l[0]!=l[1] and l[1]==l[2] and l[2]!=l[3] and l[3]==l[4] and l[4]!=l[5]:
    print("YES")
elif l[0]==l[1] and l[1]!=l[2] and l[2]==l[3] and l[3]!=l[4] and l[4]!=l[5]:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include<stdio.h>

void swap(int A[],int a,int b){
int temp;

temp=A[a];
A[a]=A[b];
A[b]=temp;

}







int main(){
int w,n,i;
int A[31];
int com1,com2;

scanf("%d",&w);
scanf("%d",&n);

for(i=1;i<=w;i++){A[i]=i;}

for(i=0;i<n;i++){scanf("%d,%d",&com1,&com2);swap(A,com1,com2);}

for(i=1;i<=w;i++){printf("%d\n",A[i]);}

return 0;
}

Measured memory_bytes: 1744
// aribon3-1-4_c
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, A;
    cin >> N >> A;
    vector<int> X(N);
    REP(i, N) {
        int x;
        cin >> x;
        X[i] = x - A;
    }

    const int mx = 50 * 50 + 1;
    vector<ll> dp(2 * mx);
    dp[mx] = 1;
    REP(i, N){

        vector<ll> prev = dp;

        REP(n, dp.size()){
            if (prev[n]) dp[n + X[i]] += prev[n];
        }
    }

    print(dp[mx] - 1);


    return 0;
}


Measured memory_bytes: 384
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#define rep(n, i) for(int i = 0; i < n; i++)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define INF 100001


void solve(void){
    int counts[INF];
    int p_flag[INF];

    rep (INF, i) counts[i] = p_flag[i] = 0;
    for (int i = 2; i <= INF; i++) {
        if (!p_flag[i-1]) {
            for (int j = 2*i; j <= INF; j += i) p_flag[j-1] = 1;
        }
    }
    for (int i = 3; i <= INF; i+=2) {
        if (!p_flag[i-1]&&!p_flag[(i+1)/2-1]) counts[i-1]++;
    }
    for(int i = 3; i <= INF; i++) counts[i-1] += counts[i-2];
    int n;
    scanf("%d\n", &n);
    while (n--) {
        int l, r;
        scanf("%d%d\n", &l, &r);
        printf("%d\n", counts[r-1]-counts[MAX(0,l-2)]);
    }
}

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


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

int main() {
  int N;
  cin >> N;
  
  if ( N <= 2 ){
    cout << 0 << endl;
  }
  else if ( N%3 == 0 ) {
    cout << N/3 << endl;
  }
  else {
    cout << N/3 << endl;
  }
}


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

const int inf = 1e9;
const ll linf = 1e18;

class UnionFind
{
protected:
    vector<int> par;
    vector<int> rank;
    vector<int> sz;
    int _count;

public:
    UnionFind(int n) : par(n), rank(n, 0), sz(n, 1), _count(n) {
        iota(par.begin(), par.end(), 0);
    }

    virtual int find(int x) {
        if (par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return;

        _count--;
        if (rank[x] < rank[y]) {
            swap(x, y);
        }
        if (rank[x] == rank[y]) rank[x]++;

        par[y] = x; sz[x] += sz[y];
    }

    bool same(int x, int y) { return find(x) == find(y); }

    int size(int x) { return sz[find(x)]; }

    int count() { return _count; }
};

template <typename T>
class WeightedUnionFind : public UnionFind
{
private:
    vector<T> wt;

public:
    WeightedUnionFind(int n, T unity = 0) : UnionFind(n), wt(n, unity) {}

    int find(int x) override {
        if (par[x] == x) return x;
        else {
            int t = find(par[x]);
            wt[x] += wt[par[x]];
            return par[x] = t;
        }
    }
    
    int weight(int x) {
        find(x); return wt[x];
    }

    void unite(int x, int y, T w) {
        w += weight(x); w -= weight(y);
        x = find(x); y = find(y);
        if (x == y) return;

        _count--;
        if (rank[x] < rank[y]) {
            swap(x, y); w = -w;
        }
        if (rank[x] == rank[y]) rank[x]++;

        par[y] = x; sz[x] += sz[y]; wt[y] = w;
    }

    T diff(int x, int y) { return weight(y) - weight(x); }
};

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

    int n, m; cin >> n >> m;
    WeightedUnionFind<int> uf(n);
    for (int i = 0; i < m; i++) {
        int l, r, d; cin >> l >> r >> d; l--, r--; // 0-indexed
        if (!uf.same(l, r)) {
            uf.unite(l, r, d);
        } else {
            if (d != uf.diff(l, r)) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1920
### A ###
def blackjack_three(a, b, c):
    res = a1 + a2 + a3
    if res >= 22:
        return 'bust'
    else:
        return 'win'
    
a1,a2,a3 = map(int, input().split())
res = blackjack_three(a1, a2, a3)
print(res)

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

int main(){
    int n,a,b;
    cin >> a >> b;
    cout << b+(b-a) << endl;

    return 0;
}

Measured memory_bytes: 256
import sys

a, b, c, d = map(int, sys.stdin.readline().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return abs(a)

def lcm(a, b):
    return abs(a // gcd(a, b) * b)

def f(n, a, b):
    return n - (n // a + n // b - n // (lcm(a, b)))

def main():
    ans = f(b, c, d) - f(a-1, c, d)
    return ans

if __name__ == '__main__':
    ans = main()
    print(ans)

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

using namespace std;

int main(){
    int A, B, C, K;
    cin >> A >> B >> C >> K;

    if (A >= K){
        cout << K << endl;
    }
    else if ((A + B) >= K){
        cout << A << endl;
    }
    else {
        cout << 2*A + B - K << endl;
    }

    return 0;
}



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

using namespace std;

int main(void) {
  int n, z, w;
  cin >> n >> z >> w;

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

  if (n == 1) {
    cout << abs(a[n - 1] - w) << endl;
  } else {
    cout << max(abs(a[n - 1] - w), abs(a[n - 1] - a[n - 2])) << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
const ll MOD = 1e9 + 7;
const ll INF = (ll)1e18;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  // ll n, m;
  // cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  string s;
  cin>>s;
  fi(0,2)
    fj(0,2)
    fk(0,2){
      ans=s[0]-'0';
      ans=(i==0?ans+s[1]-'0':ans-(s[1]-'0'));
      ans=(j==0?ans+s[2]-'0':ans-(s[2]-'0'));
      ans=(k==0?ans+s[3]-'0':ans-(s[3]-'0'));
      if(ans==7){
        cout <<s[0]<<(i==0?'+':'-')<<s[1]<<(j==0?'+':'-')<<s[2]<<(k==0?'+':'-')<<s[3]<<"=7";
        return 0;
      }
    }
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner  = new Scanner(System.in);
		int x = scanner.nextInt();
		scanner.close();
		if( x<=599){
			System.out.println(8);
			return;
		}
		if( x<=799){
			System.out.println(7);
			return;
		}
		if( x<=999){
			System.out.println(6);
			return;
		}
		if(x<=1199){
			System.out.println(5);
			return;
		}
		if(x<=1399){
			System.out.println(4);
			return;
		}
		if(x<=1599){
			System.out.println(3);
			return;
		}
		if(x<=1799){
			System.out.println(2);
			return;
		}
		if(x<=1999){
			System.out.println(1);
			return;
		}
	}
}

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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define endl "\n"
#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int gcd(ll a, ll b){
  if(b == 0){
    return a;
  }else{
    return gcd(b,a%b);
  }
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  string s;
  cin >> s;
  int max = 0;
  int now = 0;
  bool flg = false;
  REP(i,3){
    if(s[i] == 'R'){
      if(!flg){
        now = 1;
        flg = true;
        chmax(max,now);
      }else{
        now++;
        chmax(max,now);
      }
    }else{
      now = 0;
      flg = false;
    }
  }

  cout << max << endl;
  return 0;
}


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

int main ()
{
	string s;  cin>>s;
	
	if(s=="a"||s=="e"||s=="i"||s=="o"||s=="u"){
		cout<<"vowel"<<endl;
	}
	
	else 
	 cout<<"consonant"<<endl;
	 
	


}



Measured memory_bytes: 3572
import java.io.PrintWriter
import java.util.ArrayDeque

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

/** edge info */
data class Edge(val to: Int)

fun solve(out: PrintWriter) {
    val (n, m) = readIntegerList()
    val hList = readIntegerList()
    /** graph[fromNodeIndex]: edges to other node */
    val graph = Array(n) { mutableListOf<Edge>() }
    repeat(m) {
        val (a, b) = readIntegerList().map { it - 1 }
        graph[a].add(Edge(b))
        graph[b].add(Edge(a))
    }

    val isGoodNodeArray = BooleanArray(n) { true }
    val isUnchecked = BooleanArray(n) { true }
    val nodeQueue = ArrayDeque<Int>()
    for (i in 0 until n) {
        nodeQueue.addLast(i)
        isUnchecked[i] = false
        while (nodeQueue.isNotEmpty()) {
            val node = nodeQueue.removeFirst()
            for (edge in graph[node]) {
                if (isUnchecked[edge.to]) {
                    isUnchecked[edge.to] = false
                    nodeQueue.addLast(edge.to)
                }

                if (hList[node] <= hList[edge.to]) {
                    isGoodNodeArray[node] = false
                }
            }
        }
    }

    println(isGoodNodeArray.count { it })
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 80852
#include <stdio.h>
#include <string.h>
int main(){
	char a[11];
	char b[11];
	char c[11];
	scanf("%s %s %s", &a,&b,&c);
	int d = strlen(a);
	int e = strlen(b);
	if(a[d-1]==b[0]&&b[e-1]==c[0]){
		printf("YES");
	}else{
		printf("NO");
	}
return 0;
}

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

namespace AGC018A
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] NK = Console.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
            long[] A = Console.ReadLine().Split(' ').Select(b => long.Parse(b)).ToArray();
            Console.WriteLine(solve(NK[1], A) ? "POSSIBLE" : "IMPOSSIBLE");
        }

        static bool solve(long K, long[] A)
        {
            if (K > A.Max())
            {
                return false;
            }

            long Gcd = A[0];

            for (int i = 0; i < A.Length; i++)
            {
                Gcd = gcd(Gcd, A[i]);
            }

            if (K % Gcd == 0)
            {
                return true;
            }

            return false;
        }

        static long gcd(long a, long b)
        {
            long mod;
            while (b != 0)
            {
                mod = a % b;
                a = b;
                b = mod;
            }

            return a;
        }
    }
}

Measured memory_bytes: 22880
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    long a[n];

    for (int i = 0; i < n; i++)
        cin >> a[i];

    long min = a[0], max = a[0], sum = 0;

    for (int i = 0; i < n; i++)
    {
        if (min > a[i])
            min = a[i];
        if (max < a[i])
            max = a[i];
        sum += a[i];
    }
    cout << min << ' ' << max << ' ' << sum << endl;

    return 0;
}


Measured memory_bytes: 3156
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	int a = sc.nextInt();
      	int b = sc.nextInt();
      	int time = sc.nextInt();
      	int c = (int)(time/a)*b;
      	System.out.println(c);
    }
}
      	

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

#define mx 1000008
typedef long long int ll;
ll w[102],v[102];
ll dp[1009*100][103];
ll n;
typedef long long int ll;
ll cal(ll i,ll j)
{
    if(j==n+1){
        if(i==0) return 0;
        else  return 13123152832;

    }
    if(i<0) return 123239512312;
    if(i==0) return 0;
    if(dp[i][j]!=-1){
        return dp[i][j];
    }
    ll res=min(cal(i,j+1),cal(i-v[j],j+1)+w[j]);

    return dp[i][j]=res;
}
int main()
{
    //seive();
    int t=1;
    //cin>>t;
    int c=0;
    while(t--){
        ll k;
        cin>>n>>k;
        for(int i=1;i<=n;i++){
            cin>>w[i]>>v[i];
        }
        ll ans=0;
        memset(dp,-1,sizeof(dp));
        for(ll i=1;i<=100007;i++){
            ll x=cal(i,1);
            if(x<=k){
                ans=max(ans,i);
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 84792
using System;
using System.Collections.Generic;
using System.Linq;
namespace AOJ {
  public class AOJ {
    public static void Main(string[] args) {
      int[] data = new int[10000];
      int n;
      for(n = 0;; ++n) {
        int m = int.Parse(Console.ReadLine());
        if(m == 0) break;
        data[n] = m; 
      }
      for(int i = 0; i < n; ++i) {
        Console.WriteLine("Case {0}: {1}",i + 1,data[i]);
      }
    }
  }
}

Measured memory_bytes: 9412
#include<stdio.h>

int main(void)
{
	char s[101];
	long long int i,c=0,k,a;
	scanf("%s%lld",s,&k);
	for(i=0;i<100;i++)
	{
		if(s[i]=='1')
			c++;
		if(s[i]!='1'){
			a=s[i]-'0';
			break;
		}
	}
	if(c>=k)
		printf("1");
	else
		printf("%lld",a);
	return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> x(n),y(n);
  for(int i=0;i<n;i++) cin >> x[i] >> y[i];
  for(int i=0;i<n;i++) if(abs((x[0] + y[0]) % 2) != abs((x[i] + y[i]) % 2)){cout << -1 << endl; return 0;}
  int par = (1==abs((x[0] + y[0]) % 2) ? 0 : 1);
  cout << 31 + par << endl;
  int p = 1;
  if(par) cout << 1 << " ";
  for(int i=0;i<31;i++){
  	cout << p << " ";
    p = 2 * p;
  }
  cout << endl;

  for(int i=0;i<n;i++){
    p = 1073741824;
    if(par) cout << "D";
    int xx = x[i], yy = y[i] + par;
    char c[32]; c[31] = '\0';
    for(int j=0;j<31;j++){
      int u = xx + yy, v = xx - yy;
      if(u >=0 && v >= 0){c[30-j] ='R'; xx -= p;}
      else if(u >=0 && v <= 0){c[30-j] ='U'; yy -= p;}
      else if(u <=0 && v <= 0){c[30-j] ='L'; xx += p;}
      else if(u <=0 && v >= 0){c[30-j] ='D'; yy += p;}
      p /= 2;
    }
    cout << c << endl;
  }
 return 0;
}

Measured memory_bytes: 256
def inpl(): return [int(i) for i in input().split()]

n, k = inpl()
C =inpl()
ans = 10**9
for i in range(n-k+1):
    ans = min(ans, abs(C[i]-C[k+i-1])+min(abs(C[i]),abs(C[k+i-1])))
print(ans)

Measured memory_bytes: 14224
#include<stdio.h>

int  main(void){
  int A, B, C;
  int count = 0;
  scanf("%d %d %d", &A, &B, &C);
  if(A == B)
    count++;
  if(A == C)
    count++;
  if(B == C)
    count++;
  if(count == 1)
    printf("Yes");
  else
    printf("No");
  
  return 0;
}


Measured memory_bytes: 1700
#nは店の数、mは必要な栄養ドリンクの数
n,m=map(int,input().split())

#a円の栄養ドリンクがb本
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))

ab.sort()
cost=0
for i in range(n):
    if ab[i][1]>m:
        cost+=ab[i][0]*m
        break
    else:
        cost+=ab[i][0]*ab[i][1]
        m-=ab[i][1]

print(cost)


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

int main() {
    long A, B, C;
    long N;
    cin>>A>>B>>C;
    N = A+B+C;
    if(N%2!=0) cout<<0<<endl;
    else if(A==B & B==C){
        cout<<-1<<endl;
    }
    else {
        long ans1=0, ans2=0, ans3=0, ans4=0;
        while(A%2==0){
            if(A==(N-A)/2){
                ans1 = 1e9+7;
                break;
            }
            ans1++;
            A = (N-A)/2;
        }
        while(B%2==0){
            if(B==(N-B)/2){
                ans2 = 1e9+7;
                break;
            }
            ans2++;
            B = (N-B)/2;
        }
        while(C%2==0){
            if(C==(N-C)/2){
                ans3 = 1e9+7;
                break;
            }
            ans3++;
            C = (N-C)/2;
        }
        cout<<min(ans1, min(ans2, ans3))<<endl;
    }
}


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

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

    vector<int> a(n);
    int count = 0;
    for (auto i = 0; i < n; i++) {
        cin >> a[i];
        if(a[i] % 2) count++;
    }
    if(count % 2 == 0) {
        cout << "YES" << endl;
        return 0;
    }

    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}

int main()
{
    int n, ar[110], br[110], cr[110], sum, temp, i, j, k, c=0;
    scanf("%d", &n);
    for (i=0; i<n; i++)
        scanf("%d", &ar[i]);
    for (i=0; i<n; i++)
        scanf("%d", &br[i]);
    for(i=0; i<n; i++)
    {
        sum = 0;
        for(j=0; j<=i; j++)
            sum = sum+ar[j];
        for(j=i; j<n; j++)
            sum = sum+br[j];
        cr[c] = sum;
        c++;
    }
    qsort (cr, c, sizeof(int), cmpfunc);
    printf("%d", cr[c-1]);
    return 0;
}


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

using namespace std ;

const int MAX = 700 + 10 ;

int vis[MAX] , mark[MAX][MAX] , col[MAX] ;
int n , m ;

vector< vector<int> >adj(MAX) ;

int cnt[2] ;

void dfs(int node)
{
	vis[node] = 1 ;
	cnt[col[node]]++ ;
	for(auto &child : adj[node])
	{
		if(vis[child])
		{
			if(col[child] == col[node])
			{
				cout<<-1<<"\n" ;
				exit(0) ;
			}
			continue ;
		}
		col[child] = !col[node] ;
		dfs(child) ;
	}
}

int dp[MAX][MAX] ;

vector< pair<int , int> >vp  ;

int calc(int a , int b)
{
	return a * b + a * (a-1) / 2 ;
}

int solve(int idx , int cnt0 , int cnt1)
{
	if(idx == vp.size())
		return 0 ;
	int &ret = dp[idx][cnt0] ; // cnt1 is unique for every state
	if(ret != -1)
		return ret ;
	ret = solve(idx+1 , cnt0 + vp[idx].first , cnt1 + vp[idx].second) + calc(vp[idx].first , cnt0) + calc(vp[idx].second , cnt1) ;
	ret = min(ret , solve(idx+1 , cnt0 + vp[idx].second , cnt1 + vp[idx].first) + calc(vp[idx].first , cnt1) + calc(vp[idx].second , cnt0)) ;
	return ret ;
}

int main()
{
	memset(dp , -1 , sizeof(dp)) ;
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		int x , y ;
		cin>>x>>y ;
		mark[x][y] = mark[y][x] = 1 ;
	}
	for(int i = 1 ; i <= n ; ++i)
	{
		for(int j = i+1 ; j <= n ; ++j)
		{
			if(!mark[i][j] && i != j)
				adj[i].push_back(j) , adj[j].push_back(i) ;
		}
	}
	for(int i = 1 ; i <= n ; ++i)
	{
		if(vis[i])
			continue ;
		cnt[0] = cnt[1] = 0 ;
		dfs(i) ;
		vp.emplace_back(cnt[0] , cnt[1]) ;
	}
	return cout<<solve(0 , 0 , 0)<<"\n" , 0 ;
}		

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

int main()
{
	int N;
	long long A[100001];
	int count = 0;
	int maxCount = 0;

	cin >> N;

    for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	for (int i = 0; i < N-1; i++)
	{
		
		if (A[i] >= A[i + 1])count++;
		if ((A[i] < A[i + 1]) || (i == N-2))
		{
			if (maxCount <= count)maxCount = count;
			count = 0;
		}
	}
	cout << maxCount << endl;
}

Measured memory_bytes: 1024
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0
tmp = 0
for i in range(N):
    if i == 0:
        continue
    elif i == 1:
        ans += A.pop()
    elif i % 2 == 0:
        tmp = A.pop()
        ans += tmp
    else:
        ans += tmp
print(ans)

Measured memory_bytes: 94236
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(h):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h+1):
    for k in range(1, w+1):
        if arr[j][k] == "#":
            if (arr[j-1][k] == '.') and (arr[j][k-1] == '.') and (arr[j+1][k] == '.') and (arr[j][k+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')
        


Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

// NO SAD

void solve() {
  int m, d;
  cin >> m >> d;
  int ret = 0;
  for(int i = 10; i <= d; i++) {
    for(int a = 1; a <= m; a++) {
      if((i%10)*(i/10) == a && i%10 >= 2 && i/10 >= 2) {
        ret++;
      }
    }
  }
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  // casesolve();
  solve();
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,k;scanf("%lld%lld",&n,&k);
	if(k&1)printf("%lld\n",(n/k)*(n/k)*(n/k));
	else printf("%lld\n",(n/k)*(n/k)*(n/k)+((n+k/2)/k)*((n+k/2)/k)*((n+k/2)/k));
	return 0;
}

Measured memory_bytes: 256
def d_xxor(N, K, A):
    bit_max = 40  # N,K <= 10**12 < 2**40 なので、入力は40bit以下で表せる
    ans = 0

    for b in range(bit_max, -1, -1):
        power = 1 << b
        # Aの各要素を2進表記したとき、b番目のビットに1は何個立つか？
        bit_count_1 = len([1 for a in A if a & power != 0])

        # 解説における、「X_k=0とするか1とするか判定する」部分
        tmp = bit_count_1
        if power <= K and bit_count_1 <= N - bit_count_1:
            # X_k=1とした。XとKとの差を補正する。
            tmp = N - bit_count_1
            K -= power
        contribution = power * tmp

        ans += contribution  # 「b番目のビットがfに貢献する値」
    return ans

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(d_xxor(N, K, A))

Measured memory_bytes: 14620
void main()
{
    long[] nk = rdRow;
    long n = nk[0], k = nk[1];

    long[] rsp = rdRow;

    string t = rdStr;

    string u;
    long score;
    foreach (i, x; t)
    {
        dchar now = check(x);
        if (i >= k)
        {
            if (u[i-k] == now)
            {
                if (i + k >= n)
                {
                    u ~= check(now);
                }
                else
                {
                    u ~= check(check(t[i+k]));
                }
            }
            else
            {
                u ~= now;
                score += calc(now, rsp);
            }
        }
        else
        {
            u ~= now;
            score += calc(now, rsp);
        }
    }

    score.writeln;
}

dchar check(dchar x)
{
    if (x == 'r') return 'p';
    else if (x == 's') return 'r';
    else return 's';
}

long calc(dchar x, long[] arr)
{
    if (x == 'r') return arr[0];
    else if (x == 's') return arr[1];
    else return arr[2];
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 2556