akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#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 INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
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);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n, m;
	cin >> n >> m;
	int a[m];
	ll s[n+1] = {};
	fill(s, s+n+2, 0);
	bool b[n+2] = {};
	s[0] = 1;
	s[1] = 1;
	REP(i, m){
		cin >> a[i];
		b[a[i]] = 1;
	}
	if(b[1]) s[1] = 0;
	FOR(i, 2, n+1){
		if (b[i]) s[i] = 0;
		else s[i] = s[i-2] + s[i-1];
		s[i] %= 1000000007;
	}
	cout << s[n] << endl;
}


Measured memory_bytes: 1536
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n,x[N];
    cin>>n;
    map<int,int>m;
    rep(i,1,n){
        cin>>x[i];
        m[x[i]+i]++;
    }
    ll ans=0;
    rep(i,1,n) ans+=m[i-x[i]];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 21388
#problems3
n,s=map(int,input().split())
a=1
lists=list(map(int,input().split()))
visited=[False for i in range(n+1)]
data=[]
now=a
flag=True
while flag:
    now=lists[now-1]
    if visited[now]==False:
        visited[now]=True
        data.append(now)
    else:
        data.append(now)
        flag=False


#data=[...(loop)...]
looping=0
for i in range(len(data)):
    if data[i]==data[-1]:
        mod=i
        index=i
        looping=data[i:-1]
        loop=len(data)-1-index
        break

U=(s-mod)%loop
if s<=mod:
    print(data[s-1])
elif s>mod:
    print(looping[U-1])


    

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


int main() {
    ll n;
    cin >> n;
    ll sum = 0;
    for (ll i=1; i<(n+1); i++){
        if ((i%3!=0)&&(i%5!=0)) sum += i;
    }
    cout << sum << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    int d;
    cin >> d;
    vector<int> c(26);
    int s[d][26];
    for(int i = 0; i < 26; i++) cin >> c[i];
    for(int i = 0; i < d; i++){
        for(int j = 0; j < 26; j++){
            cin >> s[i][j];
        }
    }
    map<int,int> last;
    vector<int> fans(d);
    for(int day = 0; day < d; day++){
        int ct = -1;
        long long  ans = -mod*mod;
        for(int type = 0; type < 26; type++){
            int can = 0;
            can += s[d][type];
            for(int i = 0; i < 26; i++){
                if(type == i) continue;
                can -= c[i]*(d-last[i]);
            }
            if(ans < can){
                ans = can;
                ct = type;
            }
        }
        last[ct] = day;
        cout << ct << endl;
    }
    return 0;
}

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

string s[10];

bool comp(const string& s1, const string& s2) {
	if(s1.size() == s2.size()) {
		return s1 < s2;
	}
	return s1.size() < s2.size();
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin >> n, n) {
		for(int i = 0; i < n; i++) {
			cin >> s[i];
		}
		string dp[1 << 10][11];
		for(int i = 0; i < 1 << 10; i++) {
			for(int j = 0; j < 11; j++) {
				dp[i][j] = string(1000, 'z' + 1);
			}
		}
		for(int i = 0; i < n; i++) {
			dp[1 << i][i] = s[i];
		}

		int common[10][10] = { 0 };
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(i == j) continue;
				for(int k = 1; k <= min(s[i].size(), s[j].size()); k++) {
					if(s[i].substr(s[i].size() - k, k) == s[j].substr(0, k)) {
						common[i][j] = k;
					}
				}
			}
		}

		for(int i = 1; i < 1 << n; i++) {
			for(int j = 0; j < n; j++) {
				if(dp[i][j][0] == 'z' + 1) continue;
				for(int k = 0; k < n; k++) {
					if(i & (1 << k)) continue;
					int c = common[j][k];
					string ns = dp[i][j];
					if(dp[i][j].find(s[k]) == string::npos) {
						ns += s[k].substr(c, s[k].size() - c);
						dp[i | (1 << k)][k] = min(dp[i | (1 << k)][k], ns, comp);
					}
					else {
						dp[i | (1 << k)][j] = min(dp[i | (1 << k)][j], ns, comp);
					}
				}
			}
		}

		string ans = string(1000, 'z' + 1);
		for(int i = 0; i < n; i++) {
			ans = min(ans, dp[(1 << n) - 1][i], comp);
		}
		cout << ans << endl;
	}

}

Measured memory_bytes: 14548
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#define mod 1000000007
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define srep(i,s,t) for (ll i = s; i < t; i++)
#define drep(i,n) for(ll i = (n)-1; i >= 1; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;
ll modpow(ll k,ll n){
    ll x=1;
    while(n>0){
        if(n&1)x=x*k%mod;
        k=k*k%mod;
        n>>=1;
    }
    
    return x;
}

