akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var abc = IO.RSLong;
            if (abc.Where(x => x % 2 == 0).Count() >= 1)
                WriteLine(0);
            else
            {
                Array.Sort(abc);
                WriteLine(abc[0] * abc[1]);
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

signed main(void)
{
	int n, q;
	string s;
	cin >> n >> q >> s;
	int l[q], r[q], cnt[n + 1];
	rep(i, q) cin >> l[i] >> r[i];
	rep(i, n + 1) cnt[i] = 0;
	for(int i = 1; i <= n; i++)
	{
		if ("AC" == s.substr(i - 1, 2))
			cnt[i + 1]++;
	}
	rep(i, n + 1) cnt[i + 1] += cnt[i];
	rep(i, q)
		cout << cnt[r[i]] - cnt[l[i]] << endl;
	return 0;
}


Measured memory_bytes: 2176
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
map<int,int>mapp;
int main()
{
   mapp[1]=1;
   mapp[3]=1;
   mapp[5]=1;
   mapp[7]=1;
   mapp[8]=1;
   mapp[10]=1;
   mapp[12]=1;
   mapp[4]=2;
   mapp[6]=2;
   mapp[9]=2;
   mapp[11]=2;
   mapp[2]=3;
   int x,y;
   while(cin>>x>>y)
   {
      if(mapp[x]==mapp[y])
         cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        int n=S.length();
        char[] s = S.toCharArray();
        int[] ans = new int[n];

        int i=0;
        while(i<n){
            int Rcnt=0;
            while(i<n && s[i]=='R'){
                i++;
                Rcnt++;
            }
            int ni=i;
            ans[ni-1]=ans[ni-1]+(Rcnt+1)/2;
            ans[ni]=ans[ni]+Rcnt/2;

            int Lcnt=0;
            while(i<n && s[i]=='L'){
                i++;
                Lcnt++;
            }
            ans[ni-1]=ans[ni-1]+Lcnt/2;
            ans[ni]=ans[ni]+(Lcnt+1)/2;
        }
        for (int j = 0; j < n; j++) {
            System.out.print(ans[j] + " ");
        }
    }
}


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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(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()

int main() {
  int n, c;
  cin >> n >> c;
  ll d[c + 1][c + 1];
  for (int i = 1; i <= c; ++i) {
    for (int j = 1; j <= c; ++j) {
      cin >> d[i][j];
    }
  }
  ll g[n + 1][n + 1];
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cin >> g[i][j];
    }
  }
  ll count[3][c + 1];
  for (int i = 0; i < 3; ++i) {
    for (int j = 1; j <= c; ++j) {
      count[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      count[(i + j) % 3][g[i][j]]++;
    }
  }
  ll cost[3][c + 1];
  for (int i = 0; i < 3; ++i) {
    for (int j = 1; j <= c; ++j) {
      cost[i][j] = 0;
    }
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 1; j <= c; ++j) {
      for (int k = 1; k <= c; ++k) {
        cost[i][k] += count[i][j] * d[j][k];
      }
    }
  }
  ll ans = 1e18;
  for (int i = 1; i <= c; ++i) {
    for (int j = 1; j <= c; ++j) {
      for (int k = 1; k <= c; ++k) {
        if (i != j && j != k && k != i) {
          ll res = cost[0][i] + cost[1][j] + cost[2][k];
          ans = min(ans, res);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

void solve(vector<map<string,int> > &mp,map<string,int> &namelist,int i,bool (&check)[103]){
  if(check[i])return;
  check[i] = true;
  for(auto itr = mp[i].begin();itr != mp[i].end();itr++){
    if(namelist[itr->first]){
      mp[i][itr->first] = 0;
      solve(mp,namelist,namelist[itr->first],check);
    }else{
      mp[1][itr->first]++;
    }
  }
}

int main(){
  int n;
  while(cin>>n,n){
  vector<map<string,int> > mp(103,map<string,int>());
  map<string,int> namelist;
  bool check[103];
  fill(check,check+103,false);
    for(int i = 1;i <= n;i++){
      string s;
      cin >> s;
      int si = 0;
      while(s[si]!=':')si++;
      namelist[s.substr(0,si)] = i;
      int starts = si+1;
      for(int sj = si;sj < s.size();sj++){
	if(s[sj] == ',' || s[sj] == '.'){
	  mp[i][s.substr(starts,sj-starts)] = 1;
	  starts = sj+1;
	}
      }
    }
    solve(mp,namelist,1,check);
    int ct = 0;
    for(auto itr = mp[1].begin();itr != mp[1].end();itr++){
      if(itr->second>0)ct++;
    }
    cout << ct << endl;
  }
  return 0;
}

Measured memory_bytes: 3340
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = Number(arr[0]);
  const b = arr[1].split(' ').map(x => Number(x));
  let isPass = true;

  for (let i = 0; i < a; i ++) {
    if (b[i] % 2 === 0) {
      if (b[i] % 3 === 0 || b[i] % 5 === 0) {
        continue;
      } else {
        isPass = false;
      }
    }
  }
  
  console.log(isPass ? 'APPROVED' : 'DENIED');
}

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

Measured memory_bytes: 18364
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

vector<int> binary(int i, int n, int N){
    int x = 1;
    rep(j,N){
        x *= n;
    }
    vector<int> vec(N);
    rep(j,N){
        x /= n;
        vec[j] = i / x;
        i -= x * vec[j];
    }
    return vec;
}

int main(){
    int N,M;
    cin >> N >> M;
    vector<vector<int> > vec(0);
    rep(i,M){
        int k;
        cin >> k;
        vector<int> vect(k);
        rep(j,k){
            cin >> vect[j];
            vect[j]--;
        }
        vec.push_back(vect);
    }
    vector<int> p(M);
    rep(i,M){
        cin >> p[i];
    }
    int c = 1;
    rep(i,N){
        c *= 2;
    }
    int ans = 0;
    rep(i,c){
        vector<int> bin = binary(i,2,N);
        int light = 0;
        rep(j,M){
            int switches = 0;
            int len = vec[j].size();
            rep(k,len){
                if (bin[vec[j][k]] == 1) switches++;
            }
            if (switches % 2 == p[j]) light++;
        }
        if (light == M) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import math

def f(n):
    divisor = [1]
    limit = math.ceil(math.sqrt(n))
    for n2 in range(2, limit+1):
        if n % n2 == 0:
            divisor.append(n2)
    n1 = max(divisor)
    n2 = n // n1
    print(n1 + n2 - 2)

n = int(input())
f(n)


Measured memory_bytes: 3068
#include<iostream>
#include<vector>
#include <cstdio>
using namespace std;

int main(){
  int N,M;
  while(cin>>N>>M,N||M){
    long double t[100][100];
    long double dp[M][N];

    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
	scanf("%Lf",&t[i][j]);
      }
    }

    for(int i=0;i<M;i++){
      for(int j=0; j<N;j++){
	dp[i][j]=0;
      }
    }
    for(int i=0;i<N;i++) dp[0][i]=1.0;

    for(int i=1;i<M;i++){
      for(int j=0;j<N;j++){
	for(int k=0;k<N;k++){
	  dp[i][j]=max(dp[i][j],dp[i-1][k]*t[k][j]);
	}
      }
    }
    long double ans=0;

    for(int i=0;i<N;i++) ans=max(ans,dp[M-1][i]);

    printf("%.2Lf\n",ans);
  }
}

Measured memory_bytes: 1460
//ATCoder
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<(x)<<endl
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf=1e18;
const int N=2e5+10;
ll factorial(ll x){//階乗の計算
    if(x==0||x==1) return 1;
    return x*factorial(x-1);
}
ll gcd(ll a ,ll b){return b ? gcd(b,a%b) : a;}//最大公約数
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}//最小公倍数
int num_digit(ll a){//桁数を求める
    int num_dig = 0;
    while(a!=0){
        a /= 10;
        ++num_dig;
    }
    return num_dig;
}
vector<ll> digit(ll a){//桁の数字を求める
    vector<ll> dig(num_digit(a));
    for(int i=num_digit(a)-1; i>=0; --i){
        dig[i] = a%10;
        a /= 10; 
    }
    return dig;
}


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

    int cnt = 0;
    int cnt_max = 0;
    rep(i,(int)s.size()){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            ++cnt;
        }
        else{
            cnt = 0;
        }
        if(cnt_max<cnt) cnt_max = cnt;
    }
    cout(cnt_max);
    return 0;
}

Measured memory_bytes: 256
/*
 *  Author :: Kattu37
 */

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

#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortallr(x) sort(allr(x))
#define PI 3.1415926535897932384626
#define mod 1000000007

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

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

void solve()
{
	int h, w;
	cin >> h >> w;

	int p, q, r, s;
	cin >> p >> q;
	cin >> r >> s;
	p--;
	q--;
	r--;
	s--;

	queue<pair<int, int> > qu;
	vector<vector<bool> > vis(h, vector<bool> (w, 0));
	set<pair<int, int> > st;
	vector<string> grid;
	string str;

	for (int i = 0; i < h; i++)
	{
		cin >> str;
		grid.pb(str);
	}


	qu.push({p, q});
	vis[p][q] = 1;
	int magic = 0;
	bool ctr = 0;

	while (qu.empty() == 0)
	{
		int sz = qu.size();

		while (sz--)
		{
			pair<int, int> p = qu.front();
			qu.pop();
			st.insert({p.first, p.second});

			if (p.first == r && p.second == s)
			{
				ctr = 1;
				break;
			}

			for (int i = 0; i < 4; i++)
			{
				int in = p.first + dx[i];
				int jn = p.second + dy[i];

				if (in >= 0 && in < h && jn >= 0 && jn < w)
				{
					if (!vis[in][jn] && grid[in][jn] == '.')
					{
						if (in == r && jn == s)
						{
							ctr = 1;
							break;
						}
						vis[in][jn] = 1;
						qu.push({in, jn});
						sz++;
					}
				}
			}
			if (ctr)
				break;
		}

		if (ctr)
			break;

		for (auto it : st)
		{
			for (int i = -2; i <= 2; i++)
			{
				for (int j = -2; j <= 2; j++)
				{
					int in = it.first + i;
					int jn = it.second + j;

					if (in >= 0 && in < h && jn >= 0 && jn < w)
					{
						if (!vis[in][jn] && grid[in][jn] == '.')
						{
							vis[in][jn] = 1;
							qu.push({in, jn});
						}
					}
				}
			}
		}

		st.clear();
		magic++;
	}

	if (ctr)
		cout << magic << "\n";
	else cout << -1 << "\n";
}

int main(void)
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}


