akhauriyash/Code-Regression huggingface dataset:
def C_pre():
    t = input()
    a,b,c,d = list(map(int,[t[0],t[1],t[2],t[3]]))
    for j in (1,-1):
        for k in (1,-1):
            for l in (1,-1):
                if a+j*b+k*c+l*d == 7:
                    r = "".join(list(map(str,[j,k,l]))).replace("-1","-").replace("1","+")
                    return a,b,c,d,r
def C():
    a,b,c,d,r = C_pre()
    print(str(a)+r[0]+str(b)+r[1]+str(c)+r[2]+str(d)+"=7")
if __name__ == '__main__':
    C()
    

Measured memory_bytes: 39892
#B
n = int(input())
rst = []
for _ in range(n):
    s,p = map(str,input().split())
    rst.append([s,int(p)])
    
rst_sort = rst[:]
rst_sort.sort(key=lambda x: (x[0],-x[1]))

for i in range(n):
    print(rst.index(rst_sort[i]) + 1)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
int main (){
	int n, k;
	int x[100];
	cin >> n >> k;
	int ans = 0;
	for (int i = 0; i < n; i++){
	     cin >> x[i];
	     if (x[i] <= abs(k-x[i])){
			 ans += x[i]*2;
		 } else{
			 ans +=  abs(k-x[i])*2;
		 } 
	 }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI acos(-1)

using namespace std;
using LL = long long;

constexpr int MAXN = 2e5 + 5;

struct Vec2 {
    Vec2() = default;
    Vec2(LL _x, LL _y) : x(_x), y(_y) {}

    friend inline bool operator<(const Vec2& a, const Vec2& b) {
        return a.x == b.x ? a.y < b.y : a.x < b.x;
    }

    friend inline Vec2 operator-(const Vec2& a, const Vec2& b) {
        return Vec2(a.x - b.x, a.y - b.y);
    }
    /*@return cross product of two Vec2*/
    friend inline LL operator*(const Vec2& a, const Vec2& b) {
        return a.x * b.y - a.y * b.x;  //×
    }
    /*@param a 2D vector @return square norm of the vector*/
    friend inline LL normSquare(const Vec2& a) {
        return a.x * a.x + a.y * a.y;
    }
    LL x = 0, y = 0;
} vec[MAXN], cov[MAXN];

LL n, top, ans;

inline void convex() {
    top = 0;
    sort(vec + 1, vec + n + 1);
    for (int i = 1; i <= n; i++) {  //下凸壳
        while (top > 1 && (cov[top] - cov[top - 1]) * (vec[i] - cov[top]) <= 0)
            cov[top--] = Vec2(0, 0);
        cov[++top] = vec[i];
    }
    int up = top; //上凸壳起点
    for (int i = n - 1; i > 0; i--) {  //上凸壳
        while (top > up && (cov[top] - cov[top - 1]) * (vec[i] - cov[top]) <= 0)
            cov[top--] = Vec2(0, 0);
        cov[++top] = vec[i];
    }
}

inline LL rotatingCalipers(LL res = 0) { //旋转卡壳
    convex();
    int up = 1, left = 1, right = 1;
    if (top == 3) return abs(cov[1].x - cov[2].x) + abs(cov[1].y - cov[2].y);
    for (int i = 1; i < top; i++) {
        while (true) { //寻找对踵点 two polong doubleers
            auto s = cov[i], t = cov[i + 1];
            auto x1 = cov[up], x2 = cov[up + 1];
			res = max(res, abs(x1.x - s.x) + abs(x1.y - s.y));
			res = max(res, abs(x1.x - t.x) + abs(x1.y - t.y));
			res = max(res, abs(x2.x - s.x) + abs(x2.y - s.y));
			res = max(res, abs(x2.x - t.x) + abs(x2.y - t.y));
            LL s1 = abs((s - x1) * (t - x1));
            LL s2 = abs((s - x2) * (t - x2));
            if (s1 <= s2) up = up % (top - 1) + 1; //h1 <= h2
            else break;
        }
        res = max(res, abs(cov[i].x - cov[up].x) + abs(cov[i].y - cov[up].y));
        res = max(res, abs(cov[i + 1].x - cov[up].x) + abs(cov[i + 1].y - cov[up].y));
    }   
    return res;
}

int main() {
    std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n;
    for (LL i = 1; i <= n; i++)
        cin >> vec[i].x >> vec[i].y;
    cout << rotatingCalipers() << endl;
    return 0;
}

Measured memory_bytes: 6756
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline


class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n))

    def find(self, a):
        acopy = a
        while a != self.parent[a]:
            a = self.parent[a]
        while acopy != a:
            self.parent[acopy], acopy = a, self.parent[acopy]
        return a

    def union(self, a, b):
        self.parent[self.find(b)] = self.find(a)




