akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;
import java.text.*;
//Solution Credits: Taranpreet Singh
public class Main{
    //SOLUTION BEGIN
    void pre(){}
    void solve(int TC) throws Exception {
        String s = n(), t = n();
        pn(t+s);
    }
    //SOLUTION ENDS
    long mod = (int)1e9+7, IINF = (long)3e18;
    final int MAX = (int)1e6+1, INF = (int)1e9, root = 3;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399375105820974944, eps = 1e-8;
    static boolean multipleTC = false, memory = true;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        in = new FastReader();
        out = new PrintWriter(System.out);
        pre();
        int T = (multipleTC)?ni():1;
//      Solution Credits: Taranpreet Singh
        for(int i = 1; i<= T; i++)solve(i);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis()-ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n(){return in.next();}
    String nln(){return in.nextLine();}
    int ni(){return Integer.parseInt(in.next());}
    long nl(){return Long.parseLong(in.next());}
    double nd(){return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}
        public FastReader(String s) throws Exception{br = new BufferedReader(new FileReader(s));}
        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        String nextLine(){
            String str = "";
            try{str = br.readLine();}catch (IOException e){e.printStackTrace();}
            return str;
        }
    }
}

Measured memory_bytes: 22228
import java.util.Scanner;

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

    boolean isEasy = true;
    for (int i = 0; i < S.length(); i++) {
      char c = S.charAt(i);
      if (i % 2 == 0) {
        if (c == 'R' || c == 'U' || c == 'D') {
          // no-op
        } else {
          isEasy = false;
          break;
        }
      } else {
        if (c == 'L' || c == 'U' || c == 'D') {
          // no-op
        } else {
          isEasy = false;
          break;
        }
      }
    }

    System.out.println(isEasy ? "Yes" : "No");
  }
}


Measured memory_bytes: 22740
#include <iostream>
#include <iomanip>
#include<cstdlib>
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <string>
void call(int n);
using namespace std;
int main(){
	int ans=0;
	string s,t;
	
	cin>>s;
	cin>>t;
	int moji=0;
	while(s[moji]!=0){
		moji++;
	}
	

	for(int i=0;i<moji+1;i++){
		char te;
		te=s[moji-1];
		for(int hen=moji-1;hen>0;hen--){
			s[hen]=s[hen-1];
		}
		
		s[0]=te;
		int co=0;
		for(int k=0;k<moji;k++){
			if(s[k]==t[k]){
				co++;
			}else{break;}
		}if(co==moji){
			ans=3;
		}else{co=0;}
	}
	
	if(ans==3){
		cout<<"Yes"<<endl;
	}else{cout<<"No"<<endl;}
	
}

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

int main(){
    int n; cin >> n;
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    int ans=0;
    for(int i = 0; i < n; i++)
    {
        char a, b, c;
        a = s[0][i]; b = s[1][i]; c = s[2][i];
        if(a==b && c == a) continue;
        if(a!=b && b!=c && c!=a) ans+=2;
        else ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" << v[0]; FOR(i_debug, 1, v.size()){ cout << "," << v[i_debug]; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;
struct UnionFind {
	vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> memnum;

	UnionFind(ll N) { //最初は全てが根であるとして初期化
		init(N);
	}

	void init(ll N) {
		par.resize(N); memnum.resize(N);
		for (ll i = 0; i < N; i++) { par[i] = i; memnum[i] = 1; }
	}

	ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}


	void unite(ll x, ll y) { // xとyの木を併合
		ll rx = root(x); //xの根をrx
		ll ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		//
		memnum[ry] += memnum[rx];
		memnum[rx] = 0;
	}

	bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
		ll rx = root(x);
		ll ry = root(y);
		return rx == ry;
	}

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

	bool is_root(ll x) {
		return par[x] == x;
	}

	ll num(ll x) {
		return memnum[root(x)];
	}
};

