akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
template <class T>
T GCD(T a, T b)
{
    T r;
    while (a)
        r = b, b = a, a = r % a;
    return b;
}
template <class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repd(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<ll> vl;
#define ERASE(x) x.erase(unique(ALL(x)), x.end()); // erase same elements
#define VEC(type, c, n)     \
    std::vector<type> c(n); \
    for (auto &i : c)       \
        std::cin >> i;

// input
#define INIT                          \
    std::ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define VAR(type, ...) \
    type __VA_ARGS__;  \
    MACRO_VAR_Scan(__VA_ARGS__);
template <typename T>
void MACRO_VAR_Scan(T &t)
{
    std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &... rest)
{
    std::cin >> first;
    MACRO_VAR_Scan(rest...);
}

// output
template <typename T>
void MACRO_OUT(const T t) { std::cout << t; }

#define OUT(...) MACRO_OUT(__VA_ARGS__);
#define SP std::cout << " ";
#define TAB std::cout << "\t";
#define BR std::cout << "\n";
#define ENDL std::cout << std::endl;

#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define yes() printf("yes\n")
#define no() printf("no\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
    cout << a;
    ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
    cout << a << ' ';
}

ll ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b, c, d, n;
int x, y;
int sum;
char ch;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// cout << (conditon ? (result:  == 1 ): (==0)) << endl; <- output result of if
// long long 型が表せる値の上限はおよそ 9 × 10＾18 です．
int main()
{
    INIT;
    cin >> n;
    rep(i,n){
        cin>> a >> b;
         ans +=(b-a+1);
    }
    pr(ans);
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
i64 inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int n, k;
vector<int> deq;

//inputします
void input() {
	cin >> n >> k;
	deq.resize(n);
	ff(i, 0, n) {
		cin >> deq[i];
	}
}

//ライブラリ置き場



//main
int main() {
    input();
	i64 ans = -giant;
	ff(i, 0, n+1) {
		ff(j, 0, n - i+1) {
			int rem = k - i - j;
			if (rem < 0)break;
			vector<int> took;
			i64 sum = 0;
			ff(x, 0, i) {
				took.push_back(deq[x]);
				sum += deq[x];
			}
			ff(x, 0, j) {
				took.push_back(deq[n - 1 - x]);
				sum += deq[n - 1 - x];
			}
			ff(x, 0, took.size()) {
				//cout << took[x] << " ";
			}
			//cout << endl;
			srt(took);
			int siz = took.size();
			ff(x, 0, min(rem,siz)) {
				if (took[x] > 0)break;
				//cout << took[x] << " ";
				sum -= took[x];
			}
			//cout <<endl<< "sum is " << sum << endl;
			ans = max(ans, sum);
			//cout << "current biggest sum is " << ans << endl << endl;
		}
	}
	cout << ans << endl;
	return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
int flag;

Node treeMinimum(Node x){
  while(x->left != NIL) x = x->left;
  return x;
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL) return treeMinimum(x->right);
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  if(y->left != NIL) x = y->left;
  else x = y->right;
  if(x != NIL) x->parent = y->parent;
  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if(y != z){
    z->key = y->key;
    x = y;
  }
}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right, k);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u->left != NIL) inorder(u->left);
  printf(" %d", u->key);
  if(u->right != NIL) inorder(u->right);
}

void preorder(Node u){
  printf(" %d", u->key);
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  root = NIL;


  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}

Measured memory_bytes: 19364
n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(n):
  if a[i] % 2 == 1:
    x += 1
  elif a[i] % 4 == 0:
    z += 1
  elif a[i] % 2 == 0:
    y += 1

if x == 0:
  ans = 'Yes'
elif y == 0:
  if x <= z + 1:
    ans = 'Yes'
  else:
    ans = 'No'
else:
  if x > z:
    ans = 'No'
  else:
    ans = 'Yes'
print(ans)

Measured memory_bytes: 19940
#include<stdio.h>
#define M 1000

main(){
  int n,a[M],i,j,v;

    scanf("%d",&n);
      
  for( i=0 ; i<n ; i++ ) 
    scanf("%d",&a[i]);
   
   for( i=1 ; i<=n ; i++ ){
    for( j=0 ; j<n ; j++ ){
      printf("%d",a[j]);
      if(a[j+1] != '\0')
	printf(" ");
      else printf("\n");
    }
    v = a[i];
    j = i-1;
    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;
      a[j+1] = v;
    }
    }
  return 0;
}
  