Measured memory_bytes: 5320
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N; i >= 0; i--)
const ll INF = 1000000000000000000;
#define PI 3.1415926535
using Graph = vector<vector<int>>;
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;}
bool seen[510][510];
/*void dfs(const Graph &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}*/

//input



//processing
bool a = false,ans = false;



//dpTable
//int dp[100050];
int main(){
    string S;
    cin >> S;
    rep (i,S.size()) {
        if (S.at(i) == 'C') {
            a = true;
        }
        else if (S.at(i) == 'F' && a) {
            ans = true;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
int main(){
  int i;
  int a,b,n,sum;
  while(scanf("%d%d%d",&a,&b,&n)!=-1){
    a%=b;
    sum=0;
    for(i=0;i<n;i++){
      sum+=a*10/b;
      a=a*10%b;
    }
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES
#include <array>
#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>
#include <random>
#include <ctime>

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 << 29;
const int MOD = 1e9 + 7;

const int N = 1 << 18;
int c[N];

void insert(int x, int y) {
  for (; x < N; x += x & -x) {
    c[x] += y;
  }
}

int query(int x) {
  int ret = 0;
  for (; x; x -= x & -x) {
    ret += c[x];
  }
  return ret;
}

int main() {
  int n, m;
  scanf("%d", &m);
  n = 1 << m;
  vector<int> a(n), A;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    A.push_back(a[i]);
  }
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  for (int i = 0; i < n; ++i) {
    a[i] = lower_bound(A.begin(), A.end(), a[i]) - A.begin() + 1;
    insert(a[i], 1);
    // trace(i, a[i]);
  }

  int x = *max_element(a.begin(), a.end());
  A = {x};
  insert(x, -1);
  vector<int> B;
  for (int k = 0; k < m; ++k) {
    B.clear();
    for (auto& x : A) {
      int target = query(x - 1);
      if (target == 0) {
        puts("No");
        return 0;
      }
      int low = 1, high = x - 1;
      while (low < high) {
        int mid = (low + high) / 2;
        if (query(mid) < target) {
          low = mid + 1;
        } else {
          high = mid;
        }
      }
      B.push_back(high);
      insert(high, -1);
      // trace(x, high);
    }
    for (auto& it : B) A.push_back(it);
  }
  puts("Yes");
  return 0;
}


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


// # DEFINES # //
#define ll long long
#define M (ll)(1e9+7)
#define EPS 1e-9

using namespace std;

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

    ll n;

    cin >> n;

    if(n % 2 == 0)
        cout << n << endl;
    else 
        cout << 2*n << endl;
 
    return 0;
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
vector<pair<int,int>>ba(n);
rep(i,n){
    int a,b;
    cin>>a>>b;
    ba[i]={b,a};
}
sort(ba.begin(),ba.end());
int now_t=0;
string ans="Yes";
rep(i,n){
    int b=ba[i].first;
    int a=ba[i].second;
    if(b<a+now_t){
        ans="No";
        break;
    }
    now_t=a+now_t;
}
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 4740
#include "bits/stdc++.h"
#include <set>

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 rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>>a(n, vector<int>(m));
	vector<int>c(n);
	rep(i, n) {
		cin >> c[i];
		rep(j, m) {
			cin >> a[i][j];
		}
	}
	int res = INF;
	for (int bit = 0; bit < (1 << n); ++bit) {
		vector<int>skill(m,0);
		int tmpprice = 0;
		rep(i,n){
			if (bit & (1 << i)) { // i番目の本を買った場合
				rep(j, m) {
					skill[j] += a[i][j];
				}
				tmpprice += c[i];
			}
		}
		//print(tmpprice);
		//rep(i, m) {
		//	print(skill[i]);
		//}
		//println("");
		bool ok = true;
		rep(i, m) {
			if (skill[i] < x) {
				ok = false;
			}
		}
		if (ok) {
			res = min(res, tmpprice);
			//print("res=");
			//println(res);
		}
	}
	if (res == INF)res = -1;
	print(res);
}


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

int main() {
	int N;
	cin >>N;
	int A[N];
	for(int i=0 ; i<N ;i++){
		cin >>A[i];
	}
	int k=0;
	for(int i=0;i<N;i++){
		int minj=i;
		for(int j=i;j<N;j++){
			if(A[j]<A[minj]){
				minj =j ;
			}
		}
		if(i != minj){
			swap(A[i],A[minj]);
			k++;
		}
	}
	cout <<A[0];

	for(int i=1;i<N;i++){
		cout <<" "<<A[i];
	}
	cout <<endl<<k<<endl;
}


Measured memory_bytes: 3068
#include <iostream>
#include <vector>
using namespace std;
constexpr long long MOD = 1000000007;
long long N;
vector<long long> A;
int main() { 
  long long ans = 0;
  cin >> N;
  for(int i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    A.push_back(a);
  }
  long long *A_sum = new long long[200001];
  A_sum[N] = 0;
  for (int i = N - 1; i >= 0; --i) {
    A_sum[i] = (A_sum[i + 1] + A[i]) % MOD;
  }
  for (int i = 0; i < N-1; ++i) {
    ans = (ans + (A[i] * A_sum[i+1]) % MOD ) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6320
#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() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> maze(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    maze.at(a).push_back(b);
    maze.at(b).push_back(a);
  }

  // 幅優先探索を行う
  queue<int> q;
  vector<int> sign(n, -1);

  q.push(0);
  sign.at(0) = 0;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int u : maze.at(x)) {
      if (sign.at(u) != -1) continue;
      q.push(u);
      sign.at(u) = x;
    }
  }

  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) {
    cout << sign.at(i) + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 10244
#include<stdio.h>
#define N 100

int main(){
  
  int i,v,j,k,A[1000],n;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    }
  for(i=0;i<n;i++){
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
      
    }
    
    for(k=0;k<n;k++){
    printf("%d",A[k]);
    if(k!=n-1)printf(" ");
    
  }
    printf("\n");
    
  }
  
  return 0;
}



