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

namespace AtTest.D_Challenge
{
    class ABC_061
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] nm = ReadInts();
            int n = nm[0];
            int m = nm[1];
            var edges = new int[m, 3];
            for (int i = 0; i < m; i++)
            {
                int[] abc = ReadInts();
                edges[i, 0] = abc[0] - 1;
                edges[i, 1] = abc[1] - 1;
                edges[i, 2] = -abc[2];
            }
            var distances = new long[n];
            for (int i = 0; i < n; i++)
            {
                distances[i] = long.MaxValue;
            }
            distances[0] = 0;
            for (int i = 0; i < n-1; i++)
            {
                for (int v = 0; v < m; v++)
                {
                    int a = edges[v,0];
                    int b = edges[v,1];
                    long c = edges[v,2];
                    if(distances[a]!=long.MaxValue
                        && distances[b] > distances[a] + c)
                    {
                        distances[b] = distances[a] + c;
                    }
                }
            }
            //negative check
            var negative = new bool[n];
            for (int i = 0; i < n; i++)
            {
                for (int v = 0; v < m; v++)
                {
                    int a = edges[v, 0];
                    int b = edges[v, 1];
                    long c = edges[v, 2];
                    if (distances[a] != long.MaxValue
                        && distances[b] > distances[a] + c)
                    {
                        distances[b] = distances[a] + c;
                        negative[b] = true;
                    }
                    if (negative[a]) negative[b] = true;
                }
            }
            Console.WriteLine(negative[n - 1] ?
                "inf" : (-distances[n - 1]).ToString());
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}

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

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

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

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

  vector<LL> a(n + 1);
  a.at(0) = 2, a.at(1) = 1;
  for (int i = 2; i <= n; i ++) {
    a.at(i) = a.at(i - 1) + a.at(i - 2);
  }

  cout << a.at(n) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,k[200005];
bool vis[20];
void dfs(int x,int y,int l,int r)
{
    //cout<<l<<' '<<r<<' '<<x<<' '<<y<<endl;
    k[l]=x;
    k[r]=y;
    if(l>=r-1) return;
    int t;
    for(int i=0;i<n;i++)
    {
        //cout<<(1<<i&x)<<' '<<(1<<i&y)<<' '<<i<<' '<<vis[i]<<endl;
        if(vis[i]) continue;
        if((1<<i&x)!=(1<<i&y)) {t=i;break;}
    }
    //cout<<t<<endl;
    vis[t]=true;
    int p=0,q=0;
    bool flag=true;
    for(int i=0;i<n;i++)
    {
        if(vis[i])
        {
            p^=(1<<i)&x;
            q^=(1<<i)&y;
        }
        else if(flag)
        {
            p^=((1<<i)&x)^(1<<i);
            q^=((1<<i)&x)^(1<<i);
            flag=false;
        }
        else
        {
            p^=(1<<i)&x;
            q^=(1<<i)&x;
        }
    }
    dfs(x,p,l,(l+r)/2);
    dfs(q,y,(l+r)/2+1,r);
    vis[t]=false;
}
int main()
{
    scanf("%d%d%d",&n,&a,&b);
    if(__builtin_popcount(a)%2==__builtin_popcount(b)%2)
    {
        printf("NO\n");return 0;
    }
    printf("YES\n");
    int t=1<<n;
    dfs(a,b,0,t-1);
    for(int i=0;i<t;i++)
        printf(i==t-1?"%d\n":"%d ",k[i]);
}


Measured memory_bytes: 1536
#include <stdio.h>
abs(int a){
  return (a>0)?a:-1*a;
}
ans(int a){
  return (a>0)?a:0;
}
int main(){
  int w,a,b;
  scanf("%d%d%d",&w,&a,&b);
  printf("%d",ans(abs(b-a)-w));
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int half=a[n-1]/2,ans=1e9;
  for(int i=0;i<n;i++){
    if(abs(half-ans)>=abs(half-a[i])&&n-1!=i){
      ans=a[i];
    }
  }
  cout<<a[n-1]<<" "<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    long long x;cin>>x;
    bitset<32> b(x);
    cout<<b<<endl;
    cout<<(~b)<<endl;
    cout<<(b<<1)<<endl;
    cout<<(b>>1)<<endl;
}



Measured memory_bytes: 3228
void solve();

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

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
using namespace std;
int N;
int A[300000];
long long sum1[100001];   //0 - N-1,0 - N,0 - N+1 ,...からN個取ったときの和の最大値
long long sum2[100001];   //2*N - 3*N-1,2*N-1 - 3*N-1,...,2*N-i - 3*N-1,...の和の最小値
priority_queue<int, vector<int>, greater<int>> q1;
priority_queue<int> q2;

