akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL
  #define debug_echo(expr) cout << expr
#else
  #define debug_echo(expr)
#endif

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<long long> as(N);
  for (int i = 0; i < N; i++) {
    cin >> as[i];
  }

  if (N == 2) {
    cout << abs(as[0] - as[1]) << endl;
    return 0;
  }

  long long forwardsum = as[0];
  long long backwardsum = 0;
  for (int i = 1; i < N; i++) {
    backwardsum += as[i];
  }

  long long bestdiff = -1;
  for (int i = 1; i < N-1; i++) {
    forwardsum += as[i];
    backwardsum -= as[i];
    long long diff = abs(forwardsum - backwardsum);
    debug_echo(diff << endl);
    if (bestdiff == -1 || bestdiff > diff) {
      bestdiff = diff;
    }
  }
  cout << bestdiff << endl;
}


Measured memory_bytes: 1792
S=[input() for i in range(2)]
q=int(input())
ABCD=[list(map(int,input().split())) for i in range(q)]
p=[[0] for i in range(2)]
for i in range(2):
    for j,s in enumerate(S[i]):
        if s=='A':
            p[i].append(p[i][-1]+1)
        else:
            p[i].append(p[i][-1]+2)
for a,b,c,d in ABCD:
    print(['NO','YES'][(p[0][b]-p[0][a-1])%3==(p[1][d]-p[1][c-1])%3])

Measured memory_bytes: 43168
#include <iostream>
#include<algorithm>
#include <vector>
#include<string>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max(x,y) (((x)>(y)) ? x:y)
#define min(x,y) (((x)<(y)) ? x:y)
#define FOR(a,b,c) for(b=(c);b<(a);b++)
#define ender {return 0;}
#define tosasuretu(a) (a*(a+1)/2)
inline ll kaizyo(ll);
ll gcd(ll, ll);
ll combination(ll, ll);
int main() {
	int age;
	cin >> age;
	if (age == 1) {
		cout << "Hello World";
	}
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b;
	}
	return 0;
}


inline ll kaizyo(ll x) {
	long ans = 1;
	for (int z = 0; z < x; z++) {
		ans *= (x - z);
	}
	return ans;
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner scanner = new Scanner(System.in);
        	String a = scanner.next();
          	List<String> split = Arrays.asList(a.split(""));
            
            int count = 0;
            for(int i = 0; i<3; i++){
            	if(split.get(i).equals("1")){
                	count += 1;
                }
            }    
        System.out.println(count); 
      }
}

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

namespace AGC010
{
    class Program1
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToArray();
            int n_e = a.Count(x => x % 2 == 0);
            int n_o = a.Length - n_e;

            if(n_o % 2 != 0)
            {
                // 奇数が奇数個あると、絶対に最後に奇数が残る
                Console.WriteLine("NO");
            }
            else
            {
                // 偶数個の奇数は、偶数の個数を変えずに削除できる
                // 偶数だけの列は必ず1つまで減らせる
                Console.WriteLine("YES");
            }
        }
        
    }
}


Measured memory_bytes: 13400
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func convf(s string) int {
	x := strings.Split(s, ".")
	if len(x) == 1 {
		x = append(x, "0")
	}
	x[1] += "0000000000"
	x[1] = x[1][:9]
	a, _ := strconv.Atoi(x[0])
	b, _ := strconv.Atoi(x[1])
	return a*int(1e9) + b
}

const div = int(1e9)

func pfs25(n int) (int, int) {
	ret2, ret5 := 0, 0
	for n%2 == 0 {
		ret2++
		n /= 2
	}
	for n%5 == 0 {
		ret5++
		n /= 5
	}
	return ret2, ret5
}

