akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

//最大公約数
template<class T>
inline T GCD(T m, T n)
{
	T temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
template<class T>
inline T LCM(T m, T n)
{
	return m * n / GCD(m, n);
}



int main()
{
	int n; cin >> n;
	vector<vector<long long int>> a(n,vector<long long int>(3,0));
	for (int i = 0; i < n; i++) { cin >> a[i][0] >> a[i][1] >> a[i][2]; }

	//dp + init
	vector<vector<long long int>> dp(n+1,vector<long long int>(3,0));

	for (int i = 1; i <= n; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			for (int k = 0; k < 3; k++)
			{
				if (j == k) { continue; }
				dp[i][k] = max(dp[i][k], dp[i-1][j] + a[i-1][k]);
			}
		}
	}

	cout << max(max(dp[n][0], dp[n][1]), dp[n][2]) << endl;

	return 0;
}

Measured memory_bytes: 11136
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int a,b,c; cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust" << endl;
    else cout << "win" << endl; 
}


Measured memory_bytes: 256
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define f first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int a, b, c;

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

//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);


cin >>a >> b >> c;

int ans = max( a*10 + b + c,  a+ b*10 + c  );

ans = max(ans, c*10 + a+ b   );

cout << ans << endl;










return 0;}
///....


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int N;
ll K;
int A[200001];
ll C[200001];
int count;
int main(void){
    cin >> N >> K;
    for(int i=1;i<=N;i++) cin >> A[i];


    REP(i,N+1) C[i] = -1;
    C[1] = 0;
    int current = 1;
    int roll;
    REP(i,200002){
        if (C[A[current]] == -1){
            C[A[current]] = i+1;
            current = A[current];
        }else{
            current = A[current];
            roll = (i+1)-C[current];
            break;
        }
    }
    if(K<=C[current]){
        current = 1;
        REP(i,K){
            current = A[current];
        }
        cout << current << endl;
        return 0;
    }

    K = (K-C[current])%roll;
    REP(i, K) current = A[current];
    cout << current << endl;

    return 0;
}



Measured memory_bytes: 5896
#include <stdio.h>
#include <string.h>

int main(void)
{
	char s1[201];
	char s2[101];
	char p[101];
	char *ret;

	scanf("%s", s2);
	scanf("%s", p);

	strcpy(s1, s2);
	strcat(s1, s2);
	ret = strstr(s1, p);

	if (ret != NULL){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 540
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		String s = sc.next();

		System.out.println(s.matches("A[a-z]+C[a-z]+") ? "AC" : "WA");

		sc.close();
	}
}


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