n , m = map(int , input().split())
#dic = defaultdict(set)
uf = UnionFind(n)
for ii in range(m):
	u,v = map(int , input().split())
	u-=1
	v-=1
	uf.union(u,v)
c = [0]*n
for i in range(n):
	c[uf.find(i)] += 1
print(max(c))



'''
import collections,sys,threading
sys.setrecursionlimit(10**9)
threading.stack_size(10**8)






########################################
def solve():
	n , m = map(int , input().split())
	dic = defaultdict(set)
	for ii in range(m):
		u,v = map(int , input().split())
		dic[u].add(v)
		dic[v].add(u)
	l = []
	visited = [0]*(n+2)
	def f(node):
		visited[node] = True
		temp = 0
		for nei in dic[node]:
			if not visited[nei]:
				temp += f(nei)
				#print("?",node, nei , temp)
		return temp
	for i in range(1,n+1):
		if not visited[i]:
			l.append(f(i)+1)
	#print(dic)
	#print(l)
	print(max(l))


threading.Thread(target=solve).start()

'''



Measured memory_bytes: 72404
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

constexpr int Mod = 1000000007;

constexpr int add(int a, int b) { return (a + b) % Mod; }
constexpr int sub(int a, int b) { return (a - b) % Mod; }
constexpr int mul(int a, int b) { return (int) ((long long) a * b % Mod); }
constexpr int fma(int a, int b, int c) { return (int) (((long long) a * b + c) % Mod); }
constexpr int pow(int a, int b) {
  auto c = 1;
  while (b) {
    if (b & 1)
      c = mul(c, a);
    a = mul(a, a);
    b >>= 1;
  }
  return c;
}

int Q[200000];
int R[200000];

int calc(int x1, int y1, int x2, int y2) {
  auto x = x2 - x1;
  auto y = y2 - y1;
  return mul(Q[x + y], mul(R[x], R[y]));
}

struct Cell {
  int x, y;
};

