akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    int k;
    string s;
    cin >> s >> k;
    int n = s.size();
    set<string> v;
    REP(i, n) {
    	string cur;
    	FOR(j, i, min(n-1, i+4)) {
    		cur.push_back(s[j]);
    		v.insert(cur);
    	}
    }
    for(auto& str : v) {
    	if(!(--k)) {
    		cout << str << endl;
    		exit(0);
    	}
    }

    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ll mininf = -922337203685477;
const ll nax = 0;
int n, x[10], y[10], cnt=0;
double ans=0.0;

double dist(int i, int j){
		double a=x[i]-x[j];
		double b=y[i]-y[j];
		return sqrt(a*a+b*b);
	}

int main(){
	IOS
	cin >> n;
	vector<int>store(n);
	for(int i=1;i<=n;i++){
		cin >> x[i] >> y[i];
	}
	for(int i=0;i<n;i++){
		store[i]=i+1;
	}
	do{
		cnt++;
		for(int i=0;i<n-1;i++){
			ans+=dist(store[i], store[i+1]);
		}
	} while(next_permutation(store.begin(), store.end()));
	//cout << cnt << '\n';
	cout << setprecision(10) << fixed;
	cout << ans/cnt << '\n';
}


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

using namespace std;
int main(){

string A,B;
cin >> A;
cin >> B;
int N=max(A.size(),B.size());
string ans="EQUAL";
if(A.size()>B.size()){
    ans="GREATER";
}
else if (A.size()<B.size())
{
    ans="LESS";
}

else{
for(int i=0;i<N;i++){
    if(A[i]==B[i]){
        continue;
    }
    else if(A[i]>B[i]){
        ans="GREATER";
        break;
    }
    else if(A[i]<B[i]){
        ans="LESS";
        break;
    }
}

}
cout << ans <<endl;



 return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	x, y, a, b, c := nextInt(), nextInt(), nextInt(), nextInt(), nextInt()
	p, q, r := nextInts(a), nextInts(b), nextInts(c)

	sort.Sort(sort.Reverse(sort.IntSlice(p)))
	sort.Sort(sort.Reverse(sort.IntSlice(q)))
	sort.Sort(sort.Reverse(sort.IntSlice(r)))

	r = append(r, p[:x]...)
	r = append(r, q[:y]...)
	sort.Sort(sort.Reverse(sort.IntSlice(r)))

	var ans int
	for i := 0; i < x+y; i++ {
		ans += r[i]
	}

	fmt.Println(ans)
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextInts(n int) []int {
	sl := make([]int, n)
	for i := range sl {
		sl[i] = nextInt()
	}
	return sl
}


Measured memory_bytes: 9984
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn= new Scanner(System.in);
        int a=scn.nextInt();
        int b=scn.nextInt();
        int c=scn.nextInt();
        int x=scn.nextInt();
        int answer=0;
        for(int i=0;i<=a;i++){
            for(int j=0;j<=b;j++){
                for(int k=0;k<=c;k++){
                    if(500*i+100*j+50*k==x) answer++;
                }
            }
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 21844
n = int(input())
A = list(map(int, input().split()))
ans = []
maxa = max(A)
mina = min(A)
if abs(mina) > abs(maxa):
    for i in range(n)[:0:-1]:
        if A[i-1] > A[i]:
            while A[i-1] > A[i]:
                ma = min(A)
                argmina = A.index(ma)
                A[i-1] += ma
                ans.append((argmina+1, i-1+1))
else:
    for i in range(n-1):
        pa = A[i]
        aa = A[i+1]
        if pa > aa:
            while pa > A[i+1]:
                ma = max(A)
                argmaxa = A.index(ma)
                A[i+1] += ma
                ans.append((argmaxa+1, i+1+1))

print(len(ans))
for a in ans:
    print(*a)


Measured memory_bytes: 9192
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
const int Inf = 1e9 + 5;

bool isPalindrome(string s) {
    string t = s;
    reverse(t.begin(), t.end());
    return t == s;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0); 
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> freq;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        freq[a[i]]++;
    }
    ll ans = 0;
    for (auto elem : freq) {
        ans += ll(elem.second) * ll(elem.second - 1) / 2;
    }
    for (int i = 0; i < n; i++) {
        ll tmp = freq[a[i]];
        ll ans1 = ans -(tmp) * (tmp - 1) / 2;
        tmp--;
        ans1 += tmp * (tmp - 1) / 2;
        cout << ans1 << endl;
    }
    return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>


using namespace std;

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


using namespace std;



int main() {
	int n;
	cin >> n;
	int count = 0;

	vector<int> ps;
	int cur = 2;
	while(count < n) {
		bool is_prime = true;
		for (int p : ps) {
			if (cur % p == 0) {
				is_prime = false;
				break;
			}
		}
		if (is_prime) {
			ps.push_back(cur);
			if (cur % 5 == 1) {
				cout << cur << endl;
				count ++;
			}
		}
		cur ++;
	}
	return 0;

}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	vl v(n+1);
	ll mx = 0, mn = 0;
	ll ans = 0;
	rep(i, n) {
		cin >> v[i];
		mx = max(mx, v[i]);
	}
	ans = mx;
	while (1) {
		ll sum = 0;
		rep(i, n+1) {
			ll tmp = max((ll)0,v[i]-ans*b);
			sum += (tmp + a - b - 1) / (a - b);
		}
		if (sum > ans) {
			if (mx - ans >= 2) {
				mn = ans;
				ans = (mx + mn) / 2;
			}
			else {
				cout << ans+1 << endl;
				return 0;
			}
		}
		else {
			if (ans - mn >= 2) {
				mx = ans;
				ans = (mx + mn) / 2;
			}
			else {
				cout << ans << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 1152
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;
 
ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main() {
  string S;
  ll K;
  cin >> S >> K;
  vector<string> v;
  for (int i = 0; i < S.size(); ++i) {
    for (int j = 1; j <= K; ++j) {
      v.push_back(S.substr(i, j));
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v[K-1] << endl;
}


Measured memory_bytes: 1660
N,M = list(map(int,input().split()))
N_list=['']*N
 
for m in range(M):
    s_m , c_m = list(map(int,input().split()))
    
    if N != 1:
        if s_m ==1 and c_m ==0:
            N_list=[-1]
            break
    
    if N_list[s_m-1] == '':
        N_list[s_m-1] = c_m
    else:
        if N_list[s_m-1] != c_m:
            N_list=[-1]
            break
    
for n in range(len(N_list)):
    if N_list[n]=='':
        N_list[n]=0
        
if len(N_list)>1 and N_list[0]==0:
    N_list[0]=1

print(''.join(map(str,N_list)))

Measured memory_bytes: 3064
A = [input().split() for a in range(3)]
N = int(input())
B = [input() for b in range(N)]

for i in range(N):
  for j in range(3):
    for k in range(3):
      if A[j][k] == B[i]:
        A[j][k] = 'ok'
        
if A[0][0] == 'ok' and A[0][1] == 'ok' and A[0][2] == 'ok':
  print('Yes')
  exit
elif A[1][0] == 'ok' and A[1][1] == 'ok' and A[1][2] == 'ok':
  print('Yes')
  exit
elif A[2][0] == 'ok' and A[2][1] == 'ok' and A[2][2] == 'ok':
  print('Yes')
  exit
elif A[0][0] == 'ok' and A[1][0] == 'ok' and A[2][0] == 'ok':
  print('Yes')
  exit
elif A[0][1] == 'ok' and A[1][1] == 'ok' and A[2][1] == 'ok':
  print('Yes')
  exit
elif A[0][2] == 'ok' and A[1][2] == 'ok' and A[2][2] == 'ok':
  print('Yes')
  exit
elif A[0][0] == 'ok' and A[1][1] == 'ok' and A[2][2] == 'ok':
  print('Yes')
  exit
elif A[0][2] == 'ok' and A[1][1] == 'ok' and A[2][0] == 'ok':
  print('Yes')
  exit
else :
  print('No')    

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

int main() {

  int N;
  
  cin >> N;

  if ((N % 1000 - N % 100) / 100 == (N % 100 - N % 10) / 10 ){
    if ((N % 10) == (N % 100 - N % 10) / 10 || (N - N % 1000) / 1000 == (N % 1000 - N % 100) / 100 ){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

l = sum(A)
ans = float("inf")
t = 0

for i in range(N-1):
	t += A[i]
	ans = min(ans,abs(l-2*t))
	#print("t,ans",t,ans)

print(ans)




Measured memory_bytes: 26060
s1 = input()

def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True

s2 = s1[0:int((len(s1)-1)/2)]
s3 = s1[int((len(s1)+3)/2) -1:len(s1)]

if is_kaibun(s1) == True and is_kaibun(s2) == True and is_kaibun(s3) == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(void){
	string s,t;
	int i;
	cin>>s;
	t="";
	for(i=0;i<s.size();i++){
		if(s[i]=='1')		t+='1';
		else if(s[i]=='0')	t+='0';
		else{
			if(!t.empty()){
				t.erase(t.end()-1);
			}
		}
	}
	for(i=0;i<t.size();i++){
		if(t[i]!='2')	cout<<t[i];
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())

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

using namespace std;

typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;

const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;

int main() {
#ifdef XCODE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    string s; cin >> s;
    puts(len(s) >= 4 && s.substr(0, 4) == "YAKI" ? "Yes" : "No");
    return 0;
}


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

using namespace std;

int mod;

int add() { return 0; }
template<typename... M> int add(int a, M... b) {
  int x = add(b...);
  return a + x - mod * (a + x >= mod);
}

int mul() { return 1; }
template<typename... M> int mul(int a, M... b) {
  return int(1ll * a * mul(b...) % mod);
}

int pwr(int a, int x) {
  return (x ? mul(pwr(mul(a, a), x >> 1), (x & 1 ? a : 1)) : 1);
}

int dvd(int a, int b) {
  return mul(a, pwr(b, mod - 2));
}

int sub(int a, int b) {
  return a - b + mod * (a < b);
}

void inc(int& a, int b) {
  a = add(a, b);
}

void dec(int& a, int b) {
  a = sub(a, b);
}

const int N = 2e5 + 10;
int a[N];
long long ans = 0;
int T;

void solve(int l, int r) {
  if (l == r) {
    if (!a[l]) {
      ++ans;
    }
    return;
  }
  int m = l + r >> 1;
  map<int, int> cnt;
  int tt = 1;
  int res = 0;
  for (int i = m; i >= l; --i) {
    inc(res, mul(tt, a[i]));
    tt = mul(tt, 10);
    ++cnt[res];
  }
  res = 0;
  tt = 1;
  for (int i = m + 1; i <= r; ++i) {
    tt = mul(tt, T);
    res = add(mul(res, 10), a[i]);
    int need = sub(0, res);
    need = mul(need, tt);
    ans += cnt[need];
  }
  solve(l, m), solve(m + 1, r);
}

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

  int n;
  cin >> n >> mod;
  T = dvd(1, 10);
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    a[i] = c - '0';
    a[i] %= mod;
  }
  if (mod != 2 and mod != 5) {
    solve(0, n - 1);
  } else {
    for (int i = 0; i < n; ++i) {
      if (a[i] == 0) {
        ans += i + 1;
      }
    }
  }
  cout << ans;

  return 0;
}

Measured memory_bytes: 3584
# encoding: utf-8
x1, y1, x2, y2 = map(int, input().split())

x = x2
y = y2
d_x = x2 - x1
d_y = y2 - y1

ans = []
for i in range(2):
    d_y_temp = d_y
    d_y = d_x
    d_x = -d_y_temp
    x = x + d_x
    y = y + d_y
    print(x, y, end=" ")
print()

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

int main() {
    int N,
    cnt = 1;
    cin >> N;
    vector<int> d(N);

    int i;
    for (i = 0; i < N; i++) {
        cin >> d.at(i);
    }

    int j, tmp;
    for (i = 0; i < N - 1; i++) {
        for (j = 0; j < N - 1; j++) {
            if (d.at(j) < d.at(j + 1)) {
                tmp = d.at(j);
                d.at(j) = d.at(j + 1);
                d.at(j + 1) = tmp;
            }
        }
    }

    for (i = 0; i < N - 1; i++) {
        if (d.at(i) != d.at(i + 1)) {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
#define mod 1000000007
#define ll long long
#define PI acos(-1)
#define mp make_pair
#define mod 1000000007
int main()
{
	char s[105];
	ll k,i;
	cin>>s;
	cin>>k;
	ll len=strlen(s);
	for(i=0;i<len;i++)
	{
		if(s[i]=='1')k--;
		else break;
		if(k==0)break;
	}
	cout<<s[i]<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    S,T=ST().split()
    ans = ""
    for i in range(N):
        ans += S[i]+T[i]
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 38676
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(){
	int w;
	int n;
	int ary[30];

	cin >> w >> n;
	for (int i = 1; i <= w; i++){
		ary[i] = i;
	}

	for (int i = 0; i < n; i++){
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(ary[a], ary[b]);
	}

	for (int i = 1; i <= w; i++){
		cout << ary[i] << endl;
	}


	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>


using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()

int main()
{
	int n, a, b; cin >> n >> a >> b;
	cout << min(b, a*n) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define SIZE 2100000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
ll d[1010101];
int main()
{
	int num;
	scanf("%d", &num);
	num--;
	invinit();
	ll ans = 0;
	for (int i = 0; i <= num / 2; i++)d[i] = com(num - 1 - i, i)*kai[i] % mod*kai[num - i] % mod;
	for (int i = 0; i <= num / 2; i++)ans = (ans + (d[i] + mod - d[i + 1])*(num - i)) % mod;
	printf("%lld\n", ans);
}

Measured memory_bytes: 55168
#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 ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;
ll dp[3001][3001][3],m1[3001][3001],R,C;

ll ans(ll i, ll j, ll r)
{
	if(i>R || j>C)
		return 0;
	if(dp[i][j][r]!=-1)
		return dp[i][j][r];
	ll down=ans(i+1,j,0);
	if(r<2)
		down=max(down,ans(i,j+1,r+1));
	dp[i][j][r]=max(max(down,ans(i,j+1,r)), m1[i][j]+down);
	return dp[i][j][r];
}

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

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

	ll n,i,m,j,k,x,y,a,b,t;
	string s;
	
	cin >> R >> C >> k;
	for(i=0;i<=R;i++)
		for(j=0;j<=C;j++)
			dp[i][j][0]=dp[i][j][1]=dp[i][j][2]=-1;
	for(i=0;i<k;i++)
	{
		cin >> a >> b >> x;
		m1[a][b]=x;
	}
	cout << ans(1,1,0);

	return 0;
}


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

const int N = 200005;

int n;
int a[N], A[N];
int b[N], B[N];
long long res[30];
int rxor;

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

	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	for (int i = 1; i <= n; ++i) cin >> b[i];

	for (int k = 0; k < 29; ++k) {
		int T = (1 << k);

		for (int i = 1; i <= n; ++i) {
			A[i] = a[i] % (2 * T);
			B[i] = b[i] % (2 * T);
		}

		sort(B + 1, B + n + 1);

		for (int i = 1; i <= n; ++i) {
			int l = lower_bound(B + 1, B + n + 1, T - A[i]) - B;
			int r = upper_bound(B + 1, B + n + 1, 2 * T - A[i] - 1) - B;
			res[k] += r - l;

			l = lower_bound(B + 1, B + n + 1, 3 * T - A[i]) - B;
			r = upper_bound(B + 1, B + n + 1, 4 * T - A[i] - 1) - B;
			res[k] += r - l;
		}

		if (res[k] & 1) rxor |= T;
	}

	cout << rxor << endl;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i,n) for (int i=0; i< (n); ++i)
using namespace std;
typedef long long ll;

int main() {
  int a,b,ans;
  cin >> a >> b;
  if(a>=13) ans = b;
  else if(a>=6) ans = b/2;
  else ans = 0;
  cerr << "hello" << endl;
  cout << ans << endl;

  return 0;
}


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

int checknum(int binnum,int Maxnum,int hand){
  int ansh,Ans;
   ansh = hand + 1;
   if(binnum > Maxnum) Ans = ansh*100+ansh*10+ansh;
   else Ans = hand*100+hand*10+hand;
  
  return Ans;
}

int n ,A, hand, ten, one;
int main(){
  int Ans,binnum,Maxnum;
  cin >> n; 
  hand = n/100;
  A = n - hand*100;
  ten = A/10;
  one = A - ten*10; 
  
  binnum = ten*10 + one;
  Maxnum = hand*10 + hand;

  Ans = checknum(binnum,Maxnum,hand);
  
  cout << Ans << endl;
  
}


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

int main()
{
    long long k,a,b,c=0;
    cin>>k>>a>>b;
    if(a>=k)
    {
        cout<<1<<endl;
        return 0;
    }
    else if(b>=a)
    {
        cout<<-1<<endl;
        return 0;
    }else if((k-a)%(a-b)>=1)
    {
        c=1;
    }
    cout<<((k-a)/(a-b)+c)*2+1<<endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K; cin>>N>>K;
    vi a(N);
    rep(i,N) cin>>a[i];
    sort(all(a));
    int ans=0;
    rep(i,K) ans+=a[i];
    cout<<ans<<"\n";
    return 0;
}


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

#define int long long

const int MOD = 1000000007;

int mod(int val, int m) {
  int res = val % m;
  if (res < 0) res += m;
  return res;
}

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

    int x = 1;
    int y = 1;
    int z = 1;
    for(int i = 0; i < n; i++) {
        x *= 10; x %= MOD;
        y *= 9; y %= MOD;
        z *= 8; z %= MOD;
    }
    x %= MOD;
    y %= MOD;
    z %= MOD;
    int ans = mod(((x - ((2 * y) % MOD)) % MOD) + z, MOD);
    cout << ans << endl;
}

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

using namespace std;

const int maxn = 100010;
const int mod = 1e9+7;
int x[maxn];

struct matrix {
	int a[3][3];
	void init() {
		memset(a, 0, sizeof(a));
		a[0][0] = a[1][1] = a[2][2] = 1;
	}
};

matrix operator*(const matrix&a, const matrix&b) {
	matrix ret;
	for(int i = 0; i < 3; ++i) {
		for(int j = 0; j < 3; ++j) {
			int &s = ret.a[i][j];
			s = 0;
			for(int k = 0; k < 3; ++k) 
				s = (s + 1ll * a.a[i][k] * b.a[k][j]) % mod;
		}
	}
	return ret;
}

matrix pow(matrix a,int n) {
	matrix ret;
	ret.init();
	while(n) {
		if(n&1) ret=ret*a;
		a=a*a;
		n=n>>1;
	}
	return ret;
}

matrix A, B, C;

int main() {
	A.init();
	A.a[0][1] = 2;
	A.a[0][2] = 1;
	A.a[1][2] = 1;
	B.init();
	B.a[2][0] = 1;
	C = A * B;
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; ++i) scanf("%d", &x[i]);
	sort(x, x + m);
	matrix t; t.init();
	for(int i = 0; i < m; ++i) {
		int k = i == 0 ? x[i] - 1 : x[i] - x[i-1] - 1; 
		if (k) t = t * pow(C, k);
		t = t * A;
	}
	int k = n - x[m-1] - 1;
	if(k) t = t * pow(C, k);
	t = t * A;
	cout << t.a[0][2] << endl;
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
 #define PI 3.14159265359

using namespace std;
const int64_t mod = 1000000007;
const int64_t tmpMod = 998244353;

int main() {
 
  int64_t N,sum=0,ans=0;
  cin>>N;
  vector<int64_t> A(N);
  for(int i=0; i<N; i++){cin>>A[i];sum+=A[i];}
  for(int i=0; i<N; i++){
    sum-=A[i];
    ans+=(A[i]*(sum%mod));
    ans%=mod;
    
    }
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){
  //   for(int j=0; j<M; j++){
  //       cin>>A[i][j];
  //   }
  // }
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  // cout << ans/2 << endl;
  cout << ans%mod << endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb push_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
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<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed;
// cout << setprecision(10) << val;

int n;
signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> n; 
  vii h(n);
  cin >> h;
  int ans = 0;
  while (1) {
    int mi = INF;
    rep(i, 0, n) {
      if (h[i] == 0) continue;
      if (mi > h[i]) mi = h[i];
    }
    if (mi <= 0 || mi == INF) break;
    ans += mi;
    bool set = false;
    rep(i, 0, n) {
      if (h[i]) h[i] -= mi, set = true;
      else if (!h[i] && set) break;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
    long long N, L1=2, L2=1, L3, i;

    cin >> N;

    if(N==1){
        cout << 1 << endl;
    }

    else{
        for(i=2; i<=N; i++){
            L3 = L1 + L2;
            L1 = L2;
            L2 = L3;
        }

        cout << L3 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N;
    cin >> N;
    vector<ll> C(N);
    vector<ll> S(N);
    vector<ll> F(N);
    for(size_t i=0;i<N-1; i++)
    {
        //次の駅までC秒
        //S秒後に発車
        //F秒おきに発車
        cin >> C[i] >> S[i] >> F[i];
    }
    for(size_t i=0;i<N; i++)
    {
        if(i==N-1) cout << 0 << endl;
        else
        {
            ll time = S[i] + C[i];
            for(size_t j=i+1;j<N-1; j++)
            {
                if(time < S[j]) time = S[j];
                else if(time % F[j] == 0);
                else time+=F[j]-time%F[j];
                time+=C[j];
            }
            cout << time << endl;
        }
    }
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

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


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
def beautiful_strings(w: str) -> bool:
    freq = {}
    for c in w:
        freq.setdefault(c, 0)
        freq[c] += 1
    return all(f % 2 == 0 for f in freq.values())


if __name__ == "__main__":
    w = input()
    yes = beautiful_strings(w)
    print('Yes' if yes else 'No')


Measured memory_bytes: 2940
#include <stdio.h>
#include <math.h>

int main(void)
{

    int i_inputMembers;
    double d_inputMembers;
    scanf("%d", &i_inputMembers);
    d_inputMembers = i_inputMembers;

    double d_totalMembersCoordinate = 0;
    int i_memberCoordinate[i_inputMembers];
    for (int index = 0; index < i_inputMembers; index++)
    {
        scanf("%d", &i_memberCoordinate[index]);
        d_totalMembersCoordinate += i_memberCoordinate[index];
    }

    double d_meetingCoordinate = round(d_totalMembersCoordinate / d_inputMembers);

    long l_totalMembersEnergy = 0;

    for (int index = 0; index < i_inputMembers; index++)
    {
        l_totalMembersEnergy += pow(i_memberCoordinate[index] - d_meetingCoordinate, 2);
    }

    printf("%ld", l_totalMembersEnergy);

}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <sstream>
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define C(x) cout << x << endl //テスト出力

//関数
//nCkの計算の関数(呼び出しは[cbn])
ll cbn(ll n, ll k) {
    ll r = 1;
    for (ll d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
// a^n mod を計算する
ll powmod(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
//２つの最大公約数
int gcb(int a, int b){
    if(a < b){
        int x = a;
        a = b;
        b = x;
    }
    int amari = a % b;
    if(amari == 0) return b;

    return gcb(b, amari);
}
//３つの最大公約数
int gcb_3(int a, int b, int c){
    return gcb(gcb(a, b), c);
}

/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;
vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値))*/

/*-----------------------------ここから-----------------------------*/

int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll x; cin>>x;
string y = "ACL";
REP(i,x-1) y+="ACL";
cout<<y;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main()
{
    // 整数の入力
    int a, b;
    cin >> a >> b;
    if(a < b){
        int t = a;
        a = b;
        b = t;
    }
    int n = 16 - b*2;
    if(n/2 >= (a-b))cout <<  "Yay!" << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v)cout<<i<<' '; cout << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


#define SIZE 200005
#define MOD 1000000007
 
typedef pair <int,int> P;
 
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i=2; i<SIZE; i++)
	{
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
		fac[i] = fac[i-1] * (ll) i % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
    return ;
}

ll comb(int a,int b){
	if(a < b) return 0;
	return fac[a] * (finv[b] * finv[a-b] % MOD) % MOD;
}

ll beki(int a, int n){
    if(n == 0) return 1;
    ll ans = beki(a, n / 2);
    ans = ans * ans;
    if(n % 2 == 1) ans = ans * a;
    return ans;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    //cout << fixed << setprecision(15);
    
    ll A,B,N;cin>>A>>B>>N;
	ll l = min(N,B-1);
	cout << A*l/B - A*(l/B) << endl;
}

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

int main(){
int a, b, c;
  cin >> a >> b >> c;
  
  vector<int> vec = {a, b, c};
  sort(vec.begin(), vec.end());
  if(vec.at(2) == vec.at(0) + vec.at(1)){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}

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

int main()
{
	int n,sn[5000]= {0};
	ll rnum =0, gnum=0, bnum=0;
	char s[5000];
	cin >> n;
	cin >> s;

	rep(i, n){
		if(s[i] == 'R'){
			sn[i] = 0;
			rnum++;
		}else if(s[i] == 'G'){
			sn[i] = 1;
			gnum++;
		}else{
			sn[i] = 2;
			bnum++;
		}
	}

	ll max = rnum*gnum*bnum;

	//cout << "tmax " << t_max << endl;
	ll red =0;

	rep(i, n){
		int l = min(i, n-i-1);
		//cout << "i" << i << " l" << l << endl; 
		rep(j, l){
			if(sn[i-j-1] != sn[i+1+j] && sn[i] != sn[i-j-1] && sn[i] != sn[i+1+j]){
				red++;
				//cout << "i"<<i <<"red " << j<<endl;
			}
		}
	}

	cout << max  -red<< endl;

}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int main()
{
ll a;cin>>a;o(3LL*a*a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
 
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    int g=__gcd(a,b),c=g;
    k--;
    while(k){
        c--;
        if(g%c==0)k--;
    }
    cout<<c;
    return 0;
}

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

int main()
{
  int a,b; cin >>a >>b;
  if (a<=b) cout <<a <<endl;
  else cout <<a-1 <<endl;
  return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int d,a,b; cin>>d>>a>>b; 
    if (a*b>=d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3648
from collections import deque
H,W,K=map(int,input().split())
A=[list(input())for _ in[0]*H]
for i,a in enumerate(A):
	if"S"in a:j=a.index("S");Q=deque([(1,i,j)])
d=1e9
while Q:
	c,i,j=Q.popleft();d=min(d,i,j,H-i-1,W-j-1)
	if c>K:continue
	for h,w in((i+1,j),(i,j+1),(i-1,j),(i,j-1)):
		if 0<=h<H and 0<=w<W and A[h][w]==".":A[h][w]="";Q+=[(c+1,h,w)]
print(1--d//K)

Measured memory_bytes: 75484
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

n = STDIN.gets
n = n.to_i

1.upto(n) {|i|
	if i % 3 == 0 then
 		print " ", i
 		next
 	end

    tmp = i
 	while tmp > 0 do
 		if tmp % 10 == 3 then
 			print " ", i
 			break
 		end
 		tmp /= 10
 	end
}

print "\n"


Measured memory_bytes: 6868
a,b,c,x,y=map(int,input().split())
cnt_max=max(x,y)
ans=2*c*cnt_max
if a+b<=2*c:
    print(a*x+b*y)
else:
    if x<y:
        cnt=y-x
        print(min(2*c*x+cnt*b,ans))
    elif y<x:
        cnt=x-y
        print(min(2*c*y+cnt*a,ans))
    else:
        print(min(2*c*(x+y),ans))
    

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
	double r;
	cin >> r;
	cout << fixed << setprecision(7) << r * r * 3.1415926535897932384626433832795028841971693993751<< " " << fixed << setprecision(7) << r * 2 * 3.1415926535897932384626433832795028841971693993751 << endl;
	return 0;
}


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

#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 ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

const ll mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N), B(M);
    vector<bool> mA(N * M + 1, false), mB(N * M + 1, false);

    REP(i, 0, N) {
        cin >> A[i];
        if (mA[A[i]]) {
            cout << 0 << endl;
            return 0;
        }
        mA[A[i]] = true;
    }
    REP(i, 0, M) {
        cin >> B[i];
        if (mB[B[i]]) {
            cout << 0 << endl;
            return 0;
        }
        mB[B[i]] = true;
    }

    sort(begin(A), end(A));
    sort(begin(B), end(B));

    ll ans = 1;

    for (ll n = N * M; n >= 1; n--) {
        if (mA[n] * mB[n] == 1) {

        } else if (mA[n] == 0 && mB[n] == 0) {
            ll cnt = static_cast<ll>((M - (lower_bound(begin(B), end(B), n) - begin(B)))) * (N - (lower_bound(begin(A), end(A), n) - begin(A))) - (N * M - n);
            if (cnt < 0) {
                cnt = 0;
            }
            ans = (ans * cnt) % mod;
        } else {
            if (mA[n]) {
                ll cnt = (M - (lower_bound(begin(B), end(B), n) - begin(B)));
                if (cnt < 0) {
                    cnt = 0;
                }
                ans = (ans * cnt) % mod;
            } else {
                ll cnt = (N - (lower_bound(begin(A), end(A), n) - begin(A)));
                if (cnt < 0) {
                    cnt = 0;
                }
                ans = (ans * cnt) % mod;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong n = 100;
  llong x;
  cin >> x;

  int i = 1;
  while(true){
    n += n / 100;
    if(n >= x) break;
    i++;
  }

  cout << i << endl;
  return 0;

}





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


using namespace std;

int m , d , sol;
int main(){

    cin>>m>>d;
    for(int i = 1;i<=m;i++)
    {
        for(int j = 22;j<=d;j++)
        {
            if( (j/10)*(j%10)==i && j%10>1 )
                sol++;
        }
    }
    cout<<sol;
    return 0;
}



Measured memory_bytes: 256
# ABC116
# B
import numpy as np
s = int(input())

a = s
idx = 1
a_list = [a]
while(idx < 1000000):
    idx += 1
    if a % 2 == 0:
        a = int(a / 2)
    else:
        a = 3*a+1
    if a in a_list:
        print(idx)
        break
    else:
        a_list.append(a)

Measured memory_bytes: 21248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007LL;

ll solve() {
    ll N, a;
    cin >> N;
    vector<int> c(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> a;
        c[a]++;
    }
    int i;
    if ( N & 1 ) {
        if ( c[0] != 1 ) return 0;
        i = 2;
    } else {
        i = 1;
    }
    for ( ; i < N; i+=2 ) {
        if ( c[i] != 2 ) return 0;
    }

    ll n = N / 2;
    ll r = 1, t = 2;
    while ( n > 0 ) {
        if ( n & 1 ) {
            r *= t;
            r %= MOD;
        }
        t *= t;
        t %= MOD;
        n >>= 1;
    }
    return r;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

signed main(){
	int x, a, b;
	scanf("%d%d%d", &x, &a, &b);
	if(abs(a - x) < abs(b - x)){
		printf("A\n");
	}
	else{
		printf("B\n");
	}
	return 0;
}

Measured memory_bytes: 3636
//pbds
#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;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

using ll = long long;
using pii = pair<int,int>;
 
#define NL '\n'
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define sz(x) x.size()
#define pi  acos(-1.0)
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(), (x).end()
#define mem(a, b) memset(a, b, sizeof(a))
#define rep(i,a,b) for(ll i=(ll)a;i<(ll)b;++i)
#define fastIO() ios_base::sync_with_stdio(0),cin.tie(NULL)
 

#define faye_valentine 
void dbg(){cerr<<NL;}template<typename H,typename... T> void dbg(H h,T... t){cerr<<' '<<h;dbg(t... );}
#ifdef  faye_valentine
#define debug(...) cerr<<"("<<#__VA_ARGS__<<"):",dbg(__VA_ARGS__)
#else
#define debug(...) 
#endif
 
const int N = 1e6+9;
int m[N]; 
void absinthe(){
	int n; cin >> n;
	vector<int> a(n);
	rep(i, 0, n) {
		cin >> a[i];
		m[a[i]]++;
	}
	int z = 0;
	for(int i = 0; i < n; i++) {
		int fl = 0;
		if(m[a[i]] > 1) fl = 1; 
		if(a[i] != 1 && m[1] > 0) continue;
		if(!fl) for(int j = 2; j*j<=a[i]; j++) {
			if(a[i]%j == 0) {
				if(m[j] == 0 && m[a[i]/j] == 0) continue;
				fl = 1;
				break;
			}
		}
		if(fl == 0) z++;
	}
	cout << z << NL;
}
 
int main(){
	int Tx = 1; //read(Tx);  
	fastIO(); // cin >> Tx;
	while(Tx--) absinthe();
}

Measured memory_bytes: 7916
import itertools
 
def resolve():
    N = int(input())
    P_list = tuple(map(int, input().split()))
    Q_list = tuple(map(int, input().split()))
 
    N_list = [(i+1) for i in range(N)]
    N_permutations_list = itertools.permutations(N_list)
 
    i = 1
    for i_list in N_permutations_list:
        if i_list == Q_list:
            a = i
        if i_list == P_list:
            b = i
        i += 1
 
    print(abs(a-b))
 
 
if __name__ == "__main__":
    resolve()

Measured memory_bytes: 3064