akhauriyash/Code-Regression huggingface dataset:
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF		UINT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main()
{
	string N = "";
	string ret = "No";
	char last;
	int cnt = 1;
	int max_cnt = 1;

	cin >> N;

	last = N[0];
	for (int i = 1; i < N.length(); ++i) {
		if ( last == N[i] ) {
			cnt++;
			max_cnt = max(max_cnt, cnt);
		}
		else {
			cnt = 1;
			max_cnt = max(max_cnt, cnt);
		}
		last = N[i];
	}

	if (max_cnt >= 3) {
		ret = "Yes";
	}
	cout << ret << endl;


	return 0;
}





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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A, B;
  cin >> A >> B;
  cout << (A+B)%24 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	map<int, int> cnt;
	rep(i, n){
		int a; cin >> a;
		++cnt[a];
	}
	int rem = 0;
	for(const auto &p : cnt) if(p.second > 1) rem += p.second - 1;
	if(rem % 2) rem++;
	cout << n - rem << endl;
	
	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<regex>

using namespace std;

int main()
{
    string n;
    int a=0;
    cin >> n;
    for(int i = 0;i < n.size();++i){
        if(n[i] == '7'){
            cout << "Yes";
            a=1;
            break;
        }
    }
    if(a == 0) cout << "No";
    cout << endl;
    return 0;
}

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

int main() {
	
	int n;
	cin >> n;
	vector<pair<int, int>> x(n), rl(n);
	rep(i, n){
		int a, b;
		cin >> a >> b;
		x[i] = make_pair(a, b);
		int left = max(a - b, 0);
		int right = min(a + b, 1000000000);
		rl[i] = make_pair(right, left);
	}
	sort(all(x));
	sort(all(rl));
	int ans = 0;
	
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
	rep(i, n){
		que.push(rl[i]);
	}
	
	// while (!que.empty()) {
	// 	cout << que.top().first << " " << que.top().second << endl;
	// 	que.pop();
	// }
	
	int now = 0;
	while (!que.empty()) {
		if(now <= que.top().second){
			ans++;
			now = que.top().first;
		}
		que.pop();
		// cout << now << endl;
		// cout << que.top().first << " " << que.top().second << endl;
		// que.pop();
	}
	
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 2936
import heapq


def main():
    N = int(input())
    R = [list(map(int, input().split())) + ['R'] for _ in range(N)]
    B = [list(map(int, input().split())) + ['B'] for _ in range(N)]
    P = R + B
    P.sort(key=lambda x: (x[0], x[1]))
    solo = []
    ans = 0
    for p in P:
        x, y, c = p
        if c == 'R':
            solo.append((x, y))
        else:
            tmp = (-1, -1)
            for s in solo:
                if s[0] < x and tmp[1] < s[1] < y:
                    tmp = s
            if tmp != (-1, -1):
                solo.remove(tmp)
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()


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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int main() {
   int n;
   while (scanf("%d", &n) != EOF) {
      int cnt = 0;
      for (int i = 0; i < 10; i++)
         for (int j = 0; j < 10; j++)
            for (int k = 0; k < 10; k++)
               for (int l = 0; l < 10; l++) {
                  if (i+j+k+l == n) {
                     cnt++;
                  }
               }

      cout << cnt << endl;
   }

   return 0;
}


Measured memory_bytes: 3148
using System;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nm = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var h = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var results = new bool[nm[0]];
            for (var i = 0; i < nm[1]; i++)
            {
                var ab = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
                var a = ab[0];
                var b = ab[1];
                if (h[a - 1] >= h[b - 1])
                {
                    results[b - 1] = true;
                }
                if (h[b - 1] >= h[a - 1])
                {
                    results[a - 1] = true;
                }
            }

            Console.WriteLine(results.Where(r => !r).Count());

        }
    }
}

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

int gojo(int n, int m){
	if(m>n){
		swap(n,m);
	}

	if(n%m==0){
		return m;
	}

	else{
		gojo(m,n%m);
	}
}

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

	long int mx_cd = gojo(c,d);
	long int mn_cd = c*d/mx_cd;

	long int ans = b-a+1-(b/c-(a-1)/c)
				-(b/d-(a-1)/d) +(b/(c*d/mx_cd)-(a-1)/(c*d/mx_cd));
	cout << ans << endl;	
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    s = input()

    res = 0
    for i in range(n):
        X = set(s[:i])
        Y = set(s[i:])
        cnt = 0
        for x in X:
            if x in Y:
                cnt += 1
        res = max(res, cnt)

    print(res)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3060
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

