akhauriyash/Code-Regression huggingface dataset:
/*
Author : N_o_o_B
Created : March 22 2020 17:27:26 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    ll n,m;
    cin >> n >> m;
    ll ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans << endl;


    time_taken();
    return 0;
}

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

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

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n ;
    ll ans = 0;
    for( ll i = 1;i<=n;i++){
        ans += (n/i) * ( i*(n/i) + i )/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int bill = N / 1000;
    int diff = bill * 1000 - N;
    if(diff<0){
        diff = 1000 + diff;
    }
    cout << diff;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define ll long long
inline int roundup(int a, int b) { return (((a + (b -1)) / b)); }
using namespace std;

signed main(void) {
    int d, t, s;
    cin >> d >> t >> s;
    (roundup(d, s) <= t)?cout << "Yes\n":cout << "No\n";
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
//  for(int i=0; i<N; i++){
  int i=0;
  while(i<N){
    string color;
    cin >> color;
    
    if(color=="Y"){
      cout << "Four" << endl;
      break;
    }
    i++;
  }
  if(i==N){
    cout << "Three" << endl;
  }
}

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

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N)
  {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int min_ans = 0;
  int max_ans = 0;

  int num = -1;
  rep(i, N)
  {
    int n = a[i] / 400;
    if (num != n && n < 8)
    {
      min_ans++;
      max_ans++;
      num = n;
    }
    if (n >= 8)
      max_ans++;
  }
  min_ans = max(1, min_ans);
  cout << min_ans << " " << max_ans << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 
 
void solve(){
    ll n,k;
    cin>>n>>k;
    ll l[100];
    rep(i,n) cin>>l[i];
    sort(l,l+n);
    reverse(l,l+n);
    ll ans=0;
    rep(i,k) ans+=l[i];
    cout<<ans<<endl;
 
} 
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

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

using namespace std;

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

    long long n, k;
    std::cin >> n >> k;
    std::cout << std::min(n % k, k - n % k) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int main () {
  int m1, d1;
  cin >> m1 >> d1;
  int m2, d2;
  cin >> m2 >> d2;
  if (m1+1 == m2) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int i = sc.nextInt();
        int countTwo = 0;
        while (i != 0) {
            int r = i % 10;
            i /= 10;
            if (r == 2) countTwo++;
        }
		System.out.println(countTwo);
    }
}


Measured memory_bytes: 21332
N = int(input())
SP = []
for _ in range(N):
    s, p = input().split()
    SP.append((s, int(p)))
    
restaurants = SP[:]

restaurants = [(i+1, s, p) for i, (s, p) in enumerate(restaurants)]

sort_key = lambda x:(x[1],-x[2])
restaurants = sorted(restaurants, key = sort_key)

#print(restaurants)
for r in restaurants:
    print(r[0])

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

using namespace __gnu_pbds;
using namespace std;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pii pair<int,int>
#define pf push_front
#define mp make_pair
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%lld",&t)
#define p(t) printf("%lld\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define endl '\n'
#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<pii,vector<pii>,greater<pii> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define spitr set<pii>:: iterator
#define mitr map<int,int>:: iterator

int toint(const string &s) {stringstream ss; ss << s; int x; ss >> x; return x;}
string tostring ( int number ) {stringstream ss; ss << number; return ss.str();}


typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl


int32_t main()
{
    fast;
    int k,a,b;cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
        {
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
}

Measured memory_bytes: 3644
S = input()
T = input()
n = len(T)
ans = len(T)
for st in range(0, len(S)-len(T)+1):
    SS = S[st:st+len(T)]
    tmp = len(T)
    for s,t in zip(SS,T):
        if s==t:
            tmp -= 1
    ans = min(ans, tmp)
print(ans)


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

int		cmpnum(const void *n1, const void *n2)
{
	if (*(int *)n1 < *(int *)n2)
		return (1);
	if (*(int *)n1 > *(int *)n2)
		return (-1);
	else
		return (0);
}

int		main()
{
	int		N, M, i = 0;
	int		sum;
	double	val;
	int		*A;

	sum = 0;
	scanf("%d %d\n", &N, &M);
	A = (int *)calloc((N + 1), sizeof(int));
	while (i < N)
	{
		scanf("%d \n", &A[i]);
		sum += A[i];
		i++;
	}
	qsort(A, N, sizeof(int), cmpnum);
	i = 0;
	val = (double)sum / (4 * (double)M);
	while (i < M)
	{
		if ((double)A[i] < val)
		{
			printf("No\n");
			return (0);
		}
		i++;
	}
	printf("Yes\n");
	return (0);
}


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

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
template <typename T> constexpr T inf = numeric_limits<T>::has_infinity ? numeric_limits<T>::infinity() : numeric_limits<T>::max() / 4;

#define REP(i, stop) FOR(i, 0, stop)
#define FOR(i, start, stop) for (int i = start, i##_len = stop; i < i##_len; ++i)
#define RREP(i, n) for (int i = n; i-- > 0;)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COMP(key) [](const auto& a, const auto& b) { return a.key < b.key; }

template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& a) { return is >> a.first >> a.second; }
template<typename T> istream& operator>>(istream& is, vector<T>& a) { for (T& x : a) is >> x; return is; }

void LOG(const int& x) { cerr << x << "\n"; }
template<typename T> void LOG(const vector<T>& a) { for (const T& x : a) cerr << x << " "; cerr << "\n"; }
template<typename T, std::size_t S> void LOG(const T (&a)[S]) { REP(i, S) cerr << a[i] << " "; cerr << "\n"; }
template<typename T, std::size_t S, std::size_t R> void LOG(const T (&a)[S][R]) { REP(i, S) { REP(j, R) cerr << a[i][j] << " "; cerr << "\n"; } }

i64 ceil(i64 a, i64 b) { return (a - 1) / b + 1; }
i64 gcd(i64 a, i64 b) { while (b != 0) { i64 t = b; b = a % b; a = t; } return a; }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
i64 gcd(const vector<i64>& v) { return accumulate(ALL(v), 1LL, static_cast<i64(*)(i64, i64)>(gcd)); }
i64 lcm(const vector<i64>& v) { return v.empty() ? 0LL : accumulate(v.begin() + 1, v.end(), v[0], static_cast<i64(*)(i64, i64)>(lcm)); }
i64 pow(i64 x, i64 y, i64 z) { i64 a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
i64 inv(i64 x, i64 m) { return pow(x, m - 2, m); }

struct InitCpp { InitCpp() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10); } } initCpp;

signed main() {
  i32 t;
  cin >> t;
  REP(_, t) {
    i32 n, k;
    cin >> n >> k;
    vector<i32> x(n);
    cin >> x;
    vector<i32> y(n - 1);
    RREP(i, n - 1) {
      y[i] = x[i + 1] - x[i];
    }
    sort(ALL(y));
    i32 ans = 0;
    REP(i, n - k) {
      ans += y[i];
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 4288
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

//problem_C
int main(){
    int s, w;
    cin >> s >> w;
    
    if (s > w){
        cout << "safe" << endl;
    }
    else{
        cout << "unsafe" << endl;
    }
}

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

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var s = Console.ReadLine().ToCharArray();
            Console.WriteLine(s.Select((t, i) => i == 0 ? 1 : t == s[i - 1] ? 0 : 1).Sum());
        }
    }
}


Measured memory_bytes: 11616
import bisect,copy,heapq,itertools,string
from collections import *
from math import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k, s = MAP()
ans = [0]*n

for i in range(n):
        if(i < k):
                ans[i] = s
        else:
                if(s == 1e9):
                        ans[i] = 1
                else:
                        ans[i] = s + 1
print(*ans)

Measured memory_bytes: 14756
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll A,B,C,X,Y;

int main(){
	cin>>A>>B>>C>>X>>Y;
	ll res=INF;
	for(int i=0;i<100005;i++){
		res=min(res,2*C*i+A*max(0ll,X-i)+B*max(0ll,Y-i));
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,x,tmp,s=0,t=0;
	int i,a[200]={0};
	scanf("%d %d %d",&n,&m,&x);
	for(i=0;i<m;i++)
	{
		scanf("%d",&tmp);
		a[tmp]=1;
	}
	for(i=0;i<n;i++)
	{
		if(a[i]&&i<x)
		{
			s++;	
		}
		else if(a[i]&&i>x)
		{
			t++;
		}
	}
	printf("%d",min(s,t));
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import time
import re
import math
import fractions

def main():
    A,B=map(int,input().split())
    count=0
    for a in range(A,B+1):
        s=str(a)
        r="".join(reversed(list(s)))
        if s==r:
            count+=1
    print(count)
    
    
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())
# global n,A,s,memo,mx,mn,L,B



Measured memory_bytes: 5040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x;
		x = sc.nextInt();
		sc.close();
		if(x == 7 || x == 5 || x == 3)System.out.println("YES");
		else System.out.println("NO");
	}
}



Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define MOD 1000000007
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define RREP(i,a,b) for(ll i=(a); i>=(b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef int64_t in;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> p;
typedef vector<pair<ll, ll>> vpl;


int main(){
    string s; cin >> s;
    ll len = s.size();
    vector<char> S;
    ll size=0;
    rep(i,len){
        if(s[i] == '0' || s[i] == '1'){
            S.push_back(s[i]);
            size++;
        }else{
            if(size>0){
                S.pop_back();
                size--;
            }
        }
    }
    rep(i,size){
        cout << S[i];
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
n, uplus, vplus = map(int, input().split())
u, v = uplus-1, vplus-1
adj = [[] for _ in range(n)]
for _ in range(n-1):
  aplus, bplus = map(int, input().split())
  a, b = aplus-1, bplus-1
  adj[a].append(b)
  adj[b].append(a)

u_dist = [n] * n
u_dist[u] = 0
stack = [u]
while stack:
  vertex = stack.pop()
  for nxt in adj[vertex]:
    if u_dist[nxt] == n:
      u_dist[nxt] = u_dist[vertex] + 1
      stack.append(nxt)

v_dist = [n] * n
v_dist[v] = 0
stack = [v]
leaves = []
while stack:
  vertex = stack.pop()
  isleaf = True
  for nxt in adj[vertex]:
    if v_dist[nxt] == n:
      v_dist[nxt] = v_dist[vertex] + 1
      stack.append(nxt)
      isleaf = False
  if isleaf:
    leaves.append(vertex)

max_depth = 0
for leaf in leaves:
  depth = v_dist[leaf]
  if u_dist[leaf] < depth and max_depth < depth:
    max_depth = depth
    
print(max_depth - 1)

Measured memory_bytes: 29104
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;


int main(void) {
	int ab, bc, ca;
	cin >> ab >> bc >> ca;
	cout << ab * bc / 2 << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static long mod = 1000000007;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int ans = 100*a+10*b+c;
	if(ans%4==0){
		System.out.println("YES");
	}else{
		System.out.println("NO");

	}


		


	}
	static int lowerbond(int k, int[] data){		//kより小さい最小の値をdataの中から探し、返す二分探索
		int min = -1;
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return data[max];
	}


	static long cal(int n){
		long x = (long)n;
		for(int i = n-1;i > 0;i--){
			//	System.out.println(i);
			x *= i;
			x %= mod;
		}
		return x;
	}

}




Measured memory_bytes: 23764
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		int A = in.nextInt();
        int B = in.nextInt();
        String S = in.next();
		char[] s_chars = S.toCharArray();
        
      int flag = 0;
      if(s_chars[A]=='-'){
        for(int i = 0;i < A+B+1;i++){
          if(s_chars[i]=='-'){flag++;}
        }
      }
        if(flag==1){System.out.print("Yes");}
        else{System.out.print("No");}
        
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <deque>
#include <memory.h>
using namespace std;
const int MAXN = 1e5 + 10;
int dist[MAXN];

int main() {
    memset(dist, -1, sizeof(dist));
    int n;
    cin >> n;
    deque<int> q;
    dist[1] = 1;
    q.push_back(1);
    while (!q.empty()) {
        int val = q.front();
        q.pop_front();
        int cur = val*10 % n;
        while (dist[cur] == -1 || dist[cur] > dist[val]) {
            dist[cur] = dist[val];
            q.push_front(cur);
            cur = cur*10 % n;
        }
        cur = (val+1) % n;
        if (dist[cur] == -1 || dist[cur] > dist[val]+1) {
            dist[cur] = dist[val] + 1;
            q.push_back(cur);
        }
    }
    cout << dist[0] << endl;
}

Measured memory_bytes: 896
/*
 * hoge.cpp
 *
 *  Created on: 2014/09/30
 *      Author: eiichi
 */
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<map>
using namespace std;