int main()
{
	ll N, M;
	cin >> N >> M;
	UnionFind tree(N);
	vec p(N);
	REP(i, N) {
		cin >> p[i];
		p[i]--;
	}

	vec x(M), y(M);
	REP(i, M) {
		cin >> x[i] >> y[i];
		x[i]--;
		y[i]--;
		tree.unite(x[i], y[i]);
	}

	ll ans=0;
	REP(i,N){
		if(tree.same(p[i],i)) ans++;
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4224
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                 as IM
import           Data.List
import qualified Data.Map                    as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

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

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

main = do
  readInt
  s <- getLine
  print $ solve s

solve s = f sortedS 1 `mod` (10 ^ 9 + 7)
  where
    ans = product s'
    s' = map ((+ 1) . (`count` s)) sortedS
    sortedS = sort s

f [] acc = acc - 1
f aas@(a:as) acc = f (dropWhile (== a) as) ((1 + length aas - length (dropWhile (== a) as)) * (acc `mod` (10 ^ 9 + 7)))


Measured memory_bytes: 12668
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,X,L;
  cin >> N >> X;
  int pos = 0;
  for (int i = 0; i < N; i++){
    cin >> L;
    pos += L;
    if (pos > X){
      cout << i + 1;
      break;
    }
  }
  if (pos <= X) cout << N + 1;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long i,j,k,l,m,n,o,p,q;
    while(cin>>m>>n>>o>>p)

    {
        if(m>n)
            m=n;
        if(p>o)
            p=o;
        cout<<m+p<<endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
template<class C>constexpr int sz(const C&c){return int(c.size());}
using ll=long long;constexpr const char nl='\n',sp=' ';

struct UnionFind {
  vector<int> UF; int cnt; UnionFind(int N) : UF(N, -1), cnt(N) {}
  int find(int v) { return UF[v] < 0 ? v : UF[v] = find(UF[v]); }
  bool join(int v, int w) {
    if ((v = find(v)) == (w = find(w))) return false;
    if (UF[v] > UF[w]) swap(v, w);
    UF[v] += UF[w]; UF[w] = v; cnt--; return true;
  }
  bool connected(int v, int w) { return find(v) == find(w); }
  int getSize(int v) { return -UF[find(v)]; }
};

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  // freopen("err.txt", "w", stderr);
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int N, M;
  cin >> N >> M;
  UnionFind uf(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    uf.join(--a, --b);
  }
  int ans = 1;
  for (int i = 0; i < N; i++) ans = max(ans, uf.getSize(i));
  cout << ans << nl;
  return 0;
}


Measured memory_bytes: 3980
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, D, X[10][10];

  cin >> N >> D;

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

  int ans = 0;

  for (int i=0; i<N; i++) {
    for (int j=i+1; j<N; j++) {
      ll sum = 0;

      for (int k=0; k<D; k++) {
        sum += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
      }

      ll s = sqrt(sum);

      ans += s * s == sum || (s + 1) * (s + 1) == sum;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<numeric>
#include<algorithm>
#include <sstream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<utility>
#include<array>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<forward_list>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif

ll int a;
ll int b;
cin>>a;
cin>>b;

for (int i = 1; i <= b; ++i)
{
	/* code */
	if((a*i)%b==0){
		cout<<a*i<<endl;
		break;
	}
}
return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int N, D; cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  REP(i, N) {
    REP(k, D) {
      cin >> X[i][k];
    }
  }

  int cnt = 0;
  double ans = 0;
  REP(m, N) {
    REP(i, N) {
      if(m >= i) continue;
      REP(k, D) {
        ans += pow(X[m][k] - X[i][k], 2);
      }
      // cout << m << " " << i << " " << sqrt(ans) << endl;
      if(sqrt(ans) == floor(sqrt(ans))) cnt++;
      ans = 0;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scanln(&N)

	nums := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&nums[i])
	}

	max := nums[0]
	sum := nums[0]
	for i := 1; i < N; i++ {
		sum += nums[i]
		if nums[i] > max {
			max = nums[i]
		}
	}

	if max < sum-max {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
#show_flg=True

n=I()


g=[[] for i in range(1+n)]
v=[-1]*(1+n)

for i in range(n-1):
    a,b=LI_()
    g[a].append(b)
    g[b].append(a)

def dfs(cur,dep):
    mdep=0
    end=cur
    
    q=[]
    q.append((cur,dep))

    while q:
        cur,dep=q.pop()
        v[cur]=dep
        if dep>mdep:
            mdep=dep
            end=cur

        for nb in g[cur]:
            if v[nb]==-1:
                q.append((nb,dep+1))
    return mdep,end
    
dist,end=dfs(0,0)
v=[-1]*(1+n)
diam,beg=dfs(end,0)
show(end,beg,diam)
print(['First','Second'][diam%3==1])

Measured memory_bytes: 112332
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  string s,buf;
  cin >> buf >> s >> buf;

  pr("A" + s.substr(0,1) + "C");


  return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
from bisect import bisect

A, B, Q = map(int, readline().split())
S = [int(readline()) for i in range(A)]
T = [int(readline()) for i in range(B)]
ans = []
INF = 10**18
for i in range(Q):
    x = int(readline())
    p = bisect(S, x-1)
    lp = x - S[p-1] if p >= 1 else INF
    rp = S[p] - x if p < A else INF
    q = bisect(T, x-1)
    lq = x - T[q-1] if q >= 1 else INF
    rq = T[q] - x if q < B else INF
    ans.append("%d\n" % (min(max(lp, lq), max(rp, rq), lp*2+rq, lp+rq*2, lq*2+rp, lq+rp*2)))
sys.stdout.writelines(ans)

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

using namespace std;

typedef long long ll;

// dijkstra 蟻本
struct edge {ll to, cost;};
typedef pair<ll, ll> P; // firstはsからの最短距離, secondは頂点の番号
const ll INF = LLONG_MAX / 2;
const int max_n = 101010;

int n;
vector<edge> g[max_n];
ll d[max_n];

void dijkstra(ll s){
	fill(d, d + n, INF);
	d[s] = 0;

	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,s));

	while(!que.empty()){
		P p = que.top();
		que.pop();

		ll v = p.second;
		if(d[v] < p.first) continue; //後から最短パスが見つかった場合、先にqueに入っているものはここではじかれる

		for(ll i = 0; i < g[v].size(); i++){
			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.tie(0);
	ios::sync_with_stdio(false);

	int m;
	cin >> n >> m;

	rep(i, m){
		int l, r;
		ll c;
		cin >> l >> r >> c;
		l--; r--;
		g[l].push_back((edge){r, c});
	}

  rep(i, n){
    g[i+1].push_back((edge){i, 0});
  }
  
  dijkstra(0);
  ll dist = d[n-1];

  if(dist == INF){
    cout << -1 << endl;
  }else{
    cout << dist << endl;
  }
	
}


Measured memory_bytes: 9464
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
	mod int = 1e9 + 7
)

func main() {
	N := getInt()
	var A []int
	for i := 0; i < N; i++ {
		A = append(A, getInt())
	}

	flag := true
	for i := 0; i < N; i++ {
		if A[i] % 2 == 0 && (A[i] % 3 != 0 && A[i] % 5 != 0) {
			flag = false
			break
		}
	}

	if flag {
		fmt.Println("APPROVED")
	} else {
		fmt.Println("DENIED")
	}
}

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

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 640
#insertion sort
def printout(array,n):
    output = ""
    for i in range(n-1):
        output += str(array[i]) + " "
    output += str(array[N-1])
    print(output)

N = int(input())
array = [int(i) for i in input().split()]
printout(array,N)

for i in range(1,N):
    a = array[i]
    for j in reversed(range(0,i)):
        if (a < array[j]):
            array[j+1] = array[j]
            array[j] = a
        else:
            break;
    printout(array, N)


Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    cout << n * n * n <<endl;
    return 0;
}

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

// together.cpp
// author: Seong Yong-ju ( @sei40kr )
// Copyright (c) 2017 Seong Yong-ju

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

#define ALL(a) (a).begin(), (a).end()

using namespace std;

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

  int n;
  cin >> n;
  int as[n];
  REP(i, n) {
    cin >> as[i];
  }

  vector<int> cnt(100002, 0);
  REP(i, n) {
    int a = as[i];
    ++cnt[a];
    ++cnt[a + 1];
    ++cnt[a + 2];
  }

  cout << *max_element(ALL(cnt)) << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll h,w,k; cin >> h >> w >> k;
    vector<string> board(h);
    rep(i,h){
        cin >> board.at(i);
    }
    ll ans = 0;
    for(int i=0;i<(1<<(h+w));i++){
        bitset<12> b(i);
        vector<string> bd = board;
        for(int j=0;j<h;j++){
            if(b.test(j)){
                for(int k=0;k<w;k++){
                    bd.at(j).at(k) = '.';
                }
            }
        }
        for(int j=h;j<h+w;j++){
            if(b.test(j)){
                for(int k=0;k<h;k++){
                    bd.at(k).at(j-h) = '.';
                }
            }
        }
        ll count = 0;
        rep(j,h) rep(k,w) if(bd.at(j).at(k)=='#') count++;
        if(count==k) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
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);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n;
    cin >> n;

    vector<int> a(n);
    rep(i, n) cin >> a[i];
    map<int, int> cnt;
    for(auto x : a)  ++cnt[x];


    if(cnt[0] == n){
        Yes();
        return 0;
    }
    if(n%3) {
        No();
        return 0;
    }

    vector<int> num;
    for(auto x : cnt){
        rep(i, x.second/(n/3)){
            num.push_back(x.first);
        }
    }

    Judge(num.size() == 3 and accumulate(num.begin(), num.end(), 0, [](int a, int b){return a^b;}) == 0 );


    return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <vector>
using namespace std;
using ull = unsigned long long;

int main() {

    int n;

    cin >> n;

    vector<ull> v(n);

    ull sum = 0;

    for(int i = 0; i < n; ++i) {
        cin >> v[i];
        sum ^= v[i];
    }

    for(int i = 0; i < n; ++i) {

        if(i)
            cout << " ";
        cout << (v[i] ^ sum);

    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
#define ll long long
#define p pair<int, int>
using namespace std;

int h, w;
string s[22];
int dy[] = {-1, 0, 1, 0};
int dx[] = {0, -1, 0, 1};
int bfs(int sy, int sx, int gy, int gx) {
    if (sy == gy && sx == gx) return 0;
    vector<vector<int> > dist(21, vector<int>(21, 1e9));
    dist[sy][sx] = 0;
    queue<p> que;
    que.push(p(sy, sx));
    while (!que.empty()) {
        int cy = que.front().first;
        int cx = que.front().second;
        que.pop();
        for (int i = 0; i < 4; i++) {
            int ny = cy + dy[i];
            int nx = cx + dx[i];
            if (ny >= h || ny < 0) continue;
            if (nx >= w || nx < 0) continue;
            if (s[ny][nx] == '#') continue;
            if (dist[ny][nx] > dist[cy][cx] + 1) {
                dist[ny][nx] = dist[cy][cx] + 1;
                que.push(p(ny, nx));
            }
        }
    }
    return dist[gy][gx];
}

int main() {
    cin >> h >> w;
    for (int i = 0; i < h; i++) cin >> s[i];
    int ans = -1;
    for (int sy = 0; sy < h; sy++) {
        for (int sx = 0; sx < w; sx++) {
            if (s[sy][sx] == '#') continue;
            for (int gy = 0; gy < h; gy++) {
                for (int gx = 0; gx < w; gx++) {
                    if (s[gy][gx] == '#') continue;
                    ans = max(ans, bfs(sy, sx, gy, gx));
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=2e5+5;
ll sum[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=0; i<n; i++){
		cin >> sum[i];
		if(i)sum[i]+=sum[i-1];
	}
	int left=0, right=2; ll res = sum[n-1];
	for(int mid=1; mid<n-2; mid++){
		while(left+1<mid&&(sum[left]<sum[mid]-sum[left]))left++;
		ll now = abs(sum[mid]-2*sum[left]);
		ll prev = abs(sum[mid]-2*sum[left-1]);
		if(prev<now)left--;
		while(right+1<n&&(sum[right]-sum[mid]<sum[n-1]-sum[right]))right++;
		now = abs((sum[n-1]-sum[right]) - (sum[right]-sum[mid]));
		prev = abs((sum[n-1]-sum[right-1]) - (sum[right-1]-sum[mid]));
		if(prev<now)right--;
		ll mx = max({sum[left],sum[mid]-sum[left],sum[right]-sum[mid],sum[n-1]-sum[right]});
		ll mn = min({sum[left],sum[mid]-sum[left],sum[right]-sum[mid],sum[n-1]-sum[right]});
		res = min(res,mx-mn);
	}
	cout << res << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

int N;
int a[MAXN];

int getID(int x) {return lower_bound(a+1,a+1+N,x)-a; }

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

    cin >> N;
    rep(i,1,N) cin >> a[i];
    sort(a+1,a+1+N);
    int res = 0;
    rep(i,1,N) {
        rep(j,i+1,N) {
            int id = getID(a[i]+a[j]);
            res += id-j-1;
        }
    }
    cout << res << endl;
}


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

int main() {

	int n, x, l[110], d, ans = 1;

	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	d = 0;
	for (int i = 0; i < n; i++) {
		d += l[i];
		if (d <= x)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
N = int(input())
lines = input().split(' ')
lines = [int(x) for x in lines]
a_list = sorted(lines)
A = 0
B = 0


while len(a_list) > 0:
	A += a_list.pop()
	if len(a_list) > 0:
		B += a_list.pop()

print(A - B)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    ll n, t; cin >> n >> t;
    ll ans = 0;
    ll prev = 0;
    rep(i, n) {
        ll cur; cin >> cur;
        ans += min(cur-prev, t);
        prev = cur;
    }
    ans += t;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int mod = (int) 1e9 + 7;

long long binpow(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) {
      res = (res * x) % mod;
      p--;
    } else {
      x = (x * x) % mod;
      p /= 2;
    }
  }
  return res % mod;
}

long long inv(long long x) {
  return binpow(x, mod - 2) % mod;
}

int subMod(int a, int b) {
  int res = a - b;
  return res < 0 ? res + mod : res;
}

int n, a, b;
long long ans;

long long cnk(int n, int a) {
  long long res = 1;
  for (int i = n - a + 1; i <= n; i++) {
    res = res * i % mod;
  }
  long long f = 1;
  for (int i = 1; i <= a; i++) {
    f = f * i % mod;
  }
  return res * inv(f) % mod;
}

int main() { 

  cin >> n >> a >> b;

  ans = binpow(2, n);
  ans = subMod(ans, 1);

  ans = subMod(ans, cnk(n, a));
  ans = subMod(ans, cnk(n, b));

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
inpl = lambda: list(map(int,input().split()))
N = int(input())
partners = []
for i in range(N):
    partners.append(set())
for i in range(N-1):
    a, b = inpl()
    a -= 1
    b -= 1
    partners[a].add(b)
    partners[b].add(a)
C = sorted(inpl())

def goto_leaf(k):
    prev_k = None
    while len(partners[k]) > 1:
        for p in partners[k]:
            if p != prev_k:
                break
        prev_k = k
        k = p
    return k

def delete_leaf(k):
    for stem in partners[k]:
        break
    partners[stem].remove(k)
    return stem

M = sum(C[:-1])
D = [0]*N
k = 0
for i in range(N-1):
    k = goto_leaf(k)
    D[k] = C[i]
    k = delete_leaf(k)
D[k] = C[N-1]

print(M)
print(' '.join(map(str,D)))

Measured memory_bytes: 52312
#include <cstdio>
using namespace std;
const int maxn=501;

char c;
int n,maxi,row[maxn],col[maxn];
bool a[maxn][maxn],f,choose;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		c=getchar();
		for(int j=1;j<=n;j++)
		{
			c=getchar();
			a[i][j]=(c=='#');
			f=f || a[i][j];
		}
	}
	if (!f)
	{
		printf("-1\n");
		return 0;
	}
	
	for(int i=1;i<=n;i++)
	    for(int j=1;j<=n;j++)
	        row[i]+=a[i][j];
	for(int j=1;j<=n;j++)
	    for(int i=1;i<=n;i++)
	        col[j]+=a[i][j];
	
	int mini=10000;
	for(int i=1;i<=n;i++)
	{
		if (mini>n-row[i]+(col[i]==0))
		{
			mini=n-row[i]+(col[i]==0);
			choose=i;
		}
	}
	
	
	int ans=mini+n;
	for(int i=1;i<=n;i++)
	    if (col[i]==n) ans--;
	printf("%d\n",ans);
	return 0;
	    
}

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

int main(){

int x[10000]; 

 	for (int i=1; i<=10000; i=i+1 )
 	{
 	cin >> x[i] ;

		if( x[i] == 0 )
 		{
 		break;
 		}else{
		cout<< "Case "<< i << ": "<< x[i] << endl;
 		}

 	}

 return 0;
 }


Measured memory_bytes: 3036
#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 true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    double T, A; cin >> T >> A;
    int ans = 0;
    double minv = 100000000.0;
    vector<double> h(N+1);
    for(int i=1; i<=N; i++) cin >> h[i];

    for(int i=1; i<=N; i++) if(abs(T-h[i]*0.006-A) <= minv){
        minv = abs(T-h[i]*0.006-A);
        ans = i;
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

struct BIT {
    typedef ll T;
    T n;
    vector<T> bit;

    // 各要素の初期値は 0
    BIT(T num) : bit(num+1, 0) { n = num; }

    // a_i += w
    void add(T i, T w) {
        for (T x = i; x <= n; x += x & -x) {
            bit[x] += w;
        }
    }
    // [1, i] の和を計算.
    T sum(T i) {
        T ret = 0;
        for (T x = i; x > 0; x -= x & -x) {
            ret += bit[x];
        }
        return ret;
    }
    // [left+1, right] の和を計算.
    T sum(T left, T right) {
        return sum(right) - sum(left);
    }
}; // BIT bit(n);

int main() {
    ll N,K;cin>>N>>K;
    vector<ll> a(N,0),sum(N+1,0);
    rep(i,N) {
        cin>>a[i];
        a[i]-=K;
        sum[i+1] = sum[i] + a[i];
    }
    vector<ll> srt(N+1,0);
    srt = sum;
    sort(srt.begin(),srt.end());
    ll ans = 0;
    BIT bit(N+5);
    rep(i,N+1) {
        ll ord = lower_bound(srt.begin(),srt.end(),sum[i]) - srt.begin();
        ans += bit.sum(ord+1);
        // cout<<i<<" "<<ans<<" "<<ord<<endl;
        bit.add(ord+1,1);
    }
    cout<<ans<<endl;
}

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

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

bool solve(string s){
	if( s.size()<6 )return false;
	bool num=false,AL=false,al=false;

	rep(i,s.size()){
		if(isdigit(s[i]))num=true;
		if('a'<=s[i] && s[i]<='z')al=true;
		if('A'<=s[i] && s[i]<='Z')AL=true;
	}
	if( num && AL && al )return true;
	else return false;
}


int main(){
	string s;
	cin>>s;
	if(solve(s))cout<<"VALID"<<endl;
	else cout<<"INVALID"<<endl;
}

/*
テヲツ鳴?・ツュツ療・ツ按療ゥツ閉キテ」ツ??テ、ツサツ・テ、ツクツ甘」ツ?ァテ」ツ?づ」ツつ?
テヲツ閉ーテ・ツュツ療」ツつ津、ツクツ?」ツ?、テ、ツサツ・テ、ツクツ甘・ツ青ォテ」ツつ禿」ツ?ァテ」ツ??」ツつ?
テ・ツ、ツァテヲツ鳴?・ツュツ療ィツ仰アテ・ツュツ療」ツつ津、ツクツ?」ツ?、テ、ツサツ・テ、ツクツ甘・ツ青ォテ」ツつ禿」ツ?ァテ」ツ??」ツつ?
テ・ツーツ湘ヲツ鳴?・ツュツ療ィツ仰アテ・ツュツ療」ツつ津、ツクツ?」ツ?、テ、ツサツ・テ、ツクツ甘・ツ青ォテ」ツつ禿」ツ?ァテ」ツ??」ツつ?
*/

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a!=b)&&(a!=c)&&(b!=c)){
    cout << 3 << endl;
  }else if((a==b)&&(a==c)){
    cout << 1 << endl;
  }else{
    cout << 2 << endl;
  }
}

    
  

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;

Node treeSearch(Node x, int k){
  if(x==NIL || k == x->key) return x;
  if(k<x->key) return treeSearch(x->left,k);
  else return treeSearch(x->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) // T が空の場合
    root= z;
  else if (z->key < y->key)
    y->left = z; // z を y の左の子にする
  else 
    y->right = z; // z を y の右の子にする
}

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


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

   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");
    } 
  }
  
  return 0;
}

Measured memory_bytes: 19364
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
//#include <unordered_map>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define x first
#define y second
#define pi acos(-1.0)
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
//#define dprintf(...) 
#define hash _hash
//#define dprintf(...) fprintf(outFile,__VA_ARGS__)
 
#define FOREACH(it,x) for(__typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define ull unsigned long long
#define ll long long
#define N 300010


template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}
 
//FILE* outFile;
 
//inline void add(int &a,int b){a+=b;while(a>=mod)a-=mod;}


int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=ans*(ll)a%mod;
        a=(ll)a*a%mod;b>>=1;
    }
    return ans;
}