int main()
{
    
    ll N,ans,cnt,K;
    ans=0;
    cnt=0;
    cin >> N >>K;
    ll num[K+1]={};
    for(ll i=K;i>=1;i--){
        num[i]+=modpow((K/i),N);
        num[i]%=mod;
        ans+=(num[i]*i)%mod;
        ans%=mod;
        for(ll j=1;j*j<=i;j++){
            if(i%j==0){
                num[j] += mod - num[i];
                if(j!=1 && j*j!=i) num[i/j] += mod - num[i];
                num[j] %= mod;
                num[j/i] %= mod;
            }
        }
    }
    cout << ans <<endl;
    return 0;
}

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

int main(void){
    int a, b, c, temp;
    cin >> a >> b >> c;
    
    if(a > b){
        temp = b;
        b = a;
        a = temp;
    }
    if(a > c){
        temp = c;
        c = a;
        a = temp;
    }
    if(b > c){
        temp = c;
        c = b;
        b = temp;
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
const int INF = 1e18, MOD = 998244353;
signed main() {
    int n, cnt = 0, ans = 0, a;
    cin>>n;
    for (int i = 0; i < n; i++) {
        cin>>a;
        if (a == 0) ans += cnt / 2, cnt = 0;
        else cnt += a;
    }
    ans += cnt / 2, cnt = 0;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
<?php
$input = explode(' ', trim(fgets(STDIN)));
$n = intval($input[0]);
$k = intval($input[1]);
$r = $n % $k;
$ans = 0;
if ($r === 0) {
    $ans = 0;
} else {
    if ($r <= $k) {
        $ans = 1;
    }
}
printf($ans);

Measured memory_bytes: 4856
#include <cstdio>
#include <cmath>

int a, b;

int main()
{
	scanf("%d%d", &a, &b);
	double x = std::ceil((double)a / 0.08),
	       y = std::ceil((double)b / 0.10);
	double z = std::fmax(x, y);
	if (std::floor(z * 0.08) == a && std::floor(z * 0.10) == b)
		printf("%d\n", (int)z);
	else
		printf("-1\n");
	return 0;
}

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

using namespace std;

int main()
{
	string w, t, s;
	string::iterator it;
	int c = 0;
	vector<string> v;
	
	cin >> w;
	
	while(true)
	{	
		getline(cin, t);
		
		if(t == "END_OF_TEXT")
			break;
		
		transform(t.begin(), t.end(), t.begin(), ::tolower);
		s = "";
		
		for(it = t.begin(); it != t.end(); it++)
		{
			if(*it == ' ' || *it == ',' || *it == '.')
			{
				v.push_back(s);
				s = "";
			}
			else
				s += *it;
		}	
		
		v.push_back(s);
	}
	
	c = count(v.begin(), v.end(), w);
	
	cout << c << "\n";
	
	return 0;
}


Measured memory_bytes: 3188
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)

	a, b, c := getInt(), getInt(), getInt()

	x := a * b * 4
	y := (c - a - b)
	if y < 0 {
		out("No")
		return
	}
	y = y * y

	if x < y {
		out("Yes")
	} else {
		out("No")
	}
}


Measured memory_bytes: 640
def resolve():
    N = int(input())
    Z = []
    W = []

    for i in range(N):
        x, y = map(int, input().split())
        Z.append(x + y)
        W.append(x - y)

    a = max(Z) - min(Z)
    b = max(W) - min(W)
    print(max(a, b))


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 24772
object Main {
  def solve(s: String, l: Int): List[Int] = {
    val visited = Array.fill[Int](scala.math.pow(10, l).toInt)(-1)
    var dif = s.toInt
    var c = 0
    while(visited(dif) == -1) {
      visited(dif) = c
      val min = dif.toString.padTo(l, '0').split("").sortWith((a, b) => a < b)
      dif = min.reverse.mkString("").toInt - min.mkString("").toInt
      c += 1
    }
    List(visited(dif), dif, c - visited(dif))
  }
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in) 
    var s = sc.next
    var l = sc.nextInt
    while(l != 0) {
      println(solve(s, l).mkString(" "))
      s = sc.next
      l = sc.nextInt
    }
  }
}

Measured memory_bytes: 257836
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
#include<unordered_map>

#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8

#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	int n,k;
	cin>>n>>k;
	vector<int> l(n);
	REP(i,n) cin>>l[i];
	sort(ALL(l));
	int ans=0;
	REP(i,k) ans+=l[n-1-i];
	cout<<ans<<endl;
}


Measured memory_bytes: 256
N = int(input())

max_count = 0
for i in range(1, N + 1):
    n = i
    count = 0
    while n > 0 and n % 2 == 0:
        n = n // 2
        count += 1
    if count == max(max_count, count):
        res = i
        max_count = count

print(res)