void draw(int H,int W){
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i%2==0 && j%2==0 || i%2==1 && j%2==1)
				cout << "#";
			else
				cout << ".";
		}
		cout << endl;
	}
	cout << endl;
	return;
}

int main(){
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		int x = i;
		if(x%3==0){
			cout << " " << i;
			continue;
		}
		do{
			if(x%10==3){
				cout << " " << i;
				break;
			}
			x/=10;
		}while(x);
	}
	cout << endl;

	return 0;
}

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

namespace ABC172C
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var n = int.Parse(inputs[0]);
            var m = int.Parse(inputs[1]);
            var k = int.Parse(inputs[2]);

            var aList = Console.ReadLine().Split(" ").Select(x => long.Parse(x)).ToList();
            var bList = Console.ReadLine().Split(" ").Select(x => long.Parse(x)).ToList();

            var minute = 0L;
            var i = 0;
            var j = 0;
            var count = 0;

            // bmax
            minute = bList.Sum();
            j = m;

            for (i = 0; i < n + 1; i++)
            {
                // b減らす
                while (minute > k && j > 0)
                {
                    j--;
                    minute -= bList[j];
                }

                // aだけで時間超過している場合終了
                if (minute > k) break;

                // 更新
                count = Math.Max(count, i + j);

                // 最後の更新が終わったら離脱
                if (i == n) break;

                // a増やす
                minute += aList[i];
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 69420
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a, b, c;
  bool judge = false;
  
  cin >> a >> b >> c;
  
  if(a+b == c)
    judge = true;
  
  if(b+c == a)
    judge = true;
  
  if(c+a == b)
    judge = true;
  
  if(judge == true)
  	cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
a=list(map(int,input().split()))

if a.count(a[1])==3:
  print(1)
  
elif a.count(a[1])==2:
  print(2)
  
elif a.count(a[1])==1 and a.count(a[2])==1:
  print(3)
  
else:
  print(2)

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int x; cin>>x;
  cout<<"ABC"<<x<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define fi first
#define se second
#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 rep11(i, n) for (int i = 1; i < (int)(n); ++i)
#define repo(i, o, n) for (int i = o; i < (int)(n); ++i)
#define repm(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

typedef pair<int, int> P;
int main(){
    string s;
    cin>>s;
    if(s<="2019/04/30"){
        cout<<"Heisei"<<endl;
    }
    else{
        cout<<"TBD"<<endl;
    }

}





Measured memory_bytes: 256
def examA():
    N = DI()/dec(7)
    ans = N
    print(N)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    N = I()
    n = (N-1).bit_length()
    V = [[-1]*(1<<n) for i in range(1<<n)]
    #print(V)
    for i in range(n):
        b1 = 1 << i
        b2 = 1 << (i + 1)
        for j in range(1<<i):
            for k in range(1<<(n-i)):
                for l in range(1<<(n-i)):
                    #print(i,j,k,l,j+k*b2,j+b1+l*b2)
                    if j+k*b2>=N or j+b1+l*b2>=N:
                        continue
                    u,v = sorted([j+k*b2,j+b1+l*b2])
                    #print(u,v)
                    V[u][v-1] = i+1
    ans = [[]for _ in range(N-1)]
    for i in range(N-1):
        for v in V[i]:
            if v>=0:
                ans[i].append(v)
    for v in ans:
        print(" ".join(map(str,v)))
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 13684
def main():
    from collections import deque
    d = deque([s for s in input()])
    Q = int(input())
    reverse = False

    for i in range(Q):
        q = input().split()
        if q[0] == "1":
            reverse = not reverse
        else:
            if (q[1] == "1" and not reverse) or (q[1] == "2" and reverse):
                d.appendleft(q[2])
            else:
                d.append(q[2])
    
    if reverse:
        d.reverse()
    
    print("".join(d))

if __name__ == '__main__':
    main()

Measured memory_bytes: 8548
/***********************************************
 *                   _ooOoo_                   *
 *                  o8888888o                  *
 *                  88" . "88                  *
 *                  (| -_- |)                  *
 *                  O\  =  /O                  *
 *               ____/`---'\____               *
 *             .'  \\|     |//  `.             *
 *            /  \\|||  :  |||//  \            *
 *           /  _||||| -:- |||||-  \           *
 *           |   | \\\  -   * |    |           *
 *           | \_|  ''\---/''  |   |           *
 *           \  .-\__  `-`  ___/-. /           *
 *         ___`. .'  /--.--\  `. . __          *
 *      ."" '<  `.___\_<|>_/___.'  >'"".       *
 *     | | :  `- \`.;`\ _ /`;.`/ - ` : | |     *
 *     \  \ `-.   \_ __\ /__ _/   .-` /  /     *
 *======`-.____`-.___\_____/___.-`____.-'======*
 *                   `=---='                   *
 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

             佛祖保佑       永无BUG

   本程序已经经过开光处理，绝无可能再产生bug
 **********************************************/
#include<algorithm>
#include <iostream>
#include  <cstdlib>
#include  <cstring>
#include   <string>
#include   <vector>
#include   <cstdio>
#include    <queue>
#include    <stack>
#include    <ctime>
#include    <cmath>
#include      <map>
#include      <set>
#define ll long long
#define INF 0x3f3f3f3f
#define db1(x) cout<<#x<<"="<<(x)<<endl
#define db2(x,y) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<endl
#define db3(x,y,z) cout<<#x<<"="<<(x)<<", "<<#y<<"="<<(y)<<", "<<#z<<"="<<(z)<<endl
using namespace std;

int main(void)
{
    #ifdef test
    freopen("in.txt","r",stdin);
    //freopen("in.txt","w",stdout);
    clock_t start=clock();
    #endif //test

    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b)
    {
        for(int i=0;i<a;i++)
            printf("%d",b);
        printf("\n");
    }
    else
    {
        for(int i=0;i<b;i++)
            printf("%d",a);
        printf("\n");
    }

    #ifdef test
    clockid_t end=clock();
    double endtime=(double)(end-start)/CLOCKS_PER_SEC;
    printf("\n\n\n\n\n");
    cout<<"Total time:"<<endtime<<"s"<<endl;        //s为单位
    cout<<"Total time:"<<endtime*1000<<"ms"<<endl;    //ms为单位
    #endif //test
    return 0;
}