int a[N];
int main(){
    //freopen("f2.in","r",stdin);
    //freopen("A.out","w",stdout);
    //freopen("1.txt","w",stdout);
    //srand(time(0));
    int T=30,j,k,i,ca=0,m,n;
    scanf("%d",&n);
    n<<=1;
    rep(i,0,n)scanf("%d",&a[i]);
    sort(a,a+n);
    int ans=0;
    rep(i,0,n)ans+=a[i],i++;
    printf("%d\n",ans);
    //cerr<<1.*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=100005;
int N,A[MAXN],Ans[MAXN];
int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%d",&A[i]);
		Ans[A[i]]=i;
	}
	for(int i=1;i<N;i++)
		printf("%d ",Ans[i]);
	printf("%d\n",Ans[N]);
}

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

#define rep(i,x) for(int i=0;i<x;i++)
using ll = long long;
using namespace std;

void dfs(const vector<vector<int>> &graph, vector<bool> &seen, vector<int> &sg, int v){
    seen[v] = true;
    sg.push_back(v);
    for (auto next_v : graph[v]){
        if (seen[next_v]) continue;
        dfs(graph, seen, sg, next_v);
    }
}

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<vector<int>> friendList(n);
    rep(i, m){
        int a, b; cin >> a >> b; a--; b--;
        friendList[a].push_back(b);
        friendList[b].push_back(a);
    }
    vector<vector<int>> blockList(n);
    rep(i, k){
        int c, d; cin >> c >> d; c--; d--;
        blockList[c].push_back(d);
        blockList[d].push_back(c);
    }
    vector<bool> seen(n, false);
    vector<vector<int>> group;
    rep(i, n){
        if (seen[i]) continue;
        vector<int> sg;
        dfs(friendList, seen, sg, i);
        group.push_back(sg);
    }
    vector<int> ans_list(n);
    for (auto sg : group){
        sort(sg.begin(), sg.end());
        int len = sg.size();
        for (auto num : sg){
            int f_num = friendList[num].size();
            int b_num = 0;
            for(auto b : blockList[num]){
                if (binary_search(sg.begin(), sg.end(), b)) b_num++;
            }
            ans_list[num] = len - 1 - f_num - b_num;
        }
    }
    for (auto ans : ans_list){
        cout << ans << " ";
    }
}