Measured memory_bytes: 2068
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include<iomanip>

using namespace std;

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

    int M[1000] = {0};
    long long count = 0;
    for(int i= 0;i<10;i++)
    {
        int ret = S.find_first_of(std::to_string(i));
        if(ret==-1)continue;
    
        for(int j = 0;j<10;j++)
        {
            int ret2 = S.find_first_of(std::to_string(j),ret+1);
            if(ret2==-1)continue;
            for(int k = 0;k<10;k++)
            {
                int ret3 = S.find_first_of(std::to_string(k),ret2+1);
                if(ret3==-1)continue;
                char c[3] = {S[ret],S[ret2],S[ret3]};
                string s = c;
                int ret = std::stoi(s);
                if(M[ret]==0)
                {
                    M[ret]=1;
                    count++;
                }
               
            }

        }
    }

    cout<<count<<endl;
    
}

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

using namespace std;

int main() {

	int n;	
	cin >> n;

	int a[n+1];
	int b[n+1];
	int c[n+1];
	
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	for (int i = 1; i <= n; i++)
		cin >> b[i];
	for (int i = 1; i <= n-1; i++)
		cin >> c[i];
	
	int anterior = -10000;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += b[a[i]];
		if(anterior == a[i]-1)
			ans += c[anterior];
		anterior = a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i,diff;
  char str[1200];
  for(i=0;i<1200;i++){
    scanf("%c",&str[i]);
    if(str[i]=='\n')break;
  }

  diff='a'-'A';

  for(i=0;i<1200;i++){
    
    if(str[i]>=65 && str[i]<=90)str[i]+=diff;
    else if(str[i]>=97 && str[i]<=122)str[i]-=diff;
    else if(str[i]=='\n')break;
  }

  for(i=0;i<1200;i++){
    printf("%c",str[i]);
    if(str[i]=='\n')break;
  }
   
  

  return 0;

}

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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int sum = 0;
  for (auto &a : A) {
    cin >> a;
    sum += a;
  }
  sort(A.rbegin(), A.rend());
  bool ok = true;
  for (int i = 0; i < M; i++) {
    if (A[i] * 4 * M < sum) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
/* vim:set fdm=marker: */


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

int main(int argc, const char * argv[]) {
    int *a;
    int n;
    int i, j;
    int v;
    
    if ((a = (int *)malloc(sizeof(int) * n)) == NULL) {
        exit(EXIT_FAILURE);
    }
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    
    for (i = 0; i < n; i++) {
        v = a[i];
        j = i - 1;
        while (j >= 0 && a[j] > v) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        
        for (j = 0; j < n; j++) {
            printf("%d", a[j]);
            if (j != n-1) {
                printf(" ");
            } else {
                printf("\n");
            }
        }
    }
    
    return 0;
}



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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n;
    cin >> n;

    map<string, int> m;
    string s;
    for(int in=0;in<n;in++) {
        cin >> s;
        m[s]++;
    }

    int ans = 0;
    for(auto im:m) {
        ans++;
    }

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


Measured memory_bytes: 19176
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N):
    nn, pn, np, pp = [8, 1, 1, 0]
    for i in range(N - 1):
        pp = (pp * 10 + np + pn) % MOD
        pn = (pn * 9 + nn) % MOD
        np = (np * 9 + nn) % MOD
        nn = (nn * 8) % MOD

    return pp


