akhauriyash/Code-Regression huggingface dataset:
/* 
	Author: ankrypt
*/

#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;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15 
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string T = "";
string S = "";
ll cases;

int main() {
	go;
	T = "UURRURRDDDLLDLLULUUURRURRDDDLLDL";
	// trace1(T.size());
    cin >> N >> M >> A >> B;
    ll manDistX = A - N;
    ll manDistY = B - M;
    fi(i, 0, manDistX, 1) {
    	S += 'R';
    } 
    fi(i, 0, manDistY, 1) {
    	S += 'U';
    }
    fi(i, 0, manDistX, 1) {
    	S += 'L';
    }
    fi(i, 0, manDistY, 1) {
    	S += 'D';
    }
    S += 'L';
    fi(i, 0, manDistY + 1, 1) {
    	S += 'U';
    }
    fi(i, 0, manDistX + 1, 1) {
    	S += 'R';
    }
    S += 'D';
    S += 'R';
    fi(i, 0, manDistY + 1, 1) {
    	S += 'D';
    }
    fi(i, 0, manDistX + 1, 1) {
    	S += 'L';
    }
    S += 'U';
    // trace1(S.size());
    cout << S;
 	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 256
while True:
  n,m,a = map(int, raw_input().split())
  if n==m==a==0: break
  lst = [0] * n
  for i in xrange(n):
    lst[i] = i
  ms = {}
  for _ in xrange(m):
    h,p,q = map(int, raw_input().split())
    if h not in ms:
      ms[h] = {}
    ms[h][p] = q
  for i,v in sorted(ms.items()):
    for k,l in v.items():
      tmp = lst[k-1]
      lst[k-1] = lst[l-1]
      lst[l-1] = tmp
  print lst[a-1]+1

Measured memory_bytes: 6432
r,c = (int(x) for x in input().split())

table = []
i = 0

while i < r:
  table.append(list(int(x) for x in input().split()))
  i += 1

i,j = 0,0
for i in table:
  sum = 0
  for idx,j in enumerate(i):
    if idx != 0:
      print(' ', end='')
    print(j, end='')   
    sum += j
  print(' ' + str(sum))

j,ttl = 0,0
while j < c:
  i = 0
  sum = 0
  while i < r:
    sum += table[i][j]
    i += 1
  print (sum, end=' ')
  ttl += sum
  j += 1
print(ttl)


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

vector<int>cur;
vector<int>his;
int main()
{
    int a,l,count,now;
    while(true){
        count=0;
        his.clear();
        cin>>a>>l;
        his.push_back(a);
        if(a==0&&l==0)
            break;
        while(true){
            count++;
            int big=0,small=0;
            cur.clear();
            while(a>0){
                cur.push_back(a%10);
                a/=10;
            }
            while(cur.size()<l)
                cur.push_back(0);
            sort(cur.begin(),cur.end());
            for(int i=0;i<l;i++){
                small+=cur[i];
                big+=cur[l-i-1];
                if(i<l-1){
                    big*=10;
                    small*=10;
                }
            }
            now=big-small;
            unsigned long f=find(his.begin(), his.end(), now)-his.begin();
            if(f!=his.size()){
                cout<<f<<" "<<now<<" "<<count-f<<endl;
                break;
            }
            his.push_back(now);
            a=now;
        }
    }
}

Measured memory_bytes: 1220
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  if(N%2==0){
    cout << N*N/4;
  }else{
    cout << (int)(N/2) * ((int)(N/2)+1) ;
  }
  return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll dp[405][405];

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n), s(n+1);
  rep(i,n){
    cin>>a[i];
    s[i+1]=s[i]+a[i];
  }
  
  rep(i,n+1) rep(j,n+1) dp[i][j]=LINF;
  rep(i,n){
    dp[i][i+1]=0;
  }
  
  for(ll len=2; len<=n; len++){
    for(ll i=0; i+len<=n; i++){
      ll j=i+len;
      for(ll k=i+1; k<j; k++){
        chmin(dp[i][j],dp[i][k]+dp[k][j]);
        // cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
      }
      dp[i][j]+=(s[j]-s[i]);
    }
  }
  cout<<dp[0][n]<<endl;
}