Measured memory_bytes: 15172
import numpy
n=int(input())
data=[0]*n
for i in range(n):
    data[i]=input().split()

ans=numpy.empty((n,2))
for i in range(n):
    ans[i][1]=i
    ans[i][0]=int(data[i][0].upper().ljust(10,'0'),36)+100-int(data[i][1])
Ans=sorted(ans,key=lambda x:x[0])
for i in range(n):
    print(int(Ans[i][1])+1)

Measured memory_bytes: 12500
ans = 0
str = gets.chomp
n = str.size
for i in 0..str.size-1
    for j in i..str.size-1
        if str[i..j] =~ /^[A|C|G|T]+$/
            ans = [ans, str[i..j].size].max
        end
    end
end

puts ans


Measured memory_bytes: 14320
#include <bits/stdc++.h>
using namespace std;
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>

const int N = 2e5+10;

int seg[4*N];
int lazy[4*N];

void push(int ss,int se,int node)
{
    seg[node]+=lazy[node];
    
    if(ss != se)
    {
        lazy[node*2+1]+=lazy[node];
        lazy[node*2+2]+=lazy[node];
    }
    
    lazy[node] = 0;
}

void update(int node,int ss,int se,int l,int r,int x)
{
    push(ss,se,node);
    
    if(ss > r || se < l) return;
    
    if(l <= ss && se <= r)
    {
        lazy[node]+=x;
        push(ss,se,node);
        return;
    }
    
    int mid = (ss+se)/2;
    
    update(node*2+1,ss,mid,l,r,x);
    update(node*2+2,mid+1,se,l,r,x);
    
    seg[node] = max(seg[node*2+1],seg[node*2+2]);        
}