// ━━━━━━神兽出没━━━━━━
//      ┏┓       ┏┓
//     ┏┛┻━━━━━━━┛┻┓
//     ┃           ┃
//     ┃     ━     ┃
//     ????━????   ┃
//     ┃           ┃
//     ┃    ┻      ┃
//     ┃           ┃
//     ┗━┓       ┏━┛
//       ┃       ┃
//       ┃       ┃
//       ┃       ┗━━━┓
//       ┃           ┣┓
//       ┃           ┏┛
//       ┗┓┓┏━━━━━┳┓┏┛
//        ┃┫┫     ┃┫┫
//        ┗┻┛     ┗┻┛
//
// ━━━━━━感觉萌萌哒━━━━━━


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

using namespace std;

class Prime {
    public:
        vector<char> nprime;
        Prime(size_t n) : nprime(n+1) {
            nprime[0] = nprime[1] = 1;
            for(size_t i=2; i<=n; i++) {
                if(!nprime[i]) continue;
                for(size_t j=2; i*j<=n; j++)
                    nprime[i*j] = 1;
            }
        };
        bool is(size_t i) {
            return nprime[i] == 0;
        };
};

int main(void) {
    using namespace std;

    Prime p(1e6);

    long a, b;
    cin >> a >> b;
    long g = __gcd(a, b);

    long r = 1; // 1
    for(long x=1; x<=1e6; x++) {
        if(!p.is(x)) continue;
        if(g%x == 0) r++;
        while(g%x == 0) g /= x;
    }
    if(g > 1) r++;

    cout << r << endl;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b;
	scanf("%d",&n);
	if(n==1)printf("Hello World");
	else
	{
		scanf("%d %d",&a,&b);
		printf("%d",a+b);
	}
	return 0;
}