Measured memory_bytes: 4940
s = input()
ans = 0
m = 0
for S in s:
  if S in "A":
    ans += 1
  elif S in "G":
    ans += 1
  elif S in "T":
    ans += 1
  elif S in "C":
    ans += 1
  else:
    ans = 0
  m = max(m,ans)
print(m)

Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <cstring>
#include <vector>
#include <queue>
#include <iomanip>
#include <stack>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e14, cnt;

void sieve(ll n, bool prime[]){
	for(ll i=1; i<=n; i++){
		prime[i]=true;
	}
	prime[1]=false;
	for(ll i=2; i*i<=n; i++){
		if(prime[i]){
			for(ll j=i*i; j<=n; j+=i){
				prime[j]=false;
			}
		}
	}
}


ll expo(ll n,ll p){
	ll exp=0;
	ll x=p;
	while((n/x)>0){
		exp+=n/x;
		x*=p;
	}
	return exp;
}


ll check(ll n){
	bool prime[n+1];
	sieve(n,prime);
	ll ans=1;
	for(ll i=1; i<=n; i++){
		if(prime[i]==true){
			ans*= (expo(n,i)+1)%1000000007;
			ans%=1000000007;
		}
	}
	return ans;
}

int main(){
	ll n;
	cin>>n;
	cout<<check(n);
}

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);cout<<"\n";};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value!=0>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v<T>(e,v...);}
//FUNCTION

void solve(void)
{ 
  int N;
  cin>>N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  map<int,int> mp;
  int COUNT = 0;
  for (int i = 0; i < N; i++)
  {
    if(vec[i] <3200)
    mp[vec[i]/400]++;
    else
    COUNT++;
  }
  int ANS = mp.size();
  int ANS_MAX,ANS_MIN;
  ANS_MAX = min(ANS+COUNT,INF);
  ANS_MIN = max(ANS,1LL);
  
  cout<<ANS_MIN<<" "<<ANS_MAX<<endl;
  
  
  return;
}
  
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


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

main(){
  int a, b;
  char op;
  cin >> a;
  while(1){
    cin >> op;
    if ( op == '=' ) break;
    cin >> b;
    if ( op == '+' ) a += b;
    else if ( op == '*' ) a *= b;
    else if ( op == '-' ) a -= b;
    else if ( op == '/' ) a /= b;
  }
  cout << a << endl;
}

Measured memory_bytes: 1160
n = int(input())
d = {}
ans = 0

for i in range(n):
    s = ''.join(sorted(input()))
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1
#print(d)
for k, v in d.items():
  #vC2の組み合わせ
  ans += v * (v - 1) / 2

print(int(ans))



Measured memory_bytes: 17852
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[100],b[100];
	int i,an,bn,n;
	i=1;
	while(a[i-1]!='\n')
	{
		scanf("%c",&a[i]);
		i++;
	}
	an=i-1;
	i=1;
	while(b[i-1]!='\n')
	{
		scanf("%c",&b[i]);
		i++;
	}
	bn=i-1;
	for (i=1;i<=bn;i++)
		cout<<a[i]<<b[i];
	if (an>bn) cout<<a[an];
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100010],num,sum,ans[100010],last;
int main(){
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a[i];
		num+=a[i];
	}
	for (int i=0;i<n-1;i+=2) sum+=a[i];
	ans[n-1]=num-sum*2;last=(num-sum*2)/2;
	for (int i=n-2;i>=0;i--){
		ans[i]=(a[i]-last)*2;
		last=a[i]-last;
	}
	for (int i=0;i<n;i++) cout<<ans[i]<<' ';
	return 0;
}