// PfsMap : 素因数分解し、マップを作成
func PfsMap(n int) map[int]int {
	pfs := make(map[int]int)
	for n%2 == 0 {
		pfs[2] = pfs[2] + 1
		n = n / 2
	}

	for i := 3; i*i <= n; i = i + 2 {
		for n%i == 0 {
			pfs[i] = pfs[i] + 1
			n = n / i
		}
	}

	if n > 2 {
		pfs[n] = pfs[n] + 1
	}

	return pfs
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	a := make([]int, N)
	a2 := make([]int, 0)
	a5 := make([]int, 0)
	var X [40][40]int
	minus := 0
	for i := 0; i < N; i++ {
		s := getString()
		a[i] = convf(s)
		x, y := pfs25(a[i])
		if x*2 >= 18 && y*2 >= 18 {
			minus++
		}
		x = min(18, x)
		y = min(18, y)
		a2 = append(a2, x)
		a5 = append(a5, y)
		X[x][y]++
	}
	// out(a2)
	// out(a5)
	// out(minus)

	cnt := 0
	for i := 0; i < len(a2); i++ {
		x := 18 - a2[i]
		y := 18 - a5[i]
		// out(a[i], a2[i], a5[i], x, y)
		for j := x; j <= 18; j++ {
			for k := y; k <= 18; k++ {
				// if X[j][k] != 0 {
				// 	out(X[j][k], j, k)
				// }
				cnt += X[j][k]
			}
		}
	}

	out((cnt - minus) / 2)
}


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

int n, m;
vector<vector<int>> g;
vector<bool> visited;
vector<int> ord;
vector<int> low;
vector<int> parent;
int timer = 0;

void dfs(int cur, int prev) {
    ord[cur] = low[cur] = timer++;
    visited[cur] = true;
    for (int next : g[cur]) {
        if (visited[next] == false) {
            parent[next] = cur;
            dfs(next, cur);
            low[cur] = min(low[cur], low[next]);
        } else if (next != prev) {
            low[cur] = min(low[cur], ord[next]);
        }
    }
}

void art_points() {
    set<int> ap;
    timer = 1;
    dfs(0, 1);
    int child = 0;
    rep(i, n) {
        if (i == 0) continue;
        if (parent[i] == 0) child++;
        else if (ord[parent[i]] <= low[i]) ap.insert(parent[i]);
    }
    if (child > 1) ap.insert(0);
    for (int x : ap) {
        cout << x << endl;
    }
}