Measured memory_bytes: 2940
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint()
{
	int x=0,p=1;char c=getchar();
	while (c<=32)c=getchar();
	if(c==45)p=-p,c=getchar();
	while (c>32)x=x*10+c-48,c=getchar();
	return x*p;
}
using namespace std;
//
string s[15],os[15],ans[15];
int n,m;
multiset<string>S;
//
void finit()
{
	n=getint();m=getint();
	rep(i,n)cin>>s[i];
	if(n&1)
	{
		rep(i,m)s[n].push_back('*');
		n++;
	}
}
bool doit()
{
	S.clear();
	rep(j,m)
	{
		string ss;
		rep(i,n)
		{
			if(ans[i][j]=='*')ss+=ans[n-i-1][j];
			else ss+=ans[i][j];
		}
		S.insert(ss);
	}
	bool flag=true;
	while (!S.empty())
	{
		string ss=*S.begin(),sss=ss;reverse(sss.begin(),sss.end());
		S.erase(S.begin());
		if(S.find(sss)!=S.end())
		{
			S.erase(S.find(sss));
			continue;
		}
		if(ss!=sss)return false;
		if(!flag)return false;
		flag=false;
	}
	return true;
}
bool work0(int mask,int istep)
{
	if(!mask)
	{
		//rep(i,n)cout<<ans[i]<<endl;
		if(doit())
		{
			printf("YES\n");
			return true;
		}
		return false;
	}
	int x=0;
	while (!(mask&(1<<x)))x++;
	ans[istep]=s[x];
	for(int i=x+1;i<n;i++)if((mask&(1<<i)))
	{
		ans[n-istep-1]=s[i];
		if(work0(mask^(1<<i)^(1<<x),istep+1))return true;
	}
	return false;
}
int main()
{
	finit();
	if(!work0((1<<n)-1,0))printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    n, k = gets.chomp.split.map(&:to_i)

    ls = gets.chomp.split.map(&:to_i)
    lsr = ls.sort.reverse

    ans = 0
    k.times do |i|
      ans += lsr[i]
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2300
#include<bits/stdc++.h>
using namespace std;
//size_t f = string::npos
//make pair, tuple

int main(){
      string s1, s2, s3;cin >> s1 >> s2 >> s3;
      char now = 'a';
      while(true){
            if(now == 'a'){
                  if(s1.empty())return cout << 'A', 0;
                  now = s1.front();
                  s1 = s1.substr(1, s1.length() - 1);
            }
            if(now == 'b'){
                  if(s2.empty())return cout << 'B', 0;
                  now = s2.front();
                  s2 = s2.substr(1, s2.length() - 1);
            }
            if(now == 'c'){
                  if(s3.empty())return cout << 'C', 0;
                  now = s3.front();
                  s3 = s3.substr(1, s3.length() - 1);
            }
      }
}

Measured memory_bytes: 256
x,n = map(int,input().split())
P = set(map(int,input().split()))
Z = {_ for _ in range(-1,102)}
Z = Z-P
d = 101
ans = 101
for s in Z:
    y = abs(x-s)
    if y<d:
        d = y
        ans = s
print(ans)

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

using namespace std;

typedef unsigned long long ull;
typedef long double ldbl;
typedef long long ll;
typedef double dbl;
const ldbl E = 2.71828182845904523536;
const ldbl pi = acos(-1);
const dbl eps = 1e-9;
const ll mod = 1e9+7;
const ll inf = 1LL<<30;
#define countones(x) __builtin_popcount (x);
int dcmp(double x, double y)
{
    return fabs(x - y) <= eps ? 0 : x < y ? -1 : 1;
};

string convertostring(long long  num)
{
    stringstream ss;
    ss << num;
    return ss.str();
}
void PLAY()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cout << fixed << setprecision(2);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
const int N=1010;
char a[N][N];
int n,m;
ll mem[N][N];
bool inside(ll x,ll y)
{
    return x>=1&&x<=n&&y>=1&&y<=m&&a[x][y]=='.';
}
ll sol(ll i,ll j)
{
    if(i==n&&j==m)
        return 1;

    ll &ret=mem[i][j];
    if(ret!=-1)
        return ret;
    ret=0;
    ll p1=0,p2=0;
    if(inside(i,j+1))
        p1+=sol(i,j+1);

    if(inside(i+1,j))
        p2+=sol(i+1,j);
    return ret=((p1%mod)+(p2%mod))%mod;
}
int main()
{
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
            cin>>a[i][j];

    }
    memset(mem,-1,sizeof mem);
    cout<<sol(1,1);


}


Measured memory_bytes: 9216
#include <vector>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
	long long n,a,b,c,d,e;
	cin >> n >> a >> b >> c >> d >> e;
	cout << (n-1) / min({a, b, c, d, e}) + 5 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;