namespace ConsoleApp34 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int A = st[0];
            int B = st[1];

            if (A % 2 == 0 || B % 2 == 0) {
                Console.WriteLine("No");
            } else {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 13268
n = gets.to_i
d = gets.split.map &:to_i
m = gets.to_i
t = gets.split.map &:to_i

cnt = Hash.new(0)
d.each do |a|
    cnt[a] += 1
end

t.each do |a|
    cnt[a] -= 1
end

ans = cnt.values.all?{|v|v>=0}
puts ans ? "YES" : "NO"

Measured memory_bytes: 43548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;

const int mod = 1000000007;
const int inf = 1e9;
#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        ll p = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll q = c.end() - upper_bound(c.begin(), c.end(), b[i]);
        ans += p*q;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //昇順
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;

int main(){
  int n;
  cin >> n;
  // vector<int> nums(n);
  int count_2 = 0;
  int count_4 = 0;
  int tmp;
  rep_i(i, n){
    cin >> tmp;
    if(tmp%4 == 0){
      count_4 += 1;
    }else{
      if (!(tmp & 1)){
        count_2 += 1;
      }
    }
  }
  // say(count_2);
  // say(count_4);
  if(count_2 == 0){
    if(count_4 >= n - count_4 - 1){
      say("Yes");
    }else{
      say("No");
    }
  }else{
    if(count_4 >= n - count_2 - count_4){
      say("Yes");
    }else{
      say("No");
    }
  }
  // if (count_2 % 2 == 0){
  //   if(n - (count_2) - (count_4*2 + 1) <= 0){
  //     cout << "Yes" << endl;
  //   }else{
  //     cout << "No" << endl;
  //   }
  // }else{
  //   if(n - (count_2 - 1) - (count_4*2 + 1) <= 0){
  //     cout << "Yes" << endl;
  //   }else{
  //     cout << "No" << endl;
  //   }
  // }
  
  // if(count_2 == n){
  //   cout << "Yes" << endl;
  // }else{
  //   if(count_4 >= n/2){
  //     cout << "Yes" << endl;
  //   }else{
  //     cout << "No" << endl;
  //   }
  // }

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <list>
#define INF 0x3f3f3f3f
#define maxn 105000
#define maxnn 6000
#define juzheng 300
#define line cout << "-------------------------" << endl;
#define PI acos(-1.0)
#define mem(a,b) memset(a,b,sizeof(a))
#define fill_(a,b,n) fill(a,a + n,b)
#define esp 1e-9
 
#define ri(n) scanf("%d",&n)
#define ri2(a,b) scanf("%d %d",&a,&b)
#define ri3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define rd(n) scanf("%lf",&n)
#define rd2(a,b) scanf("%lf %lf",&a,&b)
#define rd3(a,b,c) scanf("%lf %lf %lf",&a,&b,&c)
#define rl(n) scanf("%lld",&n)
#define rl2(a,b) scanf("%lld %lld",&a,&b)
#define rl3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define rui(n) scanf("%u",&n)
#define rui2(a,b) scanf("%u %u",&a,&b)
#define rui3(a,b,c) scanf("%u %u %u",&a,&b,&c)
#define rs(str) scanf("%s",str)
#define pr(n) cout << n << endl
#define debug(str,x) cout << str << ":" << x << endl
#define ll long long
#define int64 __int64
#define ui unsigned int

using namespace std;

const ll mod = 1e9 + 7;

//Date:2018-8-18
//Author：HarryBlackCat

int main() {
	//cin.sync_with_stdio(false);//降低cin，cout时间
	int a,b;
	while(~ri2(a,b)){
		pr((a - 1) * (b - 1));
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int cmp(int a,int b)
{
	return(a>b);
}
int main()
{
	int x[100],i,j,n,k,max=0,sum=0;;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&x[i]);
	}
	sort(x+1,x+n+1,cmp);
	for(i=1;i<=k;i++)
	{
		sum+=x[i];
	}
	printf("%d",sum);
}

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

#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) std::sort(v, v+n);
#define VSORT(v) std::sort(v.begin(), v.end());
#define VRSORT(v) std::sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<ll, ll> LP;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


ll N,X,T;
int main() {

	cin >> N>>X>>T;
	ll kaisu = (N + (X - 1)) / X;
	cout << kaisu*T << endl;


	return 0;

}


Measured memory_bytes: 3592
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>

using namespace std;

class AGC_B {
public:
    void solve(istream& in, ostream& out) {
        int N, M;
        in >> N >> M;
        vector<vector<int>> g(N);
        int v1, v2;
        for (int i = 0; i < M; ++i) {
            int a, b;
            in >> a >> b;
            g[a-1].push_back(b-1);
            g[b-1].push_back(a-1);
            v1 = a-1;
            v2 = b-1;
        }
        
        vector<int> vis(N, 0), res;
        vis[v1] = vis[v2] = 1;
        int u = v1;
        while (true) {
            begin:
            vis[u] = 1;
            res.push_back(u);
            for (int v : g[u]) {
                if (!vis[v]) {
                    u = v;
                    goto begin;
                }
            }
            break;
        }
        reverse(res.begin(), res.end());
        u = v2;
        while (true) {
            begin2:
            vis[u] = 1;
            res.push_back(u);
            for (int v : g[u]) {
                if (!vis[v]) {
                    u = v;
                    goto begin2;
                }
            }
            break;
        }
        
        out << res.size() << "\n";
        for (int v : res) {
            out << v+1 << " ";
        }
        out << "\n";
    }
};


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

	AGC_B solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 7160
// ABC176E - Bomber
 
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long int ull;
typedef long long int ll;
 
int main() {
	int H, W, M;
	cin >> H >> W >> M;

	int h[M], w[M];
	map<int, int> row;
	map<int, int> col;
	set<pair<int,int>> bomb;
	for (int i = 0; i < M; i++) {
		cin >> h[i] >> w[i];
		row[h[i]]++;
		col[w[i]]++;
		bomb.insert(make_pair(h[i], w[i]));
	}

	int r_max = 0;
	for (int i = 1; i <= H; i++) {
		if (r_max < row[i]) {
			r_max = row[i];
		}
	}
	int c_max = 0;
	for (int i = 1; i <= W; i++) {
		if (c_max < col[i]) {
			c_max = col[i];
		}
	}

	set<int> r_max_num;
	for (int i = 1; i <= H; i++) {
		if (r_max == row[i]) {
			r_max_num.insert(i);
		}
	}
	set<int> c_max_num;
	for (int i = 1; i <= W; i++) {
		if (c_max == col[i]) {
			c_max_num.insert(i);
		}
	}

	if (r_max_num.size() * c_max_num.size() > M) {
		cout << r_max + c_max << endl;
		return 0;
	}

	for (auto i = r_max_num.begin(); i != r_max_num.end(); i++) {
		for (auto j = c_max_num.begin(); j != c_max_num.end(); j++) {
			if (bomb.find(make_pair(*i, *j)) == bomb.end()) {
				cout << r_max + c_max << endl;
				return 0;
			}
		}
	}

	cout << r_max + c_max - 1 << endl;

	return 0;
}


Measured memory_bytes: 76208
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N, K;
    cin >> N >> K;
    if(K > (N-1)*(N-2)/2) {cout << -1 << endl; return 0;}
    vector<pii> ans;
    int cnt = ((N-1)*(N-2)/2)-K;
    cout << N-1+cnt << endl;
    rep2(i, 2, N){
        cout << 1 << ' ' << i << endl;
    }
    rep2(i, 2, N-1){
        rep2(j, i+1, N){
            if(cnt == 0) break;
            cout << i << ' ' << j << endl;
            cnt--;
        }
    }
}

Measured memory_bytes: 256
X,N=map(int,input().split())
P=list(map(int,input().split()))
hako=set(P)
#print(hako)
ans=[]
P.sort()
kari=[]
for i in range(102):
    if i not in hako:
        kari.append(i)
for i in range(len(kari)):
    ans.append([abs(X-kari[i]),kari[i]])
ans.sort()
print(ans[0][1])

Measured memory_bytes: 9204
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bitset>
#include <map>
#include <cstring>
#include <cstdlib>

#define INF_LL 9000000000000000000
#define INF 2000000000

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)