Measured memory_bytes: 256
S=input()
S1=int(S[0:2])
S2=int(S[2:4])
if 1<=S1<=12:
    if 1<=S2<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1<=S2<=12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define bf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double d;
#define MAX 1000001
#define MIN -1
#define mod 1000000007
#define INF 5e17
using namespace std;
typedef vector<ll> Vector;
typedef queue<ll > Queue;
typedef stack<ll> Stack;
typedef pair<ll,ll> Pair;
#define mp make_pair
#define pb push_back
vector< pair<ll,ll> > v;
bool vis[MAX];
ll ar[MAX];
int main(){
    bf;
    ll i,j,m,k,t,n,ans; string s;
    cin>>n;
    cout<<(n*800)-((n/15)*200);
    return 0;
}

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

using namespace std;

int xs[1000001];
int main(){

  int N,T,E;
  cin>>N>>T>>E;
  for(int i=0;i<N;i++)cin>>xs[i];
  for(int i=0;i<N;i++){
    for(int j=1;j<10000;j++){
      int a=xs[i]*j;
      if(abs(T-a)<=E){
	cout<<i+1<<endl;
	return 0;
      }
    }
  }
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

string S, T;
int dp[1000 + 10][1000 + 10];
int INF = 1145141919;

int main() {
	cin >> S >> T;
	
	for (int i = 0; i <= S.size(); i++)for (int j = 0; j <= T.size(); j++)dp[i][j] = INF;
	dp[0][0] = 0;
	for (int i = 1; i <= S.size(); i++) {
		dp[i][0] = i;
	}
	for (int i = 1; i <= T.size(); i++) {
		dp[0][i] = i;
	}

	for (int i = 1; i <= S.size(); i++) {
		for (int j = 1; j <= T.size(); j++) {
			int c = 0;
			if (S[i - 1] != T[j - 1])c = 1;
			dp[i][j] = min(dp[i - 1][j] + 1, min(dp[i][j - 1] + 1, dp[i - 1][j - 1] + c));
		}
	}
	cout << dp[S.size()][T.size()] << endl;
	return 0;
}


Measured memory_bytes: 7164
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define endl "\n"
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;
bigint dp[300011] ;
int main(){
    FAST_IO ;
    dp[0] = 1 ;
    dp[1] = 1 ;
    bigint N , M ; cin >> N >> M ;
    for( int i = 0 ; i < M ; i++ ){
        int x ; cin >> x ;
        dp[x] = -1 ;
    }
    for( int i = 2 ; i <= N ; i++ ){
        if( dp[i] == -1 ){
            continue ;
        }
        if( dp[i-1] != -1 )
            dp[i] += dp[i-1] % mod ;
        if( dp[i-2] != -1 )
            dp[i] += dp[i-2] % mod ;
    }
    if( dp[N] != -1 )
        cout << dp[N] % mod << endl ;
    else
        cout << "0" << endl ;
    return 0 ;
}


Measured memory_bytes: 4436
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define P pair<int, int>

using namespace std;
using ll = long long;

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

void solve(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b)+min(c, d) << endl;
}

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


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