Measured memory_bytes: 608
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    
    string s,t,u;
    ll a,b;

    cin >> s >> t >> a >> b >> u;

    if(s == u){
        a--;
    } else {
        b--;
    }
    cout << a << " " << b;
    
    return 0;
}

Measured memory_bytes: 3152
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	uint[] GU => Strs.Select(uint.Parse).ToArray();
	decimal[] GD => Strs.Select(decimal.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	static T[] ConstantArray<T>(int n, T val) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = val; return a; }
	static T[] MakeArray<T>(int n, Func<int, T> f) { var a = new T[n]; for (var i = 0; i < n; i++) a[i] = f(i); return a; }
	static ulong One(int k) => 1ul << k;
	static ulong All(int k) => One(k) - 1;
	static bool Has(ulong s, int k) => (s & One(k)) != 0;
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var A = G;
		var M = A.Select(x => Abs(x)).Max();
		var dp = new long[N + 1, 2];
		dp[0, 1] = -(M + 2) * (N + 2L);
		for (var i = 0; i < N; i++) for (var k = 0; k < 2; k++) dp[i + 1, k] = Max(dp[i, k] + A[i], dp[i, 1 - k] - A[i]);
		WriteLine(dp[N, 0]);
	}
}


Measured memory_bytes: 33500
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
static const int MAX = 100000;
vector<int> G[MAX];
int N, timer;
bool visited[MAX];
int prenum[MAX], parent[MAX], lowest[MAX];

void dfs(int current, int prev)
{
    prenum[current] = lowest[current] = timer;
    timer++;

    visited[current] = true;

    for (int i = 0; i != G[current].size(); ++i)
    {
        int next = G[current][i];

        if ( !visited[next] )
        {
            parent[next] = current;

            dfs(next, current);

            lowest[current] = min(lowest[current], lowest[next]);
        }
        else if (next != prev)
        {
            lowest[current] = min(lowest[current], prenum[next]);
        }
    }
}

void art_points()
{
    for (int i = 0; i != N; ++i)
    {
        visited[i] = false;
    }
    timer = 1;

    dfs(0, -1);

    set<int> ap;
    int np = 0;
    for (int i = 1; i != N; ++i)
    {
        int p = parent[i];
        if (p == 0) ++np;
        else if (prenum[p] <= lowest[i]) ap.insert(p);
    }
    if (np > 1) ap.insert(0);
    for (set<int>::iterator it = ap.begin(); it != ap.end(); ++it)
    {
        cout << *it << endl;
    }
}

int main()
{
    int m, s, t;
    cin >> N >> m;
    for (int i = 0; i != m; ++i)
    {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    art_points();
    return 0;
}


Measured memory_bytes: 6800
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  as <- readInts
  print $ h as

-- https://atcoder.jp/contests/arc096/submissions/2397049
h :: [Int] -> Int
h as@[a,b,c,x,y]
  = minimum [bAB, bC, bAC, bBC]
  where
    bAB = a*x + b*y
    bC  = 2*c*(max x y)
    bAC = 2*c*x + b*(max 0 (y-x))
    bBC = a*(max 0 (x-y)) + 2*c*y


Measured memory_bytes: 380
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n,k;
    string s;cin>>n>>s>>k;
    char c=s[k-1];
    for(int i=0;i<n;i++){
        if(s[i]!=c)s[i]='*';
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <vector>

using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
int GCD (int a, int b) { return b ? GCD(b, a % b) : a; }

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

    if (s.length() == 1) {
        cout << 0 << endl;
        return 0;
    }

    // 010...パターン集計
    int cnt1 = 0;
    for (int i = 0; i < s.length(); i++) {
        if (i % 2 == 0) {
            if (s[i] == '0') {
                cnt1++;
            }
        } else {
            if (s[i] == '1') {
                cnt1++;
            }
        }
    }
    // 101..パターン集計
    int cnt2 = 0;
    for (int i = 0; i < s.length(); i++) {
        if (i % 2 == 0) {
            if (s[i] == '1') {
                cnt2++;
            }
        } else {
            if (s[i] == '0') {
                cnt2++;
            }
        }
    }
    // 比較
    if (cnt1 < cnt2) {
        cout << cnt1 << endl;
        return 0;
    } else {
        cout << cnt2 << endl;
        return 0;
    }
}


Measured memory_bytes: 512
input_line= int(input())

if input_line <= 81:
    if (input_line / 9) % 1 == 0 and (input_line / 9) <= 9:
        print ('Yes')
    elif (input_line / 8) % 1 == 0  and (input_line / 8) <= 9:
        print ('Yes')
    elif (input_line / 7) % 1 == 0 and (input_line / 7) <= 9:
        print ('Yes')
    elif (input_line / 6) % 1 == 0 and (input_line / 6) <= 9:
        print ('Yes')
    elif (input_line / 5) % 1 == 0 and (input_line / 5) <= 9:
        print ('Yes')
    elif (input_line / 4) % 1 == 0 and (input_line / 4) <= 9:
        print ('Yes')
    elif (input_line / 3) % 1 == 0 and (input_line / 3) <= 9:
        print ('Yes')
    elif (input_line / 2) % 1 == 0 and (input_line / 2) <= 9:
        print ('yes')
    elif (input_line / 1) % 1 == 0 and (input_line / 1) <= 9:
        print ('Yes')
    else:
        print ('No')
else:
    print ('No')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" },
        StringSplitOptions.RemoveEmptyEntries);

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
    public static int Pow(int x, int e)
    {
        var r = 1;
        for (var i = 0; i < e; i++) r *= x;
        return r;
    }
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if DEBUG
        sw.AutoFlush = true;