void solve() {
	cin >> N;
	for (int n = 0; n < 3 * N; n++)cin >> A[n];
	sum1[0] = 0;
	for (int n = 0; n < N; n++) {
		sum1[0] += A[n];
		q1.push(A[n]);
	}
	for (int n = N; n < 2 * N; n++) {
		if (q1.top() < A[n]) {
			sum1[n-N+1] = sum1[n-N]+A[n]-q1.top();
			q1.pop();
			q1.push(A[n]);
		}else sum1[n - N + 1] = sum1[n - N] ;
	}
	sum2[0] = 0;
	for (int n = 3 * N - 1; n >= 2 * N; n--) {
		sum2[0] += A[n];
		q2.push(A[n]);
	}
	for (int i = 1; i <= N; i++) {
		if (q2.top() > A[2*N-i]) {
			sum2[i] = sum2[i-1] + A[2 * N - i] - q2.top();
			q2.pop();
			q2.push(A[2 * N - i]);
		}
		else sum2[i] = sum2[i-1];
	}
	long long ans = -100000000000000;
	for (int n = 0; n <= N; n++) {
		if (ans < sum1[n] - sum2[N - n])ans = sum1[n] - sum2[N - n];
	}
	cout << ans << endl;
	return;
}

Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int h, w;
vector<vector<int>> v(50, vector<int>(50, 0));

void cnt(int x, int y){
    for(int dx = -1; dx <= 1; dx++){
        for(int dy = -1; dy <= 1; dy++){
            int nx = x + dx, ny = y + dy;
            if(nx >= 0 && nx < w && ny >= 0 && ny < h)
                if(v[ny][nx] >= 0)
                    v[ny][nx]++;
        }
    }
    return;
}

int main(){
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; i++){
        cin >> s[i];
        for(int j = 0; j < w; j++)
            if(s[i][j] == '#')
                v[i][j] = -1;
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(v[i][j] == -1)
                cnt(j, i);
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(v[i][j] == -1)
                cout << '#';
            else
                cout << v[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int mINF = 1e9;
const int MOD = 1e9+7;

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

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>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n;cin >> n;
    cout << fixed << setprecision(6);
    if(n == 1){
      cout << 1.000000 << endl;
    }else if(n%2==0){
      cout << 0.5000000 << endl;
    }else{
      cout << (n+1.0)/2/n << endl;
    }
    return 0;
}

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

using namespace std;


void solve() {
    int K; cin >> K;

    int ans = 0;
    for (int a = 1; a <= K; a++) {
        for (int b = 1; b <= K; b++) {
            for (int c = 1; c <= K; c++) {
                ans += __gcd(a, __gcd(b, c));
            }
        }
        
    }

    cout << ans << endl;
}


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

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip> 

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef tuple<int,int,int> iii;

string to_string(string s) {
    return '"' + s + '"';
}
    
string to_string(const char* s) {
    return to_string((string) s);
}
    
string to_string(bool b) {
    return (b ? "true" : "false");
}
    
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
    
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

void fastIO() {
    cin.sync_with_stdio(false);
    cin.tie(0);
}


int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

//#############################
const int MAXN = 1000005;

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

    REP(i, 2){
        if (s[i] != s[i+1]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// AOJ ALDS1_3_A Stack
// 2018.4.27 bal4u

#include <stdio.h>
#include <ctype.h>

int stack[102]; int top;
char buf[2000];

int main()
{
	int  v1, v2;
	char *p;

	fgets(p=buf, 500, stdin);
	top = 0;
	while (*p >= ' ') {
		while (isspace(*p)) p++;
		if (isdigit(*p)) {
			v1 = 0;
			while (isdigit(*p)) v1 = 10*v1 + (*p++ & 0xf);
			stack[top++] = v1;
		} else {
			v1 = stack[--top];
			v2 = stack[--top];
			if      (*p == '+') v2 += v1;
			else if (*p == '-') v2 -= v1;
			else if (*p == '*') v2 *= v1;
			stack[top++] = v2;
			p++;
		}
	}
	printf("%d\n", stack[--top]);
	return 0;
}



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define ll  long long
#define endl '\n'
#define pi 3.14159265
int main()
{       
    IOS;
    ll a,b,c;
    cin>>a>>b>>c;
    if(a%2==0||b%2==0||c%2==0)
    	cout<<0;
    else
    	cout<<min({-(a/2)*b*c+(a/2+1)*b*c,-(b/2)*a*c+(b/2+1)*a*c,-(c/2)*b*a+(c/2+1)*b*a});
}   

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin >>N;
    cout << (N<1000?"ABC":"ABD") << endl;
}


Measured memory_bytes: 256
open Printf
open Scanf

let (++) = Int64.add
let (--) = Int64.sub
let ( ** ) = Int64.mul
let (//) = Int64.div
let (%%) = Int64.rem
let landl = Int64.logand
let lorl = Int64.logor
let lnotl = Int64.lognot
let lxorl = Int64.logxor
let lsll = Int64.shift_left
let lsrl = Int64.shift_right_logical
let long = Int64.of_int
let succl = Int64.succ
let predl = Int64.pred

let read_char _ = scanf " %c " (fun x -> x)
let read_int _ = scanf " %d " (fun x -> x)
let read_long _ = scanf " %Ld " (fun x -> x)
let read_str _ = scanf " %s " (fun x -> x)
let read_double _ = scanf " %f " (fun x -> x)

let m = 1_000_000_007L

let rec gcd a b = if b = 0L then a else gcd b (a %% b)

let rec mod_pow a = function
  | 0L -> 1L
  | b -> (if b %% 2L = 0L then 1L else a) ** mod_pow (a ** a %% m) (b//2L) %% m


let () =
  let b = read_char () in
  let c = match b with
    | 'A' -> 'T'
    | 'T' -> 'A'
    | 'C' -> 'G'
    | _ -> 'C' in
  printf "%c\n" c


Measured memory_bytes: 384
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

long long P = 1000000007;
int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (int i = 0; i < h; i++)
    cin >> s[i];
  long long dp[h][w];
  dp[0][0] = 1;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (i == 0 && j == 0)
        continue;
      dp[i][j] = 0;
      if (s[i][j] == '#')
        continue;
      if (i > 0)
        dp[i][j] += dp[i - 1][j];
      if (j > 0)
        dp[i][j] += dp[i][j - 1];
      dp[i][j] %= P;
    }
  }
  cout << dp[h - 1][w - 1] << endl;
  return 0;
}


Measured memory_bytes: 9088
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	a, b := r.nextInt(), r.nextInt()

	x := a * 100 / 8
	y := (a + 1) * 100 / 8

	ans := -1
	for i := x; i <= y; i++ {
		if i*8/100 == a && i*10/100 == b {
			ans = i
			break
		}

	}

	fmt.Fprintln(stdout, ans)
}