int main() {
  int a, b, c;
  int count = 0;
  cin >> a >> b >> c;
  for (int j = 1; j <= c; j++) {
    if (c % j == 0 && j <= b && j >= a) count++;
  }

  cout << count << endl;
  return 0;
}



Measured memory_bytes: 3108
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a = INT()
b = INT()
h = INT()
print((a+b)*h//2)

Measured memory_bytes: 5148
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 53, M = 1e2 + 3;
const int INF = INT_MAX;
const db PI = acos(-1);

int n, k, v[N];
ll dp[N][N][M];
bool seen[N][N][M];

void test();
ll solve(int l, int r, int op);

int main() {
    fast_io();
    test();
    return 0;
}

void test() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    cout << solve(0, n - 1, 0) << "\n";
}

ll solve(int l, int r, int op) {
    if (op >= k or l > r) {
        return 0;
    }
    auto &ans = dp[l][r][op];
    auto &vis = seen[l][r][op];
    if (!vis) {
        vis = true, ans = 0;
        ans = max(ans, solve(l + 1, r, op + 1) + v[l]);
        ans = max(ans, solve(l, r - 1, op + 1) + v[r]);
        ans = max(ans, solve(l + 1, r, op + 2));
        ans = max(ans, solve(l, r - 1, op + 2));
    }
    return ans;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int x=n*800,y=(n/15)*200;
	cout<<x-y<<endl;
}

Measured memory_bytes: 256
from time import time

def solve(N, S):
    answer = 0
    Cs = [[], [], []]
    for i in range(N):
        c = S[i]
        if c == 'R':
            Cs[0].append(i)
        elif c == 'G':
            Cs[1].append(i)
        elif c == 'B':
            Cs[2].append(i)
    answer = len(Cs[0]) * len(Cs[1]) * len(Cs[2])
    for i in range(N):
        for d in range(1, N-i):
            if i + 2*d < N and not(S[i] == S[i+d] or S[i] == S[i+2*d] or S[i+d*2] == S[i+d]):
                answer -= 1
    print(answer)


def main(N, S):
    import sys
    start = time()
    from itertools import combinations
    Cs = [[], [], []]
    for i in range(N):
        c = S[i]
        if c == 'R':
            Cs[0].append(i)
        elif c == 'G':
            Cs[1].append(i)
        elif c == 'B':
            Cs[2].append(i)
    answer = 0
    for C in Cs:
        a = 0
        print(C, len(C))
        for Ci in range(len(C)-1):
            i = C[Ci]
            for Cj in range(Ci+1, len(C)):
                j = C[Cj]
                print("*", i, j)
                print(i)           # i より前
                print(j - i - 1)   # i と j の間
                print(N - 1 - j)   # j より後
                print(Ci)
                print(Cj - Ci-1)
                print(len(C) - 1 - Cj)
                a += i           # i より前
                a += N - 1 - j   # j より後
                a += j - i - 1   # i と j の間
                a -= Ci
                a -= Cj - Ci-1
                a -= len(C) - 1 - Cj
        print(S[C[0]], "expect", sum(S[C[0]] in (i, j, k) and (i == j or j == k or i == k) for i,j,k in combinations(S, 3)))
        print(S[C[0]], "actual", a)
        answer += a
    print("expect", sum(i == j or j == k or i == k for i,j,k in combinations(S, 3)))
    print("actual", answer)

    print(answer, time() - start, file=sys.stderr)
    for i in range(N):
        for d in range(1, N-i):
            if i + 2*d < N and not(S[i] == S[i+d] or S[i] == S[i+2*d]):
                answer += 1
    total = N * (N-1)*(N-2) // 6
    print(total, answer, file=sys.stderr)
    print(total - answer)
    print(time() - start, file=sys.stderr)


N = int(input())
S = input()
solve(N, S)
#main(N, S)


Measured memory_bytes: 9396
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << val << endl

using namespace std;

typedef long long int lli;

int main() {
    int N;
    cin >> N;
    int ans = 0;
    int X = N;
    while (N) {
        ans += (N % 10);
        N /= 10;
    }
    cout << (X % ans == 0 ? "Yes" : "No") << endl;
    return 0;
}

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