#else
        sw.AutoFlush = false;
#endif
        SetOut(sw);
        Solve(new IO());
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var n = io.I;
        var a = io.Is(n);

        var ans = Pow(3, n) - Pow(2, a.Count(x => x % 2 == 0));
        io.Write(ans);
    }
}

Measured memory_bytes: 13524
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()	
	{
		int N = Int32.Parse(Console.ReadLine());
		Console.WriteLine(N % f(N) == 0 ? "Yes" : "No");
	}

	private static int f(int x)
	{
		int ans = 0;
		int tmp = x;
		while(tmp > 0)
		{
			ans += tmp % 10;
			tmp /= 10;
		}
		return ans;
	}
}





Measured memory_bytes: 13140
S = list(input())
len_s = len(S)
ans = 0
for num in range(2**(len_s-1)):
  temp = S[0]
  for i in range(len_s-1):
    if num>>i&1:
      ans += int(temp)
      temp = S[i+1]
    else:
      temp += S[i+1]
  ans += int(temp)
print(ans)

Measured memory_bytes: 3060
/*
.   Bismillahir Rahmanir Rahim
.   Author - Marajul islam
.   created- Sat Apr  4 17:53:35 2020

*/ 
#include<bits/stdc++.h>
using namespace std;


 
int sc1() {int x; scanf("%d", &x); return x;}
long long sc2() {long long x; scanf("%lld", &x); return x;}

const int mod= 1e9 + 7;
inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (long long)a * b % mod;}
 
#define F               first
#define S               second 
#define mp              make_pair
#define pb              push_back
#define pf              push_front
#define speed_up        ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x)           (int)x.size()
#define all(x)          x.begin(), x.end()
#define debug           cerr << "OK\n";
#define ub              upper_bound
#define lb              lower_bound
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define Int             sc1()
#define LL              sc2()
#define For(n)          for(int i=0;i<n;i++)
#define Forj(n)         for(int j=0;j<n;j++)
#define Fork(n)         for(int k=0;k<n;k++)
#define For1(n)         for(int i=1;i<=n;i++)

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef set <int>       si;
typedef set <ll>        sll;
typedef multiset <int>  msi;
typedef multiset <ll>   msll;
typedef map <int, int>  mi;
typedef map <ll, ll>    mll;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}
  
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 5e6 + 5;
 
 
 
int solve() {
 

 	ll n,k;
 	cin>>n>>k;
 	if(n>=k){
 		if(n%k==0){
 			cout<<0<<endl;
 		}
 		else{
 			ll ss=n%k;
 			cout<<min(ss,k-ss)<<endl;
 		}
 	}
 	else{
 		ll ss=n;
 		cout<<min(ss,k-ss)<<endl;
 	}
	return 0;
}
 
 
 
 
int main()
{
	//speed_up;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
 
	int test = 1, tc = 0;
	//scanf("%d", &test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
 
	return 0;
 
 
 
 
}