using namespace std;

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

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

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

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

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool visited[2020][2020];
int main(){
	int sx, sy, tx, ty;
	memset(visited, 0, sizeof visited);
	cin >> sx >> sy >> tx >> ty;
	REP(i, abs(tx-sx)){
		if(tx > sx) cout << "R";
		else cout << "L";
	}
	REP(i, abs(ty-sy)){
		if(ty > sy) cout << "U";
		else cout << "D";
	}
	REP(i, abs(tx-sx)){
		if(tx > sx) cout << "L";
		else cout << "R";
	}
	REP(i, abs(ty-sy)){
		if(ty > sy) cout << "D";
		else cout << "U";
	}
	if(tx > sx) cout << "L";
	else cout << "R";
	REP(i, abs(ty-sy)+1){
		if(ty > sy) cout << "U";
		else cout << "D";
	}
	REP(i, abs(tx-sx)+1){
		if(tx > sx) cout << "R";
		else cout << "L";
	}
	if(ty > sy) cout << "D";
	else cout << "U";
	if(tx > sx) cout << "R";
	else cout << "L";
	REP(i, abs(ty-sy)+1){
		if(ty > sy) cout << "D";
		else cout << "U";
	}
	REP(i, abs(tx-sx)+1){
		if(tx > sx) cout << "L";
		else cout << "R";
	}
	if(ty > sy) cout << "U";
	else cout << "D";
	cout << endl;
}


Measured memory_bytes: 4224
import sys
abcd = input()
a, b, c, d = map(int, abcd)
op = [1, -1]
s_op = ['+', '-']
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a+b*op[i]+c*op[j]+d*op[k] == 7:
                print('{}{}{}{}{}{}{}=7'.format(
                    a, s_op[i], b, s_op[j], c, s_op[k], d
                    ))
                sys.exit(0)


Measured memory_bytes: 3060
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < n; i++)
#define REP(i,n) for(int i=1;i<=n;i++)

using namespace std;
typedef long long ll;

