akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<sstream>
#include<algorithm>
#include<cstdlib>
using namespace std;

bool cmp(const string& a,const string b)
{
  if(a.size() != b.size())
    return a.size() < b.size();
  if(a != b)
    return (atoi)(a.c_str()) < (atoi)(b.c_str());
  return false;
}

int main()
{
  int n;
  vector<string> vec;
  cin >> n; 
  vec.resize(n);

  int men = 100000000;  
  int Size[6];
  for(int i=0;i<6;i++)
    Size[i] = 0;
  for(int i=0;i<n;i++)
    cin >> vec[i],Size[vec[i].size()]++,men = min(men,(int)vec[i].size());

  sort(vec.begin(),vec.end(),cmp);
    
  if(Size[men] >= 4)
      cout << vec[0] << vec[3] << endl;
  else if(Size[men] == 3)
    cout << vec[1] << vec[0] << endl;
  else if(Size[men] == 2)
    {
      string a,b;
      a = vec[0]+vec[2];
      b = vec[2]+vec[0];
      cout << min((atoi)(b.c_str()),(atoi)(a.c_str())) << endl;
    }
  else if(Size[men] == 1)
    {
      vector<string> ans;
      for(int i=0;i<4;i++)
	for(int j=0;j<4;j++)
	  if(i != j)
	    ans.push_back(vec[i]+vec[j]);
      sort(ans.begin(),ans.end(),cmp);
      cout << ans[2] << endl;
    }


  


  return 0;
}

Measured memory_bytes: 1656
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int n,y;
    float b[60],r,t;
    float bank[60];
    int number;
    cin>>n;
    while(n != 0){
        cin>>y;
        for(int i=0;i<n;i++){
            cin>>b[i]>>r>>t;
            if( t == 1 ){
                bank[i] = 1 + y * r / 100;
            }
            if( t == 2 ){
                bank[i] = 1;
                for(int j=0;j<y;j++){
                    bank[i] = bank[i] * (1 + r / 100);
                }
            }
        }
        number = 0;
        for(int i=1;i<n;i++){
            if(bank[number] < bank[i]){
                number = i;
            }
        }
        cout<<b[number]<<"\n";
        cin>>n;
    }
    return 0;
}




Measured memory_bytes: 3260
#include <stdio.h>

int main(void)
{
	int moun[10];
	int height[10001] = {0};
	int sub = 3;
	int i;
	
	for (i = 0; i < 10; i++){
		scanf("%d", &moun[i]);
		height[moun[i]]++;
	}
	while (1){
		for (i = 10000; i >= 0; i--){
			if (height[i] > 0){
				printf("%d\n", i);
				height[i]--;
				sub--;
				break;
			}
		}
		if (sub == 0)break;
	}
	
	return (0);
}

Measured memory_bytes: 1840
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            C();
        }

        static void C()
        {
            var S = Read().ToArray();
            var ans = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (i + 1 >= S.Length) break;
                if (S[i] == S[i+1])
                {
                    ans++;
                    S[i+1] = S[i+1] == '1' ? '0' : '1';
                }
            }
            Println(ans);
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13268
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr = (input.trim()).split("\n");
var N1 = Number(Arr[0])
var arr1 = Arr[1].split(" ").map(Number);
var arr2 = Arr[3].split(" ").map(Number);

const linearSearch = (key, arr) => {
  let i = 0
  arr[N1] = key;
  while (true) {
      if (arr[i] === key) break;
      i++;
  }
  return i !== N1 ? 1 : 0;
}
console.log(arr2.map(e => linearSearch(e, arr1)).reduce((a, b) => a + b, 0));



Measured memory_bytes: 19856
import java.util.*;

public class Main {
	static String AKI = "AKIHABARA";
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next() + "a";
		int idx = 0;
		for (int i = 0; i < AKI.length(); i++) {
			if (s.charAt(i - idx) != AKI.charAt(i)) {
				if (AKI.charAt(i) == 'A') {
					idx++;
				} else {
					System.out.println("NO");
					return;
				}
			}
		}
		if (s.charAt(AKI.length() - idx) != 'a') {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}
	}
}


Measured memory_bytes: 23764
s = str(input())
t = str(input())
ns = len(s)
nt = len(t)
start = -1
for j in range(ns):
    if t[0] == s[j] or s[j] == '?':
        j_temp = j
        i_temp = 0
        is_ok = True
        while i_temp < nt - 1:
            i_temp += 1
            j_temp += 1
            if j_temp >= ns:
                is_ok = False
                break
            if s[j_temp] == '?' or s[j_temp] == t[i_temp]:
                if i_temp == nt - 1:
                    break
                continue
            if s[j_temp] != t[i_temp]:
                is_ok = False
                break
        if is_ok:
            start = max(j, start)
ans = ""
if start == -1:
    print("UNRESTORABLE")
    exit()
for i in range(ns):
    if start <= i < start + nt:
        ans += t[i - start]
    elif s[i] == "?":
        ans += "a"
    else:
        ans += s[i]
print(ans)

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

int dp[1001][1001];

signed main(){
    int N; cin >> N;
    REP( i, N ){
        string s, t; cin >> s >> t;
        REP( i, s.size() ){
            REP( j, t.size() ){
                if( s[i] == t[j] ){
                    dp[i + 1][j + 1] = dp[i][j] + 1;
                }else{
                    dp[i + 1][j + 1] = max( dp[i + 1][j], dp[i][j + 1] );
                }
            }
        }

        cout << dp[s.size()][t.size()] << endl;
    }
}