int main() {
    LL w, h, x, y;
    cin >> w >> h >> x >> y;

    int flag = 0;
    if (2 * x == w and 2 * y == h) flag = 1;
    printf("%.9f %d\n", w * h / 2.0, flag);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
template<class S, class T> void map_init(map<S, T> &m, S k, T v){if(!m.count(k)) m[k] = v;}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    // T, S, Z はカドを埋められないので、居るだけ
    i64 I, O, T, J, L, S, Z;
    cin >> I >> O >> T >> J >> L >> S >> Z;
    i64 ans = 0;

    ans += O;

    // 「問」型を作るかどうか
    if(I > 0 && J > 0 && L > 0 && I % 2 + J % 2 + L % 2 > 1) {
        ans += 3;
        I--, J--, L--;
    }
    ans += (J / 2 + L / 2 + I / 2) * 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;
using pll=pair<ll,ll>;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	int N,A,B;
	string S;
	cin >> N >> A >> B >> S;
	int count = 0, countb = 0;
	rep(i, N) {
		if(S[i] == 'c') {
			cout << "No" << endl;
			continue;
		}
		else if(S[i] == 'a') {
			if(count < A+B) {
				cout << "Yes" << endl;
				count++;
				continue;
			}
			cout << "No" << endl;
		}
		else if(S[i] == 'b') {
			if(count < A+B && countb < B) {
				cout << "Yes" << endl;
				count++;
				countb++;
				continue;
			}
			else cout << "No" << endl;
		}
	}

  return 0;
}


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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){

    bool flag=true;
    ll ans=1,sum=0;

    int n,m;
    cin>>n;

    vector<ll> a(n);

    rep(i,n){
        cin>>a[i];
        if(a[i]==0){cout<<0<<endl;return 0;}
    }

    rep(i,n){
        ll lim = (ll)1e18/ans;
        if(a[i] > lim || ans > 1e18){
            flag=false;
            break;
        }
        ans *= a[i];
    }

    //cout <<fixed<<setprecision(16)<< << endl;
    if(flag)cout << ans <<endl;
    else cout << "-1" <<endl;

    return 0;
}


Measured memory_bytes: 4052
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n+1];
		for(int i = 1; i <= n; i++) {
			a[i] = sc.nextInt();
		}
		buildMaxHeap(a);
		for (int i = 1; i <= n; i++) {
			System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println();
		
		sc.close();
	}
	
	void maxHeapify(int[] A, int i) {
		int l = 2*i;
		int r = 2*i+1;
		
		int largest = i;
		if(l < A.length && A[l] > A[i])
			largest = l;
		
		if(r < A.length && A[r] > A[largest])
			largest = r;
		
		if(largest != i) {
			int tmp = A[i];
			A[i] = A[largest];
			A[largest] = tmp;
			maxHeapify(A, largest);
		}
	}
	
	void buildMaxHeap(int[] A) {
		for(int i = (A.length-1)/2; i >= 1; i--) {
			maxHeapify(A, i);
		}
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 166584
# coding: utf-8
# Your code here!

x, y, m = [int(i) for i in input().split()]

a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
num = [min(a)+min(b)]

for _ in range(m):
    tmp = [int(i) for i in input().split()]
    num.append(a[tmp[0]-1]+b[tmp[1]-1]-tmp[2])

print(min(num))

Measured memory_bytes: 18488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    ll A, B;
    cin >> A >> B;
    ll ans = -1;
    REP(i, 100000)
    {
        if (ans == -1 and (i * 108) / 100 - i == A and (i * 11) / 10 - i == B)
        {
            ans = i;
        }
    }
    OUT(ans);
}