int main(){
	vector<int> now, next;
	int len;
	while( cin >> len, len ){
		now.resize(len);
		next.resize(len);
		for( int i=0; i<len; i++ ){
			cin >> next[i];
		}
		int ope=0;
		while(!(now == next)){
			ope++;
			for( int i=0; i<len; i++ )	now[i] = next[i];
			for( int i=0; i<len; i++ ){
				int cnt=0;
				for( int j=0; j<len; j++ ){
					if( now[i] == now[j] )	cnt++;
				}
				next[i] = cnt;
			}
		}
		cout << ope-1 << endl;
		cout << now[0];
		for( int i=1; i<len; i++ ){
			cout << " " << now[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
bool ans[100][100];
void Calc(){
	int N = rei();
	if(N % 2 == 0){
		for(int i=0;i<N;i++){
			ans[i][N-1-i] = true;
			ans[i][i] = true;
		}
	}
	else{
		for(int i=0;i<N-1;i++){
			ans[i][N-2-i] = true;
			ans[i][i] = true;
		}
		ans[N-1][N-1] = true;
	}
	int c = 0;
	for(int i=0;i<N;i++){
		for(int j=0;j<i;j++){
			if(!ans[j][i]){
				c++;
			}
		}
	}
	cout << c;
	for(int i=0;i<N;i++){
		for(int j=0;j<i;j++){
			if(!ans[j][i]){
				cout << "\n" << j+1 << " " << i+1;
			}
		}
	}
	cout << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            n = n % 10;
            if(n==3){
                Console.WriteLine("bon");
                return;
            }
            if(n==0 || n==1 || n==6 || n ==8){
                Console.WriteLine("pon");
                return;
            }
            Console.WriteLine("hon");
            return;
        }
    }
}


Measured memory_bytes: 27548
n = int(input())
a, b, c, ans = 0, 0, 0, 0
for i in range(n):
    word = input()
    ans += word.count('AB')
    if word[-1] == 'A' and word[0] == 'B':
        c += 1
    elif word[-1] == 'A':
        a += 1
    elif word[0] == 'B':
        b += 1

if c == 0:
    ans += min(a, b)
elif a+b > 0:
    ans += c+min(a, b)
elif a+b == 0:
    ans += c-1
print(ans)


Measured memory_bytes: 9216
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()

int main() {
	multiset<int> MS;
	int q;
	cin >> q;
	Rep(i, q) {
		int n;
		cin >> n;
		if (n == 0) {
			int x;
			cin >> x;
			MS.insert(x);
			cout << MS.size() << endl;
		}
		else if (n == 1) {
			int x;
			cin >> x;
			cout << distance(MS.lower_bound(x), MS.upper_bound(x)) << endl;
		}
		else if (n == 2) {
			int x;
			cin >> x;
			MS.erase(x);
		}
		else if (n == 3) {
			int L, R;
			cin >> L >> R;
			for (auto itr = MS.lower_bound(L); itr != MS.end() && *itr <= R; itr++) {
				cout << *itr << endl;
			}
		}
	}
	return 0;
}


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

int main(void) {
	int n, k, p,ans;
	cin >> n;
	for (int i = 0; i < n; i++) {
		ans = 0;
		cin >> k >> p;
		ans = k % p;
		if (k % p == 0) {
			ans = p;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>
#include <string.h>
#include <queue>

using namespace std;

int main(void){
	int black[50][50], white[50][50], h, w, i, j, k, x, y, bc, wc;
	char field[50][51];
	const int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
	queue<int> qx,qy;
	scanf("%d%d%*c",&w,&h);
	while(w != 0 || h != 0){
		memset(black,0,sizeof(black));
		memset(white,0,sizeof(white));
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++)
				field[i][j] = getchar();
			getchar();
		}
		for(i = 0;i < h;i++){
			for(j = 0;j < w;j++){
				if(field[i][j] == 'B'){
					qx.push(j);
					qy.push(i);
					while(qx.size()){
						x = qx.front();
						y = qy.front();
						qx.pop();
						qy.pop();
						if(field[y][x] == '.')
							black[y][x] = 1;
						for(k = 0;k < 4;k++){
							if(x + dx[k] >= 0 && x + dx[k] < w && y + dy[k] >= 0 && y + dy[k] < h && field[y + dy[k]][x + dx[k]] == '.' && !black[y + dy[k]][x + dx[k]]){
								qx.push(x + dx[k]);
								qy.push(y + dy[k]);
							}
						}
					}
				}
				else if(field[i][j] == 'W'){
					qx.push(j);
					qy.push(i);
					while(qx.size()){
						x = qx.front();
						y = qy.front();
						qx.pop();
						qy.pop();
						if(field[y][x] == '.')
							white[y][x] = 1;
						for(k = 0;k < 4;k++){
							if(x + dx[k] >= 0 && x + dx[k] < w && y + dy[k] >= 0 && y + dy[k] < h && field[y + dy[k]][x + dx[k]] == '.' && !white[y + dy[k]][x + dx[k]]){
								qx.push(x + dx[k]);
								qy.push(y + dy[k]);
							}
						}
					}
				}
			}
		}
		bc = wc = 0;
		for(i = 0;i < h;i++)
			for(j = 0;j < w;j++) if(white[i][j] && !black[i][j]) wc++;
		for(i = 0;i < h;i++)
			for(j = 0;j < w;j++) if(black[i][j] && !white[i][j]) bc++;
		printf("%d %d\n",bc,wc);
		scanf("%d%d%*c",&w,&h);
	}
	return 0;
}

Measured memory_bytes: 53772
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  string s[n];
  rep(i,n) R s[i];
  map<string,int> m;
  rep(i,n) m[s[i]]++;
  int M=0;
  vector<string> v;
  tr(it,m) {
    if(it->S>M) {
      M=it->S;
      v.clear();
      v.pb(it->F);
    } else if(it->S==M) v.pb(it->F);
  }
  rep(i,v.size()) pr(v[i]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 27120
using System;


class Program
{
    static void Main(string[] args)
    {
        string ABCD = Console.ReadLine();
        int A = int.Parse(Convert.ToString(ABCD[0]));
        int B = int.Parse(Convert.ToString(ABCD[1]));
        int C = int.Parse(Convert.ToString(ABCD[2]));
        int D = int.Parse(Convert.ToString(ABCD[3]));
        if (A + B + C + D == 7)
        {
            Console.WriteLine($"{A}+{B}+{C}+{D}=7");
        }
        else if (A + B + C - D == 7)
        {
            Console.WriteLine($"{A}+{B}+{C}-{D}=7");
        }
        else if (A + B - C + D == 7)
        {
            Console.WriteLine($"{A}+{B}-{C}+{D}=7");
        }
        else if (A - B + C + D == 7)
        {
            Console.WriteLine($"{A}-{B}+{C}+{D}=7");
        }
        else if (A - B - C + D == 7)
        {
            Console.WriteLine($"{A}-{B}-{C}+{D}=7");
        }
        else if (A - B + C - D == 7)
        {
            Console.WriteLine($"{A}-{B}+{C}-{D}=7");
        }
        else if (A + B - C - D == 7)
        {
            Console.WriteLine($"{A}+{B}-{C}-{D}=7");
        }
        else if (A - B - C - D == 7)
        {
            Console.WriteLine($"{A}-{B}-{C}-{D}=7");
        }

    }
}



Measured memory_bytes: 13268
import math
import itertools

n = int(input())
x = [list(map(int, input().split())) for i in range(n)]

res = 0
cnt = 0
for v in itertools.permutations(x):
  for i in range(n-1):
    res += math.sqrt((v[i+1][0] - v[i][0]) ** 2 + (v[i+1][1] - v[i][1]) ** 2)
  cnt += 1

print((res+0.0)/cnt)


Measured memory_bytes: 42220
#include<bits/stdc++.h> 
using namespace std;
struct edge
{
    int v,w,nxt;
}e[400050];
int head[100050],ecnt;
void adde(int u,int v,int w)
{
    e[++ecnt].v = v;
    e[ecnt].w = w;
    e[ecnt].nxt = head[u];
    head[u] = ecnt;
}
int n,m;
int l[200050],r[200050];
int d[200050];
long long dist[100005];
queue<int> que;
bool vis[100050],inq[100050];

bool spfa(int st)
{
    que.push(st);
    inq[st] = true;
    dist[st] = 0;
    long long curmax = 0,curmin = 0;
    while(!que.empty())
    {
        int u = que.front();
        que.pop();
        for(int i = head[u];i;i = e[i].nxt)
        {
            int v = e[i].v;
            if(dist[v] == 12345678987654321)
            {
                dist[v] = dist[u] + e[i].w;
                curmax = max(curmax,dist[v]);
                curmin = min(curmin,dist[v]);
                if(curmax - curmin > 1000000000)
                    return false;
                vis[v] = 1;
                if(!inq[v])
                    que.push(v);
            }
            else if(dist[v] != dist[u] + e[i].w)
                return false;
        }
        inq[u] = false;
    }
    return true;
}

int main()
{
    for(int i = 1;i <= 100000; ++ i)
        dist[i] = 12345678987654321;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d%d",&l[i],&r[i],&d[i]);
        adde(l[i],r[i],d[i]);
        adde(r[i],l[i],-d[i]);
    }
    for(int i = 1;i <= n; ++ i)
        if(!vis[i])
        {
            vis[i] = 1;bool l = spfa(i);
            if(!l)
            {
                printf("No\n");
                return 0;
            }
        }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 9088
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
AB = sorted(AB)
T = [[] for j in range(N)]
for i in range(M):
    T[AB[i][0]-1].append(AB[i][1])
    T[AB[i][1] - 1].append(AB[i][0])
ans = 0
for i in range(N):
    f =True
    for e in T[i]:
        if H[e-1]>=H[i]:
            f = False
    if f:
        ans+=1
print(ans)


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

const int INF = 2e9;

int main(){
    int n;
    cin >> n;
    vector<int> c(4);
    vector<string> s(n);
    rep(i,n){
        cin >> s[i];
        if(s[i] == "AC") c[0]++;
        else if(s[i] == "WA") c[1]++;
        else if(s[i] == "TLE") c[2]++;
        else if(s[i] == "RE") c[3]++;
    }
    cout << "AC" << " x " << c[0] << endl;
    cout << "WA" << " x " << c[1] << endl;
    cout << "TLE" << " x " << c[2] << endl;
    cout << "RE" << " x " << c[3] << endl;
}

Measured memory_bytes: 6424
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI=3.14159265358979323846;

int main(){
  int n;
  cin >> n;
  set<string> se;
  vector<int> vi;
  vector<string> vs(n);
  rep(i,n) cin >> vs[i];
  sort(vs.begin(), vs.end());

  int count=1;
  rep(i,n){
    if(i==n-1){
      se.insert(vs[i]);
      vi.push_back(count);
      break;
    }
    if(vs[i] == vs[i+1]){    
      count++;
    }
    else if(vs[i]!=vs[i+1]){
      se.insert(vs[i]);
      vi.push_back(count);
      count = 1;
    }
  }
  
  int max = *max_element(vi.begin(), vi.end());

  int i=0;
  for(auto ss: se){
    if(vi[i] == max) cout << ss << endl;
    i++;
  }
}


Measured memory_bytes: 24436
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

from collections import Counter
def main():
    n = ii()
    S = []
    for _ in range(n):
        S.append(input())
    c = Counter(S)
    d = c.most_common()
    ans = []
    mm = 0
    for i in range(len(c)):
        if mm > d[i][1]:
            break
        ans.append(d[i][0])
        mm = d[i][1]
    ans.sort()
    for i in range(len(ans)):
        print(ans[i])

main()

        
        


    

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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > P(N * N);
  cin >> P;
  for(auto &p : P) --p;
  int64 ret = 0;

  auto dist = make_v< int >(N, N);
  auto alive = make_v< int >(N, N);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      alive[i][j] = 1;
      dist[i][j] = min({i + 1, N - i, j + 1, N - j}) - 1;
    }
  }
  const int vy[] = {-1, 1, 0, 0};
  const int vx[] = {0, 0, -1, 1};
  for(auto &_ : P) {
    int y = _ / N;
    int x = _ % N;

    ret += dist[y][x];
    alive[y][x] = 0;
    queue< pair< int, int > > que;
    que.emplace(y, x);
    while(!que.empty()) {
      int py, px;
      tie(py, px) = que.front();
      que.pop();
      for(int k = 0; k < 4; k++) {
        int ny = py + vy[k];
        int nx = px + vx[k];
        if(ny < 0 || nx < 0 || ny >= N || nx >= N) continue;
        int nxt_cost = dist[py][px] + alive[py][px];
        if(chmin(dist[ny][nx], nxt_cost)) {
          que.emplace(ny, nx);
        }
      }
    }
  }
  cout << ret << "\n";
}



Measured memory_bytes: 6104
#pragma GCC opointimize("Ofset_asc")
#pragma GCC opointimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC opointimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(ll i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        // freopen("error.txt","w",stderr);
    #endif
}
const int mxN=int(2e6)+100;
ll fac[mxN], ifac[mxN], pow25[mxN], pow26[mxN];
ll ncr(ll n, ll r)
{
    ll ans=fac[n];
    ans*=ifac[n-r];
    ans%=mod;
    ans*=ifac[r];
    ans%=mod;
    return ans;
}
int main()
{
    vok();
    fac[0]=pow25[0]=pow26[0]=1LL;
    ifac[0]=P(fac[0],mod-2LL,mod);
    loop(i,1,mxN)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
        ifac[i]=P(fac[i],mod-2LL,mod)%mod;
        pow25[i]=(pow25[i-1]*25LL)%mod;
        pow26[i]=(pow26[i-1]*26LL)%mod;
    }
    ll k;
    IN k;
    string s;
    IN s;
    ll n=(ll)(int)(s.length());
    ll ans=0LL;
    loop(i,0,k+1)
    {
        ll add=ncr(n+i-1,n-1);
        add*=pow25[i];
        add%=mod;
        add*=pow26[k-i];
        add%=mod;
        ans+=add;
        ans%=mod;
    }
    OUT ans<<endl
    return 0;
}

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