Measured memory_bytes: 10988
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans=0;
  for(int i=0;i<3;i++){
    if(s[i]=='1'){
      ans++;
    }
  }
  cout << ans << endl;    
  return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
int a[100001];
int b[100001];
LL ans[100001];

LL s[100001];
LL m=-1;
LL total=0;

vector<int>G[100001];
bool used[100001];
int dfs(int x){
    int cnt=1;
    used[x]=true;
    REP(i,G[x].size()){
        int now=G[x][i];
        int p=(a[now]^b[now]^x);
        if(used[p]==false){
           int a=dfs(p);
           int b=N-a;
           //cout<<x<<" "<<a<<" "<<b<<endl;
           if(a==b){
              m=now;
           }else{
              //cout<<s[x]<<" aa "<<s[p]<<" "<<a<<" "<<b<<endl;
              ans[now]=((s[x]-s[p])/(a-b));
              total+=(ans[now]*a);
           }
           cnt+=a;
        }
    }
    
    return cnt;
}

int main(){
    cin>>N;
    REP(i,N-1){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        G[a[i]].push_back(i);
        G[b[i]].push_back(i);
    }
    REP(i,N){
        cin>>s[i];
    }
    REP(i,N)used[i]=false;
    dfs(0);
    if(m!=-1){
       ans[m]=(s[0]-total)/(N/2);
    }
    REP(i,N-1){
        cout<<ans[i]<<endl;
    }
    return(0);
}

Measured memory_bytes: 16512
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000001
#define epsilon 1e-6
typedef long long ll;
typedef unsigned long long ull;

template<typename T>
class IO{
public:

    void read(vector<T> &a){ for(int i=0; i<a.size(); i++) cin >> a[i];}
    void read(vector<vector<T>> &a){
        for(int i=0; i<a.size(); i++)
            for(int j=0; j<a[i].size(); j++)
                cin >> a[i][j];
    }
    void print(vector<T> &a){ for(int i=0; i<a.size(); i++) cout << a[i] << ' '; }
    void print(vector<vector<T> > &a){
        for(int i=0; i<a.size(); i++){
            for(int j=0 ; j<a[i].size(); j++){
                cout << a[i][j] << ' ';
            }
        cout << '\n';
        }
    }
};

IO<int> io;

void solve(){
    string S;
    cin >> S;
    if(S[S.length()-1] == 's') S = S + "es";
    else S = S + "s";
    cout << S;
}

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
    #endif

    int t =1;

    while(t--){
        solve();
    }

    return 0;
}





Measured memory_bytes: 3652
#include <stdio.h>

int main(void)
{
	int h[10];
	int i,j;
	int a;
	
	for(i=0;i<10;i++)
	{
		scanf("%d",&h[i]);
	}
	
	for(i=0;i<3;i++)
	{
		for(j=0;j<9-i;j++)
		{
			if(h[j]>h[j+1])
			{
				a=h[j];
				h[j]=h[j+1];
				h[j+1]=a;
			}
		}
	}
	
	for(i=9;i>6;i--)
	{
		printf("%d\n",h[i]);
	}
	
	return 0;
}

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