def main():
    # parse input
    N = int(input())
    print(solve(N))


# tests
T1 = """
2
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
2
"""

T2 = """
1
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
0
"""

T3 = """
869121
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
2511445
"""

T4 = """
3
"""
TEST_T4 = """
>>> as_input(T4)
>>> main()
54
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


Measured memory_bytes: 63564
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        int a=i;
        int cnt=0;
        while(a>0){
            a/=10;
            cnt++;
        }
        if(cnt%2==1) ans++;
    }
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	int n, l;
	cin >> n >> l;
	VE vec(n);
	int min_abs=INT_MAX,min_ind=0;
	REP(i, n) {
		vec[i] = l + i;
		if (abs(vec[i]) < min_abs) {
			min_abs = abs(vec[i]);
			min_ind = i;
		}
	}
	vec.erase(vec.begin() + min_ind);
	cout << accumulate(vec.begin(), vec.end(), 0) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
//#include <list>
#include <iomanip>
//#include <stdlib.h>
//#include <cctype>

using namespace std;

const int MAX_N = 1000000;
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
//typedef pair<int,int> P;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}


Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

void y() {
    cout << "Yes" << endl;
    exit(0);
}

void n() {
    cout << "No" << endl;
    exit(0);
}

void Y() {
    cout << "YES" << endl;
    exit(0);
}

void N() {
    cout << "NO" << endl;
    exit(0);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}

/*   kokomade  */

int cnt = 0;
bool is_prime[ 50000 + 1 ];
vector<int> P;
void Eratosthenes( const int N )
{
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;//初期化
    }
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
}

int main() {
    IOS;
    int n,a,b,ans=0;
    string str,s,t;
    cin>>n;
    if(n%2==0)cout<<n/2-1;
    else cout<<(n-1)/2;
    //for (int i = 1; i < n; ++i) {
    //    if(i)
    //}




    cout<<endl;
    return 0;
}

/*
テレビも無ェ ラジオも無ェ
自動車もそれほど走って無ェ
ピアノも無ェ バーも無ェ
巡査 毎日ぐーるぐる
朝起ぎで 牛連れで
二時間ちょっとの散歩道
電話も無ェ 瓦斯も無ェ
バスは一日一度来る
俺らこんな村いやだ 俺らこんな村いやだ
東京へ出るだ 東京へ出だなら
銭コァ貯めで 東京でベコ(牛)飼うだ
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;

char a[202][202];
int n, vis[202];

int main() {

    //ios_base::sync_with_stdio(0);
    //cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i)
    	for(int j = 0; j < n; ++j) {
    		cin >> a[i][j];
    		a[i][j] -= '0';
    	}
    int ans = -1;
    for(int i = 0; i < n; ++i) {
    	int cur = -1;
    	bool k = 1;
    	queue<int> q;
    	memset(vis, 0, sizeof vis);
    	vis[i] = 1;
    	q.push(i);
    	while(!q.empty() && k) {
    		int x = q.front();
    		q.pop();
    		cur = max(cur, vis[x]);
    		for(int i = 0; i < n; ++i)
    			if(a[x][i]) {
    				if(!vis[i]) {
    					q.push(i);
    					vis[i] = vis[x] + 1;
    				}
    				else {
    					if(abs(vis[x] - vis[i]) != 1) {
    						k = 0;
    						break;
    					}
    				}
    			}
    	}
    	if(k) ans = max(ans, cur);
    }
    cout << ans << endl;	

}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
int main() {
	int time[4] = {};
	cin >> time[0];
	cin >> time[1];
	cin >> time[2];
	cin >> time[3];
	int sum = 0;
	sum = time[0] + time[1] + time[2] + time[3];
	int sm = 0;
	while (sum >= 60) {
		sum -= 60;
		sm++;
	}
	cout << sm << endl;
	cout << sum << endl;
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int64_t answer = 0;
  vector<int> data(n);
  for(int i = 0; i < n; i++){
    cin >> data.at(i);
    answer += data.at(i);
  }
  sort(data.begin(), data.end());
  cout << data.at(0) << " " << data.at(n - 1) << " " << answer << endl;
}



Measured memory_bytes: 3204
#include <iostream>
#include <algorithm>
#include <utility>

using namespace std;

const int T = 50, P = 10;

struct team{
	int id, time, score;
	int counts[P];
};

team teams[T] = { };

bool comp(const team& a, const team& b){
	if(a.score == b.score){
		if(a.time == b.time){
			return a.id > b.id;
		}
		return a.time < b.time;
	}
	else{
		return a.score > b.score;
	}
}

int main(){
	int m, t, p, r;
	while(cin >> m >> t >> p >> r){
		int a, b, c, d;
		for(int i = 0;i < t;++i){
			teams[i].id = i + 1;
			teams[i].time = teams[i].score = 0;
			fill(teams[i].counts, teams[i].counts + P, 0);
		}
		for(int i = 0;i < r;++i){
			cin >> a >> b >> c >> d;
			--b;
			if(!d){
				teams[b].time += a + teams[b].counts[--c] * 20;
				++teams[b].score;
			}
			else{
				++teams[b].counts[--c];
			}
		}
		sort(teams, teams + t, comp);
		for(int i = 0;i < t;++i){
			if(i > 0){
				if(teams[i - 1].time == teams[i].time && teams[i - 1].score == teams[i].score) cout << "=";
				else cout << ",";
			}
			cout << teams[i].id;
			if(i == t - 1) cout << endl;
		}
	}
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    int vi;
    vector<int> V;
    for(int i=0;i<N;i++){
        cin >> vi;
        V.push_back(vi);
    }
    sort(V.begin(), V.end());
    double res = (V[0] + V[1])/2.;
    for(int i=2;i<N;i++){
        res = (res + V[i])/2.;
    }
    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  Delivery to a Luxurious House
//
//  Created by x15071xx on 2017/06/19.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int n,m,t,taroSc[100000] = {0},time=0;
    vector<int> cometime;
    cin >> n >> m >> t;
    
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        cometime.push_back(tmp);
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = cometime[i]-m; j < cometime[i]+m; j++) {
            taroSc[j] = 1;
        }
    }
    
    for (int i = 0; i < t; i++) {
        if (taroSc[i] == 0) {
            time++;
        }
    }
    
    cout << time << endl;
    return 0;
}

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

int main() {
  
  int n;
  cin >> n;
  int a[n];
  for(int i = 0 ; i < n ; i++){
    cin >> a[i];
  }
  int cnt = 0;
  for(int i = 0 ; i < n ; i+=2){
    if(a[i]%2 == 1){
      cnt++;
    }
  }
  
  cout << cnt << "\n";
  
}

Measured memory_bytes: 3600
/**
 *   created: 25 January 2019  12:36:55
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007

void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
vector< vector<int> > day;
vector< vector<int> > gain;
int n;
int vac(int cs, int prev){
	if(cs>=n)
		return 0;
	if(cs==n-1){
		if(prev==0){
			return max(day[cs][1],day[cs][2]);
		}
		if(prev==1){
			return max(day[cs][0],day[cs][2]);
		}
		if(prev==2){
			return max(day[cs][1],day[cs][0]);
		}
	}
	if(prev==-1)
		return gain[cs][0] = max( max( vac(cs+1,0)+day[cs][0], vac(cs+1,1)+day[cs][1] ), vac(cs+1,2)+day[cs][2] );
	if(gain[cs][prev]!=-1)
		return gain[cs][prev];
	if(prev==0)
		return gain[cs][0] = max(vac(cs+1,1)+day[cs][1], vac(cs+1,2)+day[cs][2]);
	if(prev==1)
		return gain[cs][1] = max(vac(cs+1,0)+day[cs][0], vac(cs+1,2)+day[cs][2]);
	if(prev==2)
		return gain[cs][2] = max(vac(cs+1,0)+day[cs][0], vac(cs+1,1)+day[cs][1]);

}
int main()
{
	optimizeIO();
	cin>>n;
	day.resize(n);
	gain.resize(n, vector<int>(3,-1));
	F(i,0,n-1){
		int x,y,z;
		cin>>x>>y>>z;
		day[i].PB(x);
		day[i].PB(y);
		day[i].PB(z);
	}
	cout<<vac(0,-1);
	return 0;

}


Measured memory_bytes: 15872
S = list(input())

import numpy as np

S = np.array(S)

zeroichi = ["0","1"]*(len(S)//2)+["0"]*(len(S)%2)
ichizero = ["1","0"]*(len(S)//2)+["1"]*(len(S)%2)

zeroichi = np.array(zeroichi)
ichizero = np.array(ichizero)

print(min(list(S == ichizero).count(False),list(S == zeroichi).count(False)))

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


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

/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  int A, B, C, count=0, ans=0;
  string D, E;
  cin >> A >> B >> C;
  
  cout << C << " " << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define inf 1000000005
#define all(a) (a).begin(), (a).end()
#define ms(a,x) memset(a, x, sizeof(a))
#define mod 1000000007
#define sz(a) ((ll)(a).size())

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcount(s);}
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define Repd(i,n) for(int i = (n)-1; i >= 0; --i)
#define For(i,a,b) for(int i = (a); i <= (b); ++i)
#define Ford(i,a,b) for(int i = (a); i >= (b); --i)

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define eps 1e-12
typedef pair<int, int> II;
typedef pair<ll, ll> LL;
template<class T> T gcd(T a, T b){ T r; while (b != 0) { r = a % b; a = b; b = r; } return a;}
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define PI (2 * acos((ld)0))
#define linf (1ll << 60)
#define y1 y32432
#define y0 y435346

#define maxn 1000005

int n, m;
int deg[maxn];

int main()
{
//	freopen("in.txt", "r", stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> m;
	Rep(run, m){
		int u, v;
		cin >> u >> v;
		deg[u]++;
		deg[v]++;
	}
	For(i, 1, n) if(deg[i] & 1){
		cout << "NO" << endl;
		return 0;
	}
	cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define lol long long
using namespace std;
int main(){
    int a,b,c;
    string s,t,q;
    cin>>s>>t;
    if(s[2]==t[0] && s[1]==t[1] && s[0]==t[2] )cout<<"YES\n";
    else cout<<"NO\n";
    return(0);
}

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

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

    vector<long> r;
    long n;
    long c = 0;
    cin >> n;
    long sum = 0;
    long i;
    while(c < n && cin >> i){
        r.push_back(i);
        sum += i;
        ++c;
    }

    long max = *std::max_element(r.begin(), r.end());
    long min = *std::min_element(r.begin(), r.end());

    cout << min << " " << max << " " << sum << endl;

    return 0;
}

Measured memory_bytes: 3244
#! /usr/bin/env python
# -*- coding: utf-8 -*-

n = int(raw_input())
while n!=0:
    SQ = [[0]*500 for i in range(500)]

    Max = [250, 250, 250, 250]
    Map = {0:[250, 250]}
    for i in range(1, n):
        (b, p) = map(int, raw_input().split())
        if p == 0:
            SQ[(Map[b])[0]-1][(Map[b])[1]] = i
            if Max[p] > Map[b][0]-1:
                Max[p] = Map[b][0]-1
            Map[i] = [(Map[b])[0]-1, (Map[b])[1]]
        elif p == 1:
            SQ[(Map[b])[0]][(Map[b])[1]-1] = i
            if Max[p] > Map[b][1]-1:
                Max[p] = Map[b][1]-1
            Map[i] = [(Map[b])[0], (Map[b])[1]-1]
        elif p == 2:
            SQ[(Map[b])[0]+1][(Map[b])[1]] = i
            if Max[p] < Map[b][0]+1:
                Max[p] = Map[b][0]+1
            Map[i] = [(Map[b])[0]+1, (Map[b])[1]]
        elif p == 3:
            SQ[(Map[b])[0]][(Map[b])[1]+1] = i
            if Max[p] < Map[b][1]+1:
                Max[p] = Map[b][1]+1
            Map[i] = [(Map[b])[0], (Map[b])[1]+1]

    print Max[2]-Max[0]+1, Max[3]-Max[1]+1

    n = int(raw_input())

Measured memory_bytes: 8308
package main

import "fmt"

func main() {
	var N int
	var s string
	fmt.Scanf("%d", &N)
	fmt.Scanf("%s", &s)
	count := 0
	r := []rune(s)
	for i := 0; i < N-2; i++ {
		if r[i] == 'A' {
			if r[i+1] == 'B' && r[i+2] == 'C' {
				count++
			}
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] A = new long[3*n];
        for(int i=0;i<3*n;i++) A[i]=sc.nextLong();
        Arrays.sort(A);
        long ans = 0;
        for(int j=3*n-2;j>=n;j-=2){
            ans += A[j];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 100304
program answer
  implicit none
  integer(8) :: N, a, b, c
  read(*,*) N
  a=N/100
  b=(N-a*100)/10
  c=N-100*a-10*b
  if(a==c) then
     write(*,*) 'Yes'
  else
     write(*,*) 'No'
  end if

  stop
 end program answer

Measured memory_bytes: 2760
from collections import Counter

n,*S = open(0).read().split()
c = Counter(S[0])
for s in S[1:]:
    temp = Counter(s)
    remove = set()
    for x in c.items():
        if temp[x[0]] > 0:
            c[x[0]] = min(c[x[0]],temp[x[0]])
        else:
            remove.add(x[0])
    for x in remove:
        del c[x]
if len(c) == 0:
    print('\n')
else:
    s = sorted([x for x in c.items()])
    ans = []
    for x in s:
        ans.append(x[0]*x[1])
    print(''.join(ans))

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

int read()
{
	int num=0;
	int flg=1;
	char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
		{
			flg=-1;
		}
		c=getchar();
	}
	while(isdigit(c))
	{
		num=(num<<1)+(num<<3)+(c^48);
		c=getchar();
	}
	return num*flg;
}

int main()
{
	return 0&(int)puts(abs(read()-read())<=1?"Brown":"Alice");
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] s_chars = s.toCharArray();
		Arrays.sort(s_chars);
		String s_asc = new String(s_chars);

		char[] t_chars = t.toCharArray();
		Arrays.sort(t_chars);
		String t_asc = new String(t_chars);
		String t_desc = new StringBuilder(t_asc).reverse().toString();

		if (s_asc.compareTo(t_desc) < 0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static int count;

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		for(int i = 0;i < n; i++){
			int num = Integer.parseInt(br.readLine());
			solve(num);
		}

		System.out.println(count);

	}

	public static void solve(int num){
		if(num == 1){
			return;
		}
		else if(num == 2){
			count++;
			return;
		}
		else if(num % 2 == 0){
			return;
		}
		else{
			for(int i = 3;i <= Math.sqrt(num); i +=2){
				if(num % i == 0){
					return;
				}
			}
		}
		count++;
	}

}

Measured memory_bytes: 30400
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n;
  vector<int> train;

  while (cin >> n) {
    if (n) {
      train.push_back(n);
    }
    else {
      cout << train.back() << endl;
      train.pop_back();
    }
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;

namespace B_001_60
{
    internal class Program
    {
        private static void Main(string[] args)
        {
           
            new Logic_B().Start();
          
        }

        public class Logic_B
        {
            public void Start()
            {
                var str = Console.ReadLine().Split(' ');
                var a = Convert.ToInt32(str[0]);
                var b = Convert.ToInt32(str[1]);
                var c = Convert.ToInt32(str[2]);

                var boolList = new int[b];

                for (int i = 0; i < a * b; i++)
                {
                    var mod = a * i % b;
                    if (mod == c)
                    {
                        Console.WriteLine("YES");
                        return;
                    }
                    else
                    {
                        boolList[mod] = 1;
                    }

                    if (boolList.Where(n => n == 1).Count() == b - 1)
                    {
                        Console.WriteLine("NO");
                        return;
                    }
                }
                Console.WriteLine("NO");
            }
        }

     
        
    }
}

Measured memory_bytes: 13396
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            MyDebugger.Test(process, "../TextFile1.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var x = int.Parse(spl[0]);
        var y = int.Parse(spl[1]);

        for(int i=0; i<=x; i++) {
            var j = x-i;
            var yy = i*2 + j*4;
            if(yy == y) return Yes;
        }

        return No;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27448
n,t = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)

min = 10**9
difval = -1
cnt = 0
a.each{|x|
  if min > x
    min = x
  elsif difval < x-min
    difval = x-min
    cnt = 1
  elsif difval == x-min
    cnt += 1
  end
}

p cnt

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

using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
    if (b == 0)
        return a;
    return gcd(b, a%b);
}

int main() {
    ll n, k;    cin >> n >> k;

    cout << min(n%k, abs(n%k-k)) << endl;

    return 0;
}

Measured memory_bytes: 256