Measured memory_bytes: 2048
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <type_traits>

#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
double ruijo(double x, int n) {
    double res = 1;
    rep(i, 0, n) { res *= x; }
    return res;
}
int intruijo(int x, int n) {
    int res = 1;
    rep(i, 0, n) { res *= x; }
    return res;
}
int main() {
    int N, K;
    cin >> N >> K;
    double res = 0;
    double n1 = 1 / (double)N;
    int r = 1;
    for(int i = N; i > 0; i--) {
        // cout << "i:" << i << endl;
        if(i >= K) {
            res += n1;
            // cout << n1 << endl;
            continue;
        }

        while(i *intruijo(2, r) < K) {

            r++;
        }
        res += n1 * ruijo(0.5, r);
        // cout << "r:"<<r<<"res:"<< n1 * ruijo(0.5, r) << endl;
    }
    // cout << res<< endl;
    printf("%.13f\n", res);

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,k=0;
	scanf("%d%d%d",&a,&b,&c);
	if(a>b)
	{
		k=a;a=b;b=k;
	}
	if(b>c)
	{
		k=b;b=c;c=k;
	}
	if(a>b)
	{
		k=a;a=b;b=k;
	}
	k=a+b;
	printf("%d",k);
}

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


int main()
{
	char A[5] = { 'a','e', 'o', 'i', 'u' };
	char op;
	int B=0;
	cin >> op;
	for (int i = 0; i < 5; i++) {
		if (op == A[i]) {
			B = 1;
		}
}
	if (B == 1) {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;

	}
	return 0;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    i32 N;
    cin >> N;
    string S;
    cin >> S;
    if (S.size() % 2 == 1) {
        cout << "No" << endl;
        return;
    }
    string a = S.substr(0, S.size() / 2);
    string b = S.substr(S.size() / 2, S.size() / 2);
    if (a == b) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

namespace ABC
{
    class ProgramB
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var a = long.Parse(inputs[0]);
            var b = long.Parse(inputs[1]);
            var k = long.Parse(inputs[2]);
            var result = a - 1;

            for (var i = a; i < a + k; i++)
            {
                if (result < i && i <= b)
                {
                    Console.WriteLine(i);
                    result = i;
                }
            }

            for (var i = b - k + 1; i <= b; i++)
            {
                if (result < i)
                {
                    Console.WriteLine(i);
                    result = i;
                }
            }
        }
    }
}