int query(int node,int ss,int se,int id)
{
    push(node,ss,se);
    
    if(se < id || ss > id) return 0;
    
    if(ss == id && se == id) return seg[node];
    
    int mid = ( ss + se)/2;
    
    return query(node*2+1,ss,mid,id) + query(node*2+2,mid+1,se,id);
}

pair<pii,int> a[N];
int adder[N];
int dp[N];
int n,m;

signed main()
{
    fast;
    
    cin >> n >> m;
    
    f(i,m) cin >> a[i].F.F >> a[i].F.S >> a[i].S;
    
    f(i,m)
    {
         adder[a[i].F.F]+=a[i].S;
         adder[a[i].F.S+1]-=a[i].S;
    }
    
    f(i,m) swap(a[i].F.F,a[i].F.S);
    sort(a,a+m);
    f(i,m) swap(a[i].F.F,a[i].F.S);
    
    int id = 0;
    
    for(int i=1;i<=n;i++)
    {
        adder[i]+=adder[i-1];
        
        dp[i] = seg[0] + adder[i];
        
        update(0,0,n-1,i,i,dp[i] - query(0,0,n-1,i) - adder[i]);
        
        while(id < m && a[id].F.S <= i)
        {
            update(0,0,n-1,a[id].F.F,a[id].F.S,a[id].S);
            id++;
        }
    }
    
    int res = 0;
    
    for(int i=1;i<=n;i++) res = max(res,dp[i]);
    
    cout << res;
}