Measured memory_bytes: 256
def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(122)
    else:
        return num2alpha(num//26)+chr(96+num%26)

if __name__ == "__main__":
    N = int(input())
    ans = num2alpha(N)
    print(ans)

Measured memory_bytes: 9204
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
    long long n,c,x[100000],v[100000],s[2][100001],m[2][100001],d[2][100001] = {0};
    cin >> n >> c;
    for(long long i = 0;i < n;i++)
        cin >> v[i] >> x[i];
    s[0][0] = 0;
    for(long long i = 1;i <= n;i++)
        s[0][i] = s[0][i-1] + x[i-1];
    for(long long i = 1;i <= n;i++)
        s[0][i] = s[0][i] - v[i-1];
    s[1][0] = 0;
    for(long long i = 1;i <= n;i++)
        s[1][i] = s[1][i-1] + x[n-i];
    for(long long i = 1;i <= n;i++)
        s[1][i] = s[1][i] - (c - v[n-i]);
    vector<pair<long long,long long>> p[2];
    for(long long i = 0;i <= n;i++) {
        p[0].push_back(make_pair(s[0][i], i));
        p[1].push_back(make_pair(s[1][i], i));
    }
    sort(p[0].begin(), p[0].end(),greater<pair<long long,long long>>());
    sort(p[1].begin(), p[1].end(),greater<pair<long long,long long>>());
    long long z = n;
    for(auto itr = p[0].begin();itr < p[0].end();itr++) {
        if(itr->second <= z) {
            for(long long i = itr->second;i <= z;i++) {
                m[0][i] = itr->first;
                if(i != 0 && itr->second != 0)
                    d[0][i] = v[itr->second - 1];
                else
                    d[0][i] = 0;
            }
            z = itr->second - 1;
        }
    }
    z = n;
    for(auto itr = p[1].begin();itr < p[1].end();itr++) {
        if(itr->second <= z) {
            for(long long i = itr->second;i <= z;i++) {
                m[1][i] = itr->first;
                if(i != 0 && itr->second != 0)
                    d[1][i] = c - v[n - itr->second];
                else
                    d[1][i] = 0;
            }
            z = itr->second - 1;
        }
    }
    
    long long retval = 0;
    for(long long i = 0;i <= n;i++) {
        retval = max(retval,m[0][i] + m[1][n-i] - min(d[0][i],d[1][n-i]));
        retval = max(retval,m[1][i] + m[0][n-i] - min(d[1][i],d[0][n-i]));
    }
    cout << retval << endl;
    return 0;
}


Measured memory_bytes: 9836
import java.util.Scanner;
public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);

		int intNum = scan.nextInt();

		//配列の宣言、要素数は入力された数値
		int[] array = new int[intNum];

		//配列に要素を格納
		for(int i = 0 ;i < array.length;i++){
			array[i] = scan.nextInt();
		}

		//要素数/2 回交換を行う
		for(int i = 0 ;i < array.length / 2;i++){
				//配列の最後尾
				int intBack = array.length - i - 1;

				int intCh = array[i];
				array[i] = array[intBack];
				array[intBack] = intCh;
		}
		for(int i = 0 ;i < array.length - 1;i++ ){
		System.out.print(array[i] + " ");
		}
		System.out.println(array[array.length - 1]);
		scan.close();
	}
}



Measured memory_bytes: 26200
function Main( input ){

    input = input.split( ' ' )

    var a = Number( input[0] )
    var b = Number( input[1] )
    var c = Number( input[2] )

    if( b - a === c - b ){
        console.log( 'YES' )
    } else {
        console.log( 'NO' )
    }

}

Main( require( 'fs' ).readFileSync( '/dev/stdin', 'utf8' ) )

Measured memory_bytes: 10828
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int inCorrectNum = (int) IntStream.range(0, N).map(i -> sc.nextInt()).filter(i -> i % 2 == 0)
				.filter(i -> (i % 3 != 0) && (i % 5 != 0)).count();
		if (inCorrectNum == 0) {
			System.out.println("APPROVED");
		} else {
			System.out.println("DENIED");
		}
	}
}


Measured memory_bytes: 29012
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N;
    void solve()
    {
        var A = new bool[26];
        var S = cin.next;
        N = S.Length;
        for (int i = 0; i < N; i++)
        {
            A[alfa.IndexOf(S[i])] = true;
        }
        for (int i = 0; i < 26; i++)
        {
            if (!A[i])
            {
                WriteLine(alfa[i]);
                return;
            }
        }
        WriteLine("None");
    }

}

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