int main(){
  int D,N;
  cin >> D >> N;
  int ans = 0;
  if(N == 100) ans = pow(100,D)*101;
  else ans = pow(100,D)*N;
    
  cout << ans <<endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> vec;
  for(int i=0; i<n; i++){
    int tmp;
    cin >> tmp;
    vec.push_back(tmp);
  }
  vector<int> sortvec = vec;
  sort(sortvec.begin(),sortvec.end());
  if(sortvec==vec){cout << "YES" << endl;return 0;}
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      vector<int> swapvec = vec;
      swap(swapvec.at(i),swapvec.at(j));
      if(swapvec==sortvec){cout << "YES" << endl; return 0;}
    }
  }
  cout << "NO" << endl;
}

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

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

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

	int sum = 0, pos = 0;
	for(int i = 0; i < n; i++){
		sum += abs(a[i]-pos);
		pos = a[i];
	}
	sum += abs(a[n-1]);

	for(int i = 0; i < n; i++){
		if(i == 0){
			int k = sum;
			k -= abs(a[i])+abs(a[i+1]-a[i]);
			k += abs(a[i+1]);
			cout << k << endl;
		} else if(i == n-1){
			int k = sum;
			k -= abs(a[i]-a[i-1])+abs(a[i]);
			k += abs(a[i-1]);
			cout << k << endl;
		} else {
			int k = sum;
			k -= abs(a[i]-a[i-1])+abs(a[i+1]-a[i]);
			k += abs(a[i+1]-a[i-1]);
			cout << k << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
namespace my_std {
using namespace std;
#define reg register
#define Rint register int
#define FOR(i, a, b) for (register int i = (a), ed_##i = (b); i <= ed_##i; ++i)
#define ROF(i, a, b) for (register int i = (a), ed_##i = (b); i >= ed_##i; --i)
typedef long long i64;
#define Templ(T) template <typename T>
inline int read() {
    reg int ans = 0, f = 1;
    reg char c = getchar();
    while (!isdigit(c)) f ^= (c == '-'), c = getchar();
    for (; isdigit(c); c = getchar()) ans = (ans << 1) + (ans << 3) + (c ^ 48);
    return f ? ans : -ans;
}
Templ(_Tp) inline int chkmin(_Tp &x, _Tp y) { return x > y ? x = y, 1 : 0; }
Templ(_Tp) inline int chkmax(_Tp &x, _Tp y) { return x < y ? x = y, 1 : 0; }
#define mod 998244353
inline void qmo(int &x) { x += (x >> 31) & mod; }
} // namespace my_std
using namespace my_std;

#define N 410
#define inf (1145141919)
int n, h[N];
int c[2][N][N], f[N][N][2];
int T;

inline void init(){
    n = read();
    FOR(i, 1, n) h[i] = read();
    f[0][0][0] = -inf;
    FOR(i, 0, n) c[0][i][0] = c[0][0][i] = 1;
    FOR(i, 1, n){
        qmo(c[0][i][1] = -mod + (c[0][i - 1][1] << 1));
        qmo(c[1][i][1] = c[0][i][1] - 1);
        FOR(j, 2, n){
            qmo(c[0][i][j] = (i64)c[0][i][1] * c[0][i][j - 1] % mod);
            qmo(c[1][i][j] = (i64)c[1][i][1] * c[1][i][j - 1] % mod);
        }
    }
}

inline int dp(int l, int r){
    if(l > r) return 0;
    static int tmp[N][2];

    reg const int id(++T), len(r - l + 1);
    reg int (*g)[2] = f[id];
    Rint mn(inf), num(0);
    FOR(i, l, r) chkmin(mn, h[i]);
    g[0][0] = 1;
    for(Rint L(l), R(l), siz(0); R <= r + 1; ++R)
        if(h[R] == mn || R == r + 1){
        reg int (*u)[2] = f[dp(L, R - 1)];
        if(u[0][0] == -inf){
            ++num, L = R + 1;
            continue;
        }
        memset(tmp, 0, sizeof(tmp));
        FOR(i, 0, siz) FOR(j, 0, R - L){
            FOR(x, 0, 1) FOR(y, 0, 1){
                qmo(tmp[i + j][x | y] += (i64)g[i][x] * u[j][y] % mod - mod);
            }
        }
        memcpy(g, tmp, sizeof(tmp));
        ++num, siz += R - L;
        L = R + 1;
    }//处理儿子
    FOR(o, 1, num - 1){
        memcpy(tmp, g, sizeof(tmp));
        FOR(j, 0, len - 1){
            qmo(tmp[j + 1][0] -= g[j][0]);
            qmo(tmp[j + 1][1] += g[j][0] - mod);
        }
        memcpy(g, tmp, sizeof(tmp));
    }//处理 num - 1 个最低的位置
    reg const int hgh(mn - max(h[l - 1], h[r + 1]));
    FOR(i, 0, len){
        qmo(g[i][0] = (i64)c[0][len - i][hgh] * g[i][0] % mod);
        qmo(g[i][1] = (i64)c[1][len - i][hgh] * g[i][1] % mod);
    }//乘容斥系数
    return id;
}

inline void get_ans(reg const int &t){
    Rint ans(0);
    FOR(i, 0, n){
        qmo(ans += f[t][i][0] - mod);
        qmo(ans += f[t][i][1] - mod);
    }
    printf("%d\n", ans);
}

int main() {
    init();
    get_ans(dp(1, n));
    return 0;
}

Measured memory_bytes: 6320
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> mass(h, vector<char>(w, '.')); 
    set<int> ih, iw; 
    rep(i, h) {
        rep(j, w) {
            char c; cin >> c;
            if (c == '#') {
                mass[i][j] = c;
                ih.insert(i);
                iw.insert(j);
            }
        }
    }
    for(int i : ih) {
        for (int j : iw) {
            cout << mass[i][j];
        }
        cout << endl;
    }
    return 0;
}

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

#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))

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

int gcd(int a,int b);

int main(void)
{
  int n,m;
  scanf("%d%d",&n,&m);
  //int a[100001]
  int min=0,max=100000;
  int i;
  int l,r;
  //
  REP(i,m)
  {
    scanf("%d%d",&l,&r);
    if(min<=l) min = l;
    if(max>=r) max = r;
  }
  if(max-min+1<0) printf("0");
  else printf("%d",max-min+1);
  
  return 0;
  
  
}

int gcd(int a,int b)
{
  int max,min,tmp;
  max = MAX(a,b);
  min = MIN(a,b);
  if(max%min==0) return min;
  else
  {
    tmp = min;
    min = max%min;
    max = tmp;
    return gcd(max,min);
  }
}


Measured memory_bytes: 256
using System;

   class FennecVsMonster {
       static void Main(string[] args) {
           string[] line1 = System.Console.ReadLine().Trim().Split(' ');
           string[] line2 = System.Console.ReadLine().Trim().Split(' ');
           long[] H = new long[int.Parse(line1[0])];
           for (int i = 0; i < int.Parse(line1[0]); i++){
               H[i] = long.Parse(line2[i]);
           }
           Array.Sort(H);
           long A = 0;
           for (int i = 0; i < (int.Parse(line1[0]) - int.Parse(line1[1])); i++){
               A = A + H[i];
           }
           System.Console.WriteLine(A);
       }
   }


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

int main(void) {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(){
    long long  n;
    cin>>n;
    for(long long i=-1000;i<1000;i++){
        for(long long  j=-1000;j<1000;j++)
        if((pow(i,5)-pow(j,5))==n){
            cout<<i<<" "<<j<<endl;
            return 0;
        }
    }
    return 0;
}



Measured memory_bytes: 4096
from collections import Counter

N = int(input())

an = Counter([int(i) for i in input().split()])


def main():
    # 要素(k) よりも 要素数(v) が 以上ならば その差(v - k)
    # 要素(k) よりも 要素数(v) が 小さければ 要素数(v)
    print(sum([v - k if k <= v else v for k, v in an.items()]))

    return


main()


Measured memory_bytes: 18668
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int N;
int main() {
	cin >> N;
	vector<ll> A(N);
	REP(i, N) scanf("%lld", &A[i]);
	
	ll ans = longINF;
	ll rsum = accumulate(ALL(A), 0ll);
	ll lsum = 0;
	
	REP(i, N - 1) {
		lsum += A[i];
		rsum -= A[i];
		chmin(ans, abs(lsum - rsum));
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
import Data.List
import Control.Monad.Writer

data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show)

findRoot :: Int -> [(Int, (Int, Int))] -> Int
findRoot x xs = let
                  findLR (idx, (l, r)) = l == x || r == x
                  node = find findLR xs
                in
                  case node of
                    Just (idx, _) -> findRoot idx xs
                    Nothing       -> x

makeTree :: Int -> [(Int, (Int, Int))] -> Tree Int
makeTree x xs = let
                  node = lookup x xs
                in
                  case node of
                    Just (l, r) -> Node x (makeTree l xs) (makeTree r xs)
                    Nothing            -> EmptyTree

preorder :: Tree Int -> Writer [Int] (Tree Int)
preorder EmptyTree = return (EmptyTree)
preorder (Node idx l r) = do
  tell [idx]
  preorder l
  preorder r

inorder :: Tree Int -> Writer [Int] (Tree Int)
inorder EmptyTree = return (EmptyTree)
inorder (Node idx l r) = do
  inorder l
  tell [idx]
  inorder r

postorder :: Tree Int -> Writer [Int] (Tree Int)
postorder EmptyTree = return (EmptyTree)
postorder (Node idx l r) = do
  postorder l
  postorder r
  tell [idx]
  return (EmptyTree)

format :: [Int] -> String
format xs = foldl (\acc x -> acc ++ " " ++ show x) "" xs

main = do
  n <- fmap (read) getLine
  lns <- sequence $ replicate n getLine
  let nodes = map ((\[x,y,z] -> (x, (y,z))) . map read . words) lns
      r = findRoot (fst (nodes !! 0)) nodes
      tree = makeTree r nodes
  putStrLn "Preorder"
  putStrLn $ format . snd . runWriter $ preorder tree
  putStrLn "Inorder"
  putStrLn $ format . snd . runWriter $ inorder tree
  putStrLn "Postorder"
  putStrLn $ format . snd . runWriter $ postorder tree

Measured memory_bytes: 4144
/**/
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <cctype>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#define mm(i,v) memset(i,v,sizeof i);
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll INF=99999999999999;
const int inf=999999999;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	char s[100];
	cin>>n>>s>>k;
	char t=s[k-1];
	for(int i=0;i<n;i++)
		if(s[i]!=t)
			s[i]='*';
	cout<<s;
	return 0;
}

/*
    summary:
*/


Measured memory_bytes: 256
ll = lambda: list(map(int, input().split()))
testcases = 1
def abs(x):
    if x<0:
        return -x
    return x
# testcases = int(input())
for testcase in range(testcases):
    [n,m]=ll()
    broken=[1]*(n+1)
    for i in range(m):
        [ai]=ll()
        broken[ai]=0
    ans=[0]*(n+1)
    ans[0]=1
    ans[1]=1*broken[1]
    for i in range(2,n+1):
        ans[i] = (ans[i-1]*broken[i] + ans[i-2]*broken[i])%(10**9+7)
    # print(ans)
    print(ans[n])




Measured memory_bytes: 7764
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
using namespace std;

#define MOD 1000000007;


int main(){
    int n, m;
    cin >> n >> m;
    int a[n + 1];
    for (int i = 1; i <= n; i++){
        a[i] = 0;
    }
    int tmp;
    for (int i = 1; i <= m; i++){
        cin >> tmp;
        a[tmp] = 1;
    }

    int dp[m + 1];
    dp[0] = 1;
    for (int i = 1; i <= n; i++){
        if (a[i] == 0){
            if (i == 1){
                dp[i] = dp[i - 1];
            }
            else {
                dp[i] = dp[i - 1] + dp[i - 2];
            }
        }
        else {
            dp[i] = 0;
        }
        dp[i] %= MOD;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
const ll INF=1e15;
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
const double pi = acos(-1.0);
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}

long long binpows(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)  //impar
            res = res * a;
        a = a * a;
        b >>= 1;  // /2
    }
    return res;
}
const int mod=1e9+7;
int binpow(int a, int b, int m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
//CHECAR SE PRECISA DE LONG LONG
double dp[3456][3456];
int n;
vector<double> v;
double resolve(int pos,int qt){
	if(pos==n){
		if(qt>n/2){
			return 1;
		}else{
			return 0;
		}
	}
	double &x=dp[pos][qt];
	if(x>-5)
		return x;
	x=0;
	x+=v[pos]*resolve(pos+1,qt+1);
	x+=(1-v[pos])*resolve(pos+1,qt);
	return x;
}	
void solve(){
	for(int i=0; i<3456; i++)
		for(int j=0; j<3456; j++)
			dp[i][j]=-100;
	cin>>n;
	v.resize(n);
	for(double &i: v)cin>>i;

	cout<<fixed<<setprecision(10)<<resolve(0,0)<<endl;
}
//revise as variaveis e a ordem nas funções
signed main(){
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 97268
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const int MOD = 1e9+7;

int main(){
    int N;
    cin >> N;
    int x,y;
    x = N*800;
    y = (N/15)*200;
    cout << x - y << endl;
    return 0;
}

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

int main(){
	int n, i, s[1000], sum;
	double m, a;
	
	while(1){
		scanf("%d", &n);
		if(n == 0) break;
		sum = 0;
		a = 0;
		for(i=0; i<n; i++){
			scanf("%d", &s[i]);
			sum += s[i];
		}
		m = (double)sum / n;
		for(i=0; i<n; i++){
			a += pow(s[i]-m, 2);
		}
		a = sqrt(a/n);
		printf("%f\n", a);
	}
	
	return 0;
}

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

int main()
{
	char a; cin>>a;
	if(a>='a' && a<='z'){
		cout<<"a"<<endl;
	}
	if(a>='A' && a<='Z'){
		cout<<"A"<<endl;
	}	
	return 0;

}

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

int main()
{
	int n;
	for (int i = 0; i < 10000; i++) {
		cin >> n;
		if (n != 0) {
			cout << "Case " << i + 1 << ": " << n << endl;
		}
		else break;
	}
	return 0;
}

Measured memory_bytes: 2912
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define EPS 1e-10
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

/**
 * Usage:
 * 
 * chmin(old, new);
 * chmax(old, new);
 * 
 */ 
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;
}

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



ll a, b;

int main () {
  cin >> a >> b;

  if (a <= 0 && b >= 0) {
    cout << "Zero\n";
  } else {
    if (b < 0) {
      ll ct = b - a + 1;
      if (ct % 2 == 0) {
        cout << "Positive\n";
      } else {
        cout << "Negative\n";
      }
    } else {
      cout << "Positive\n";
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=3e5+5;
ll n,m,a[10];
ll cost[]={0,2,5,5,4,5,6,3,7,6};
ll dp[10005];
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m;
    for(ll i=0;i<m;i++)cin>>a[i];
    sort(a,a+m);
    memset(dp,-1,sizeof(dp));
    dp[0]=0;
    for(ll i=0;i<n;i++){
        if(dp[i]==-1)continue;
        for(ll j=0;j<m;j++){
            if(i+cost[a[j]]<=n){
                dp[i+cost[a[j]]]=max(dp[i+cost[a[j]]],dp[i]+1);
            }
        }
    }
    string ans="";
    ll k=n;
    while(k){
        for(ll i=m-1;i>=0;i--){
            if(k-cost[a[i]]>=0 && dp[k-cost[a[i]]]==dp[k]-1){
                ans+=('0'+a[i]);
                k-=cost[a[i]];
                break;
            }
        }
    }
    cout<<ans;
}



Measured memory_bytes: 384
#include <stdio.h>

int main(void){
    int i,j;
    int N = 0;
    
    char S[32];
    
    scanf("%s",S);
    
    for(i = 0;S[i] != '\0';i++){
        if(S[i] == 'o') N++;
    }
    
    if((N + 15 - i) >= 8) printf("YES\n");
    else printf("NO\n");
    
    
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  string s,t;
  cin>>s>>t;
  vector<vector<ll>> d(26);
  vector<bool> b(26,false);
  for(int i=0;i<s.size();i++){
    d[s[i]-'a'].push_back(i+1);
    b[s[i]-'a']=true;
  }
  int v=t.size()-1,n=t.size();
  ll m=0LL,c=0LL;
  for(int i=0;i<t.size();i++){
    if(!b[t[i]-'a']){
      cout<<-1;return 0;
    }
    if((upper_bound(d[t[i]-'a'].begin(),d[t[i]-'a'].end(),m)-d[t[i]-'a'].begin())==d[t[i]-'a'].size()){
      m=d[t[i]-'a'][0];
      c++;
    }else{
      m=d[t[i]-'a'][upper_bound(d[t[i]-'a'].begin(),d[t[i]-'a'].end(),m)-d[t[i]-'a'].begin()];
    }
  }
  cout<<c*s.size()+m;
}

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

ll N,M;
vector<ll> G[MAX];
bool visited[MAX];
int d[MAX];

bool dfs(int pos,int depth){
  if(visited[pos])return (d[pos]==depth%2);
  
  visited[pos]=true;
  d[pos]=depth%2;

  bool res=true;
  for(int i=0;i<(int)G[pos].size();i++){
    int to=G[pos][i];
    if( !dfs(to,depth+1) )res=false;
  }
  return res;
}

int main(){
  scanf("%lld %lld",&N,&M);
  for(int i=0;i<M;i++){
    ll x,y;
    scanf("%lld %lld",&x,&y);
    x--,y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }

  ll ans=0;
  ll cnt=0;
  ll cntA=0;
  ll cntB=0;
  for(int i=0;i<N;i++){
    if(visited[i])continue;
    if(G[i].size()==0){
      cnt++;
      continue;
    }
    bool isb=dfs(i,0);
    if(isb){
      cntA++;
    }    else {
      cntB++;
    }
  }
  // cout<<cntA<<' '<<cntB<<endl;
  
  ans+= (cnt*N*2 - cnt*cnt);

  ans+= cntB*(cntB-1);
  ans+= cntB;
  
  ans+=( cntA*(cntA-1) *2   );
  ans+= cntA*2;
  
  ans+= cntA*cntB*2;

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


Measured memory_bytes: 13056
//
//  main.cpp
//  Exercise
//
//

#include <algorithm>
#include <iostream>
#include <limits>
#include <math.h>
#include <tuple>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "string.h"
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <array>
#include <set>

using namespace std;

using int_t = long long;

int main() {
    string s;
    cin >> s;
    int K;
    cin >> K;
    unordered_set<string> substrSet;
    substrSet.reserve(s.length() * s.length());
    vector<string> substrs;
    substrs.reserve(s.length() * s.length());
    for (int i = 0; i < s.length(); i++) {
        for (int len = 1; len <= min(K, (int)s.length()); len++) {
            string sub = s.substr(i, len);
            if (substrSet.find(sub) == substrSet.end()) {
                substrs.push_back(sub);
            }
            substrSet.insert(sub);
        }
    }
    sort(substrs.begin(), substrs.end());
    printf("%s", substrs[K-1].c_str());
    printf("\n");
    return 0;
}





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

#define MAX 20

typedef struct {
  int row;               
  int col;               
} Coord;

// ??????????????¨ ?§???????
typedef struct _stack {
  struct _stack *next;
  Coord point;
} *stack, stackelem;

char M[MAX+2][MAX+2];    // ?????¢?????°??????????????§???

// ????????????????????£?¨?
int solve (int W, int H);
int search_df (int W, int H, Coord start);

// ??????????????¨
stack  new_stack (void);
int is_empty (stack);
int push (stack, Coord);
Coord top (stack);
Coord pop (stack);

// main ??¢??°
int main () {
  while (1) {
    int W, H;
    scanf("%d%d", &W, &H);
    if (W==0 && H==0) break;
    printf("%d\n", solve(W,H));
  }

  return 0;
}

// ?????£?????¢?´¢ 
int solve (int W, int H) {
  Coord start;             // ??????????????°???
  int i, j;

  //  ?£?????????????????¨???? 
  for (i=0; i<=W+1; i++) { M[0][i] = '#'; M[H+1][i] = '#'; }
  for (i=1; i<=H; i++) { M[i][0] = '#'; M[i][W+1] = '#'; }
  // ??????????????\??? 
  for (i=1; i<=H; i++) {
    for (j=1; j<=W; j++) {
      scanf(" %c", &M[i][j]);
      if (M[i][j]=='@') {
	start.row = i;
	start.col = j;
      }
    }
  }

  return search_df(W, H, start);
}

int search_df (int W, int H, Coord start) {
  stack S = new_stack ();  // ?¨?????????????????????????????????????
  int c = 1;               // ????????????????????????????????°???????????? 1 ??§?????????
  // ??????????????°???????¨????
  push(S,start);                               // ??????????????°?????? push
  // ??¢?´¢
  while (!is_empty(S)) {
    Coord current = pop(S);                    // pop ???????????????
    int d;                                     // ??????
    int D1[]={1,0,-1,0}; int D2[]={0,-1,0,1};  // ????????¢?????¶?????¨
    for (d=0; d<4; d++) {
      Coord nc = current;                      // Next Cell
      nc.row += D1[d];  nc.col += D2[d]; 
      if (M[nc.row][nc.col] == '.') {
	M[nc.row][nc.col] = '*';               // ?????°???????????°?????????
	c++;                                   // ???????????????????????????????????????
	push(S,nc);
      } // nc ????????¢?´¢?????? (*) ????£? (#) ?????´?????????????????????
    } 
  }
  return c;  // ??°??????????????????????????°?????????
}

/* ??°??????????????????????¢?????????????????????? */
stack new_stack (void) {
  stack s;
  s = (stack) malloc (sizeof (stackelem));
  if (s == NULL) return NULL;
  s->next = NULL;
  return s;
}
    
/* ???????????????????????????????????? */
int is_empty (stack s) {
  return (s && s->next == NULL);
}

/* ??°??????????´???????????????\ */
int push (stack s, Coord v) {
  stack p;
  if (s == NULL) return 0;
  p = (stack) malloc (sizeof (stackelem));
  if (p == NULL) return 0;
  p->point = v;
  p->next = s->next;
  s->next =  p;
  return 1;
}

/* ?????????????´?????????? */
Coord top (stack s) {
  if (s && s->next) 
    return s->next->point;
  exit (1);
}

/* ????????? */
Coord pop (stack s) {
  stack p;
  Coord v = top (s);
  p = s->next;
  s->next = p->next;
  free (p);
  return v;
}

Measured memory_bytes: 616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = (ll)1e9 + 7;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}
ll rev(ll x) {
	return bin_pow(x, MOD - 2);
}

const int N = 200200;
ll f[N], rf[N];
ll pA[N], pB[N];
int n;
ll A, B, C;

ll getC(int n, int k) {
	if (k < 0 || k > n) return 0;
	return mult(f[n], mult(rf[k], rf[n - k]));
}

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

	ll x;
	cin >> x;
	cout << 180 * (x - 2) << endl;
	return 0;

	f[0] = 1;
	for (int i = 1; i < N; i++)
		f[i] = mult(f[i - 1], i);
	rf[N - 1] = rev(f[N - 1]);
	for (int i = N - 1; i > 0; i--)
		rf[i - 1] = mult(rf[i], i);

	scanf("%d%lld%lld%lld", &n, &A, &B, &C);
	pA[0] = pB[0] = 1;
	pA[1] = mult(A, rev(A + B));
	pB[1] = mult(B, rev(A + B));
	for (int i = 2; i < N; i++) {
		pA[i] = mult(pA[i - 1], pA[1]);
		pB[i] = mult(pB[i - 1], pB[1]);
	}
	ll ans = 0;
	for (int k = 0; k < n; k++) {
		ll cur = getC(n - 1 + k, k);
		ans = add(ans, mult(mult(cur, n + k), add(mult(pA[n], pB[k]), mult(pB[n], pA[k]))));
	}
	ans = mult(ans, mult(100, rev(A + B)));
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int a,b,c;
    while(1){
        cin >> a >> b >> c;
        
        if(a==-1 && b == -1 && c == -1){
            break;
        }
        else if(a==-1 || b==-1){
            cout << "F" << endl;
        }
        else if(a+b >= 80){
            cout << "A" << endl;
        }
        else if(a+b >= 65){
            cout << "B" << endl;
        }
        else if(a+b >= 50){
            cout << "C" << endl;
        }
        else if(a+b >= 30){
            if(c >= 50){
                cout << "C" << endl;
            }
            else{
                cout << "D" << endl;
            }
        }
        else{
            cout << "F" << endl;
        }
    }


    return 0;
}



Measured memory_bytes: 3104
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define d_flag 0
int n,m;

typedef int atom;

typedef struct _cell
{
  atom car;
  struct _cell *cdr;
} cell;

#define NULL_ATOM 0;
cell* make_cell(atom val);
void delete_cell(cell* cp);
cell* cons(atom val,cell* cp,int *err);
atom pop(cell** cpp, int *err);
void print_atom(atom val);
void print_list(cell* cp);

cell* swi[10];
int l[10][10];
int p[10];

int lit(int x){
  int try[10];
  int i,j,count=0;
  if(d_flag)    printf("try %d\n",x);

  for(i=0;i<m;i++)
    try[i]=p[i];
  while(x){
    cell* temp=swi[count];
    if(x&1){
      while(temp!=NULL){
	int a=temp->car;
	try[a]^=1;
	temp=temp->cdr;
      }
    }
    count++;
    x/=2;
  }
  int flag=1;
  if(d_flag){
    for(i=0;i<m;i++)
      printf("%d",try[i]);
    printf("\n");
  }
    
  for(i=0;i<m;i++)
    if(try[i]){
      flag=0;break;
    }
  return flag;
}
int main(){
  int i,j,err,s;
  for(i=0;i<m;i++)
    swi[i]=NULL;
  scanf("%d%d",&n,&m);

  for (i=0;i<m;i++){
    int k;
    scanf(" %d",&k);
    for(j=0;j<k;j++){
      scanf(" %d",&s);
      s--;
      swi[s]=cons(i,swi[s],&err);
    }
  }
  for(j=0;j<m;j++)
    scanf("%d",&p[j]);

  if(d_flag){
    for(i=0;i<n;i++){
      printf("swi %d:",i);
      print_list(swi[i]);
    }
    printf("\n");
  }
  int count=0;
  for(i=0;i<1<<n;i++){
    int flag=lit(i);
    if(flag)count++;
  }
  printf("%d",count);
  for(i=0;i<n;i++)
    free(swi[i]);
  return 0;
}
cell* make_cell(atom val)
{
  cell* ncellp=malloc(sizeof(cell));
  if(ncellp!=NULL)
    {
      ncellp->car=val;
      ncellp->cdr=NULL;
    }
  else
    printf("not enough memory.\n");
  return ncellp;
}


void delete_cell(cell* cp)
{
  cell* temp=cp,*next;
  while(temp!=NULL)
    {
      next=temp->cdr;
      free(temp);
      temp=next;
    }
}

cell* cons(atom val,cell* cp,int *err)
{
  cell* top=make_cell(val);
  if(top!=NULL)
    {
      *err=1;
      top->cdr=cp;
      return top;
    }
  *err=0;
  return cp;
}

atom pop(cell** cpp, int *err)
{
  if(*cpp==NULL)
    {
      *err=0;
      printf("nil.\n");
      return NULL_ATOM;
    }

  atom it=(*cpp)->car;
  cell* temp=(*cpp)->cdr;
  *err=1;
  free(*cpp);
  *cpp=temp;
  return it;
}
void print_atom(atom val)
{
  printf("%d",val);
}

void print_list(cell* cp)
{
  cell* temp=cp;
  printf("[");
  while(temp!=NULL)
    {
      printf(" ");
      print_atom(temp->car);
      temp=temp->cdr;
    }
  printf(" ]\n");
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

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

int main(){
    string s;
    cin >> s;
    int ans = 100000;
    rep(i, s.size() - 2){
        int tmp = 0;
        rep(j, 3){
            tmp *= 10;
            tmp += (s[i + j] - '0');
        }
        if(abs(tmp - 753) < ans){
            ans = abs(tmp - 753);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
input_line = int(input())
fizzbuzz_list = []

for i in range(input_line + 1):
    if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:
        pass
    else:
        fizzbuzz_list.append(i)
print(sum(fizzbuzz_list))

Measured memory_bytes: 29980
#!/usr/bin/env python3

x = int(input())

ans = 1
for i in range(2, 32):
    ans_tmp = 1
    while(1):
        # print(ans_tmp**i)
        if (ans_tmp+1)**i <= x:
            ans_tmp += 1

        else:
            break
    ans = max(ans, ans_tmp**i)
print(ans)


Measured memory_bytes: 8952
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <array>
#include <tuple>
#include <utility>
#include <numeric>
#include <iomanip>
#include <cctype>
#include <cmath>
#include <assert.h>
#include <cstdlib>
#include <list>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

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) {
    s << "[";
    for (int i = 0; i < v.size(); i++) s << (i == 0 ? "" : ", ") << v[i];
    s << "]";
    return s;
}

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

vector<int> graph[200005];
int color[200005];

bool dfs(int v, int d) {
    color[v] = d;

    bool res = false;
    for (int to : graph[v]) {
        if (color[to] < 0) {
            res = res || dfs(to, d ^ 1);
        } else if (color[to] != (d ^ 1)) {
            res = true;
        }
    }
    return res;
}

int main() {
    ll N, M;
    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        A--; B--;
        graph[A].push_back(B);
        graph[B].push_back(A);
    }

    memset(color, -1, sizeof(color));

    bool flag = dfs(0, 0);
    if (flag) {
        cout << (N * (N - 1)) / 2 - M << endl;
    } else {
        ll even = 0, odd = 0;
        for (int v = 0; v < N; v++) {
            if (color[v] == 0) even++;
            else odd++;
        }
        cout << even * odd - M << endl;
    }

    return 0;
}


Measured memory_bytes: 9216
#include<iostream>
#include<algorithm>
#include<sstream>
#include<stack>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<deque>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < n;i++)
#define req(i,n) for(int i = 1;i <= n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define fix  fixed << setprecision(10)
const int MOD = 1000000007;
const ll INF = (1LL << 60);
string s; ll n, m, k, q = 0, ans, sum =INF;
ll r = 0, g = 0, b =0;
int main() {
    cin >> n >> s;
    rep(i, n) {
        if (s[i] == 'R') r++;
        else if (s[i] == 'G') g++;
        else b++;
    }
    sum = r * g * b;
    rep(i, n - 2) {
        for (int j = 1; i + j * 2 < n;j++) {
            if (s[i] != s[j + i] && s[i +j] != s[i + 2*j] && s[i] != s[i + 2*j]) sum--;
        }
    }
    cout << sum << endl;
}

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

using namespace std;

int main(){
    string s;
    int cnt,res;
    bool isStart = false;
    
    cin >> s;

    cnt = 0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A' && isStart == false){
            cnt++;
            isStart = true;
            continue;
        }
        if(isStart)
            cnt++;
        
        if(s[i] == 'Z')
            res = cnt;
    }

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

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <stack>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}

bool hasA(int bd[8][8]) {
    for (int i = 0; i < 7; i++) {
        for (int j = 0; j < 7; j++) {
            if (bd[i][j] && bd[i][j+1] && bd[i+1][j] && bd[i+1][j+1]) return true;
        }
    }
    return false;
}

bool hasB(int bd[8][8]) {
    for (int i = 0; i < 5; i++) {
        for (int j = 0; j < 8; j++) {
            if (bd[i][j] && bd[i+1][j] && bd[i+2][j] && bd[i+3][j]) return true;
        }
    }
    return false;
}

bool hasC(int bd[8][8]) {
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 5; j++) {
            if (bd[i][j] && bd[i][j+1] && bd[i][j+2] && bd[i][j+3]) return true;
        }
    }
    return false;
}

bool hasD(int bd[8][8]) {
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {
            if (bd[i][j+1] && bd[i+1][j] && bd[i+1][j+1] && bd[i+2][j]) return true;
        }
    }
    return false;
}