Measured memory_bytes: 18688
# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: print('Yes' if b else 'No')
YESNO=lambda b: print('YES' if b else 'NO')

def main():
    N=int(input())
    edge=[[] for _ in range(N)]
    for i in range(N):
        l=list(map(lambda x:int(x)-1,input().split()))
        edge[i]=l[2:]
    d=[INF]*N
    d[0]=0
    que=deque()
    que.append(0)
    while que:
        v=que.popleft()
        for nv in edge[v]:
            if d[nv]>d[v]+1:
                d[nv]=d[v]+1
                que.append(nv)
    for i in range(N):
        print(i+1,d[i] if d[i]!=INF else -1)

if __name__ == '__main__':
    main()



Measured memory_bytes: 6040
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
	char ch;
	vector<int> v(5);
	int& a = v.at(0),
		& b = v.at(1),
		& c = v.at(2),
		& d = v.at(3),
		& e = v.at(4);

	while (cin >> a) {
		cin >> ch >> b >> ch >> c >> ch >> d >> ch >> e;

		/*
		one pair  （2 枚の同じ数字のカードが1 組ある）
		two pair  （2 枚の同じ数字のカードが2 組ある）
		three card（3 枚の同じ数字のカードが1 組ある）
		full house（3 枚の同じ数字のカードが1 組と、残りの2 枚が同じ数字のカード）
		four card （4 枚の同じ数字のカードが1 組ある）
		straight  （5 枚のカードの数字が連続している）
		null
		*/

		sort(v.begin(), v.end());
		//cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << e << endl;

		string t = "null";
		vector<int> v2(4);
		v2.at(0) = b - a;
		v2.at(1) = c - b;
		v2.at(2) = d - c;
		v2.at(3) = e - d;

		int cnt = count(v2.begin(), v2.end(), 0);
		if (cnt == 1) {
			t = "one pair";
		}
		else if (cnt == 2) {
			if (v2.at(0) == 0 && v2.at(1) == 0) {
				t = "three card";
			}
			else if (v2.at(1) == 0 && v2.at(2) == 0) {
				t = "three card";
			}
			else if (v2.at(2) == 0 && v2.at(3) == 0) {
				t = "three card";
			}
			else {
				t = "two pair";
			}
		}
		else if (cnt == 3) {
			if (v2.at(1)!=0||v2.at(2)!=0){
				t = "full house";
			}
			else {
				t = "four card";
			}
		}
		else {
			if (v.at(1) == v.at(0) + 1
				&& v.at(2) == v.at(1) + 1
				&& v.at(3) == v.at(2) + 1) {
				t = "straight";
			}
		}

		if (a == 1 && b == 10 && c == 11 && d == 12 && e == 13) t = "straight";

		cout << t << endl;
	}
}


Measured memory_bytes: 3064