Measured memory_bytes: 256
d,g=map(int, input().split())
p=[list(map(int, input().split())) for i in range(d)]
x=[]
for i in range(2**d):
    t=0
    u=0
    v=[]
    for k in range(d):
        v.append(k)
    for j in range(d):
        if ((i>>j)&1):
            t+=p[j][0]*100*(j+1)+p[j][1]
            u+=p[j][0]
            v[j]=0
    if t>=g:
        x.append(u)
    else:
        for l in range(p[max(v)][0]):
            if t+(max(v)+1)* 100*l<g<=t+(max(v)+1)* 100*(l+1):
                x.append(u+l+1)
print(min(x))

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n), h(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> h[i];
    for (int posY = 0; posY <= 100; posY++) {
        for (int posX = 0; posX <= 100; posX++) {
            int needH = -1;
            for (int i = 0; i < n; i++) {
                if (h[i] > 0) {
                    int tmp = h[i] + abs(posY - y[i]) + abs(posX - x[i]);
                    if (needH == -1) needH = tmp;
                    else {
                        if (needH != tmp) {
                            needH = -2;
                            break;
                        }
                    }
                }
            }
            if (needH == -2) continue;
            for (int i = 0; i < n; i++) {
                if (h[i] == 0) {
                    int dist = abs(posY - y[i]) + abs(posX - x[i]);
                    if (needH > dist) {
                        needH = -2;
                        break;
                    }
                }
            }
            if (needH == -2) continue;
            cout << posX << " " << posY << " " << needH << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}
ll kai(vector<ll> A, ll key) {
	ll an = 0;
	rep(i, A.size()) {
		an += (A.at(i) - 1) / key;
	}
	return an;
}
// index が条件を満たすかどうか
bool isOK(int index,vector<ll> A, int K) {
	if (kai(A,index) <= K) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(ll MA,vector<ll> A,ll K) {
	int left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = MA; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, A,K)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
vector<ll> fact, factinv, inv;
ll mod = 1e9 + 7;
void prenCkModp(ll n) {
	fact.resize(n + 5);
	factinv.resize(n + 5);
	inv.resize(n + 5);
	fact.at(0) = fact.at(1) = 1;
	factinv.at(0) = factinv.at(1) = 1;
	inv.at(1) = 1;
	for (ll i = 2; i < n + 5; i++) {
		fact.at(i) = (fact.at(i - 1) * i) % mod;
		inv.at(i) = mod - (inv.at(mod % i) * (mod / i)) % mod;
		factinv.at(i) = (factinv.at(i - 1) * inv.at(i)) % mod;
	}

}
ll nCk(ll n, ll k) {
	if (n < 0 || k < 0){
		return 1;
	}
	else if (n < k) {
		return 0;
	}
	return fact.at(n) * (factinv.at(k) * factinv.at(n - k) % mod) % mod;
}

ll dp[100002];
void res() {
	for (ll n = 0; n < 102; n++) {
		for (ll v = 0; v < 100002; v++) {
			dp[n] = 1e12;
		}
	}
}
int main() {
	ll N, K;
	cin >> N >> K;

	vector<ll> h(N);
	rep(i, N) {
		cin >> h[i];
	}
	
	rep(i, 100001) {
		dp[i + 1] = 1e11;
	}
	dp[1] = 0;

	for(ll i=2;i<=N;i++){
		for (ll k = 1; k <= K; k++) {
			if (i - k > 0) {
				dp[i] = min(dp[i], dp[i - k] + abs(h[i - 1] - h[i - k - 1]));
				
			}
			
		}
	}
	cout << dp[N] << endl;
}


Measured memory_bytes: 4804
n = int(input())
h = list(map(int, input().split()))

dp = [0] * n
dp[0] = 0
ans = 0
for i in range(1, n):
    if h[i - 1] >= h[i]:
        if dp[i - 1] == 0:
            dp[i] = 1
        else:
            dp[i] = dp[i - 1] + 1
        ans = max(dp[i], ans)
print(ans)


Measured memory_bytes: 14224
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <string.h>

using namespace std;
#define ll long long int

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

	ll n;
	cin>>n;
	if(n>=30){
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;

	return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
int main()
{
    double L[10];
    double V1, V2;
    double meet_pos;
    double railway_lenth;
    int cnt1, cnt2;
    int output[50];
    
    cnt2 = 0;
    while(scanf("%lf,", &L[0]) != EOF){
    	for(cnt1 = 1; cnt1 < 10; cnt1++)
			scanf("%lf,", &L[cnt1]);
		scanf("%lf,%lf", &V1, &V2);
    	
    	railway_lenth = 0;
    	for(cnt1 = 0; cnt1 < 10; cnt1++)
			railway_lenth += L[cnt1];
    	meet_pos = railway_lenth * V1 / (V1 + V2);
    	
    	cnt1 = 0;
    	railway_lenth = 0;
    	while(railway_lenth < meet_pos)
			railway_lenth += L[cnt1++];
    	output[cnt2] = cnt1;
    	cnt2++;
    }
    
    for(cnt1 = 0; cnt1 < cnt2; cnt1++)
    {
		printf("%d\n", output[cnt1]);
	}
	
    return 0;
} 

Measured memory_bytes: 620
N, M = map(int, input().split())
H = list(map(int, input().split()))
L = [0]*N
for i in range(N):
    L[i] = [1]
for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] > H[B-1]:
        L[B-1].append(0)
    elif H[A-1] < H[B-1]:
        L[A-1].append(0)
    else:
        L[A-1].append(0)
        L[B-1].append(0)
dame = 0
for i in range(N):
    if 0 in L[i]:
        dame = dame + 1
    else:
        continue
kaito = N - dame
print(kaito)

Measured memory_bytes: 24496
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll A;
    long double B;
    cin >> A >> B;

    A *= B;

    cout << A << endl;
    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
main(){for(char s[50],i,j,p,q;p=atoi(gets(s));printf("%d\n",i)){for(i=0;i<p;s[i++]=strlen(gets(s+i)));for(i=j=0;j<7;)for(p=i++,j=q=1;q>0;)for(q=j++>5?0:j-2&&j-4?8:6;q>1;q-=s[p++]);}}

Measured memory_bytes: 1128
#include <stdio.h>

int main(){
	int i, j, n, m, bunbo, check, sum=0, dummy;
	scanf("%d %d",&n,&m);
	int a[n];
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	for(i=0;i<n;i++) sum+=a[i];
	bunbo = 4*m;
	check = sum/bunbo;
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(a[i]<a[j]) {
				dummy = a[i];
				a[i] = a[j];
				a[j] = dummy;
			}
		}
	}
	
	
	
	if(4*m*a[m-1]<sum) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

void matrix(int**,int*,int);

int main(){
  int *vertex;
  int **num;
  int n,m;
  int i,j;

  scanf("%d",&n);

  num=malloc(sizeof(int*)*(n+1));
  vertex=malloc(sizeof(int)*(n+1));
  
  for(i=0;i<n+1;i++){
    num[i]=malloc(sizeof(int)*(n+1));
  }
  
  
  for(i=0;i<n+1;i++){
    for(j=0;j<n+1;j++){
      num[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d%d",&vertex[i],&m);
    for(j=1;j<m+1;j++){
      scanf("%d",&num[vertex[i]][j]);
    }
  }

  matrix(num,vertex,n);

  return 0;
}


void matrix(int **num,int *vertex,int n){
  int i,j,k,frag;
  for(i=1;i<=n;i++){
    for(j=1,k=1;j<=n;j++){
      
      while(k!=n+1){
	if(num[vertex[i]][k]==j){ 
	  printf("1");
	  frag=1;
	  if(j!=n) printf(" ");
	}	
	k++;
      }
      
      if(frag!=1) printf("0");
      
      if(j!=n && frag!=1) printf(" ");
      k=1;
      frag=0;
    }
    printf("\n");
  }
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int N, T, A;
	cin >> N >> T >> A;

	double d = INF, h = -1;
	for (int i = 0; i < N; i++) {
		int H;
		cin >> H;
		double n = (double)T - H * 0.006;
		double m = abs(A - n);
		if (m < d) {
			d = m;
			h = i + 1;
		}
	}

	cout << h << endl;
}

Measured memory_bytes: 3744
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#define int long long
using namespace std;

signed main() {
	int a; cin >> a;
	int ans = 3;
	for (int b = 0; b < a; b++) {
		ans = ans * 2 + 1;
	}
	cout << ans-1 << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                int k = sc.nextInt();
                int[] h = new int[n];
                for(int i = 0 ; i < n ; i++){
                        h[i] = sc.nextInt();
                }
                sc.close();
                int[] q = new int[n];
                Arrays.fill(q , (int)Math.pow(10 , 9));
                q[0] = 0;
                for(int i = 1; i < n ; i++){
                        for(int j = 1 ; j <= Math.min(k , i) ; j++){
                                q[i] = Math.min(q[i] , q[i - j] + Math.abs(h[i] - h[i - j]));
                        }
                }
                System.out.println(q[n - 1]);
        }
}

Measured memory_bytes: 59480
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) FOR(i,n,0)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


int m,nmin,nmax;
int p[1000000];

void search(int m,int nmin,int nmax){
  int p[100000];

  rep(i,m){
    cin>>p[i];
  }

  int n=nmin,pm=p[nmin-1]-p[nmin];

  FOR(i,nmin,nmax+1){
    if(pm<=p[i-1]-p[i]){
      pm = p[i-1]-p[i];
      n = i;
    }
  }

  cout<<n<<endl;

}


int main(){

  int m,nmin,nmax;
  while(1){
    cin>>m>>nmin>>nmax;
    if(m==0) break;
    search(m,nmin,nmax);
  }


  return 0;
}




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

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

bool contam[100005];
int cnt[100005], ans;

int n, m, a, b;

int main(){
	scanf("%d %d", &n, &m);
	contam[1] = true;
	FI(i, 1, n) cnt[i] = 1;
	FI(i, 1, m){
		scanf("%d %d", &a, &b);
		if(contam[a]) contam[b] = true;
		cnt[a]--, cnt[b]++;
		if(cnt[a] == 0) contam[a] = false;
	}
	FI(i, 1, n) if(cnt[i] > 0 && contam[i]) ans++;
	printf("%d\n", ans);
	return 0;
}

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

int main(){
	int a, b, c, k;
	cin >> a >> b >> c >> k;

	int maxi = max(a, max(b, c));
	if( maxi == a ){
		for( int i = 0; i < k; ++i )
			maxi *= 2;
		cout << maxi + b + c << endl;
	} else if( maxi == b ){
		for( int i = 0; i < k; ++i )
			maxi *= 2;
		cout << maxi + a + c << endl;
	} else {
		for( int i = 0; i < k; ++i )
			maxi *= 2;
		cout << maxi + a + b << endl;
	}
	return 0;
}

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

map<string, int> cnt;
vector<string> ans;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	for(int i = 0; i < n; i++) {
		string s; cin >> s;
		cnt[s]++;
	}

	int mx = -1;
	for(auto& it : cnt)
		mx = max(mx, it.second);
	for(auto& it : cnt) {
		if(it.second == mx)
			ans.push_back(it.first);
	}
	sort(ans.begin(), ans.end());

	for(auto& it : ans)
		cout << it << '\n';

	return 0;
}

Measured memory_bytes: 25584
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)