bool hasE(int bd[8][8]) {
    for (int i = 0; i < 7; i++) {
        for (int j = 0; j < 6; j++) {
            if (bd[i][j] && bd[i][j+1] && bd[i+1][j+1] && bd[i+1][j+2]) return true;
        }
    }
    return false;
}

bool hasF(int bd[8][8]) {
    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 7; j++) {
            if (bd[i][j] && bd[i+1][j] && bd[i+1][j+1] && bd[i+2][j+1]) return true;
        }
    }
    return false;
}

bool hasG(int bd[8][8]) {
    for (int i = 0; i < 7; i++) {
        for (int j = 0; j < 6; j++) {
            if (bd[i][j+1] && bd[i][j+2] && bd[i+1][j] && bd[i+1][j+1]) return true;
        }
    }
    return false;
}

int main() {
    string s;
    int bd[8][8];
    while(cin >> s) {
        REP(i,8) bd[0][i] = s[i] - '0';
        REP(j,7) {
            cin >> s;
            REP(i,8) bd[j+1][i] = s[i] - '0';
        }
        // input ends
        if (hasA(bd)) cout << "A" << endl;
        else if (hasB(bd)) cout << "B" << endl;
        else if (hasC(bd)) cout << "C" << endl;
        else if (hasD(bd)) cout << "D" << endl;
        else if (hasE(bd)) cout << "E" << endl;
        else if (hasF(bd)) cout << "F" << endl;
        else if (hasG(bd)) cout << "G" << endl;
    }
    return 0;
}

Measured memory_bytes: 1176
package main

import(
    "fmt"
)



func main() {
    var a,b,c,d int
    fmt.Scan(&a,&b,&c,&d)
    ans := min32(a,b) + min32(c,d)
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512