int main() {
  int n,c=0,x,y;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i=0; i < n; i++){
    cin >> a.at(i);
    cin >> b.at(i);
  }
  x = a.at(0);
  y = b.at(0);
  for(int i=0; i < n; i++){
    if(a.at(i) == b.at(i)) c++;
    else c =0;
    if(c == 3){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No" ;
}


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
S = input()
T = input()

max_cnt = 0
for i in range(len(S) - len(T) + 1):
    cnt = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            cnt += 1

    if max_cnt < cnt:
        max_cnt = cnt

print(len(T) - max_cnt)

Measured memory_bytes: 9092
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int M = sc.nextInt();
            int K = sc.nextInt();

            UnionFindTree uft = new UnionFindTree(N);

            List<Integer>[] friends = new List[N];
            for (int i = 0; i < N; i++) {
                friends[i] = new ArrayList<>();
            }

            for (int i = 0; i < M; i++) {
                int a = sc.nextInt() - 1;
                int b = sc.nextInt() - 1;

                friends[a].add(b);
                friends[b].add(a);

                uft.unite(a, b);
            }

            List<Integer>[] groups = new List[N];
            for (int i = 0; i < N; i++) {
                groups[i] = new ArrayList<>();
            }

            for (int i = 0; i < N; i++) {
                groups[uft.find(i)].add(i);
            }

            int[] C = new int[N];
            for (int i = 0; i < N; i++) {
                C[i] = groups[uft.find(i)].size() - 1 - friends[i].size();
            }

            for (int i = 0; i < K; i++) {
                int c = sc.nextInt() - 1;
                int d = sc.nextInt() - 1;

                if (uft.find(c) == uft.find(d)) {
                    C[c]--;
                    C[d]--;
                }
            }

            StringBuilder ans = new StringBuilder();
            for (int i = 0; i < N; i++) {
                ans.append(C[i]).append(" ");
            }

            System.out.println(ans.toString().trim());
        }
    }

    public static class UnionFindTree {

        private int[] parent;

        private int[] rank;

        public UnionFindTree(int N) {
            parent = new int[N];
            rank = new int[N];
            for (int i = 0; i < N; i++) {
                parent[i] = i;
                rank[i] = 0;
            }
        }

        public int find(int x) {
            if (parent[x] == x) {
                return x;
            } else {
                int p = find(parent[x]);
                parent[x] = p;
                return p;
            }
        }

        public void unite(int x, int y) {
            x = find(x);
            y = find(y);

            if (x == y) {
                return;
            }

            if (rank[x] < rank[y]) {
                parent[x] = y;
            } else {
                parent[y] = x;
                if (rank[x] == rank[y]) {
                    rank[x]++;
                }
            }
        }

        public boolean same(int x, int y) {
            return find(x) == find(y);
        }

    }

}