Measured memory_bytes: 13264
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,h,m=0;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>h;
        if(h>m) m=h;
        else{
            if(m-h>1){
                cout<<"No"<<endl;
                break;
            }
        }
        if(i==n-1) cout<<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <functional>
#include <list>
#include <bitset>
#include <numeric>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <string>
#include <map>

#define INF 1e9
#define MOD 1000000007
#define ll long long
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
typedef unsigned long long ull;
typedef pair<ll, ll> pr;
bool f[100001];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a,b,c;
    int n;
    cin>>n;
    cin>>a>>b>>c;
    int ans=0;
    for(int i=0;i<a.size();i++){
        if(a[i]==b[i]&&a[i]==c[i]){
            continue;
        }
        if(a[i]==b[i]){
            ans++;
        }
        else if(a[i]==c[i]){
            ans++;
        }
        else if(b[i]==c[i]){
            ans++;
        }
        else{
            ans+=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/*
Let k = 50 and prepare a grid of dimensions 2K * 2K
Paint all cells in the topmost K rows black. Paint the other cells White
From the topmost K rows, choose A - 1 cells such that no tow chosen cells are 4-adjacent and paint them white
From the bottommost K rows, choss B - 1 cells such that no tow chosen cells are 4-adjacent and paint them black.
*/ 
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 105;

char board[MAXN][MAXN];

int A, B, K = 50;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> A >> B, --A, --B;
    for (int i = 0; i < (K << 1); i++)
    	for (int j = 0; j < (K << 1); j++)
    		board[i][j] = (i < K ? '#' : '.');
    for (int i = 0; i < K; i += 2)
    	for (int j = 0; j < (K << 1); j++)
    		if ((i + j) % 2 == 0 && A)
    			board[i][j] = '.', --A;
    for (int i = K + 1; i < (K << 1); i += 2)
    	for (int j = 0; j < (K << 1); j++)
    		if ((i + j) % 2 == 0 && B)
    			board[i][j] = '#', --B;
    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < (K << 1); i++)
    {
    	for (int j = 0; j < (K << 1); j++)
    		cout << board[i][j];
    	cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓


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

    ll n,m;
    cin>>n>>m;
    if(n==1&&m==1)cout<<1<<endl;
    else if(n==1&&m!=1)cout<<m-2<<endl;
    else if(m==1&&n!=1)cout<<n-2<<endl;
    else cout<<n*m-(n+m)*2+4<<endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
#include<queue>
#include<cmath>
#include<numeric>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<iomanip>
#include<functional>
#include<bitset>

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

using namespace std;
typedef long long ll;

int main(){
    string s,t;
    cin>>s>>t;
    int ans = 1;
    rep(i,s.size()){
        if(s[i]!=t[i]) ans = 0;
    }
    cout<<(ans? "Yes":"No")<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
//g++??????
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <vector>
#include <iomanip>
using namespace std;

double calc_average(vector<int> score)
{
	double sum = 0;
	int n = score.size();
	for(int i = 0; i < n; i++){
		sum += score[i];
	} 
	double m = sum / n;//?????????
	
	return m;	
}
double StandardDeviation(vector<int> score)
{
	int n = score.size();
	double sigma = 0;
	double m = calc_average(score);
	for(int i = 0; i < n; i++){
		sigma += pow(score[i] - m, 2);
	}
	
	double ss = sigma / n;
	
	return sqrt(ss);
}
int main(void)
{	
	cout << fixed << setprecision(4);//?¨????
	while(true){
		int n;
		cin >> n;
		
		if(n == 0){
			break;
		}
		vector<int> score(n);
		for(int i = 0; i < n; i++){
			cin >> score[i];
		}
		double r = StandardDeviation(score);
		cout << r << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

const int INF=1e9;
const int MAX_V=114;

// d[i][j]: 辺e=(i, j)のコスト(存在しない場合はINF, d[i][i]=0)
// d[i][i]が負になる場合は負の閉路が存在
int d[MAX_V][MAX_V];
int V;

void warshall_floyd(){
	REP(k, V){
		REP(i, V){
			REP(j, V){
				d[i][j]=min(d[i][j], d[i][k]+d[k][j]);
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w, c, a;
	cin>>h>>w;
	V=10;
	REP(i, 10){
		REP(j, 10){
			cin>>c;
			d[i][j]=c;
		}
	}
	warshall_floyd();
	int ans=0;
	REP(i, h){
		REP(j, w){
			cin>>a;
			if(a==-1){
				continue;
			}
			ans+=d[a][1];
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string T;
  cin >> T;
  for (int i = 0; i < T.length(); i++) {
    if (T[i] == '?') {
      T[i] = 'D';
    }
  }
  cout << T << endl;
  return 0;
}


Measured memory_bytes: 3712
#include <iostream>

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

//math
//-------------------------------------------
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
// #define dump(x) cerr << #x << " = " << (x) << endl;
// #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
//                       << " " << __FILE__ << endl;

int main()
{
    int N, K;
    cin >> N >> K;

    vector<int> H;
    REP(i, N)
    {
        int h;
        cin >> h;
        H.push_back(h);
    }

    auto cond = [K](int a) {
        return a >= K;
    };

    int ans = count_if(H.begin(), H.end(), cond);

    cout << ans << endl;
}

Measured memory_bytes: 892
#include <iostream>

using namespace std;

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

    int num = 0;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] == '+') {
            num++;
        } else {
            num--;
        }
    }

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int N = sc.nextInt();
        int M = sc.nextInt();

        if (M > N) {
            System.out.println("No");
            return;
        }

        char dataN[][] = new char[N][];
        for ( int i = 0; i < N; i++) {
            dataN[i] = sc.next().toCharArray();
        }

        char dataM[][] = new char[M][];
        for ( int i = 0; i < M; i++) {
            dataM[i] = sc.next().toCharArray();
        }

        int diff = N - M;
        for (int i = 0; i <= diff; i++ ) {
            for ( int j = 0; j <= diff; j++) {
                if (compareData(dataN,dataM,i,j,M)) {
                    System.out.println("Yes");
                    return ;
                }
            }
        }
        System.out.println("No");
    }

    private static boolean compareData(
        char dataN[][],
        char dataM[][],
        int startX,
        int startY,
        int len
    ) {
        for (int i = 0; i < len; i++ ) {
            for ( int j = 0; j < len; j++) {
                if (dataM[i][j] != dataN[i + startX][j + startY]) {
                    return false;
                }
            }
        }
        return true;
    }
}


Measured memory_bytes: 23508
#include<stdio.h>
int swap(v,w){
    int d;
    d = v;
    v = w;
    w = d;
    return v,w;
}

int gcd(x, y){
    int r;
    if (x < y){
        swap(x, y);
    }
    while (y > 0){
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main(){
    int a, b, c;
    scanf("%d %d", &a, &b);
    c = gcd(a,b);
    printf("%d\n",c);

    return 0;
}




Measured memory_bytes: 2064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, a[200002], b[200002];
bool judge = false;

int main(){

	cin >> n;
	rep(i, n) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b, b + n);

	if (b[n - 1] == b[n - 2])judge = true;

	rep(i, n) {
		if (judge)cout << b[n - 1] << endl;
		else if (a[i] == b[n - 1])cout << b[n - 2] << endl;
		else cout << b[n - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <utility>
typedef long long ll;
using namespace std;

int main(){
  ll i,j,k;
  string s;
  cin >> s;
  for(i=0;i<(ll)s.size();i++){
    for(j=i;j<=(ll)s.size();j++){
      //cout << s.substr(0,i)+s.substr(j) << endl;
      if(s.substr(0,i)+s.substr(j)=="keyence"){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

using namespace std;

// https://atcoder.jp/contests/abc074/tasks/abc074_b
// 200点

// abs(0-x) とabs(K-x)の小さいほうの和が答え

int main()
{
    int n;
    cin >> n;
    int k;
    cin >> k;
    int x[100];
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i];
        ans += min(abs(x[i]), abs(k - x[i])) * 2;
    }
    cout << ans << endl;
}

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

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

    ll small = 2;
    ll big = 1;
    ll ans =0;
    if( n ==1)
        cout<<1;
    else {
        for (int i = 2; i <= n; i++) {
            ans = small + big;
            small = big;
            big = ans;
        }
        cout << ans;
    }
}

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


int main() {
    string S;
  cin >> S;
  
  vector<string> D = {"SAT", "FRI" , "THU", "WED", "TUE", "MON","SUN"};
  
   int Ans = 0;
  
  for(int i = 0; i < 7; i++){
  	if(S == D.at(i)) Ans = i+1;
  }
  
  cout << Ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#define BUF 100

int main(void) {
    char str[BUF];
    int count = 0, hug = 0;
    
    for (int i = 0; i < BUF; i++) {
        str[i] = '\0';
    }

    while (count < BUF) {
        scanf("%c", &str[count]);
        if (str[count] == '\n')
            break;
        count++;
    }
    str[count + 1] = '\0';

    for (int i = 0; i < count / 2; i++) {
        if (str[i] != str[(count - 1) - i])
            hug++;
    }

    printf("%d\n", hug);

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 

 
const int INF = 1000000;
const double EPS = 1e-8;
const int mod = 1e9 + 7;

ll dp[1010][1010];

int main(){
	int n, m;
	ll ans;
	vi d(1010), c(1010);
	while(cin>>n>>m){
		//cout<<"OK"<<endl;
		rep(i, n) cin>>d[i];
		rep(i, m) cin>>c[i];
		rep(i, 1010) rep(j, 1010) dp[i][j] = j==0?0LL:1e18;
		for(int i = 1; i <= m; i++){
			for(int j = 1; j <= n; j++){
				dp[i][j] = min({dp[i-1][j], dp[i-1][j-1] + d[j-1]*c[i-1]});
			}
		}
		ans = 1e18;
		for(int i = 1; i <= m; i++){
			ans = min(ans, dp[i][n]);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 11048
#include<bits/stdc++.h>
#define sl(x) scanf("%I64d",&x)
#define pl(x) printf("%I64d\n",x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
ll fpow(ll n,ll k)
{
	ll ans = 1;
	while(k)
	{
		if(k&1)
		ans = ans*n;
		
		n = n*n;
		k /= 2;
	}
	return ans;
}
ll dp[N],value[N],cnt;

int main()
{
	ll n,i,j,k;
	sl(n);
	value[cnt++] = 1;
	for(i = 1;fpow(6,i) <= n;i++)
	value[cnt++] = fpow(6,i);
	for(i = 1;fpow(9,i) <= n;i++)
	value[cnt++] = fpow(9,i);
	for(i = 0;i < N;i++)
	dp[i] = INF;
	dp[0] = 0;
	for(i = 0;i < cnt;i++)
	{
		for(j = value[i];j <= n;j++)
		{
			dp[j] = min(dp[j],dp[j-value[i]]+1);
		}
	}
	pl(dp[n]);
}

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

int main()
{
   ll sum = 0;
   string s;
   cin >> s;
   for(int i=0; i<s.size(); i++)
   {
       sum += s[i] - '0' ;
   }
   if(sum%9==0)
   {
       cout << "Yes" << endl;
       
   }
   else cout << "No" << endl;
}


Measured memory_bytes: 3768
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef long double ld;
    typedef unsigned long long ull;
    typedef vector<int> vi;
    typedef vector<long long> vll;
    typedef pair<ll,ll> pll;
     
    const ll mod = 1e9 + 7;
    const ld PI = 3.1415926535897932384626;
    const ld eps = 1e-9;                            
     
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define sidha(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
    #define ulta(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);--i)
    #define stl(container,itr) \
        for(auto itr = container.begin(); itr != container.end(); itr++)
    #define sab(v) v.begin(), v.end()
    #define rall(v) v.rbegin(), v.rend()            
    #define test ll t;cin>>t;while(t--)
    #define sz(v) ((int)(v).size())
    #define pb push_back
    #define mp make_pair
    #define fi first
    #define se second
    #define LOG2(X) (63ll - __builtin_clzll(X))
    #define endl '\n'
    #define modinv(x) power(x, mod-2)
    #define MAX 100005
     
    ll power(ll x, ll y) { 
        ll ans=1;
        x=x%mod;
        while(y>0) { 
            if (y&1) 
                ans=(ans*x)%mod; 
            y=y>>1;
            x=(x*x)%mod; 
        } 
        return ans; 
    }

    int main()
    {
        boost;
        ll n,d,ans=0,x,y;
        cin>>n>>d;
        sidha(i,0,n){
            cin >> x >> y;
            if ( x * x + y * y <= d*d)   ans++;
        }
        cout<<ans;
        return 0;
    }
    

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

int main(){

    int h, w; cin >> h >> w;
    vector<vector<int> > a(h + 2, vector<int> (w + 2, 1));

    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> a[i][j];
        }
    }

    vector<vector<int> > dp(h + 1, vector<int> (w + 1, 0));

    int ans = 0;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){

            if(a[i][j] == 1) dp[i][j] = 0;
            else{
                int v = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
                dp[i][j] = v;

                ans = max(ans, v);
            }
        }
    }

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


Measured memory_bytes: 18408
import sys
import math
readline = sys.stdin.readline

def main():
  p = 1000000007
  N = int(readline().strip())
  A = {}
  ans = 0
  for i in range(N):
    s = ''
    ai, bi = map(int, readline().split())
    if ai == 0 and bi == 0:
      ans += 1
      ans %= p
      continue
    gi = math.gcd(ai, bi)
    ai //= gi
    bi //= gi
    if ai != 0 and bi != 0:
      if ai < 0 and bi < 0:
        ai *= -1
        bi *= -1
      elif ai < 0:
        ai *= -1
        s = '-'
      elif bi < 0:
        bi *= -1
        s = '-'
    elif ai == 0 and bi != 0:
      ai = 0
      bi = 1
    elif bi == 0 and ai != 0:
      ai = 1
      bi = 0
      s = '-'
    xi = s + str(ai) + '/' + str(bi)
    if s == '':
      s = '-'
    else:
      s = ''
    yi = s + str(bi) + '/' + str(ai)
    if xi in A:
      A[xi][0] += 1
      A[xi][0] %= p
    elif yi in A:
      A[yi][1] += 1
      A[yi][1] %= p
    else:
      A[xi] = [1, 0]
  r = 1
  for i in A:
    r *= (pow(2, A[i][0], p) + pow(2, A[i][1], p) -1)
    r %= p
  ans += r - 1
  ans %= p
  print(ans)

if __name__ == '__main__':
  main()

Measured memory_bytes: 54740
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;

int main(){
    i64 A ,B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    i64 ans = 1e18;
    for(i64 i = 0; i <= max(X, Y); i++){
        i64 res = C*2*i + A*max(X - i, 0l) + B*max(Y - i, 0l);
        ans = min(ans, res);
    }

    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
using Graph =vector<int>;
typedef pair<int,int> P;
int ans;
int main(){
  string S,T;cin>>S>>T;
  for(int i=S.size()-T.size();i>-1;--i){
    bool f=true;
    rep(j,T.size()){
      if (S[i+j]!=T[j] && S[i+j]!='?'){
        f=false;break;
      }
    }
    if (f){
      string ans;
      rep(k,S.size()){
        if(i<=k&&k<i+T.size()) ans+=T[k-i];
        else if(S[k]=='?') ans+='a';
        else ans+=S[k];
      }
      cout<<ans<<endl;
      return 0;
    }
  }
  cout<<"UNRESTORABLE"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            ans += v[i]*v[j];
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

const int MaxN = 100000 + 5;

int N;
long long A[MaxN];

void init() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%lld", &A[i]);
  }
}

void solve() {
  std::sort(A + 1, A + 1 + N);

  if (N % 2 == 0) {
    long long ans = 0;
    for (int i = 1; i < N / 2; ++i) {
      ans -= 2 * A[i];
    }
    ans -= A[N / 2];
    ans += A[N / 2 + 1];
    for (int i = N / 2 + 2; i <= N; ++i) {
      ans += 2 * A[i];
    }

    printf("%lld\n", ans);
  } else {
    long long ans1 = 0, ans2 = 0;

    for (int i = 1; i <= N / 2 - 1; ++i) {
      ans1 -= 2 * A[i];
    }
    ans1 -= A[N / 2] + A[N / 2 + 1];
    for (int i = N / 2 + 2; i <= N; ++i) {
      ans1 += 2 * A[i];
    }

    for (int i = 1; i <= N / 2; ++i) {
      ans2 -= 2 * A[i];
    }
    ans2 += A[N / 2 + 1] + A[N / 2 + 2];
    for (int i = N / 2 + 3; i <= N; ++i) {
      ans2 += 2 * A[i];
    }

    printf("%lld\n", std::max(ans1, ans2));
  }
}

int main() {
  init();
  solve();
  return 0;
}

Measured memory_bytes: 896
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE MultiWayIf #-}

import Control.Monad
import Control.Monad.ST
import Control.Monad.State
import Control.Applicative
import Control.Arrow
import Data.List
import Data.Array
import Data.Array.IO
import Data.Maybe
import Data.Bits
import Data.Ord
import Data.Ratio
import Data.Int
import Data.Char
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Data.Tuple
import Data.Function
import Text.Printf
import Debug.Trace
import Numeric

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)
listToTuple5 [a,b,c,d,e] = (a,b,c,d,e)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt

for = flip map

main :: IO ()
main = do
  s <- getLine
  (x,y) <- listToTuple2 . map read . words <$> getLine :: IO (Int,Int)

  let
    (xs,ys) = splitByIndexOddEven $ splitByT s
    len = length s

  dpx <- newArray ((0,-len),(length xs,len)) False :: IO (IOUArray (Int,Int) Bool)
  dpy <- newArray ((0,-len),(length ys,len)) False :: IO (IOUArray (Int,Int) Bool)

  writeArray dpx (1,head xs) True
  forM_ (zip [2..] (tail xs)) $ \(i,d) -> do  
    forM_ [-len..len] $ \x -> do
      a <- if x-d >= -len then readArray dpx (i-1,x-d) else return False
      b <- if x+d <= len then readArray dpx (i-1,x+d) else return False
      writeArray dpx (i,x) (a || b)

  writeArray dpy (0,0) True
  forM_ (zip [1..] ys) $ \(i,d) -> do
    forM_ [0..len] $ \y -> do
      a <- if y-d >= -len then readArray dpy (i-1,abs (y-d)) else return False
      b <- if y+d <= len then readArray dpy (i-1,y+d) else return False
      writeArray dpy (i,y) (a || b)


  putStrLn =<< (\a b -> if a && b then "Yes" else "No") <$> readArray dpx (length xs,x) <*> readArray dpy (length ys,abs y)
  
  where
    splitByT [] = []
    splitByT xs = length a : splitByT (if null b then b else tail b)
      where (a,b) = span (/='T') xs

    splitByIndexOddEven xs = aux xs 1
      where
        aux [] _ = ([],[])
        aux (x:xs) n
          | odd n = first (x:) $ aux xs (n+1)
          | even n = second (x:) $ aux xs (n-1)


Measured memory_bytes: 19836
#include <iostream>
#include <string>

int main(void){
  int N,M;
  std::cin >> N;
  std::cin >> M;
  
  int s[M] = {};
  int c[M] = {};
  std::string ans;
  switch(N){
    case 1:
      ans = "0";
      break;
    case 2:
      ans = "10";
      break;
    case 3:
      ans = "100";
      break;
    default:
      ans = "";
  }
  bool isDic[N] = {};
  bool isAns = true;
  for(int i = 0;i < M;i++){
    std::cin >> s[i];
    std::cin >> c[i];
    char ch = '0' + c[i];
    
    if(isDic[s[i] - 1] && ans[s[i] - 1] != ch){
      isAns = false;
      break;
    }
    else if(N != 1 && s[i] == 1 && c[i] == 0){
      isAns = false;
      break;
    }
    isDic[s[i] - 1] = true;
    ans[s[i] - 1] = ch;
  }

  if(isAns){
    std::cout << ans << std::endl;
  }
  else{
   	std::cout << "-1" << std::endl; 
  } 
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char C;
  cin >> C;
  if(C == 'a' || C == 'e'  || C == 'i'  || C == 'o'  || C == 'u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int A, B, C, X, Y;
	
	cin >> A >> B >> C >> X >> Y;

	int total = 0;

	if (A+B >= 2 * C)
	{
		if (X >= Y)
		{
			if (A <= 2 * C)
			{
				total += 2 * Y * C;
				total += (X-Y)*A;
			}
			else
			{
				total = 2 * X * C;
			}
			
		}
		else
		{
			if (B <= 2 * C)
			{
				total += 2 * X * C;
				total += (Y-X)*B;
			}
			else
			{
				total = 2 * Y * C;
			}
			
		}
	}
	else
	{
		total += X * A + Y * B;
	}
	
	cout << total << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    t = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-t//2))
print(-sum(a))

Measured memory_bytes: 14180