int main()
{
    // Input
    string in;
    cin >> in;

    if (in[in.length() - 1] != 's') {
        cout << in + "s";
    } else {
        cout << in + "es";
    }

    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  string s;
  cin >> s;
  string tmp = s;
  int month = stoi(s.substr(5, 2));
  int day = stoi(tmp.substr(9, 2));

  if(month < 4) cout << "Heisei" << endl;
  else if(month == 4 && day <= 30) cout << "Heisei" << endl;
  else cout << "TBD" << endl;

}


Measured memory_bytes: 256
x = []
for i in range(5):
        x.append(int(input()))
k = int(input())
a = x[0]
n = True
for i in x:
        b = abs(a-i)
        if b > k:
                n = False
        else:
                None
if not n:
        print(":(")
else:
        print("Yay!")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>

using namespace std;

int main()
{
    int n, ans = 0, x, m = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> x;
        if (x >= m) {
            ans++;
        }
        m = max(x, m);
    }

    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#include<unordered_map>
using namespace std;
typedef long long ll;
const ll inf=(1ll<<61);
const ll mod=1e9+7;
const int MX=1e5+9;
int n,m,a[MX],c,vis[MX],x,y,add[MX],sum,is[MX];
ll ans=0;
vector<int>v[MX],com[MX];
void dfs(int x,int p){
    if(vis[x])return ;
    vis[x]=1;
    com[c].push_back(a[x]);
    for(auto pp:v[x]){
        if(pp==p)continue;
        dfs(pp,x);
    }
}
int main(){
    cin>>n>>m;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int i=0;i<m;i++){
        scanf("%d%d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
        is[x]=is[y]=1;
    }
    if(n==1){
        puts("0");
        return 0;
    }
    for(int i=0;i<n;i++){
        if(vis[i])continue;
        dfs(i,-1);
        sort(com[c].begin(),com[c].end());
        c++;
    }
    if(c==1){
        puts("0");
        return 0;
    }
    if(m==0){
        if(n==2){
            cout<<a[0]+a[1]<<endl;
            return 0;
        }
        puts("Impossible");
        return 0;
    }
    vector<int>sol;
    for(int i=0;i<c;i++){
        ans+=com[i][0];
        for(int j=1;j<com[i].size();j++)sol.push_back(com[i][j]);
    }
  //  cout<<ans<<endl;
    if(sol.size()>=c-2){
        sort(sol.begin(),sol.end());
        for(int i=0;i<c-2;i++){
            ans+=sol[i];
        }
        cout<<ans<<endl;
        return 0;
    }
    puts("Impossible");
}


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

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        String s=fsc.next();
        String t=fsc.next();
        fsc.close();
        System.out.println(t+s);
    }
    static 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());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 21204
#include <iostream>
#define llint long long int

using namespace std;

llint N = 50;
llint K, R;
llint a[55];