Measured memory_bytes: 131000
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{
			string input = Console.ReadLine();
			string output = "";
			bool check = false;
			
			for(int i=1; i<input.Length; i++)
			{
				if(input[i] == input[i-1])
				{
					Console.WriteLine("{0} {1}",i,i+1);
					check = true;
					break;
				}
				if(i>1 && input[i] == input[i-2]) 
				{
					Console.WriteLine("{0} {1}",i-1,i+1);
					check = true;
					break;
				}
			}
			if(!check)
            Console.WriteLine("-1 -1");
            
		}

	}
}

Measured memory_bytes: 3032
#include <iostream>

using namespace std;

int main(void)
{
    int N, X, i;

    cin >> N;

    for(i=0; i<=N; i++){
        if(i * 1.08 >= N){
            break;
        }
    }

    if(i * 1.08 < N+1){
        cout << i << endl;
    }
    
    else{
        cout << ":(" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<set<int>>;

typedef long long ll;
typedef tuple<ll, ll, ll> mytuple;
const ll INF = 1e9;
const ll MOD = 1000000007;
const double pi = 3.141592653589793238;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) { if (b == 0) {return a;} else {return GCD(b, a % b);} }
// a と b の最小公倍数を返す関数
long long LCM(long long a, long long b) { return a/GCD(a,b)*b; }

template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return true; } return false; }

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

    vector<int64_t> c(N);
    vector<vector<int>> a(N, vector<int>(M));

    for (int i = 0; i < N; ++i) {
      cin >> c.at(i);
      for(int j = 0; j < M; j++) {
        cin >> a.at(i).at(j);
      }
    }

    int64_t minV = 1200010;
    for(int bits = 0; bits < (1<<N); bits++) {
      auto mask = bitset<12>(bits);
      int64_t sum = 0;
      vector<int> b(M, 0);
      for (int i = 0; i < N; ++i) {
        if(mask.test(i)) {
          sum += c.at(i);
          for (int j = 0; j < M; ++j) {
            b.at(j) += a.at(i).at(j);
          }
        }
      }

      bool flag = true;
      for (int j = 0; j < M; ++j) {
        if(b.at(j) < X) {
          flag = false;
          break;
        }
      }

      if(flag) {
        minV = min(minV, sum);
      }
    }

    if(minV == 1200010) {
      minV = -1;
    }

    cout << minV << endl;
}



Measured memory_bytes: 3640