Measured memory_bytes: 640
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int X, Y;
	std::cin >> X >> Y;
	std::cout << (X + Y / 2) << "\n";
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

long long int gcd(long long int m,long long int n){
	if(n == 0) return m;
	return gcd(n,m % n);
}

int main(void){
	long long int a, b;
	while(scanf("%lld%lld",&a,&b) != EOF){
		printf("%lld %lld\n",gcd(a,b),a * b / gcd(a,b));
	}
	return 0;
}

Measured memory_bytes: 1024
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
	string s, t;
	cin >> s >> t;
	int s_len = s.size(), t_len = t.size();
	int i;
    if(s_len < t_len){
        cout << "UNRESTORABLE";
		return 0;
    }
	for(i=s_len-t_len;i>=0;i--){
		bool flag = true;
		for(int j=0;j<t_len;j++){
			flag &= ((s[i+j] == '?') || (s[i+j] == t[j]));
		}
		if(flag) break;
		else if(i == 0){
			cout << "UNRESTORABLE";
			return 0;
		}
	}
	rep(j, s_len){
		if(i <= j && t_len > j - i) cout << t[j-i];
		else {
			if(s[j] != '?') cout << s[j];
			else cout << 'a';
		}
	}
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val K, A, B = nl()
    val prof = B - A - 2
    val ans = if (prof <= 0 || K < A + 1) {
      K + 1
    } else {
      val remain = K - (A + 1)
      val times = remain / 2 + 1
      K + 1 + times * prof
    }

    out.println(ans)
  }


  def debug(as: Array[Boolean]): Unit = {
    System.err.println(as.map(x => if(x) "1" else "0").mkString)
  }

  def debug(as: Array[Int]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(as: Array[Long]): Unit = {
    System.err.println(as.mkString(" "))
  }

  def debug(s: String): Unit = {
    System.err.println(s)
  }

  def debug(num: Long): Unit = {
    System.err.println(num)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}


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

int main(){
    int N,K;

    cin >> N;

    string S;
    cin >> S >> K;

    for(int i = 0; i < N; i++){
        if(S.at(K-1) != S.at(i)){
            S.at(i) = '*';
        }
    }
    cout << S << endl;
    }

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;

vector<P> table[100000];
vector<bool> used(100000);
vector<ll> ans(100000);

void dfs(ll x,ll y){
	ll res=0;
	for(int i=0;i<table[x].size();i++){
		ll to=table[x][i].first,cost=table[x][i].second;
		if(used[to]) continue;

		res=cost+y;
		used[to]=true;
		ans[to]=res;
		dfs(to,res);
	}
	return ;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N,Q,K;
	cin>>N;
	for(int i=0;i<N-1;i++){
		ll a,b,c;
		cin>>a>>b>>c;
		a--; b--;
		table[a].push_back(make_pair(b,c));
		table[b].push_back(make_pair(a,c));
	}
	cin>>Q>>K;
	K--;
	vector<ll> x(Q),y(Q);
	for(int i=0;i<Q;i++)cin>>x[i]>>y[i];

	fill(used.begin(),used.end(),false);
	used[K]=true;
	ans[K]=0;
	dfs(K,0);

	//for(int i=0;i<5;i++) cout<<ans[i]<<" ";
	for(int i=0;i<Q;i++){
		cout<<ans[x[i]-1]+ans[y[i]-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int N, M, p;
    cin >> N >> M >> p;
    vector<vector<P>> graph(N), rev(N);
    vector<tuple<int, int, int>> es;
    for(int i = 0; i < M; ++i){
        int A, B, C;
        cin >> A >> B >> C;
        --A, --B;
        C -= p;
        graph[A].emplace_back(B, C);
        rev[B].emplace_back(A, C);
        es.emplace_back(A, B, C);
    }

    vector<bool> ok_1(N, false), ok_N(N, false), used(N, false);
    auto dfs = [&](auto&& self, vector<vector<P>>& g, vector<bool>& table, int cur) -> void {
        used[cur] = true;
        table[cur] = true;
        for(auto& e : g[cur]){
            int nxt = e.first;
            if(!used[nxt])  self(self, g, table, nxt);
        }
    };
    dfs(dfs, graph, ok_1, 0);
    for(int i = 0; i < N; ++i)  used[i] = false;
    dfs(dfs, rev, ok_N, N - 1);

    constexpr ll inf = 1e+18;
    vector<ll> dist(N, -inf);
    dist[0] = 0;
    for(int i = 0; i < N; ++i){
        bool update = false;
        for(auto& e : es){
            int from, to, cost;
            tie(from, to, cost) = e;
            if(!ok_1[from] || !ok_N[from] || !ok_1[to] || !ok_N[to])    continue;
            if(chmax(dist[to], dist[from] + cost))  update = true;
        }
        if(i == N - 1 && update){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << max(0LL, dist[N - 1]) << endl;
}

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

int main(){
    int n;
    cin >> n;
    int *arr = new int[n];
    for (int i = 0; i < n; i++){
        cin >> arr[i];
    }

    long long *sum = new long long[n+2];
    long long ans = 0;
    //sum[i+1] = arr[0] + arr[1] + ... + arr[i]
    //sum[i,j] = sum[j] -sum[i] (i <= j)
    sum[0] = 0;
    for (int i = 1; i <= n; i++){
        sum[i] = sum[i-1] + arr[i-1];
    }
    sort(sum, sum+n+1);
    sum[n+1] = -1; //番兵
    for (int i = 0; i < n;i++){
      for (int j = i+1; j <= n+1; j++){
        if (sum[i] != sum[j]){
          ans += (long long)(j-i-1) * (j-i) / 2;
          i = j-1;
          break;
        }
      }
    }


    cout << ans << endl;

    delete[] arr;
    delete[] sum;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	vector<int> v(3);
	for (int i = 0; i < 3; ++i) cin >> v[i];
	sort(v.begin(), v.end());
	for (int i = 0; i < 3; ++i) {
		if (i) cout << " ";
		cout << v[i];
	}
	cout << endl;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d,ans=-1;
	cin>>a>>b;
	for(int i=1;i<=10001;i++)
	{
		c=i*0.08;
		d=i*0.1;
		if(c==a&&d==b)
		{
			ans=i;
			break;
		}
	}
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<queue>
#include<algorithm>
#include<vector>

using namespace std;

vector<int> dp(100000);

int main(){

    int N,W;
    int v[2000];
    int w[2000];
    cin >> N >> W;
    for(int i=0;i<N;i++){
	cin >> v[i] >> w[i];
    }
    for(int j=0;j<N;j++){
	for(int i=W;i>=0;i--){
	    if(i-w[j] > -1 ) {
		dp[i] = max(dp[i],dp[i-w[j]] + v[j]);
	    }
	}
    }
    int res = 0;
    for(int i=0;i<=W;i++){
	res = max(res,dp[i]);
    }
    cout << res << endl;
    dp.clear();


    return 0;
}

Measured memory_bytes: 1540
#include<stdio.h>
int main(void){
  int n,y,m,d,count;
  scanf("%d",&n);
  while(n--){
    count=0;
    scanf("%d%d%d",&y,&m,&d);
    count=(y-1)*39*5;
    count+=((y-1)/3)*1*5;
    if(y%3==0){
      count+=(m-1)*20;
    }
    else{
      count+=(m-1)*20-(m-1)/2*1;
    }
    count+=d-1;
    printf("%d\n",196470-count);
  }
  return 0;
}

Measured memory_bytes: 592
#include <stdio.h>
using namespace std;

int main(void) {
  int n, m, suma = 0, sumb = 0, i, x, a;
  scanf("%d%d%d", &n, &m, &x);
  for(i = 0; i < m; ++i) {
    scanf("%d", &a);
    if(a < x) ++suma;
    else ++sumb;
  }
  printf("%d", suma < sumb ? suma : sumb);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

void c()
{
    long long int x, y;
    cin >> x >> y;
    int len = 1;
    while (1)
    {
        x = x * 2;
        if(x > y)
        {
            break;
        }else{
            len++;
        }
    }
    cout << len << endl;
}

void d()
{

}

int main() {
    c();
    return 0;
}


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

int main(){
#ifdef _DEBUG
    freopen("inp.txt", "r", stdin );
    freopen("ans.txt", "w", stdout);
#endif
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k; cin >> n >> k;
    if(n == 1){
        cout << 0 << '\n';
        return 0;
    }
    vector<int> a(n + 1), mi(n + 1);
    mi[0] = 1e9 + 5;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        mi[i] = min(mi[i - 1], a[i]);
    }
    int mx = 0, cnt = 0;
    for(int i = 1; i <= n; i++) mx = max(mx, a[i] - mi[i - 1]);
    for(int i = 1; i <= n; i++) if(mx == a[i] - mi[i]) cnt++;
    cout << cnt << '\n';
}


Measured memory_bytes: 1024
import math
pi=3.1415926535897932
a,b,h,m=map(int,input().split())
ad=h*30+m*0.5
bd=m*6.0
x=min(abs(ad-bd),360.0-abs(ad-bd))
#if abs(x-180.0)<0.0000000001:
#    print(a+b)
#    exit()
ans=a**2+b**2-(2*a*b*math.cos(math.radians(x)))
print(ans**0.5)

Measured memory_bytes: 62704
N=int(input())
A=[int(input()) for x in range(N)]

used=[False for x in range(N)]
cnt=0
used[0]=True

ans=0
while True:
  cnt=A[cnt]-1
  ans+=1
  if used[cnt]:
    print(-1)
    break
  else:
    used[cnt]=True
    
  if cnt==1:
    print(ans)
    break


Measured memory_bytes: 7852
#include<bits/stdc++.h>
#define pll              pair<long,long>
#define pii              pair<int,int>
#define scn(a)           scanf("%d", &a)
#define scn2(a, b)       scanf("%d%d", &a, &b)
#define scn3(a, b, c)    scanf("%d%d%d", &a, &b, &c)
#define pairl            pair<ll , ll >
#define scnl(a)          scanf("%lld", &a)
#define scnl2(a, b)      scanf("%lld%lld", &a, &b)
#define scnl3(a, b, c)   scanf("%lld%lld%lld", &a, &b, &c)
#define scns(s)          scanf("%s",s)
#define prts(s)          printf("%s\n",s)
#define prt(a)           printf("%d\n", a)
#define prtl(a)          printf("%lld\n", a)
#define prs(a)           printf("%d ", a)
#define prt2(a, b)       printf("%d %d\n", a, b)
#define prt3(a, b, c)    printf("%d %d %d\n", a, b, c)
#define prsl(a)          printf("%lld ", a)
#define prtl2(a, b)      printf("%lld %lld\n", a, b)
#define prtl3(a, b, c)   printf("%lld %lld %lld\n", a, b, c)
#define ptcs(a)          printf("Case %d: ", a)
#define pf               printf
#define sc               scanf
#define vi               vector<int >
#define vil              vector<ll >
#define pb               push_back
#define mem(a, b)        memset((a), (b), sizeof(a))
#define lg2(n)           (31-__builtin_clz(n))
#define N                2000010
#define inf              9999999
#define ll               long long
#define ull              unsigned long long
#define MIN              INT_MIN
#define MAX              INT_MAX
#define fast             ios_base::sync_with_stdio(false),cin.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree<pair<ll, ll> , null_type, less<pair<ll, ll> >, rb_tree_tag, tree_order_statistics_node_update> odrst;
ll gcd(ll a, ll b){if(b==0) {return a;}return gcd(b, a % b);}
ll BigMod(ll B,ll P,ll M){     ll R=1; while(P>0)      {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;}
//___________________________________________________________________________________________________________________
ll dp[N],dp1[N];
map<char,ll>mp,mp1;
vector<ll>v,v1,v2,v3;
char c[100001];
set<char>se;
int main()
{
    fast;
    odrst os;
    //freopen("fff.txt","w",stdout);
    bool ok=false,ok1;
    //os.insert({-100000000000,0});
    //v.pb(-100000000000);
    ll t,n,q,m,M=1000000007,k,x,x1,y,ans=0,yy,mm,z,mx=1e10,my=0,z1=0,h,cn=0,p1=1,p2=0,i;
    cin>>n;
    string s;
    cin>>s;
    cn=1;
    for(int i=0;i<n;i++) mp[s[i]]++;
//    for(int i=n-1;i>=0;i--)
//    {
//        se.insert(s[i]);
//        my=se.size()-1;
//        cn+=BigMod(2LL,my,M);
//        cn%=M;
//        mp[s[i]]++;
//        ok=false;
//        for(char c='a';c<='z';c++)
//        {
//            if(c!=s[i] && mp[c]>=2)
//            {
//                ok=true;
//                mx=(mx*(mp[c]-1))%M;
//            }
//        }
//        if(ok) cn+=(my*mx);
//        cn%=M;
//        //cout<<cn<<endl;
//    }
    for(char c='a';c<='z';c++)
    {
        if(mp[c])
        {
            cn=(mp[c]*cn+cn)%M;
        }
    }
    cn--;
    cn+=M;
    cn%=M;
    cout<<cn<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int N;
  cin>>N;
  vector<int> d(N);
  for(int ii=0;ii<N;ii++){
    cin>>d[ii];
  }
  sort(d.begin(), d.end());

  int cnt=0;
  for(int ii=1;ii<=N;ii++){
    if(d[ii]!=d[ii-1]) cnt++;
  }
  cout<<cnt<<endl;

  return 0;

}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,A,B,k,x,y;
    cin >> N >> A >> B;
    vl S(N);
    rep(i,N){
        cin >> S[i];
    }
    vl fin_x(N,0),fin_y(N,0);
    fin_x[0]=fin_y[0]=1;
    vl badx,bady;
    rep(i,N-1){
        if(S[i+1]-S[i]<A){
            badx.pb(i);
        }
        if(S[i+1]-S[i]<B){
            bady.pb(i);
        }        
    }
    badx.pb(INF),bady.pb(INF);
    rep(i,N-1){
        if(S[i+1]-S[i]>=A&&S[i+1]-S[i]>=B){
            fin_x[i+1]=fin_x[i]+fin_y[i];
            fin_y[i+1]=fin_x[i]+fin_y[i];
        }
        else if(S[i+1]-S[i]<A&&S[i+1]-S[i]>=B){
            fin_y[i+1]=fin_x[i]+fin_y[i];
            k=upper_bound(S.begin(),S.end(),S[i+1]-A)-S.begin();
            //cout << k << " " << i << endl;
            x=*lower_bound(bady.begin(),bady.end(),k);
            y=*lower_bound(bady.begin(),bady.end(),i);
            if(x==y){
                fin_x[i+1]=fin_y[k];
            }
        }
        else if(S[i+1]-S[i]>=A&&S[i+1]-S[i]<B){
            fin_x[i+1]=fin_x[i]+fin_y[i];
            k=upper_bound(S.begin(),S.end(),S[i+1]-B)-S.begin();
            //cout << k << " " << i << endl;
            x=*lower_bound(badx.begin(),badx.end(),k);
            y=*lower_bound(badx.begin(),badx.end(),i);
            if(x==y){
                fin_y[i+1]=fin_x[k];
            }
        }
        else{
            k=upper_bound(S.begin(),S.end(),S[i+1]-B)-S.begin();
            //cout << k << " " << i << endl;
            x=*lower_bound(badx.begin(),badx.end(),k);
            y=*lower_bound(badx.begin(),badx.end(),i);
            if(x==y){
                fin_y[i+1]=fin_x[k];
            }
            k=upper_bound(S.begin(),S.end(),S[i+1]-A)-S.begin();
            //cout << k << " " << i << endl;
            x=*lower_bound(bady.begin(),bady.end(),k);
            y=*lower_bound(bady.begin(),bady.end(),i);
            if(x==y){
                fin_x[i+1]=fin_y[k];
            }
        }
        fin_x[i+1]%=MOD;
        fin_y[i+1]%=MOD;
    }
    /*rep(i,N){
        cout << fin_x[i] << " " << fin_y[i] << endl;
    }*/
    cout << (fin_x[N-1]+fin_y[N-1])%MOD << endl;
}

Measured memory_bytes: 7572
import sys
input = sys.stdin.readline
N,U,V = map(int, input().split())
d = [set() for _ in range(N+1)]
dps = [0 for _ in range(N+1)]
dpss = [0 for _ in range(N+1)]
oks = set()

def it(v):
    stack = [v]
    vs = set()
    path = []
    while True:
        if not len(stack):
            break
        v = stack.pop()
        if v > 0:
            path.append(v)
            vs.add(v)
            for u in d[v]:
                if u in vs:
                    continue
                if u == V:
                    r = path[:]
                    continue
                dps[u] = dps[v] + 1
                oks.add(u)
                stack.append(-v)
                stack.append(u)
        else:
            path.pop()
    return r

def it2(v, path):
    stack = [v]
    vs = set()
    while True:
        if not len(stack):
            break
        v = stack.pop()
        vs.add(v)
        for u in d[v]:
            if u in vs:
                continue
            if u not in oks:
                continue
            if dps[v] >= dpss[v] and u not in path:
                continue
            dpss[u] = dpss[v] + 1
            stack.append(u)

for _ in range(N-1):
    a, b = [int(x) for x in input().split()]
    d[a].add(b)
    d[b].add(a)

oks.add(U)
path = set(it(U))
it2(V, path)
print(max(dpss)-1)


Measured memory_bytes: 94128
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;
vector <char> v;
vector<int> num;
string s ;
int table[100001][3];
int main(){
  int N;
  s = "Yes";
  cin >> N;
  table[0][0] = 0;
  table[0][1] = 0;
  table[0][2] = 0;
  for (int i = 1;i<N+1;i++){
    for (int j = 0;j<3;j++){
      cin >> table[i][j];
    }
  }

  for (int i = 0 ;i < N;i++){
    int def = table[i+1][0]-table[i][0]-abs(table[i+1][1]-table[i][1])-abs(table[i+1][2]-table[i][2]);
    if(!((abs(table[i+1][1]-table[i][1])+abs(table[i+1][2]-table[i][2]))<=(table[i+1][0]-table[i][0])&&(def%2 == 0)))
    {
      s = "No";
      break;
    }
  }
  cout << s << endl;
  return 0;
}


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

int main(){
	int x1,y1,x2,y2 ;
	cin >> x1 >> y1 >> x2 >> y2 ;
	int x3 = x2-(y2-y1) ;
	int y3 = y2+(x2-x1) ;
	int x4 = x3-(x2-x1) ;
	int y4 = y3-(y2-y1) ;
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl ;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i > 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	if (n < 10);
	else if (n < 100) n = 9;
	else if (n < 1000) n -= 90;
	else if (n < 10000) n = 909;
	else if (n < 100000) n -= 9090;
	else n = 90909;
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
using namespace std;

#define rep(i,n) for(long long i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long int ulli;

const ll INF = ll(1e18) + 1;

typedef struct {
	ll cost;
	ll damage;
}magic;

unsigned long long int a(ulli n, ulli b) {
	if (b <= 1) {
		return n;
	}
	else {
		return a(n * 2, b - 1);
	}
}

ll mina(ll a, ll b) {
	return (a > b) ? b : a;
}

void Main()
{
	ll h, n, min = INF; cin >> h >> n;
	ll* h_ptr = &h;
	ll* n_ptr = &n;
	vector<magic> a(n);
	rep(i, n) {
		cin >> a[i].damage >> a[i].cost;
	}

	//ソート
	rep(i, n-1)rep(j, n-1) {
		if (a[j].cost > a[j + 1].cost) {
			magic temp = a[j];
			a[j] = a[j + 1];
			a[j + 1] = temp;
		}
	}

	//ソート後表示
	/*
	rep(i, n) {
		cout << a[i].damage << " " << a[i].cost << endl;
	}
	*/
	

	//２次元配列定義
	vector<vector<ll>> table(n, vector<ll>(h+1));
	
	//1行目挿入
	rep(i,h+1) {
		table.at(0).at(i) = ((i % a[0].damage == 0) 
			? (i / a[0].damage) : (i / a[0].damage + 1))*a[0].cost;
	}

	//２行目以降の挿入
	for (auto i = 1; i < n; i++) {
		rep(j, h + 1) {
			ll temp = a[i].cost;
			if (a[i].damage < j) {
				temp += mina(table.at(i).at(j - a[i].damage),
					table.at(i - 1).at(j - a[i].damage));
			}

			table.at(i).at(j) = mina(table.at(i-1).at(j),temp);
		}
	}

	
	//全表示
	/*
	rep(i, n) {
		rep(j, h+1) {
			cout << table.at(i).at(j) << " ";
		}
		cout << endl;
	}
	*/
	

	rep(i, n) {
		if (min > table.at(i).at(h)) {
			min = table.at(i).at(h );
		}
	}
	cout << min << endl;
}

int main() {
	Main();
	return 0;
}

Measured memory_bytes: 78592
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <random>
#include <vector>
#include <string>
#include <cstring>
#include <cassert>
#include <complex>
#include <ctime>
#include <numeric>
using namespace std;

#define pb push_back
#define pii pair <int, int>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define reunique(x) (x).resize(unique(all(x)) - (x).begin())
#define ld long double
#define int long long

void SOLVE() {
	int n;
	cin >> n;
	string s;
	cin >> s;

	vector <int> pR(n);
	vector <int> pG(n);
	vector <int> pB(n);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') pR[i] = 1;
		if (s[i] == 'G') pG[i] = 1;
		if (s[i] == 'B') pB[i] = 1;
		if (i) {
			pR[i] += pR[i - 1];
			pG[i] += pG[i - 1];
			pB[i] += pB[i - 1];
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			if (s[i] == s[j]) continue;
			char c;
			if (s[i] == 'R' && s[j] == 'G' || s[j] == 'R' && s[i] == 'G') c = 'B';
			if (s[i] == 'R' && s[j] == 'B' || s[j] == 'R' && s[i] == 'B') c = 'G';
			if (s[i] == 'B' && s[j] == 'G' || s[j] == 'B' && s[i] == 'G') c = 'R';
			
			if (c == 'R') ans += pR[n - 1] - pR[j];
			if (c == 'G') ans += pG[n - 1] - pG[j];
			if (c == 'B') ans += pB[n - 1] - pB[j];

			if (j + j - i < n && s[j + j - i] == c) ans--;
		}
	}

	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed;
	cout.precision(10);
	int Q = 1;
	//cin >> Q;
	while (Q--) {
		SOLVE();
	}

	return 0;
}

Measured memory_bytes: 3720
module Main where
import Data.List

int = read :: String -> Int

splitLength :: Eq a => Int -> [a] -> [[a]]
splitLength n = map (take n) . takeWhile (/=[]) . iterate (drop n) 

main = interact $ printer . solver . parser

printer = unlines . (:[]) . unwords . map show

parser = map int . words

solver (n:as) = result 
  where
    isOdd = odd n
    tmp2 = if isOdd then tail as else as 
    tmp1 = splitLength 2 tmp2
    p1 = map (!!0) tmp1
    p2 = map (!!1) tmp1
    result = if isOdd 
      then reverse p2 ++ (head as : p1)
      else reverse p2 ++ p1



Measured memory_bytes: 151292
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

ll dp[1010][1010];

int main(){
	int n, k;
	cin>>n>>k;
	for(int i = 0; i < k; i++) dp[0][i] = 1;
	for(int i = 1; i < n; i++){
		for(int j = 0; j < k; j++){
			dp[i][j] = dp[i-1][j]*(k-1);
		}
	}
	ll sum = 0LL;
	rep(i, k){
		sum += dp[n-1][i];
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define int long long
#define M 1000000007
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int32_t main()
{
    //fastio;
    int t=1,n,k,i,j;
    //cin>>t;
    while (t--)
    {
        cin>>n>>k;

        int a[n],dp[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        dp[0]=0;
        dp[1]=abs(a[1]-a[0]);
        for(i=2;i<n;i++)
        {
        	dp[i]=1e15;
        	int lim=max(i-k,0ll);
        	for(j=lim;j<i;j++)
        	{
        		dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        	}
        }
        cout<<dp[n-1]<<"\n";

    }
    return 0;
}

/*
    ifstream cin("input.txt");
    ofstream cout("output.txt");

    string s;
    cin>>s;
*/

Measured memory_bytes: 1792