// ダイクストラ法　O(ElogV)
// 配列dに基点sからの最短距離を返す
// グラフのコストに負の値が含まれる場合は使えない
#define MAX_E (500000)
#define MAX_V (100000)
int V, E; // V:頂点数、E:辺数
struct edge { int to, cost; }; // 辺の構造
vector<vector<edge>> G; // 隣接配列でグラフを保持
int d[MAX_V];
typedef pair<int, int> P; // firstは最短距離、secondは頂点の番号

void shortest_path(int s) {
	priority_queue<P, vector<P>, greater<P>> que;
	fill(d, d + V, INF);
	d[s] = 0;
	que.push(P(0, s)); // 頂点sからスタート

	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue; // 他に最短路が見つかっていれば何もしない
		for (int i = 0; i < G[v].size(); i++) {
			// vから繋がる頂点を一通り計算
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				// 最短経路が見つかれば値を追加し次のキューに追加
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main() {

	cin >> V >> E;
	int r;
	cin >> r;

	G.resize(V);
	for (int i = 0; i < E; i++) {
		int v;
		cin >> v;
		edge tmp;
		cin >> tmp.to >> tmp.cost;
		G[v].push_back(tmp); // 有向グラフ
	}

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

	return 0;

}



Measured memory_bytes: 12912
"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const k = Number(spi[0]);
    const [a, b] = spi[1].split(' ').map(e => Number(e));

    for (let i = a; i <= b; i++) {
        if (i % k == 0) {
            console.log("OK");
            return;
        }
    }

    console.log("NG");
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
	int x;
	cin >> x;
	int cnt1 = x / 500;
	x = x % 500;
	int cnt2 = x / 5;
	long long sum = cnt1 * 1000 + cnt2 * 5;
	cout << sum << endl;
	return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n;
void solve(){
	cin >> n;
	
	i64 ans = LINF;
	for(i64 i = 1; i*i <= n; i++){
		if(n % i == 0){
			chmin(ans, i+n/i);
		}
	}
	cout << ans-2 << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>

using namespace std;

int main(void) {

	int a,b,num=0;
	cin>>a>>b;

	if(a<=5){
		num=0;
	}else if(a<=12){
		num=b/2;
	}else{
		num=b;
	}
	cout<<num<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <functional>

using namespace std;

typedef long long ll;

ll n, a[300005], sum = 0, b[100005], c[100005];

int main() {
    
    cin >> n;
    for (int i = 0; i < n*3; i++)
        cin >> a[i];
    priority_queue<ll, vector<ll>, greater<ll>> que;
    for (int i = 0; i < n; i++) {
        sum += a[i];
        que.push(a[i]);
    }
    for (int i = 0; i < n; i++) {
        b[i] = sum;
        ll tmp = que.top();
        que.pop();
        sum -= tmp;
        if(tmp < a[i+n]){
            
            tmp = a[i+n];
        }
        sum += tmp;
        que.push(tmp);
    }
    b[n] = sum;
    sum = 0;
    priority_queue<ll> que2;
    for (int i = 0; i < n; i++) {
        sum += a[i + 2 * n];
        que2.push(a[i + 2 * n]);
    }
    for (int i = 0; i < n; i++) {
        c[i] = sum;
        ll tmp = que2.top();
        que2.pop();
        sum -= tmp;
        tmp = min(tmp, a[2 * n - i - 1]);
        sum += tmp;
        que2.push(tmp);
    }
    c[n] = sum;
    ll ans = b[0] - c[0];
    for (int i = 0; i <= n; i++)
        ans = max(ans, b[i] - c[n - i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5876
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n;
string s;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>s;
    bool dp1[10];
    bool dp2[10][10];
    bool dp[10][10][10];
    for(int i=0;i<10;i++){
        dp1[i]=false;
        for(int j=0;j<10;j++){
            dp2[i][j]=false;
            for(int k=0;k<10;k++){
                dp[i][j][k]=false;
            }
        }
    }
    for(int i=0;i<n;i++){
        int si=s[i]-'0';
        for(int i=0;i<10;i++){
        if(dp1[i]){
            for(int j=0;j<10;j++){
                if(dp2[i][j]){
                    dp[i][j][si]=true;
                    //cout<<i<<" "<<j<<" "<<si<<"\n";
                    }
                }
                dp2[i][si]=true;
            }
        }
        dp1[si]=true;
    }
    int ans = 0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                if(dp[i][j][k]) ans++;
            }
        }
    }
    cout << ans << "\n";
}



Measured memory_bytes: 384
import java.util.*;

class Main{
	
	int n, q;int count=0;int j, L, R, mid;
	int[] S ;int[] T;
	Scanner sc = new Scanner(System.in);
	
	void input(){
		n = sc.nextInt();
		S = new int[n];
		for(int i=0; i<n; i++)S[i] = sc.nextInt();
		q = sc.nextInt();
		T = new int[q];
		for(int j=0; j<q; j++)T[j] = sc.nextInt();
		search();
		output();
	}
	void search(){
		for(j=0; j<q; j++){
			L=0; R=n;
			midd();
		}
	}
	void midd(){
		while(L!=R){
			mid=(L+R)/2;
			if(S[mid]==T[j]){
				count++;
				L=R;
			}else{
				if(S[mid]>T[j]){
					R=mid;
				}else{
					L=mid+1;
				}
			}
		}
	}

	void output(){
		System.out.println(count);
	}
	
	public static void main(String[] args){
		new Main().input();
	}
}

Measured memory_bytes: 76228
#include <bits/stdc++.h>
using namespace std;
int n;
int t[200000],x[200000],y[200000];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=1;i<=n;i++){
        if(x[i] + y[i] > t[i]){
            cout<<"No"<<endl;
            return 0;
        }
        if((x[i]+y[i])%2==0 && t[i]%2 == 1 )
        {
            cout<<"No"<<endl;
            return 0;
        }
        if((x[i]+y[i])%2 == 1 && t[i]%2 ==0)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 1408
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>

#define int long long
#define rr register

#define inf 1e9
#define MAXN 200010

using namespace std;

inline int read() {
	int s = 0, f = 0;
	char ch = getchar();
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

void print(int x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) print(x / 10);
	putchar(x % 10 + 48);
}

int n, ans;

int a[MAXN];

signed main() {
	n = read();
	for (int i = 1; i <= n; i++) a[i] = read(), ans ^= a[i];
	for (int i = 1; i <= n; i++) cout << (ans ^ a[i]) << " ";
	puts("");
}

Measured memory_bytes: 5188
#include <stdio.h>
#define N 101

int G[N][N], X[N], Y[N], n;

void find(int x, int y){
	int i;
	X[x] = y;
	for(i=1; i<=Y[x]; i++)
	if(y+1 < X[G[x][i]]) find(G[x][i], y+1);
}

int main(){
	int i, j, m;
	
	scanf("%d", &n);
	
	for(i=1; i<=n; i++){
		X[i] = 100000000;
		scanf("%d", &m);
		scanf("%d", &Y[m]);
		
		for(j=1; j<=Y[m]; j++)
		scanf("%d", &G[m][j]);
	}
	
	find(1, 0);
	
	for(i=1; i<=n; i++)
	if(X[i] == 100000000)  X[i] = -1;
	
	for(i=1; i<=n; i++)
	printf("%d %d\n", i, X[i]);
	
	return 0;
}

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

int main(void) {
  ll N;
  cin >> N;
  vector<ll> S(N);
  REP(i, 0, N) {
    ll P;
    string M;
    cin >> P >> M;
    ll x = 0;
    REP(j, 0, M.size()) {
      char c = M[j];
      if('0' <= c && c <= '9') x = x * P + (c - '0');
      if('A' <= c && c <= 'Z') x = x * P + (c - 'A' + 10);
      if('a' <= c && c <= 'z') x = x * P + (c - 'a' + 10 + 'Z' - 'A' + 1);
    }
    S[i] = x;
  }

  ll g = 0;
  REP(i, 0, N) g = g ^ S[i];
  cout << (g != 0 ? "win" : "lose") << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n; 
    int a=0;
    bool b=false;
    cin>>n;
    vector<vector<int>> d(n,vector<int>(2));
    vector<int> f(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i).at(0)>>d.at(i).at(1);
        if(d.at(i).at(0)==d.at(i).at(1)){
            a++;
            if(a==3){
                b=true;
            }
        }else{
            a=0;
        }
    }
    if(b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3564
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	int n, A[3000];
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	long long ans=0;
	for (int i = 0; i < n; i++) ans += A[i];
	cout << ans - n;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		String s = sc.next();
		for (int i = 0; i < 3; i++) {
			if (s.charAt(i) == s.charAt(i + 1) ) {
				System.out.println("Bad");
				return;
			}
		}

		System.out.println("Good");
	}
}

Measured memory_bytes: 22100
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



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

    rep(i,0,sz(s)-8)cout << s[i];
    cout << endl;
	return  0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<chrono>
#include<climits>
#include<numeric>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
using namespace std;
 
#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define print(v) {for(auto x : v) cout << x << ' '; cout << endl;}
#define printn(v, n) {for(int _i = 0; _i < n; _i++) cout << *(v + _i) << ' '; cout << endl;}
 
typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
 
const int MAXN = 1e5 + 20;
long long n;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    cout << n * (n - 1) / 2 << endl;

    return 0;
}











Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int a, b, c, d, e, f, g, h, i;
    cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
    
    int x, y, z;
    x = b - a; y = e - d; z = h - g;
    if (x != y or y != z) {cout << "No" << endl; return 0;}
    
    x = b - c; y = e - f; z = h - i;
    if (x != y or y != z) {cout << "No" << endl; return 0;}
    
    x = d - a; y = e - b; z = f - c;
    if (x != y or y != z) {cout << "No" << endl; return 0;}
    
    x = d - g; y = e - h; z = f - i;
    if (x != y or y != z) {cout << "No" << endl; return 0;}
    
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256