int main(void)
{
	cin >> K;
	
	for(llint i = 0; i < N; i++){
		a[i] += N-1 + (K / N);
	}
	
	R = K % N;
	for(llint i = 0; i < N; i++){
		if(i < N - R) a[i] -= R;
		else a[i] += N - R + 1;
	}
	
	cout << N << endl;
	for(llint i = 0; i < N; i++){
		cout << a[i];
		if(i < N-1) cout << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
	int a,b;
	string moji;
	while(1){
		cin >> a >> moji >> b;
		if(moji=="?") break;
		if(moji=="+") cout << a+b;
		else if(moji=="-") cout << a-b;
		else if(moji=="*") cout << a*b;
		else if(moji=="/") cout << a/b;
		cout <<endl;
	}
	return 0;
}

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

#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1e9+7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
/*(._.)*/
int main(){
	int N; cin >> N;
	vector<int> A(N);
	int M,m;
	M = -1, m = -2;
	REP(i,N){
	    cin >> A[i];
	}

	REP(i,N){
	    if (A[i] < m) continue;
	    if ((A[i] < M) and (m < A[i])){
	    	m = A[i];
	    	continue;
	    }
	    m = M; M = A[i];
	}

	REP(i,N){
	    if (M == m){
	    	cout << M << "\n";
	    	continue;
	    }else{
	    	if (A[i] == M){
	    		cout << m << "\n";
	    	}else{
				cout << M << "\n";
	    	}
	    }
	}


    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
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<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

bool isprime(long long n)
{
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;
    for (int i = 3; i <= std::sqrt(n)+10; i += 2)
        if (n % i == 0)
            return false;
    return true;
}

int main()
{
        ll X;
        cin >> X;
        rep(i, X, X+1000000) {
                if (isprime(i)) {
                        cout << i << endl;
                        return 0;
                }
        }
}

Measured memory_bytes: 256
n,m=map(int,input().split())
d={i:set() for i in range(1,n+1)}
for i in range(m):
    a,b=map(int,input().split())
    d[a].add(b)
    d[b].add(a)

vis = set()
res = 0
for i in range(1,n+1):
    if i not in vis:
        stack=[i]
        ans=1
        vis.add(i)
        while stack:
            cur=stack.pop()
            for j in d[cur]:
                if j not in vis:
                    vis.add(j)
                    ans+=1
                    stack.append(j)
        res=max(res,ans)
print(res)
        


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

int main() {
  int n;
  cin >> n;
  vector<int>v(n), c(n);
  rep(i,n) cin >> v[i];
  rep(i,n) cin >> c[i];
  int ans = 0;
  rep(i,n){
    if(v[i]-c[i]>=0) ans += (v[i]-c[i]);
    else continue;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;


typedef long long lint, ll;
typedef long double ldouble, ld;

#ifdef LOCAL
	#define dbg(expr) cerr << "[" << __LINE__ << "] " << #expr << " = " << (expr) << '\n';
#else
	#define dbg(expr) (void) 0;
#endif


struct zint {
	const lint mod = 1e9 + 7;
	lint value;

	zint(): value() {}

	zint(lint val) {
		value = (val % mod + mod) % mod;
	}

	zint operator +(const zint & other) const {
		return zint(value + other.value);
	}

	zint operator -(const zint & other) const {
		return zint(value - other.value);
	}

	zint operator *(const zint & other) const {
		return zint(value * other.value);
	}

	zint operator +=(const zint & other) {
		this->value = (*this + other).value;
		return *this;
	}

	zint operator -=(const zint & other) {
		this->value = (*this - other).value;
		return *this;
	}

	zint operator *=(const zint & other) {
		this->value = (*this * other).value;
		return *this;
	}

    zint & operator=(zint other) {
        this->value = other.value;
        return *this;
    }

    friend ostream & operator <<(ostream & os, const zint & number) {
        os << number.value;
        return os;
    }

    friend istream & operator >>(istream & is, zint & number) {
        is >> number.value;
        number = zint(number.value);
        return is;
    }
};

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

    int n;
    cin >> n;
    vector<string> field(2);
    for (int i = 0; i < 2; i++)
        cin >> field[i];
    int prev_type = 2;
    zint result = 1;
    for (int i = 0; i < n; i++) {
        if (field[0][i] == field[1][i]) {
            if (prev_type == 2)
                result *= 3;
            else if (prev_type == 1)
                result *= 2;
            else
                result *= 1;
            prev_type = 1;
        } else {
            if (prev_type == 2)
                result *= 6;
            else if (prev_type == 1)
                result *= 2;
            else
                result *= 3;
            prev_type = 0;
            i++;
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
const ll MAX_N=2e5;
ll N,A[MAX_N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll sm=0,ans;
	cin>>N;
	REP(i,N){
		cin>>A[i];
		sm+=A[i];
	}
	ans=sm;
	ll psm=0;
	REP(i,N-1){
		psm+=A[i];
		sm-=A[i];
		ans=min(ans,llabs(psm-sm));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	
	void main() {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt ();
		int[] a = new int[n];
		for(int i = 0; i < a.length; i++) {
		a[i] = sc.nextInt ();
		}
		for(int i = 0; i < a.length; i++) {
		System.out.print(a[n-1-i]);
		if (i != (a.length - 1))
		System.out.print(" ");
		
		}
		System.out.println();
	}
	public static void main(String[] args) {
		  new Main().main();
	}
	
	}


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

int main()
{
	int card[4][13],n,x; //S,H,C,D
	char mark;
	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 13;j++) {
			card[i][j] = 1;
		}
	}
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> mark >> x;
		if (mark == 'S') { card[0][x-1] = 0; }
		else if (mark == 'H') { card[1][x-1] = 0; }
		else if (mark == 'C') { card[2][x-1] = 0; }
		else { card[3][x-1] = 0; }
	}

	for (int i = 0;i < 4;i++) {
		for (int j = 0;j < 13;j++) {
			if (card[i][j] == 1) {
				if (i == 0) { cout << "S " << j+1 << endl; }
				else if (i == 1) { cout << "H " << j+1 << endl; }
				else if (i == 2) { cout << "C " << j+1 << endl; }
				else { cout << "D " << j+1 << endl; }
			}
		}
	}
	return 0;

}

Measured memory_bytes: 1164
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)
    else:
        break


Measured memory_bytes: 5596
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
inline ll read() {
    ll x=0,tmp=1;char ch=getchar();
    while((ch<'0')||(ch>'9')){
        if(ch=='-')tmp=-1;ch=getchar();
    }
    while((ch>='0')&&(ch<='9')){
        x=x*10+ch-'0';ch=getchar(); 
    }
    return x*tmp;
}
ll dp[4005][4005][2];
ll jc[4005];
bool line[4005];
int main(){
    int n=read(),k=read();
    jc[0]=1;
    for(int i=1;i<=n;i++)
    jc[i]=jc[i-1]*i%924844033;
    int tot=0;
    for(int i=1;i<=k;i++)
     for(int t=2;t--;){
         for(int j=i;j<=n;j+=k){
             tot++;
             if(j!=i) line[tot]=1;
         }
     }
    dp[0][0][0]=1;
    for(int i=0;i<=n*2-1;i++)
     for(int j=0;j<=n;j++){
         dp[i+1][j][0]=(dp[i][j][0]+dp[i][j][1])%924844033;
         if(line[i+1]) dp[i+1][j+1][1]=dp[i][j][0];
     }
    ll ans=0;
    for(int i=0,j=1;i<=n;i++,j=-j)
    ans=(ans+((dp[2*n][i][0]+dp[2*n][i][1])*jc[n-i]%924844033)*j+924844033)%924844033;
    cout<<ans;
}

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

namespace ABC
{
    class ABC_IHCA
    {
        const string FILE = "/tmp/data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            long D = RL();
            long[] Ca = RLa(26);
            long[,] La = RLa(D, 26);

            for (int i = 0; i < D; ++i)
            {
                Console.WriteLine(max(La, i) + 1);
            }

#if DEBUG
            Console.WriteLine("*** end ***");
            Console.SetIn(Console.In);
            Console.ReadKey();
            Console.WriteLine();
#endif
        }

        static int max(long[,] La, int i)
        {
            long m = 0;
            int midx = 0;
            for (int j = 0; j < 26; ++j)
            {
                if (La[i, j] > m)
                {
                    m = La[i, j];
                    midx = j;
                }
            }
            return midx;
        }

        static long RL()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] RLa(long n)
        {
            string[] sa = Console.ReadLine().Split(' ');
            long[] la = new long[n];
            for (int i = 0; i < n; ++i)
            {
                la[i] = long.Parse(sa[i]);
            }
            return la;
        }

        static long[,] RLa(long r, long c)
        {
            long[,] la = new long[r, c];
            for (int i = 0; i < r; ++i)
            {
                string[] sa = Console.ReadLine().Split(' ');
                for (int j = 0; j < c; ++j)
                {
                    la[i, j] = long.Parse(sa[j]);
                }
            }
            return la;
        }
    }
}


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

int main(void){
    int n;
    cin>>n;
    
    long long luca[87];
    luca[0]=2;luca[1]=1;
    
    for(int i=2;i<87;i++){
        luca[i]=luca[i-1]+luca[i-2];
    }
    
    cout<<luca[n]<<endl;
}


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

int main(){
  int n;
  int a;
  int b[100010] = {};
  cin >> n;

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


  int tmp = 0;
  for(int i= 0;i < 100010;i++){
    if(b[i] > 1){
      tmp += b[i]-1;
    }
  }

  if(tmp % 2 == 0){
    cout << n-tmp << endl;
  }else{
    cout << n-tmp-1 << endl;
  }

  return 0;
}


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

int main(){
  int N; cin >> N;
  int c=1;
  for(int i=0;i<N;i++){
    int k; cin >> k;
    if(k%2==1){
      c*=-1;
    }
  }
  if(c==-1){
    cout << "NO" << endl;
  }
  else cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long dp[4001]={0};
int main(){
    dp[0]=1;
    for(int i=0;i<4;++i){
        for(int j=i*1000;j>=0;--j){
            long long back=dp[j];
            dp[j]=0;
            for(int k=0;k<=1000;++k){
                dp[j+k]+=back;
            }
        }
    }
    int n;
    while(cin>>n){
        cout<<dp[n]<<endl;
    }
    return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int64_t n;
    int64_t cap[5];
    cin >> n;
    for(int i=0;i<5;i++) cin >> cap[i];
    for(int i=1;i<5;i++) cap[i] = min(cap[i-1], cap[i]);
    cout << (n+cap[4]-1) / cap[4] + 4 << endl;
    
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,c=1; cin>>n;
    vector <int> num(n),ans(n);
    for(i=0; i<n; ++i) 
        {
            cin>>num[i];
            ans[num[i]-1]=c;
            c++;
        }
    for(i=0; i<n; ++i) cout<<ans[i]<<" ";
    return 0;
}

Measured memory_bytes: 1664
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n, m, x, y = map(int, input().split())

    xs = list(map(int, input().split()))
    ys = list(map(int, input().split()))

    x_val = max(xs)
    y_val = min(ys)

    flag = 0
    if x >= y_val or y <= x_val:
        flag = 1
    elif y_val <= x_val:
        flag = 1
    else:
        pass

    if flag == 1:
        print("War")
    else:
        print("No War")


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;
 
 //O(100000000)
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        long N = Long.parseLong(sc.next());
        long ans = 1;
        for(int i=0;i<N;i++){
           long t = Long.parseLong(sc.next());
           ans = lcm(ans, t);
        }

        System.out.print(ans);
        System.out.println();
    }
    
    public static final long gcd(long a, long b) {
    //a > b にする（スワップ）
    if(b == 0) return a;
     return gcd(b,a%b);
    }
    
    public static final long lcm(long a, long b) {
    long g = gcd(a,b);
    return a / g * b;
    }



}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int h, w;
  cin >> h >> w;
  int az[26];
  fill(az, az+26, 0);
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      char c;
      cin >> c;
      az[c-'a']++;
    }
  }
  int odd = 0, even = 0;
  if (h%2==1 && w%2==1) {
    odd = 1;
    even = h/2 + w/2;
  } else if (h%2==1) {
    even = w/2;
  } else if (w%2==1) {
    even = h/2;
  }
  for (int i = 0; i < 26; ++i) {
    if (az[i]%2==1) {
      if (odd == 0) {cout << "No" << endl; return 0;}
      odd--;
    } else if (az[i]%4!=0) {
      if (even == 0) {cout << "No" << endl; return 0;}
      even--;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

using namespace std;

int main()
{
	int a, b, big,ans,flag=0;
	cin >> a >> b;
	ans = a;
	if (a < b){
		ans = b;
		b--;
	}
	else a--;
	ans += (a > b) ? a : b;
	cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    // 最終形は3通り、RRR, WWW, RRRWWW
    int N;
    cin >> N;
    string S;
    cin >> S;
    int red = 0, white = 0;
    rep(i, N) {
        if (S[i] == 'R') red++;
        else white++;
    }
    int ans = min(red, white);
    // 左からgreedyに
    int temp = 0;
    rep(i, N) {
        if (red == 0) ans = min(ans, temp);
        if (S[i] == 'R') {
            red--;
        } else {
            temp++;
            red--;
        }
    }
    cout << ans << '\n';
    return 0;
}

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

int main() {
  int A, B;
  int p = 0;
  cin >> A >> B;
  
  for (int i = A; i <= B; ++i) {
    if ((i / 10000) == (i % 10)) {
      if ((i / 1000 % 10) == (i / 10 % 10)) {
        p++;
      }
    }
  }
  
  cout << p << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[100009],dp[100009];
int main() {
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i>2){
            dp[i]=min(abs(a[i]-a[i-1]) +dp[i-1],abs(a[i]-a[i-2]) +dp[i-2] );
        }
        if(i==2)dp[i]=abs(a[i]-a[i-1]) +dp[i-1];
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
	char s[105], t[105], output[210];
	int i, n, s_num=0, t_num=0;
	
	scanf("%d", &n);
	scanf("%s", s);
	scanf("%s", t);

	for (i = 0; i < 2*n; i++) {
		if (i % 2 == 0) {
			output[i] = s[s_num];
			s_num++;

		}
		else {
			output[i] = t[t_num];
			t_num++;
		}
	}
	
	output[2 * n] = '\0';

	printf("%s", output);

	return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>; 

string P = "";
string Q = "";
ll Pnum = 0, Qnum = 0;
ll Pcount = 0, Qcount = 0;

void dfs(string now, ll n, ll m, string P, string Q){
    if(n == 0){
        if(now == P){
            Pnum = Pcount;
        }if(now == Q){
            Qnum = Qcount;
        }
        Pcount++;
        Qcount++;
        return;
    }
    for(char c = '1'; c < '1'+m; c++){
        bool con = false;
        for(char nowc : now){
            if(nowc == c) con = true; 
        }
        if(con) continue;
        string next = now;
        next += c;
        dfs(next, n-1, m, P, Q);
    }
}

int main() {
    ll N;
    cin >> N;
    rep(i, N){
        char c;
        cin >> c;
        P += c;
    }
    rep(i, N){
        char c;
        cin >> c;
        Q += c;
    }
    dfs("", N, N, P, Q);
    cout << abs(Pnum - Qnum);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
vector<ll> adj[200007] ;
ll vis[30003] ;
ll ans[30006] ,lvl[30007] ;

void bfs(ll n) {

    vis[n] = 1 ;
    queue<ll> q ;
    q.push(n) ;
    lvl[n] = 0 ;
    while(!q.empty ()) {

        ll f = q.front() ;

        q.pop() ;

        for(auto it : adj[f] ) {
            if (!vis[it]) {
                  //  cout << it << ' ' << f << endl ;
                vis[it] = 1 ;
                q.push(it) ;
                lvl[it] = lvl[f]+1 ;
                ans[lvl[it]]++ ;
            }
        }

    }

}

int main() {

    ll n , x ,y ,i,j;
    cin >> n >> x >> y ;
    for(i=1;i<=n-1;i++) {
        adj[i].pb(i+1) ;
        adj[i+1].pb(i) ;
    }
    adj[x].pb(y) ;
    adj[y].pb(x) ;


    for(i=1;i<=n;i++) {
        for(j=0;j<n+5;j++) lvl[j] =  vis[j] = 0 ;
        bfs(i ) ;
    }

    for(i=1;i<n;i++) cout << ans[i]/2 << '\n' ;




}


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

typedef long long ll;

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<=(n);i++)

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

int main(){
    ll n;
    int min=100;
    cin >> n;
    reps(i,1,sqrt(n)){
        if((n%i)==0){
            int temp = max(to_string(i).size(),to_string(n/i).size());
            if(min > temp)
                min = temp;
        }
    }
    cout << min << endl;
    return 0;
}


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

#define SIZE 5005
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
bool dp[SIZE];
int A[SIZE];
P pos[SIZE];
 
int main()
{
	int n,K;
	scanf("%d %d",&n,&K);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	sort(A,A+n);
	ll sum=0;
	for(int i=0;i<n;i++) sum+=A[i];
	memset(dp,false,sizeof(dp));
	dp[0]=true;
	int ret=0;
	for(int i=n-1;i>=0;i--)
	{
		bool up=false;
		for(int j=0;j<K;j++)
		{
			if(dp[j]&&j+sum>=K) up=true;
		}
		if(!up) ret++;
		sum-=A[i];
		for(int j=K-1;j>=A[i];j--) dp[j]|=dp[j-A[i]];
	}
	printf("%d\n",ret);
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, a int
	fmt.Scan(&n)
	max := -1
	min := 1001
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a > max {
			max = a
		}
		if a < min {
			min = a
		}
	}
	fmt.Println(max - min)
}


Measured memory_bytes: 512
//InTheNameOfGod
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,j,k) for(int i=j;i<k;++i)
#define rrep(i,j,k) for(int i=j;i>=k;i--)
#define pb push_back
#define lb(i) i&(-i);
const int maxn =2e6+6;
int n,a[maxn];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n;
    n*=2;
    rep(i,0,n)cin>>a[i];
    sort(a,a+n);
    int re=0;
    rep(i,0,n)
    {
        if(i%2==0)re+=a[i];
    }
    cout<<re;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	int A, B, C;
	rep(i, N) {
		cin >> A >> B >> C;
		if (A * A == B * B + C * C ||
			B * B == A * A + C * C ||
			C * C == A * A + B * B) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}





Measured memory_bytes: 3008