int main() {
  Q[0] = 1;
  for (auto i = 1; i < 200000; ++i)
    Q[i] = mul(Q[i - 1], i);
  R[199999] = pow(Q[199999], Mod - 2);
  for (auto i = 199999; i; --i)
    R[i - 1] = mul(R[i], i);
  int N, M, K;
  scanf("%d%d%d", &N, &M, &K);
  static Cell A[3001];
  for (auto i = 0; i < K; ++i)
    scanf("%d%d", &A[i].x, &A[i].y);
  sort(A, A + K, [](const Cell& a, const Cell& b) {
    return a.x != b.x ? a.x < b.x : a.y < b.y;
  });
  A[K] = {N, M};
  static int F[3001];
  for (auto i = 0; i <= K; ++i) {
    F[i] = calc(1, 1, A[i].x, A[i].y);
    for (auto j = 0; j < i; ++j)
      if (A[j].x <= A[i].x && A[j].y <= A[i].y)
        F[i] = sub(F[i], mul(F[j], calc(A[j].x, A[j].y, A[i].x, A[i].y)));
  }
  printf("%d\n", add(F[K], Mod));
  return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

int main() {
  int n;
  scanf("%d", &n);
  vector<ii> a(n);
  vector<int> A(n), B(n);
  for (int i = 0; i < n; ++i) {
    a[i] = {-INF, INF};
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &B[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (i == 0 || A[i] > A[i - 1]) {
      a[i].first = max(a[i].first, A[i]);
      a[i].second = min(a[i].second, A[i]);
    } else {
      a[i].first = max(a[i].first, 1);
      a[i].second = min(a[i].second, A[i]);
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    if (i == n - 1 || B[i] > B[i + 1]) {
      a[i].first = max(a[i].first, B[i]);
      a[i].second = min(a[i].second, B[i]);
    } else {
      a[i].first = max(a[i].first, 1);
      a[i].second = min(a[i].second, B[i]);
    }
  }
  bool found = false;
  int ret = 1;
  for (int i = 0; i < n; ++i) {
    if (a[i].first > a[i].second) {
      found = true;
      break;
    }
    ret = (int64)ret * (a[i].second - a[i].first + 1) % MOD;
  }
  if (found) ret = 0;
  printf("%d\n", ret);
  return 0;
}


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

int main()
{
	long long X;
	cin >> X;

	long long yokin = 100;

	int nen = 0;
	while(yokin < X)
	{
		yokin += yokin / 100;
		nen++;
	}

	cout << nen << endl;


	return 0;
}



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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int MOD=1e9+7;

int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

int nxt[111111];
int dp[111111][2];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin>>s; int n=s.length(); 
	bool pos=1;
	for(int i=0;i+1<n;i++)
	{
		if(s[i]==s[i+1]) pos=0;
	}
	if(pos) {cout<<1<<'\n'; return 0;}
	s="$"+s;
	nxt[n]=-1;
	for(int i=n-1;i>=1;i--)
	{
		nxt[i]=-1;
		if(s[i+1]==s[i]) {nxt[i]=i+1; continue;}
		nxt[i]=nxt[i+1];
	}
	nxt[0]=nxt[1];
	dp[0][0]=1; 
	for(int i=0;i<n;i++)
	{
		int v=add(dp[i][0],dp[i][1]);
		dp[i+1][s[i+1]-'a']=add(dp[i+1][s[i+1]-'a'],v);
		if(nxt[i+1]>0) dp[nxt[i+1]][(s[i+1]-'a')^1]=add(dp[nxt[i+1]][(s[i+1]-'a')^1],v);
	}	
	int ans=0; int sum=0;
	for(int i=n;i>=1;i--)
	{		
		if(sum==0) ans=add(ans,add(dp[i][0],dp[i][1]));
		sum+=(s[i]=='a'?1:2); sum%=3;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 1664
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::char;
fn main(){

    input!{
        n: u32,
        s: chars,
    }

    let mut ans: String = String::new();
    // for i in s{
    //     if i=='Z'{
    //         ans += &'Z'.to_string();
    //     } else {
    //         let mut c = char::from_u32(i as u32 + n);
    //         ans += &c.to_string();
    //     }
    // }

    ans = s.iter().map( |&x| {
        std::char::from_u32('A' as u32 + (x as u32 - 'A' as u32 + n) % 26).unwrap()
    }).collect();

    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

signed main(){
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    REP(i, tx - sx) cout << "R";
    REP(i, ty - sy) cout << "U";
    REP(i, tx - sx) cout << "L";
    REP(i, ty - sy) cout << "D";
    cout << "D";
    REP(i, tx - sx + 1) cout << "R";
    REP(i, ty - sy + 1) cout << "U";
    cout << "LU";
    REP(i, tx - sx + 1) cout << "L";
    REP(i, ty - sy + 1) cout << "D";
    cout << "R" << endl;
    return 0;
}

Measured memory_bytes: 3584
using System;
public class Program{
    public static void Main(){
        
        string[] s = Console.ReadLine().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);
        int ans;
        
        if(0<a && a<10 && 0<b && b<10){
            ans=a*b;
        }else{
            ans=-1;
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 17716
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.IO;

class Program
{
    static void Main()
    {
        new Program().Solve();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    public void Solve()
    {
        string n = cin.next;
        string res = "";
        foreach(char c in n)
        {
            if (c == '9')
            {
                res += "1";
            }else if (c == '1')
            {
                res += "9";
            }
            else
            {
                res += c;
            }
        }
        WriteLine(int.Parse(res));
    }
}


class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main() {
	// your code goes here
	long n, c = 3;
	cin >> n;
	long points[n][c], dp[n][c];
	for(long i=0; i<n; i++) {
		for(long j=0; j<c; j++) {
			cin >> points[i][j];
			dp[i][j] = 0;
		}
	}
	for(long j=0; j<c; j++) {
		dp[0][j] = points[0][j];
	}
	for(long i=0; i<n-1; i++) {
		for(long j=0; j<c; j++) {
			for(long k=0; k<c; k++) {
				if(j != k) {
					dp[i+1][k] = max(dp[i+1][k], dp[i][j]+points[i+1][k]);
				}
			}
		}
	}
	long maximum = 0;
	for(long j=0; j<c; j++) {
		maximum = max(maximum, dp[n-1][j]);
	}
	cout << maximum << endl;
	return 0;
}

Measured memory_bytes: 4992
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

#define MAXN 200000
#define INF 0x7fffffff
int N,A,B;

int main(){
	scanf("%d",&N);
	bool flag=0;
	long long All=0,Rest=INF;
	for(int i=1;i<=N;i++){
		scanf("%d%d",&A,&B);
		All+=B;
		flag|=A!=B;
		if(A>B)
			Rest=min(Rest,1ll*B);
	}
	printf("%lld",flag*(All-Rest));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat pw(cat a, cat e, cat mod) {
	if(e <= 0) return 1;
	cat x = pw(a, e/2, mod);
	x = (x*x)%mod;
	if(e&1) x = (x*a)%mod;
	return x;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for(int i = 0; i < M; i++) {
		cin >> A[i];
		A[i]--;
		if(A[i] == 0) {
			M--;
			i--;
		}
	}
	cat mod = 1000000007, ans = 0;
	vector<cat> fac((1<<N)+1, 1), inv((1<<N)+1, 1);
	for(int i = 1; i <= (1<<N); i++) {
		fac[i] = (i * fac[i-1]) % mod;
		inv[i] = pw(fac[i], mod-2, mod);
	}

	// subsets 2^0 .. 2^(N-1)
	vector< vector<cat> > cnt(M+1, vector<cat>(1<<N, 0));
	vector<int> sz(1<<N, 0);
	for(int i = 0; i < (1<<N); i++) for(int j = 0; j < N; j++) sz[i] += (i>>j)&1;
	cnt[M][0] = 1;
	for(int i = M-1; i >= 0; i--) {
		cnt[i] = cnt[i+1];
		for(int j = (1<<N)-1; j >= 0; j--) for(int k = 0; k < N; k++) if(((j>>k)&1) == 0) {
			// A[i], potom 2^k-1 vasich (z N-1-A[i]-j)
			if((1<<N)-A[i]-j-(1<<k) < 0) continue;
			cat x = fac[(1<<N)-1-A[i]-j]*inv[(1<<N)-A[i]-j-(1<<k)]%mod * (1<<k) % mod;
			cnt[i][j+(1<<k)] = (cnt[i][j+(1<<k)] + cnt[i+1][j] * x) % mod;
		}
	}
	for(int i = 0; i < (1<<N); i++) {
		int sz = 0;
		for(int j = 0; j < N; j++) if((i>>j)&1) sz++;
		cat x = cnt[0][i] * fac[(1<<N)-1-i] % mod;
		if(sz&1) ans -= x;
		else ans += x;
	}
	ans = (ans % mod * (1<<N)) % mod;
	if(ans < 0) ans += mod;
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 10624
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	char b;
	cin >> b;
	cout << (b == 'A' ? 'T' : b == 'T' ? 'A' : b == 'C' ? 'G' : 'C') << endl;
	return 0;
}
 

Measured memory_bytes: 256
n=int(input())
l=[]
c=False
for i in range(n):
    l.append(list(input().split()))
for x in range(n-2):
    if l[x][0]==l[x][1]:
        if l[x+1][0]==l[x+1][1]:
            if l[x+2][0]==l[x+2][1]:
                c=True
if c:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9104
// #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

// int K;
// vector<vector<int>> memo(201,vector<int> (201,0));


// long long gcd(long long a,long long b){
//   if (memo[a][b]) return memo[a][b];
//   else if (b) {
//     if (memo[b][a%b]) {
//       return memo[b][a%b];}
//     else return gcd(b,a%b);
//   }
//   else {
//     return a;
//   }
// }

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

int main() {
  int K;
  cin >> K;
  vector<vector<ll>> memo(201,vector<ll> (201,0));

  rep2(i,1,201) rep2(j,1,201) {
    memo[i][j] = memo[j][i] = gcd(i,j);
  }
  ll ans = 0;
  rep2(i,1,K+1)rep2(j,1,K+1)rep2(k,1,K+1) {
    // cout << memo[i][memo[j][k]] << endl;
    ans += memo[i][memo[j][k]];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3952
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>

using namespace std;

#define LINE DEBUG{ printf("LINE : %d\n", __LINE__); }
#define DEBUG if(false)

using ll = long long;
template<class T> using vec = vector<T>;

const int MOD = 1000000007;

template<class T>
T in(void){
  T tmp;
  cin >> tmp;
  return tmp;
}

int main(){
  ll X; cin >> X;
  double XX = X;
  int n = 0;
  double yokin = 100.0;
  while(true){
    yokin = yokin*1.01;
    n++;
    if(yokin > XX){
      break;
    }
    yokin = (double)(ll)yokin;
  }
  cout << n << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#define MAX 100
#define NIL -1

typedef struct{
  int p;
  int l;
  int r;
}info;

info T[MAX];
int n;

void preorder(int);
void inorder(int);
void postorder(int);


int main(){
  int i,v,l,r,root;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL){
      T[l].p=v;
    }
    if(r!=NIL){
      T[r].p=v;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL){
      root=i;
    }
  }
    printf("Preorder\n");
    preorder(root);
    printf("\n");
    printf("Inorder\n");
    inorder(root);
    printf("\n");
    printf("Postorder\n");
    postorder(root);
    printf("\n");
  return 0;
}

void preorder(int u){
  if(u==NIL){
    return;
  }
  printf(" %d",u);
  preorder(T[u].l);
  preorder(T[u].r);
}

void inorder(int u){
  if(u==NIL){
    return;
  }
  inorder(T[u].l);
  printf(" %d",u);
  inorder(T[u].r);
}

void postorder(int u){
  if(u==NIL){
    return;
  }
  postorder(T[u].l);
  postorder(T[u].r);
  printf(" %d",u);
}



Measured memory_bytes: 2112
n = int(input())

def factorization(n):
    # https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def s2n(s):
    m = 0
    for i in range(1, 9):
        if i * (i+1) // 2 <= s:
            m = i
        else:
            break
    return m

if n == 1:
    print(0)
else:
    ans = 0
    for [p, esum] in factorization(n):
        ans += s2n(esum)
    print(ans)

Measured memory_bytes: 63376
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll>x(n),y(n),z(n);
  vector<vector<ll>>ans(8,vector<ll>(n));
  for(int i=0; i<n; i++) cin >> x[i] >> y[i] >> z[i];
  
  for(int i=0; i<8; i++){
    for(int j=0; j<n; j++){
      if(i>>0 & 1)ans[i][j]+=x[j];
      else ans[i][j]-=x[j];
      if(i>>1 & 1)ans[i][j]+=y[j];
      else ans[i][j]-=y[j];
      if(i>>2 & 1)ans[i][j]+=z[j];
      else ans[i][j]-=z[j];
    }
  }
  
  ll MAX=0;
  for(int i=0; i<8; i++){
    ll max_kari=0;
    sort(ans[i].begin(),ans[i].end());
    reverse(ans[i].begin(),ans[i].end());
    for(int j=0; j<m; j++){
      max_kari+=ans[i][j];
    }
    MAX=max(MAX,max_kari);
  }
  
  cout << MAX << endl;
}
  
  
  


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
template<typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p){
    return o << "(" << p.first << ", " << p.second << ")";
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

struct Sieve{
    int n;
    vi f, primes;
    Sieve(int n): n(n), f(n+1){
        f[0] = f[1] = -1;
        for(ll i=2; i<=n; i++){
            if(f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for(ll j=i*i; j<=n; j += i){
                if(!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x){ return f[x] == x; }
    vi prime_factor(int x){
        vi res;
        while(x != 1){
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<pii> factor(int x){
        vi pf = prime_factor(x);
        if(pf.size() == 0) return {};
        vector<pii> res(1, pii(pf[0], 0));
        for(int p : pf){
            if(res.back().first == p){
                res.back().second++;
            }else{
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    auto sieve = Sieve(56000);
    int n; cin >> n;

    vi ans;
    int idx = 1;
    while(ans.size() < n){
        int p = sieve.primes[idx];
        if(p % 5 == 1) ans.push_back(p);
        idx++;
    }
    cout << join(ans, " ") << endl;
    return 0;
}

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

using namespace std;

const long long MOD = 1000000007;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

vector<pair<int, int>> events;

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    /*
     * REMOVE ME PLS
     */

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

    int n, m;

    cin >> n >> m;

    int mini = 1, maxi = n;

    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        events.push_back(make_pair(a, 0)); // insert
        events.push_back(make_pair(b, 1)); // delete
        mini = max(a, mini);
        maxi = min(b, maxi);
    }

    sort(events.begin(), events.end());

    int prev = 0, left = n, right = 0;
    int counter = 0;
    bool possible = false;

    for(auto i : events){
        if(i.second == 0){
            ++counter;
        }
        if(i.second == 1){
            --counter;
        }
        if(counter == m){
            possible = true;
            left = min(left, i.second);
            right = max(right, i.second);
        }
    }

    if(possible)
        cout << maxi - mini + 1;
    else
        cout << 0;


    return 0;
}


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

int main() { 
  int a, b;
  cin >> a;
  cin >> b;
  int now = 1;
  int cou = 0;



  if(b == 1){

    cou = 0;

  }else {

    while(now < b){

      now = now + (a-1);
      cou++;
    }

  }

  cout << cou << endl;
  
  return 0;
}

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

int main() {
  vector<int> A(9);
  rep(i, 9) {
    cin >> A.at(i);
  }

  int N;
  cin >> N;
  vector<bool> check(9, false);
  rep(i, N) {
    int b;
    cin >> b;
    rep(j, 9) {
      if (A.at(j) == b) {
        check.at(j) = true;
      }
    }
  }

  set<int> s;
  if ((check.at(0) && check.at(1) && check.at(2)) || (check.at(3) && check.at(4) && check.at(5)) || (check.at(6) && check.at(7) && check.at(8)) || (check.at(0) && check.at(3) && check.at(6)) || (check.at(1) && check.at(4) && check.at(7)) || (check.at(2) && check.at(5) && check.at(8)) || (check.at(0) && check.at(4) && check.at(8)) || (check.at(2) && check.at(4) && check.at(6))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

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

const ll MOD = 1000000007;
const ll INF = LLONG_MAX;
const ll MAX_N = 100000;

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

ll NUM = 2 * 3 * 5 * 7 * 11, prime[] = {2,3,5,7,11};

int main() {
	ll n,sum = 0,ans[20000];
	cin >> n;

	ll i = 2;
	for (ll cnt = 0;cnt < n-2;i++) {
		bool flag = false;
		for (ll j = 0; j < 5; j++) {
			if (i%prime[j] == 0)flag = true;
		}
		if (flag) {
			sum += i;
			ans[cnt] = i;
			cnt++;
		}
	}
	ll all = (sum / NUM + 1)*NUM;
	while (all - sum < i * 2)all += NUM;
	while (1) {
		bool flag[2]{};
		for (ll j = 0; j < 5; j++) {
			if (i%prime[j] == 0)flag[0] = true;
		}
		for (ll j = 0; j < 5; j++) {
			if ((all-sum-i)%prime[j] == 0)flag[1] = true;
		}
		if (flag[0] && flag[1]) {
			ans[n - 2] = i;
			ans[n - 1] = all - sum - i;
			break;
		}
		i++;
	}
	for (int j = 0; j < n; j++) {
		printf("%lld\n",ans[j]);
	}
	cout << flush;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<map>

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

using namespace std;

const int INF = 1000;

int N, M;

int d[100];

int A[100][100];

int main()
{
	cin >> N;

	string S;
	cin >> S;

	if (S.length() % 2 == 0) {

		int length = S.length();

		string s1, s2;
		s1 = S.substr(0, length / 2);
		s2 = S.substr(length / 2, length / 2);

		if (s1 == s2) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
 
int main(){
  
  string s;
  cin>>s;
  
  if(s=="SAT"){
    cout<<"1"<<endl;
  }
  else if(s=="FRI")
    cout<<"2"<<endl;
  else if(s=="THU")
    cout<<"3"<<endl;
  else if(s=="WED")
    cout<<"4"<<endl;
  else if(s=="TUE")
    cout<<"5"<<endl;
  else if(s=="MON")
    cout<<"6"<<endl;
  else 
    cout<<"7"<<endl;
 
  return 0;
}

Measured memory_bytes: 256
n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
b = [list(map(int,input().split())) for _ in range(m)]

c = [[0]*l for _ in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+= a[i][k]*b[k][j]
            
for i in range(len(c)):
    print(" ".join(map(str,c[i])))
        


Measured memory_bytes: 6900
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int dp[5000002]; //dp[capacity] ::= min_price

int main(){
  int total_manju;
  int total_box;
  while(~scanf("%d %d",&total_manju,&total_box)){
    vector<int> manju;
    for(int manju_idx=0;manju_idx<total_manju;manju_idx++){
      int price;
      scanf("%d",&price);
      manju.push_back(price);
    }

    sort(manju.begin(),manju.end(),greater<int>());
    int sum[10001];
    memset(sum,0,sizeof(sum));
    for(int manju_idx=0;manju_idx<total_manju;manju_idx++){
      sum[manju_idx + 1] = sum[manju_idx] + manju[manju_idx];
    }


    memset(dp,0x3f,sizeof(dp));

    dp[0] = 0;
    for(int box_idx=0;box_idx<total_box;box_idx++){
      int capacity;
      int price;
      scanf("%d %d",&capacity,&price);
      for(int prev_manju_num = 10000; prev_manju_num >=0; prev_manju_num--){
        dp[prev_manju_num + capacity]
          = min(dp[prev_manju_num + capacity],
                dp[prev_manju_num] + price);
      }
    }

    for(int prev_manju_num = 500*10000; prev_manju_num >=0; prev_manju_num--){
      dp[prev_manju_num] = min(dp[prev_manju_num],dp[prev_manju_num + 1]);
    }
    
    int res = 0;
    for(int manju_num=1;manju_num<=total_manju;manju_num++){
      res = max(sum[manju_num] - dp[manju_num],res);
    }

    printf("%d\n",res);
  }
}

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

n = int(input())
a_list = list(map(int, input().split()))

a_list.sort()
a_list.reverse()

alice = 0
bob = 0
for i in range(0, len(a_list), 2):
    alice += a_list[i]

    if i + 1 < len(a_list):
        bob += a_list[i + 1]

print(alice - bob)


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

long long unsigned int mod = 1000000007;

// PowMod( base, index, modulo) return base ** index % modulo {{{
// PowMod = base ** index % mod ( natural numbers )
long long unsigned int PowMod( long long unsigned int base, long long unsigned int index, long long unsigned int modulo = mod ){
    if( index == 0 ) return 1;
    // O( log(index) )
    if( index % 2 ){
        return base * PowMod(base, index - 1, modulo) % modulo;
    }else{
        long long unsigned int Phalf = index / 2;
        long long unsigned int half = PowMod(base, Phalf, modulo);
        return half * half % modulo;
    }
}
// }}}

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N,K;
    Scd2(N,K);

    static ll c[6011][6011] = {};

    Rep(i,6011){
        c[i][0] = 1;
        c[i][i] = 1;
    }
    Repe(k,6011,1){
        Repe(j,k,1){
            c[k][j] = c[k-1][j-1] + c[k-1][j];
            c[k][j] %= mod;
        }
    }


    // sonyuu
    ll ans = 1;
    int n = N;

    N = K;
    K = n-K;

    Rep(k,N){
        // K-1_H_k * 2+k_H_K-k
        // = : * K+1_C_K-k
        //
        printf ("%llu\n", c[N-1][k] * c[K+1][K-k] % mod );
    }

    return 0;
}



Measured memory_bytes: 280704
# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

if len(d) == 0:
    ans = 0
else:
    last = sorted(d.items(), key=lambda x: x[1])[0][0]
    ll.remove(last)
    ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)


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

#define int int_fast64_t

signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);

  int h, w, k; cin >> h >> w >> k;
  vector<string> v;
  copy_n(istream_iterator<string>(cin), h, back_inserter(v));

  int ans=0;
  for (int colmask = 0; colmask < (1<<h); ++colmask) {
    for (int rowmask = 0; rowmask < (1<<w); ++rowmask) {
      int blacks=0;
      for (int y = 0; y < h; ++y) {
        for (int x = 0; x < w; ++x) {
          bool has_x = (colmask & (1<<y))!=0;
          bool has_y = (rowmask & (1<<x))!=0;
          if (v[y][x]=='#' && !has_x && !has_y) {
            ++blacks;
          }
        }
      }
      if (blacks==k)
        ++ans;
    }    
  }
  cout << ans << '\n';
}



Measured memory_bytes: 3640
import           Data.Array.IArray (Array, listArray, range, (!))
import qualified Data.ByteString.Char8 as B
import           Data.Char
import           Data.List

main :: IO ()
main = do
    [n, a] <- readInts
    xs     <- listArray (1, n) <$> readInts
    print $ solve n a xs

readInts :: IO [Int]
readInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

solve :: Int -> Int -> Array Int Int -> Int
solve n a xs = dps ! (n, n * xm) - 1
  where
    dp :: Int -> Int -> Int
    dp 0 t | t == n * xm = 1
           | otherwise   = 0
    dp j t | t - ys ! j < 0          = dps ! (j - 1, t)
           | t - ys ! j > 2 * n * xm = dps ! (j - 1, t)
           | otherwise               = dps ! (j - 1, t) + dps ! (j - 1, t - ys ! j)

    dps :: Array (Int, Int) Int
    dps      = listArray dpBounds [ dp j t | (j, t) <- range dpBounds ]

    dpBounds = ((0, 0), (n, 2 * n * xm))

    xm       = a `max` maximum [ xs ! i | i <- range (1, n) ]

    ys       = fmap (subtract a) xs

Measured memory_bytes: 35196
use std::cmp::*;
use std::io::*;

fn putans(a: &Vec<usize>) {
    for &i in a.iter() {
        if i == 0 {
            print!("S");
        } else {
            print!("W");
        }
    }
}
fn check(s: &Vec<char>, a: &mut Vec<usize>, n: usize) -> bool {
    for i in 1..=n {
        if s[i] == 'o' {
            if a[i] == 0 {
                a[i + 1] = a[i - 1];
            } else {
                a[i + 1] = a[i - 1] ^ 1;
            }
        } else {
            if a[i] == 0 {
                a[i + 1] = a[i - 1] ^ 1;
            } else {
                a[i + 1] = a[i - 1];
            }
        }
    }
    a[0] == a[n] && a[1] == a[n + 1]
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut s: Vec<char> = itr.next().unwrap().chars().collect();
    s.push(s[0]);

    let mut a = vec![0; n + 2];
    if check(&s, &mut a, n) {
        a.pop();
        a.pop();
        putans(&a);
        return;
    }
    let mut a = vec![0; n + 2];
    a[0] = 0;
    a[1] = 1;
    if check(&s, &mut a, n) {
        a.pop();
        a.pop();
        putans(&a);
        return;
    }
    let mut a = vec![0; n + 2];
    a[0] = 1;
    a[1] = 0;
    if check(&s, &mut a, n) {
        a.pop();
        a.pop();
        putans(&a);
        return;
    }
    let mut a = vec![0; n + 2];
    a[0] = 1;
    a[1] = 1;
    if check(&s, &mut a, n) {
        a.pop();
        a.pop();
        putans(&a);
        return;
    }
    println!("-1");
}


Measured memory_bytes: 5592
#include<iostream>
using namespace std;
int main () {
  int A, B;
  cin >> A >> B;
  for (int i = 0; i < 10000; i ++) {
    int j = i * 8;
    j /= 100;
    int k = i / 10;
    if (j == A && k == B) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

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

#define ll long long
#define ull unsigned long long
#define inf 0x3f3f3f3f
#define met(a, x) memset(a,x,sizeof(a))
#define mp make_pair;

using namespace std;
const int mod = 19e+7;
const int N = 3e5 + 10;
const int M = 1e6 + 10;

ll a[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    for(int i=1;i<=3*n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+3*n);
    ll ans=0;
    for(int i=(3*n)-1;i>=n+1;i-=2){
        ans+=a[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 302, MAXM = 45004, Mod = 998244353 , MAXLog = 20;


bool cmp(const pair<string, pair<int, int>> p1, const pair<string, pair<int, int>> p2) {
    if (p1.first == p2.first) {
        return p2.second.first < p1.second.first;
    }
    return p1.first < p2.first;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n;
    cin >> n;
    vector<pair<string, pair<int, int>>> rest(n);
    for (int i = 0; i < n; ++i) {
        cin >> rest[i].first >> rest[i].second.first;
        rest[i].second.second = i;
    }

    sort(rest.begin(), rest.end(), cmp);

    for (int i = 0; i < n; ++i) {
        cout << rest[i].second.second + 1 << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
using namespace std;
using ll = int64_t;
using vi = vector<int>;
using vvi = vector<vi>;


int main() {
    int n, m;
    cin >> n >> m;
    bitset<100001> a(0);
    rep(i, m) {
        int g;
        cin >> g;
        a.set(g);
    }

    vi dp(n+1);
    dp[0] = 1;
    rep(i, n) {
        if(a.test(i+1)) {
            continue;
        }
        int j = i+1;
        if(j > 1) {
            dp[j] = dp[j-2]; 
            dp[j] %= 1000000007;
        }
        dp[j] += dp[j-1];
        dp[j] %= 1000000007;
    }
    /*rep(i, n) {
        cout << dp[i] << '\n';
    }*/
    cout << dp[n] << '\n';
}

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

int main(){
    int n;
    cin >> n;
    string s;
    vector<pair<int,string>> a(n);
    for(int i=0;i<n;i++){
        a.at(i).first=0;
    }
    int co=0;
    set<string> mozi;
    map<string,int> g;
    for(int i=0;i<n;i++){
        cin >> s;
        if(mozi.count(s)){
            a.at(g.at(s)).first++;
        }else{
            mozi.insert(s);
            g[s]=co;
            a.at(co).second=s;
            a.at(co).first++;
            co++;
        }
    }

    sort(a.rbegin(),a.rend());
    

    vector<string> ans(n);
    co=0;
    int ma=a.at(0).first;
    for(int i=0;i<n;i++){
        if(a.at(i).first==ma){
            ans.at(co)=a.at(i).second;
            co++;
        }else{break;}
    }
    co--;
    for(int i=co;i>=0;i--){
        cout << ans.at(i) << endl;
    }
    
}

Measured memory_bytes: 39296
h,w = map(int, input().split())
cell = []

for i in range(h):
    row = list(input())
    if row != ["."]*w:
        cell.append(row)

counter = []
for i in range(w):
    flag = 0
    for j in range(len(cell)):
        if cell[j][i] == "#":
            flag = 1
            break
    if flag == 1:
            counter.append(i)

for a in cell:
    ans = ''
    for i in counter:
        ans = ans + a[i]
    print(ans)

Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
int main(){
    int k ; cin >> k;
    ll sum = 0;
    _rep(i,1,k + 1){
        _rep(j,1,k + 1){
            _rep(l,1,k + 1){
                ll a = gcd(i, j);
                ll b = gcd(a, l);
                sum += b;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3620
n = gets.to_i
spots = []
n.times do
  spots.push(gets.chomp.split(" ").map(&:to_i))
end
atcodeer = [0, 0, 0]
x_move = 0
y_move = 0
t_move = 0
t_left = 0
judge = true
spots.each do |elm|
  x_move = (elm[1] - atcodeer[1] ).abs
  y_move = (elm[2] - atcodeer[2] ).abs
  t_move = x_move + y_move
  t_left = elm[0] - atcodeer[0]
  if t_left >= t_move && (t_left - t_move).even?
    atcodeer = elm
  else
    judge = false
    puts "No"
    break
   end
end
if judge == true
  puts "Yes"
end

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

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

    for(int c = 0; c <= x; c++) {
        int t = x - c;
        int asi = 2 * c + 4 * t;
        if(y == asi) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}    


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

template <typename T> T load() { T r; cin >> r; return r; }
template <typename T> vector<T> loadMany(int n) { vector<T> rs(n); generate(rs.begin(), rs.end(), &load<T>); return rs; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto n = load<int>();
    auto height = loadMany<int>(n);
    auto dyn = vector<int>(n);
    dyn[0] = 0;
    for (auto i=1; i<n; ++i) {
        dyn[i] = dyn[i-1] + abs(height[i-1] - height[i]);
        if (i >= 2)
            dyn[i] = min(dyn[i], dyn[i-2] + abs(height[i] - height[i-2]));
    }
    cout << dyn[n-1] << '\n';
}


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

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){
	int n;
	vector<int> x;
	cin>>n;
	x.assign(n, 0);
	for(int i=0;i<n;i++)
		cin>>x[i];
	ll ans = 10000000;
	for(int i=1;i<=100;i++){
		ll sum = 0;
		for(int j=0;j<n;j++){
			sum += (x[j]-i)*(x[j]-i);
		}
		ans = min(ans, sum);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256