int main() {
    cin >> n;
    cin >> m;
    g.resize(n);
    visited.resize(n, false);
    ord.resize(n);
    low.resize(n);
    parent.resize(n);
    rep(i, m) {
        int s, t ;
        cin >> s;
        cin >> t;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    art_points();
}


Measured memory_bytes: 4704
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <queue>

using namespace std;


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

	int cnt = 0;
	for (int i = A; i <= B; i++)
	{
		string s = to_string(i);
		if (s[0] == s[4] && s[1] == s[3])
		{
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
 
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	ans = (N * 800) - ((N/15) * 200);
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N;
	
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

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


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

	int dp[n+1];
	dp[0]=0;
	dp[1]=0;
	dp[2]=abs(arr[2]-arr[1]);

	for(int i=3;i<=n;i++){
		dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}

	cout<<dp[n];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=1e5;
const long inf=1e18;
int main(){
	int N; cin>>N;
	int t[2],a[2],b[2];
	t[0] = a[0] = b[0] = 0;
	rep(i,0,N){
		cin>>t[1]>>a[1]>>b[1];
		int x = t[1] - t[0];
		int y = abs(a[1]-a[0]);
		int z = abs(b[1]-b[0]);
		if(x < y + z || x % 2 != (y + z) % 2){
			cout<<"No"<<endl;
			return 0;
		}t[0] = t[1]; a[0] = a[1]; b[0] = b[1];
	}cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int d2b(int n,int b,char c[])
{
    int i=0,k;                                                                                                                                                   
    while(n!=0)
    {
        k=n%b;
        n/=b;
        if(k<0){k-=b;n+=1;}
        if(k>9)c[i]=char(k-10+'A');
        else c[i]=char(k+'0');
        i++;
    }
    return i-1;
}
int main()
{
    int a,n,i;
    char b[400];
    scanf("%d",&a);n=-2;
    if(a==0)printf("0");
    for(i=d2b(a,n,b);i>=0;i--)printf("%c",b[i]);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update> o_set;

struct qs
{
    int l,r,id;
    qs(int l, int r, int id)
    {
        this->l=l;
        this->r=r;
        this->id=id;
    }
    bool operator<(qs b)
    {
        if(r!=b.r)
            return r<b.r;
        return l<b.l;
    }
};

int n,q,i,nr,l,r;
vector <qs> qv;
o_set s;
int a[500005];
int last[500005];
int ans[500005];

int main()
{
    cin>>n>>q;
    for(i=1;i<=n;i++)
        cin>>a[i];

    for(i=1;i<=q;i++)
    {
        cin>>l>>r;
        qv.push_back(qs(l, r, i));
    }
    sort(qv.begin(), qv.end());

    r=0;
    for(auto it : qv)
    {
        while(r<it.r)
        {
            r++;
            if(last[a[r]])
                s.erase(last[a[r]]);
            last[a[r]]=r;
            s.insert(r);
        }

        nr=s.order_of_key(it.l)-1;
        nr=s.size()-nr-1;

        ans[it.id]=nr;
    }

    for(i=1;i<=q;i++)
        cout<<ans[i]<<'\n';
    return 0;
}


Measured memory_bytes: 38880
mod = 10**9+7
 
n = int(input())
a = [[int(x) for x in input().split()] for _ in range(n)]
 
dp = [-1 for __ in range(1 << n)]
dp[0] = 1
 
 
def dfs(bit, i):
    if dp[bit] != -1:
        return dp[bit]
    else:
        tmp = 0
        for j in range(n):
            if bit & (1 << j) and a[i][j]:
                tmp += dfs(bit ^ (1 << j), i+1)
    dp[bit] = tmp % mod
    return dp[bit]
 
 
print(dfs(2**n-1, 0))

Measured memory_bytes: 202080
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
int main() {
#define int long long
	int n, m;
	cin >> n >> m;
	string s, t;
	cin >> s >> t;
	int hoge = n*m;
	hoge /= gcd(n, m);
	int left = 0;
	int right = 0;
	while (right < m&&left < n) {
		if (s[left] != t[right]) {
			cout << -1 << endl;
			return 0;
		}
		left += n / gcd(n,m);
		right += m / gcd(n,m);
	}
	cout << hoge << endl;
	return 0;
}

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

using namespace std;

int main() {
    
    int t;
    t=1;
  //  cin >> t;
    while(t--){
        int n;
        cin >> n;
        
        int arr[n][3];
        int dp[n][3];
        for(int i=0;i<n;i++){
            for(int j=0;j<3;j++){
                cin >> arr[i][j];
                dp[i][j] = 0;
            }
        }
        
        for(int i=0;i<3;i++){
            dp[0][i] = arr[0][i];
        }
        for(int i=1;i<n;i++){
            for(int j=0;j<3;j++){
                dp[i][j] = max(arr[i][j]+dp[i-1][(j+1)%3],arr[i][j]+dp[i-1][(j+2)%3]);
            }
        }
        
        cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
        
    }
    return 0;

}

Measured memory_bytes: 2560
//Author - Rahil Malhotra
#include <bits/stdc++.h>
using namespace std;

template <typename T> void debug(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void debug(T t, Args... args) { cout<<t<<" "; debug(args...); }

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int n;
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int ans[10005]={};
    for(int x=1;x<=200;x++)
    {
        for(int y=1;y<=200;y++)
        {
            for(int z=1;z<=200;z++)
                if(x*x+y*y+z*z+x*y+y*z+z*x<=10002)
                ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
        }
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i]<<endl;
}

Measured memory_bytes: 3684
n, m = map(int, input().split())
AB = sorted([tuple(map(int, input().split())) for _ in range(m)], key=lambda x: x[1])
last_b, cnt = 0, 0
for a, b in AB:
    if last_b < a:
        last_b = b - 1
        cnt += 1
print(cnt)

Measured memory_bytes: 19012
s = input()

count = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            count += 1
        else:
            count = 0
    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            count += 1
        else:
            count = 0

if count == len(s):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public static void main(String[] args) {
        FastScanner fsc = new FastScanner();
        int n = fsc.nextInt();
        long[] a = new long[n];
        long s = 0;
        for (int i = 0; i < n; i++) {
            a[i] = fsc.nextLong();
            s += a[i];
        }
        if (s % ((long) n * (n + 1) / 2) != 0) {
            System.out.println("NO");
            return;
        }
        long x = s * 2 / n / (n + 1);
        long[] d = new long[n];
        for(int i = 0; i < n; i++) {
            d[i] = a[i] - a[(i - 1 + n) % n] - x;
            if (d[i] > 0 || d[i] % n != 0) {
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}


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 || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main() {
  int k;
  string s;
  cin >> k >> s;
  
  string ten = "...";
  int l = s.size();
  
  if(k < l){
    s.erase(k);
    s += ten;
  }
  cout << s << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
string s;
void wa()
{
	puts("Bad");
	exit(0);
}
void ac()
{
	puts("Good");
	exit(0);
}
int main()
{
	cin >>s;
    int n=s.size();
    for(int i=0;i<n-1;i++)
    if(s[i]==s[i+1])
    wa();
    ac();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define oo 1e9
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
#define _cos(xxxx) cos(xxxx*acos(-1)/180)
#define _sin(xxxx) sin(xxxx*acos(-1)/180)
#define _tan(xxxx) tan(xxxx*acos(-1)/180)
#define PE cout<<fixed
#define sqr(x) ((x)*(x))
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
 
const ld pi=acos(-1);

ll l,r,i,sl[509];
string s;

bool ok() {
    for (int ii='a';ii<='z';ii++) {
        if (sl[ii]>=2) {
            return true;
        }
    }
    return false;
}

int main() {
    IO;
    cin>>s;
    if (s.length()==2) {
        if (s[0]==s[1]) {
            cout<<1<<' '<<2<<'\n';
        }
        else {
            cout<<"-1 -1\n";
        }
    }
    else {
        l=-1;
        r=-1;
        sl[s[0]]++;
        sl[s[1]]++;
        sl[s[2]]++;
        if (ok()) {
            l=1;
            r=3;
        }
        for (i=3;i<s.length();i++) {
            sl[s[i-3]]--;
            sl[s[i]]++;
            if (ok()) {
                l=i-1;
                r=i+1;
            }
        }
        cout<<l<<' '<<r<<'\n';
    }
}
    

Measured memory_bytes: 3756
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define ll long long
#define mod 1000000000+7
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
using namespace std;
int main(){
  int n,f=0;
  cin>>n;
  string s;
  cin>>s;
  int m;
  m=n/2;

  if(n==1||n%2==1)f=1;
  else{
    rep(i,m){
    char a,b;
    a=s.at(i);b=s.at(i+m);
    if(a!=b)f=1;
    }
  }
  if(f==0)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    char a = S[0], res = 0;
    bool flag = true;
    REP(i, 4){
        res = 0;
        REP(j, 4){
            if (S[i] == S[j]) res++;
        }
        if (res != 2) flag = false;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int N;
	cin >> N;
	
	vector<int> ans;

	for (int i = 3; i < 10; i++) {
		for (int j = 1; j < i - 1; j++)for (int k = 1; k < i - j; k++)for (int s = 1; s < i - j - k + 1; s++) {
			if (j + k + s != i)continue;
			vector<int> v;
			for (int a = 0; a < j; a++)v.push_back(3);
			for (int a = 0; a < k; a++)v.push_back(5);
			for (int a = 0; a < s; a++)v.push_back(7);
			do {
				int tmp = 0;
				for (int a = 0; a < v.size(); a++) {
					tmp += v[a] * pow(10, a);
				}
				ans.push_back(tmp);
			} while (next_permutation(v.begin(), v.end()));
		}
	}
	sort(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) {
		if (N < ans[i]) {
			cout << i << endl;
			break;
		}
		if (i == ans.size() - 1) {
			cout << i+1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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 INF = 1LL << 60;

int main(){
  int x, y, z;
  cin >> x >> y >> z;

  cout << (x-z)/(y+z) << endl;

  return 0;
}


Measured memory_bytes: 256
K,X = map(int,input().split())

minI = -(10**6)
maxI = (10**6)

Is = [0 for _ in range(2*(10**6)+1)]

for i in range(X,max(minI,X-K),-1):
	Is[i] = 1
	
for i in range(X,min(maxI,X+K)):
	Is[i] = 1
	
for i in range(minI,maxI):
	if Is[i] == 1:
		print(i,end=" ")

Measured memory_bytes: 123624
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
#include<cmath>
#include<cstdio>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
typedef pair<ll, ll > P;
const int MOD = 1000000007;


int main() {
	ll i, j, k, l, m, n, sum, flag, cc, M, X, H, W, N,Y,Z,K;
	cc = 0;
	flag = 0;
	cin >> N;
	ll A[305][305];
	REP(i, 0, N) {
		REP(j, 0, N) {
			cin >> A[i][j];
		}
	}
	ll ans = 0;
	bool d[305][305];
	REP(i, 0, N) {
		REP(j, 0, N) {
			d[i][j] = 0;
		}
	}
	REP(i, 0, N) {
		REP(j, 0, N) {
			REP(k, 0, N) {
				if (A[i][j] > A[i][k] + A[k][j]) {
					output("-1");
					return 0;
				}
				if (A[i][j] == A[i][k] + A[k][j] &&A[i][k]>0&&A[k][j]>0) {
					d[i][j] = 1;
				}
			}
		}
	}
	REP(i, 0, N) {
		REP(j, i, N) {
			if (d[i][j] == 0) {
				ans += A[i][j];
			}
		}
	}
	output(ans);
	return 0;
}





Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#define Max zhi5968
typedef long long ll;
using namespace std;

int main ()
{
	int x,y,z;
	cin>>x>>y>>z;
	cout<<(x-z)/(y+z)<<endl;
	return 0;
}

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

using namespace std;

int main() {
	priority_queue<int> q; int p, ans;
	for(int n=0; n<2; ++n) {
		ans = 0;
		for(int i=0; i<10; ++i) {
			cin >> p;
			q.push(p);
		}
		for(int i=0; i<3; ++i) {
			ans += q.top(); q.pop();
		}
		while(!q.empty()) q.pop();
		cout << ans << (!n?" ":"");
	}
	cout << endl;
	return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;

int main() {
    ios::sync_with_stdio (false), cin.tie (0);
    ll n ;
    cin >> n;
    ll ans = (ll)1e18;
    for(ll a = 1; a * a <= n; a++){
        ll b = n / a;
        if(a * b ==n){
            ans = min(ans , a+b - 2);
        }
    }
    cout << ans << '\n';

    return 0;
}













Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
struct edge{int to;ll cost;};
typedef pair<ll,int> P;
const ll INF=1000000000000LL;
const ll MOD=1000000007LL;
const ll MAX=100010;
int main(){
	priority_queue<ll> q;
	string s;
	while(cin>>s){
		if(s=="end"){
			return 0;
		}
		int a;
		if(s=="insert"){
			int a;cin>>a;
			q.push(a);
		}else{
			cout<<q.top()<<endl;
			q.pop();
		}
	}
	return 0;
}



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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 500
#define MAX_C 30

i64 G[MAX_N][MAX_N];
i64 D[MAX_C][MAX_C];
i64 dist[3][MAX_C];

int main() {
    i64 N, C; cin >> N >> C;
    REP(i, C) REP(j, C) cin >> D[i][j];
    REP(i, N) REP(j, N) { cin >> G[i][j]; G[i][j]--; };

    REP(i, 3) REP(j, C) dist[i][j] = 0;

    REP(i, N) REP(j, N) {
        dist[(i + j) % 3][G[i][j]]++;
    }

    i64 minc = 1152921504606846976;
    REP(c0, C) REP(c1, C) REP(c2, C) {
        if (c0 == c1 || c1 == c2 || c2 == c0) continue;
        vector<i64> colors = {c0, c1, c2};
        i64 cost = 0;
        REP(rem, 3) {
            REP(c, C) {
                cost += D[c][colors[rem]] * dist[rem][c];
            }
        }
        chmin(minc, cost);
    }
    cout << minc << endl;

    return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<set>
#include<vector>
#include<cmath>
#include<complex>
#include<string>
#include<algorithm>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main(void)
{
  int n,r=0,b=0;
	char s;

  cin >> n;
	rep(i,n) {
		cin >> s;
		if('R'==s) ++r;
		else ++b;
	}
	if(r<=b){
		cout << "No" << endl;
		return 0;
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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 int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out



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

    ll h,w;
    cin>>h>>w;
    if(h%3==0||w%3==0){
        fin(0);
        return 0;
    }
    ll cmin=LLINF;
    ll a[3];
    if( h >= 3) cmin = min(cmin, w);
    if( w >= 3) cmin = min(cmin, h);

    for(ll i=1;i<w;i++){
        a[0]=i*h;
        
            a[1]=(w-i)*(h/2);
            a[2]=(w-i)*(h-h/2);
        
        sort(a,a+3);
        cmin=min(cmin,a[2]-a[0]);
        // cout<<cmin<<endl;
    }
    for(ll i=1;i<h;i++){
        a[0]=i*w;
        
            a[1]=(h-i)*(w/2);
            a[2]=(h-i)*(w-w/2);
        
        sort(a,a+3);
        cmin=min(cmin,a[2]-a[0]);
        // cout<<cmin<<endl;
    }
    cout<<cmin<<endl;
//////////////////////////////////////////////////////
return 0;}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n,m;cin>>n>>m;
  vector<ll>a(n);
  for(i=0;i<m;i++){
    ll p,q;cin>>p>>q;
    a[p-1]++;
    a[q-1]++;
  }
  for(i=0;i<n;i++){
    if(a[i]%2)judge=false;
  }
  ans2(judge);
  return 0;
}

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

namespace AtCoder
{
    public class Code5
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            Console.WriteLine(funcMain(s1));
#if DEBUG
            Console.ReadKey();
#endif
        }

        static public string funcMain(string arg1)
        {
            string[] s = arg1.Split();
            int i1, i2, i3;
            int ret = 0;

            i1 = int.Parse(s[0]);
            i2 = int.Parse(s[1]);
            i3 = int.Parse(s[2]);

            while (i1 >= i2 + i3*2)
            {
                i1 -= (i2 + i3);
                ret++;
            }
            return ret.ToString();
        }
    }
}


Measured memory_bytes: 11092
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {Main instance = new Main();sc = instance.new Scanner();instance.solve();}
    private class Scanner {String[] s = new String[0];String regex = " ";int i = 0;BufferedReader br = new BufferedReader(new InputStreamReader(System.in));public String next() {try {if (i < s.length) { return s[i++];}String st = br.readLine();while ("".equals(st)) { st = br.readLine(); }s = st.split(regex, 0);i = 0;return s[i++];} catch (IOException e) { return null; }}public int nextInt(){return Integer.parseInt(next());}}        
    private static Scanner sc;

    private void solve() {
        int H = sc.nextInt();
        int W = sc.nextInt();
        int D = sc.nextInt();
        int[] posx = new int[H*W];
        int[] posy = new int[H*W];
        int[] d = new int[H*W];
        
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                int A = sc.nextInt()-1;
                posx[A] = j;
                posy[A] = i;
            }
        }

        for (int i = D; i < H*W; i++) {
            int diffx = posx[i]-posx[i-D]; diffx = diffx < 0 ? -diffx : diffx;
            int diffy = posy[i]-posy[i-D]; diffy = diffy < 0 ? -diffy : diffy;
            d[i] += d[i-D] + diffx + diffy;
        }
        
        int Q = sc.nextInt();
        for (int i = 0; i < Q; i++) {
            System.out.println(-d[sc.nextInt()-1]+d[sc.nextInt()-1]);
        }
    }
}

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

int main(void){
    int N;
    cin >> N;
  
  	int array[100010];
  	for(int i=0;i<N;i++){
    	int temp;
      	cin >> temp;
      	array[temp-1] = i+1;
    }
  	for(int i=0;i<N;i++){
  		cout << array[i];
      	if(i+1<N) cout << " ";
    }
    return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>
int main(void)
{
    int a[30], i;
    memset(a, 0, sizeof(a));
    for (i=0; i<28; ++i) {
        int t;
        scanf("%d", &t);
        a[t-1] = 1;
    }
    for (i=0; i<30; ++i)
        if (!a[i]) printf("%d\n", i+1);
    return 0;
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s.push_back('2');

    vint cl;
    char now = s[0];
    int l = 0;
    rep(i, n + 1)
    {
        if (now != s[i])
        {
            int cnt = (i - l);
            cnt *= now == '1' ? 1 : -1;
            cl.emplace_back(cnt);
            l = i;
            now = s[i];
        }
    }
    int m = cl.size();
    int k1 = min(m, k * 2 + 1), k0 = min(m, (k - 1) * 2 + 1);

    int s0 = 0, s1 = 0;
    rep(i, k0) s0 += abs(cl[i]);
    int ans = 0;
    if (cl[0] < 0)
    {
        rep(i, k1 - 1) s1 += abs(cl[i]);
        ans = max(s1, s0);
        s1 += abs(cl[min(1, m - 1)]);
    }
    else
    {
        rep(i, k1) s1 += abs(cl[i]);
        ans = max(s1, s0);
    }

    l = 0;

    for (int i = k1 + 1 - (cl[0] < 0); i < m; i += 2)
    {
        s1 -= abs(cl[l]);
        s1 -= abs(cl[l + 1]);
        s1 += abs(cl[i - 1]);
        s1 += abs(cl[i]);
        ans = max(ans, s1);
        if (l == 0 && cl[0] < 0)
        {
            l++;
        }
        else
        {
            l += 2;
        }
    }

    // view(cl);
    // printf("%d %d %d\n", m, k1, k0);
    // printf("%d %d %d\n", l, s1, ans);
    // cout << m - l << endl;

    if (m - l > k1 || (m == 3 && l == 0))
    {
        s1 -= abs(cl[l]);
        s1 -= abs(cl[l + 1]);
        s1 += abs(cl[m - 1]);
        ans = max(ans, s1);
    }

    l = 0;
    for (int i = k0; i < m; ++i)
    {
        s0 -= abs(cl[l]);
        s0 += abs(cl[i]);
        ans = max(ans, s0);
        l++;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	int n, m;
	cin>>n>>m;
	vector<int> graph[n];
	set<int> par[n];
	for(int i=0; i<n+m-1; i++){
		int a, b;
		cin>>a>>b;
		a--;
		b--;
		graph[a].push_back(b);
		par[b].insert(a);
	}
	int root;
	for(int i=0; i<n; i++){
		if(par[i].size()==0){
			root = i;
			break;
		}
	}
	vector<int> visit(n, 0);
	visit[root] = 1;
	queue<int> bfs;
	bfs.push(root);
	while(!bfs.empty()){
		int v = bfs.front();
		bfs.pop();
//		if(visit[v]==0){
//			continue;
//		}
		for(int i:graph[v]){
			if(par[i].size()==1){
				bfs.push(i);
			}else{
				par[i].erase(v);
			}
		}
		
	}
	par[root].insert(-1);
	for(int i=0; i<n; i++){
		cout<<(*par[i].begin())+1<<'\n';
	}
}

Measured memory_bytes: 16000
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=1e5+5;
int inf=1e18;

vi g[maxn];
int d[maxn]={0};
int n,m,res,ans=0,vis[maxn]={0};

int dfs(int x,int t){
    
    vis[x]=1;
    if(d[x]!=0) return d[x];
    int res=0;
    for(int i:g[x]){
        res=max(res,dfs(i,t+1));
    }
    res++;
    return d[x]=res;
}

void solve(){
    cin>>n>>m;
    rep(i,0,m){
        int u,v;cin>>u>>v;
        g[u].pb(v);
    }

    rep(i,1,n+1){
        if(vis[i]) continue;
        res=dfs(i,0);
        ans=max(ans,res);
    }

    cout<<ans-1;
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

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

int main(void) {
	int A, B;
	cin >> A >> B;
	int max = -20000;

	if (A + B > max)
		max = A + B;
	if (A - B > max)
		max = A - B;
	if (A * B > max)
		max = A * B;
	cout << max << endl;

	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define rrepa(i,a,n) for(int i=n;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
#define vc vector

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    while(b!=0){
        int tmp=a%b;
        a=b;
        b=tmp;
    }
    return a;
}

int main(){

    int k;
    cin>>k;
    k++;

    ll ans=0;
    repa(i,1,k){
        repa(j,1,k){
            repa(l,1,k){
                // int tmp=gcd(gcd(i,j),l);
                // cerr<<i<<","<<j<<","<<l<<" = "<<tmp<<"\n";
                // ans+=tmp;
                ans+=gcd(gcd(i,j),l);
            }
        }
    }

    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
long long int a[100001][3];
long long int dp[100001][3];
int main(void){
    int n;
    cin>>n;
    for (int i=0;i<n;i++) {
        for (int j=0;j<3;j++) {
            cin>>a[i][j];
        }
    }
    for (int i=0;i<n;i++) {
        for (int j=0;j<3;j++) {
            for (int k=0;k<3;k++) {
                if (j==k) {
                    continue;
                } else {
                    chmax(dp[i+1][k],dp[i][j]+a[i][k]);
                }
            }
        }
    }
    long long int ans=0;
    for (int i=0;i<3;i++) {
        chmax(ans,dp[n][i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8240
N = int(input())

color = [0] * N
Group = [0] * N

Q = []
num = 1

lis = []

nnq = []
for i in range(N):

    lis.append([0] * N)

    nnq.append(i)

Q.append(nnq)
nexQ = []

while True:

    nq = Q[-1]
    del Q[-1]

    nexa = []
    nexb = []

    for i in range(len(nq)):

        if i % 2 == 0:

            nexa.append(nq[i])

            for j in range(len(nq)):

                if j % 2 == 1:
                    lis[nq[i]][nq[j]] = num

        else:

            nexb.append(nq[i])

            for j in range(len(nq)):

                if j % 2 == 0:
                    lis[nq[i]][nq[j]] = num

    if len(nexa) > 1:
        nexQ.append(nexa)

    if len(nexb) > 1:
        nexQ.append(nexb)


    if len(Q) == 0:

        num += 1

        for k in nexQ:
            Q.append(k)

        nexQ = []

        if len(Q) == 0:
            break

    #print (Q,nq)

for i in range(N):

    l = []

    for j in range(N-1-i):

        j += 1 + i

        l.append(lis[i][j])

    print (" ".join(map(str,l)))


Measured memory_bytes: 47964
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <iterator>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define dump(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
int main(){
  int A,B,X;
  cin >> A >> B >> X;
  if(A+B >= X && A <= X){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL
#include "libs/debug/print_list.hpp"
#define debug(x) (cout << # x ": " << x << endl)
#define dev(v, m, n) for(int i=0;i<n;++i){for(int j=0;j<m;++j){cout<<"|"<<v[j][i];}cout<<"|"<<endl;}
#endif

// :----------------------------------------

#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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 P (1'000'000'007)

signed main() {
    capi(n);

    bool found = false;
    int ans =0;
    int c = 1;
    rep(i, n) {
        capi(a);
        if (a == c) {
            ++c;
            found = true;
        } else {
            ++ans;
        }
    }

    if(found) cout << ans;
    else cout << -1;

    return 0;
}


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

using namespace std;

int main () {
    int N;
    cin >> N;
    vector <int> A(10*10);
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            A[i*10+j] = i*j;
        }
    }
    int ans = 0;
    for (int i = 0; i < A.size(); i++) {
        if (N == 0) break;
        if (N == A[i]) {
            ans = 1;
            break;
        }
    }

    cout << ((ans == 1) ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 256
// Copyright 2017 wu_qing
#include <cstdio>
#include <cstring>
#include <algorithm>
const int N = 110, INF = ~0u >> 1;
char s[N];
int tot[N], ans = INF, l, last[N];
bool e[N];
int main() {
    scanf("%s", s);
    l = strlen(s);
    memset(last, -1, sizeof last);
    for (int i = 0; i < l; i++) {
        tot[s[i] - 'a'] = std::max(tot[s[i] - 'a'], i - last[s[i] - 'a'] - 1);
        last[s[i] - 'a'] = i;
        e[s[i] - 'a'] = true;
    }
    for (int i = 0; i < 26; i++)
        tot[i] = std::max(tot[i], l - last[i] - 1);
    for (int i = 0; i < 26; i++)
        if (e[i])
            ans = std::min(ans, tot[i]);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
def generate_g(n)
  g = [1]
  while 3 * g[-1] + 1 < n
    g << 3 * g[-1] + 1
  end
  g.reverse
end

def insertion_sort(arr, n, g)
  cnt = 0
  for i in g...n
    v = arr[i]
    j = i - g
    while j >= 0 && arr[j] > v
      arr[j+g] = arr[j]
      j -= g
      cnt += 1
    end
    arr[j+g] = v
  end
  cnt
end

def sehll_sort(arr, n)
  total_cnt = 0
  g_arr = generate_g(n)
  g_arr.each do |g|
    cnt = insertion_sort(arr, n, g)
    total_cnt += cnt
  end
  return g_arr, total_cnt
end

n = gets().to_i
arr = []
n.times do 
  arr << gets().to_i
end

g, cnt = sehll_sort(arr, n)
puts g.length
puts g.join(' ')
puts cnt
arr.each do |num|
  puts num
end


Measured memory_bytes: 14812
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int gcd(int a, int b) {
	if (b == 0) return a;
	else return gcd(b, a%b);
}
int gcd1(vector<int> a) {
	int ans = a[0];
	for (int i = 1; i < a.size(); i++) {
		ans = gcd(ans, a[i]);
	}
	return ans;
}
int main(void) {
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) {
		cin >> a[i];
	}
	cout << gcd1(a) << endl;
	return 0;
}

Measured memory_bytes: 1024