Measured memory_bytes: 27488
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto X = RD;
	auto N = RD;
	auto P = RDA;

	bool[long] set;
	foreach (i; 0..N)
	{
		set[P[i]] = true;
	}

	long ans;
	foreach (i; 0..10^^7)
	{
		auto x1 = X - i;
		if (set.get(x1, false) == false)
		{
			ans = x1;
			break;
		}
		auto x2 = X + i;
		if (set.get(x2, false) == false)
		{
			ans = x2;
			break;
		}
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 2752
#include <bits/stdc++.h>
#define int long long
#define inf 1e9+7
#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;

int n,m;
bool b[364364],c[364364];
signed main(){
	cin>>n>>m;
	rep(i,m){
		int p,q;cin>>p>>q;
		if(p==1)b[q]=true;
		if(q==n)c[p]=true;
	}
	for(int i=1;i<n;i++){
		if(b[i]&&c[i]){
			cout<<"POSSIBLE"<<endl;
			return 0;
		}
	}
	cout<<"IMPOSSIBLE"<<endl;
}


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

#define rep(i,z) for(int i = 0; i<(int)(z); i++)
#define rep1(i,z) for(int i = 1; i<=(int)(z); i++)
 
using namespace std;

typedef long long ll;
const ll MOD=1e9+7;
using pear = pair<int,int>;

int main(){
double d,t,s;
cin>>d>>t>>s;
  if(d/s>t)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 3724
//
//  main.cpp
//
// https://atcoder.jp/contests/abc131/tasks/abc131_f

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

struct UnionFind {
    vector<size_t> parent;
    vector<size_t> rank;
    size_t find_parent(size_t x) {
        if (parent[x] == x) {
            return x;
        } else {
            parent[x] = find_parent(parent[x]);
            return parent[x];
        }
    }
    explicit UnionFind(size_t size) {
        parent.resize(size);
        rank.resize(size);
        for (size_t i = 0; i < size; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }
    virtual ~UnionFind() {}
    void unite(size_t x, size_t y) {
        size_t px = find_parent(x);
        size_t py = find_parent(y);
        if (px == py) {
            return;
        }
        if (rank[px] < rank[py]) {
            parent[px] = py;
        } else if (rank[px] > rank[py]) {
            parent[py] = px;
        } else { // rank[px] == rank[py]
            parent[py] = px;
            rank[px]++;
        }
    }
    bool is_same(size_t x, size_t y) {
        return find_parent(x) == find_parent(y);
    }
};

int main(int argc, char* argv[]) {
    int N;
    cin >> N;
    UnionFind tree(N);
    vector<pair<int, int>> pts;
    map<int, int> x_to_idx;
    map<int, int> y_to_idx;
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        pts.push_back(make_pair(x, y));
        if (x_to_idx.find(x) != x_to_idx.end()) {
            tree.unite(i, x_to_idx[x]);
        } else {
            x_to_idx[x] = i;
        }
        if (y_to_idx.find(y) != y_to_idx.end()) {
            tree.unite(i, y_to_idx[y]);
        } else {
            y_to_idx[y] = i;
        }
    }
    unordered_map<int, set<int>> parent_idx_to_groups;
    for (int i = 0; i < N; i++) {
        int parent = (int)tree.find_parent(i);
        if (parent_idx_to_groups.find(parent) == parent_idx_to_groups.end()) {
            parent_idx_to_groups[parent] = set<int>{i};
        } else {
            parent_idx_to_groups[parent].insert(i);
        }
    }
    ll count = 0;
    for (const pair<int, set<int>>& parent_group : parent_idx_to_groups) {
        const set<int>& group = parent_group.second;
        set<int> x_coords;
        set<int> y_coords;
        for (int idx : group) {
            x_coords.insert(pts[idx].first);
            y_coords.insert(pts[idx].second);
        }
        count += x_coords.size() * y_coords.size();
    }
    cout << count - pts.size() << endl;
}



Measured memory_bytes: 21364
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mp make_pair
#define mm(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define fto(k,m) for(auto k:m)
#define in_edges(m) repp(i, 1, m){ ll a, b; cin >> a >> b; adj[a].pb(b), adj[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define MOD 1000000007
#define sz(a) ll((a).size())
#define pii 3.1415926535897
#define ld long double
#define print(a,n) rep(i,0,n)cout <<a[i] <<" ";
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// stoll(s);
int main()
{
   BRAHAMASTRA
   ll t; t=1;
   // cin >>t;
   while(t--)
   {
       ll n; cin >>n;
       ll cnt  =  0;
       rep(i,1,n+1)
       {
          ll a; cin >>a;
          if(a%2==1 and i%2==1)cnt++;
       }
       cout<<cnt<<endl;
   }
}


Measured memory_bytes: 3616
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// conversion
#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) (INT((x).size()))
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1<<25;
// const ll INF = 1LL<<50;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define yes(c) cout << ((c) ? "yes" : "no") << endl;

#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


// --------------------------------------------------------

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

  string s;
  cin >> s;

  int ans = 0;
  REP(i, SZ(s)) {
    if (i % 2 == 0) {
      if (s[i] == 'p') {
        ans--;
      }
    } else {
      if (s[i] == 'g') {
        ans++;
      }
    }
  }

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

Measured memory_bytes: 640
#include <stdio.h>

int main() {
	int r, d, x, prex, nowx;
	scanf("%d%d%d", &r, &d, &x);
	prex = x;
	for (int i = 2001; i < 2011; i++) {
		nowx = r * prex - d;
		printf("%d\n", nowx);
		prex = nowx;
	}
		
	return 0;
}

Measured memory_bytes: 128
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define RE rend()
#define RB rbegin()
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007

const int N= 2e5 +7;
m(int,bool) vis;
v(int) g[N];
v(int) loop;
int n,x,y;
ll k;
int id=-1;


void DFS(int node)
{
	vis[node]=true;
	loop.pub(node);
	int tmp= g[node][0];
	if(!vis[tmp])
	{
		DFS(tmp);
	}
	else
	{
		if(tmp==1);
		else
		{
			id= find(all(loop),tmp)- loop.B;	
		}	
	}	
}


void Solve()
{
	cin>>n>>k;
	f(i,1,n)
	{
		cin>>x;
		g[i].pub(x);
	}
	
	DFS(1);
	
	if(id==-1)
	{
		int tx= k% loop.sz;
		cout<< loop[tx];	
	}
	else
	{
		if(k<=id)
		{
			cout<< loop[k];
		}
		else
		{
			int zex= loop.sz-id;
			k -= id;
			k= k% zex;
			cout<< loop[id+k] ;
		}
	}
	
}

signed main() 
{
	speed		
	
	int q=1;
	//cin>>q;
	
	while(q--)
	Solve();
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

 
 

Measured memory_bytes: 36468
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int sum(int ab){
    int res = 0;
    while(ab){
        res += ab%10;
        ab /= 10;
    }
    return res;
}

int main()
{
    int n;
    cin >> n;
    int ans = INF;
    for(int a = 1; a < n; a++){
        int b = n-a;
        ans = min(ans,sum(a)+sum(b));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    string c;cin>>c;
    int rcnt = 0;
    rep(i,n){
        if(c[i]=='R')rcnt++;   
    }
    int ans = 0;
    rep(i,rcnt){
        if(c[i]=='W')ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3772
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

ll A[200000];

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

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

	ll ans = 0;
	ll t = A[0];

	for (int i=1; i<N; i++) {
		if (A[i] < t) {
			ans += t - A[i];
		} else {
			t = A[i];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5180
////*24-AUG-19*///
//Why do we fall?//
// So we can learn to pick ourself up!//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n) {fr(j, 1, m) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
const int inf = 1e18;
const int mod=1e9+7;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
bool isPrime(int n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
    }
//z function -  z[i] is the length of the longest common prefix between s and the suffix of s starting at i
vector<int>z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}
int lis( int arr[], int n )
{
    int lis[n];

    lis[1] = 1;

    /* Compute optimized LIS values in bottom up manner */
    for (int i = 2; i <= n; i++ )
    {
        lis[i] = 1;
        for (int j = 1; j < i; j++ )
            if ( arr[i] >=arr[j] && lis[i] < lis[j] + 1)
                lis[i] = lis[j] + 1;
    }

    // Return maximum value in lis[]
    return *max_element(lis+1, lis+n+1);
}
signed main()
{
  string s,t;
  cin>>s>>t;
  int ans=0;
  fr(i,0,3)
  {
      if(s[i]==t[i])
      {
          ans+=1;
      }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


x = int(input())

if x == 2:
    print(x)
    exit()

if x % 2 == 0:
    x += 1

while not is_prime(x):
    x += 2

print(x)


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

int main(){
  int r,d;
  vector<int> x(11);
  cin>>r>>d>>x[0];

  for(int i=1; i<=10; i++){
    x[i] = r*x[i-1]-d;
    cout<<x[i]<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define se second
#define pb push_back
#define pf push_front
#define eb emplace_back
#define emp emplace
#define ins insert
#define sz(s) (int)s.size()
#define rep(i,a,b) for( int i=a;i<b;i++)
#define repr(i,a,b) for( int i=a;i>=b;i--)
#define bitcount __builtin_popcount
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(n,m) memset(n,m,sizeof(n))
#define ii pair<int,int>
#define iii tuple<int, int, int>
#define si set<int>
#define vi vector<int>
#define vii vector<ii>
#define mi map<int,int>
#define lb lower_bound
#define ub upper_bound
#define present(s,x) (s.find(x) != s.end())
#define ford(container, it) for(auto it:container)
#define fors(container, it, a, b) for(auto it = a; it != b; it++)
#define Raag4924 ios_base::sync_with_stdio(0);
#define fastio cin.tie(0);cout.tie(0);
#define mod 987654319
#define EPSILON 1e-9
#define PI acos(-1)
#define inf 1e17
#define int long long
#define debug(a) cerr<<#a<<": ";for(auto i:a)cerr<<i<<" ";cerr<<'\n';
#define trace(a) cerr<<#a<<": "<<a<<"\n"
#define gcd(a,b) __gcd(a,b)
using namespace std;
int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
int mul(int a, int b, int c){int res=(int)a*b;return(res>=c?res%c:res);}
template<typename T>T power(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
template<typename T>T mdpower(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
/*------------------------------------------------------------------------------------------------------------------*/
int dp[101][100005];
int32_t main()
{
    Raag4924
    fastio
 
    

    int n,W;
    cin>>n>>W;
    int weight[n+1],values[n+1];
    for(int i=1;i<=n;i++)
    cin>>weight[i]>>values[i];
    memset(dp,0,sizeof dp);
    dp[0][0] =0;
    
    for(int i=1;i<=n;i++)
    {
        for(int j= 1;j<=W;j++)
        {
            if(weight[i]<=j)
            {
                dp[i][j] = max(dp[i-1][j],values[i]+dp[i-1][j-weight[i]]); 
            }
            else dp[i][j] = dp[i-1][j];
        }
    }

    cout<<dp[n][W]<<"\n";
    


    
  
 
 






 
#ifndef LOCAL_DEFINE
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}


Measured memory_bytes: 79232
#include <cstdio>
#include <cmath>

using namespace std;

long long A, B;
int b1, b2;
long long ans;

int main() {
    scanf("%lld%d.%d", &A, &b1, &b2);
    B = b1 * 100 + b2;
    ans = (long long) (A * B) / 100;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication76
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
 			int b = int.Parse(Console.ReadLine());
 			Console.WriteLine(a*a-b);
        }
    }
}



Measured memory_bytes: 11220
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    auto H = readln.chomp.to!int;
    auto W = readln.chomp.to!int;

    writeln((N - W + 1) * (N - H + 1));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    a--; b--; c--; d--;
    if (c < d) {
        for (int i = a; i < d; ++i) {
            if (s[i] == s[i+1] && s[i] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    } else {
        for (int i = a; i < c; ++i) {
            if (s[i] == s[i+1] && s[i] == '#') {
                cout << "No" << endl;
                return 0;
            }
        }
        for (int i = b; i <= d; ++i) {
            if (s[i-1] == '.' && s[i] == '.' && s[i+1] == '.') break;
            if (i == d) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3772
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	string W;
	cin >> W;	

	int N = W.size();
	if (N % 2 == 1) {
		cout << "No" << endl;
		return 0;
	}

	map<char, int> h;
	for (char c = 'a'; c <= 'z'; ++c) {
		h[c] = 0;
	}

	FOR(i, 0, N) {
		h[W[i]]++;
	}

	string ans = "Yes";
	for (char c = 'a'; c <= 'z'; ++c) {
		if (h[c] % 2 == 1) {
			ans = "No";
			break;
		}
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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_MAX	2,147,483,647 = 2*1.0e9

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

  vector<int> a(N+1);
  for(int i = 1; i < N+1; i++)cin >> a[i];

  vector<int> b(N+1, 0);
  vector<bool> ans(N+1, false);
  int M = 0;
  for(int i = N; i >= 1; i--){
    if(b[i] == a[i]) continue;
    ans[i] = true;
    M++;
    for(int j = 1; j * j <= i; j++){
      if(i%j == 0){
        b[j] ^= 1;
        if(j * j != i) b[i/j] ^= 1;
      }
    }
  }

  cout << M << endl;
  for(int i = 1; i < N+1; i++){
    if(ans[i]) cout << i << " ";
  }
  cout << endl;

  return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
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 ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int N, M, r; cin >> N >> M >> r;
    vector<vector<pair<int, int>>> G(N);
    for (int i = 0; i < M; i++) {
        int a, b, d; cin >> a >> b >> d;
        G[a].push_back(make_pair(b, d));
    }

    //始点0からの距離d[v] / 到達した頂点を記録するchecked[v]
    //次に到達する候補の中からコストd[v]が小さい順に取り出すpq
    vector<int> d(N, MAX);
    vector<bool> checked(N, false);
    priority_queue<pair<int, int>> pq;
    d[r] = 0;
    pq.push(make_pair(0, r));

    while (!pq.empty()) {
        auto p = pq.top();
        pq.pop();
        int v = p.second;
        
        //取り出した経路が最短でない場合
        if (d[v] < p.first * (-1)) continue;
        
        checked[v] = true;

        //vに隣接している未到達の頂点の最短経路を更新し、もし更新したらpqに入れる
        for (auto np : G[v]) {
            int nv = np.first;
            if (checked[nv]) continue;

            if (chmin(d[nv], d[v] + np.second)) pq.push(make_pair(d[nv] * (-1), nv));
        }
    }

    for (int i = 0; i < N; i++) {
        if (d[i] == MAX) {
            cout << "INF" << endl;
        } else {
            cout << d[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 12916
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = INT()
left = N % 500
if left <= A:
	print("Yes")
else:
	print("No")


Measured memory_bytes: 5400
#include <iostream>
#include <sstream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>
#include <list>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
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; }

using namespace std;

int main(void)
{
	int S, W; cin >> S >> W;
	if (W >= S)cout << "unsafe" << endl;
	else cout << "safe" << endl;


	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int r; cin >> r;
    cout << 3 * r * r << endl;
}

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

N = int(input())
C = [()]*N
X = [0]*N
Y = [0]*N
for i in range(N):
    x, y = inpl()
    if x > y:
        x, y = y, x
    X[i] = x
    Y[i] = y
    C[i] = (x,y)
minx, maxx, miny, maxy = min(X), max(X), min(Y), max(Y)
ans = (maxy - miny)*(maxx - minx)
ix = X.index(minx)
iy = Y.index(maxy)
l, r = X[iy], Y[ix]
if r < l:
    l, r = r, l
H = []
for x, y in C:
    if y <= l:
        l = y
        continue
    if x >= r:
        r = x
        continue
    H.append((x,y))
Candi = []
for x, y in H:
    if l <= x <= r or l <= y <= r:
        continue
    Candi.append((x,y))
Candi.sort()
for x, y in Candi:
    ans = min(ans, (maxy - minx)*(r - x))
    r = max(r, y)
ans = min(ans, (maxy - minx)*(r - l))
print(ans)

Measured memory_bytes: 47492
n = int(input())
s_list = [list(map(int, input().split())) for i in range(n)]
ans = "Yes"
for s in s_list:
    if s[0] < s[1] + s[2]:
        ans = "No"
        break
    elif s[0] % 2 == 0 and (s[1] + s[2]) % 2 == 1:
        ans = "No"
        break
    elif s[0] % 2 == 1 and (s[1] + s[2]) % 2 == 0:
        ans = "No"
        break
print(ans)


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

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

    const int mod = 1e+9 + 7;

    long long res = 0;
    for (int i = 0; i < 60; i++) {
        long long x0 = 0;
        long long x1 = 0;

        for (int j = 0; j < N; j++) {
            int x = (A[j] >> i) & 1;
            if (x == 0) x0 += 1;
            else x1 += 1;
        }

        long long tmp = (1ll << i) % mod;
        long long x = x0 * x1 % mod;
        tmp = tmp * x % mod;
        res = (res + tmp) % mod;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef  long long  ll;
#define  re   register
int main()
{
	ll a, b;
	cin >> a >> b;
	int sum = b - a + 1;
	if(a > 0) {
		cout << "Positive" << endl;
		return 0;
	}
	if(a < 0 && b < 0 && (sum % 2 == 1)) {
		cout << "Negative" << endl;
		return 0;
	}
	if(a <= 0 && b >= 0) {
		cout << "Zero" << endl;
		return 0;
	}
	{
		cout << "Positive" << endl;
		return 0;
	}
}



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

using namespace std;
int main(){
 long long n;
  cin>>n;
  vector<long long>moji(n);
  for(long long i=0;i<n;i++) cin>>moji.at(i);
  long long counter=0;
  for(long long i=1;i<=n-1;i++){
  	if(moji.at(i-1)<=moji.at(i)){
       counter+=0;
  }
    else {
    	counter+=moji.at(i-1)-moji.at(i);
      moji.at(i)=moji.at(i-1);
    }
  }
  cout<<counter<<endl;
 }



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


int main() {
	string s, t;
	cin >> s >> t;
	string ans = t+s;
	printf("%s\n",ans.c_str());
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <map>
#include <utility>
using namespace std;

int N, K, L;
int par[200001*2];

void init(int n) {
    for (int i = 0; i <= n*2; i++) par[i] = i;
}

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

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    par[x] = y;
}

int main() {
    int a, b;
    scanf("%d %d %d", &N, &K, &L);
    init(N);

    for (int i = 0; i < K; i++) {
        scanf("%d %d", &a, &b);
        unite(a, b);
    }
    for (int i = 0; i < L; i++) {
        scanf("%d %d", &a, &b);
        unite(a+N, b+N);
    }

    map<pair<int, int>, int> M;
    for (int i = 1; i <= N; i++) {
        auto key = make_pair(root(i), root(i+N));
        M[key]++;
    }
    for (int i = 1; i <= N; i++) {
        auto key = make_pair(root(i), root(i+N));
        printf("%d\n", M[key]);
    }
}


Measured memory_bytes: 13568
#include<bits/stdc++.h>
#include<stack>
using namespace std;
int main()
{
	char s[200010];
	scanf("%s",&s);
	int x=strlen(s);
	stack<int> a;
	for(int i=0;i<x;i++)
	{
		if(a.empty())
		{
			if(s[i]=='S')
			a.push(0);
			else
			a.push(1);
			continue;
		}
		if(a.top()==0&&s[i]=='T')
		a.pop();
		else{
			if(s[i]=='S')
			a.push(0);
			else
			a.push(1);
		}
		
	}
	cout << a.size() << endl;
}

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

int main() {
	int  Z;
	long X, Y;

	cin >> X;

	Y = 100;
	Z = 0;
	
	if(X>1001009377){
		Y=1001009377;
		Z=1677;
	}
	while(Y<X){
		Y = Y*1.01;
		Z++;
	}
	
	cout << Z << endl;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#define N 100010
using namespace std;
int main()
{
    char x[N];
    int sum1=1,sum2=0,total=0;
    scanf("%s",&x);
    if(x[0]=='p')
    {
        total--;
    }
    for(int i=1;x[i]!='\0';i++)
    {
        if(x[i]=='p')
        {
            if(sum1>sum2)
            {
                sum2++;
            }
            else
            {
                total--;
                sum1++;
            }
        }
        if(x[i]=='g')
        {
            if(sum1>sum2)
            {
                sum2++;
                total++;
            }
            else
            {
                sum1++;
            }
        }
    }
    printf("%d",total);
    return 0;
}


Measured memory_bytes: 256