int main()
{
	int cost = 2147483647;
	int A, B, m;
	int* a, * b;
	cin >> A >> B >> m;
	a = new int[A];
	b = new int[B];

	int am = 2147483647, bm = 2147483647;
	for (int i = 0; i < A; i++) {
		cin >> a[i];
		am = min(am, a[i]);
	}
	for (int i = 0; i < B; i++) {
		cin >> b[i];
		bm = min(bm, b[i]);
	}

	for (int i = 0; i < m; i++) {
		int x, y, c;
		cin >> x >> y >> c;
		cost = min(cost, a[x-1] + b[y-1] - c);
	}

	cost = min(cost, am + bm);

	cout << cost;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int k, q;
    cin >> k >> q;
    vector<ll> d(k);
    rep(i, k) cin >> d[i];
    while (q--) {
        ll n, x, m;
        cin >> n >> x >> m;
        ll sum = 0;
        // cout << x % m << " ";
        ll cnt = 0;
        rep(i, k) {
            sum += d[i] % m;
            if (d[i] % m == 0) cnt++;
            // cout << d[i] % m << " ";
        }
        // cout << endl;
        sum *= (n - 1) / (ll)k;
        cnt *= (n - 1) / (ll)k;
        sum += x % m;
        rep(i, (n - 1) % k) {
            sum += d[i] % m;
            if (d[i] % m == 0) cnt++;
        }
        cout << n - 1 - cnt - sum / m << endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

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

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 H, W;
char maze[25][25];
int d[25][25];
int solve(int s_i, int s_j, int t_i, int t_j) {
    REP(i, H) {
        REP(j, W) { d[i][j] = INF; }
    }

    queue<pair<int, int>> q;
    q.push(make_pair(s_i, s_j));
    d[s_i][s_j] = 0;
    while (!q.empty()) {
        pair<int, int> p = q.front();
        q.pop();
        if (p.first == t_i && p.second == t_j) {
            break;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        REP(i, 4) {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if (0 <= nx && nx < H && 0 <= ny && ny < W && maze[nx][ny] != '#' && d[nx][ny] == INF) {
                q.push(make_pair(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[t_i][t_j];
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    cin >> H >> W;
    REP(i, H) {
        REP(j, W) {
            char tmp;
            cin >> tmp;
            maze[i][j] = tmp;
        }
    }

    int ans = 0;
    REP(s_i, H) {
        REP(s_j, W) {
            REP(t_i, H) {
                REP(t_j, W) {
                    if (maze[s_i][s_j] == '.' && maze[t_i][t_j] == '.') {
                        int tmp = solve(s_i, s_j, t_i, t_j);
                        if (tmp != INF) {
                            chmax(ans, tmp);
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(
        s:String,
    );
//    let s = String::new()
    println!("{}", s.chars().filter(|&c| c == '1').count());
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

vector<int> par;
int root(int n) {
	//cout << "n=" << n << endl;
	if (n == par[n]) {
		//cout << n << endl;
		return n;
	}
	else {
		return par[n] = root(par[n]);
	}
}

void unite(int a, int b) {
	int art = root(a), brt = root(b);
	//cout << "art=" << art << "brt=" << brt << endl;
	if (art == brt) return;
	else par[brt] = art;
}

int main() {
	int N, M; cin >> N >> M;
	par=vector<int>(M + 1);
	for (int i = 1; i <= M; i++) par[i] = i;
	vector<vector<int>> lan(N);
	for (int i = 0; i < N; i++) {
		int K; cin >> K;
		for (int j = 0; j < K; j++) {
			//printf("i=%d j=%d\n", i, j);
			int L; cin >> L;
			lan[i].push_back(L);
			if (j > 0) {
				unite(lan[i][0], lan[i][j]);
			}
		}
	}

	int rt = 0;
	bool fl = true;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < lan[i].size(); j++) {
			if (i == 0 && j == 0) rt = root(lan[i][j]);
			else if (rt != root(lan[i][j])) {
				fl = false;
				break;
			}
		}
	}

	if (fl) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 8976
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;


int main(){
    ll n,q;
    cin >> n >> q;
    ll ans=(n-2)*(n-2);
    set<pll> s,t;// sは横、tは縦
    rep(i,q){
        ll type,x;
        cin >> type >> x;
        if(type==1){
            auto it=t.lower_bound({x,0});
            if(it==t.end()){
                ans-=n-2;
                s.insert({n,x});
                t.insert({x,n});
            }
            else{
                pll a=*it;
                ans-=a.se-2;
                //t.erase({a.fi,a.se});
                //s.erase({a.se,a.fi});
                s.insert({a.se,x});
                t.insert({x,a.se});
            }
        }
        if(type==2){
            auto it=s.lower_bound({x,0});
            if(it==s.end()){
                ans-=n-2;
                t.insert({n,x});
                s.insert({x,n});
            }
            else{
                pll a=*it;
                ans-=a.se-2;
                t.insert({a.se,x});
                s.insert({x,a.se});
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 28632
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]],is_prime
    
q = int(input())
Query = [list(map(int,input().split())) for _ in range(q)]

Primes,Is_Prime = primes(100000)

Like_2017 = [False]*(100000+1)
for p in Primes:
  if p*2-1 <= 100000 and Is_Prime[p*2-1]:
    Like_2017[p*2-1] = True

accum = 0
Accum = []
for i in range(100000+1):
  accum += int(Like_2017[i])
  Accum += [accum]

for query in Query:
  print(Accum[query[1]]-Accum[query[0]-1])

Measured memory_bytes: 33144
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    String o = sc.next();
    String e = sc.next();
    String ans = "";
    for (int i = 0; i < e.length(); i++) {
      ans += o.charAt(i);
      ans += e.charAt(i);
    }

    if (o.length() != e.length()) {
      ans += o.charAt(o.length() - 1);
    }

    System.out.println(ans);

  }
}

Measured memory_bytes: 38968
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    for(int i=0;i<=n;i+=4){
        if((n-i)%7==0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>

using namespace std;

int main(){
	int i, j;
	int n;
	double t, a;
	vector<int>h;

	cin >> n;
	cin >> t >> a;

	for (i = 0; i < n; i++) {
		int num;
		cin >> num;
		h.push_back(num);
	}

	double minn = 9999999;
	int index = -1;

	for (i = 0; i < n; i++) {
		double num = t - h[i] * 0.006;
		double num2;



		if (a < 0 && num < 0) {
			num2 = fabs(a) - fabs(num);
			num2 = fabs(num2);
		}
		else if (a < 0 && num > 0) {
			num2 = fabs(a) + num;
		}
		else if (a > 0 && num < 0) {
			num2 = a + fabs(num);
		}
		else {
			num2 = fabs(a) - fabs(num);
		}

		if (minn > fabs(num2)) {
			minn = fabs(num2);
			index = i;
		}

	}


	cout << index + 1 << endl;



	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    A,B,K=pin()
    s=set()
    for i in range(K):
        if A+i<=B:s.add(A+i)
    
    for k in range(K):
        if (B+k-K+1)>=A: s.add(B+k-K+1)
    print(*sorted(list(s)),sep='\n')
    #print()
#%%submit!
resolve()

Measured memory_bytes: 38256