akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, fo, tw, no;

int main() {
    cin >> N;
    REP(i, N) {
        LCIN(a);
        if(a % 4 == 0)
            fo++;
        else if(a % 2 == 0)
            tw++;
    }
    no = N - fo - tw;
    bool judge = false;
    if(fo + tw == N || (fo >= no && tw) || (fo + 1 >= no && tw == 0))
        judge = true;
    Yes(judge);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long 
#define all(v) v.begin() , v.end()
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define tr(con) for(auto it = con.begin(); it!= con.end() ; it++)
#define INF 1e9+7   // 1 * 10^9+ 7
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define fo(i,n) for(ll i=0;i<n;i++)
using namespace std;
 
int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n ; cin >>n ;
    string str ;cin >> str;
    for(int i=0;i<str.length();i++){
       str[i] = ((str[i]-'A')+n)%26 +'A';
    }
    cout<< str;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int x,a,b;
        x = sc.nextInt();
        a = sc.nextInt();
        b = sc.nextInt();

        int t = b - a;

        String msg = null;

        if(t <= 0)
            msg = "delicious";
        else if(t <= x)
            msg = "safe";
        else
            msg = "dangerous";

        System.out.println(msg);
    }
}


Measured memory_bytes: 21716
#include<cstdio>
#include<algorithm>
int main(){
    int n;
    char s[101],t[101];
    scanf("%d%s%s",&n,s,t);
    int ans=2*n;
    for(int i=1;i<=n;i++){
        bool flag=true;
        for(int j=0;j<i;j++){
            if(t[j]!=s[n-i+j]){
                flag=false;
                break;
            }
        }
        if(flag)ans=2*n-i;
    }
    printf("%d",ans);
}

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

#define pb push_back
#define PQ priority_queue
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

typedef long long ll;
typedef long double ld;

//__builtin_popcount(x)

using namespace std;

const int mod = 1e9 + 7;

ll add(ll a, ll b) {
    ll res = a + b;
    if (res >= mod) res -= mod;
    return res;
}

ll sub(ll a, ll b) {
    ll res = a - b + mod;
    if (res >= mod) res -= mod;
    return res;
}

ll mul(ll a, ll b) {
    return (((a % mod) * (b % mod)) % mod);
}

/* Z-FUNCTION
ll l = 0, r = 0, n = (int)s.size();
vector<int> z(n, 0);
for (int i = 1; i < n; i++) {
    if (r >= i) {
        z[i] = min(1ll*z[i-l], r-i+1);
    }
    while (z[i] + i < n && s[z[i]] == s[z[i] + i]) z[i]++;
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
}
*/

/*vector<int> find_dividers(int x) {
    vector<int> dividers;

    for (int i = 1; i <= sqrt(x); i++) {
        if (x % i == 0) {
           dividers.push_back(i);
            if (i * i != x) {
                dividers.push_back(x / i);
            }
        }
    }

    return dividers;
}*/

/*int nok(int a, int b) {
    return a / __gcd(a, b) * b;
}*/

void solve() {
    int n, m;
    cin >> n >> m;
    vector<ll> dp(m + 1, 0);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        for (int i = m; i >= x; i--) {
            dp[i] = max(dp[i], dp[i - x] + y);
        }
    }

    cout << dp[m] << endl;

}

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

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

    return 0;
}


Measured memory_bytes: 3976
#include<iostream>
#include<vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX]; // List of vectors
int color[MAX];

void dfs_visit(int v, int id) {
    color[v] = id;
    for (int i=0; i<G[v].size(); i++) {
        int u = G[v][i];
        if (color[u]==NIL) {
            dfs_visit(u, id);
        }
    }
}

void dfs() {
    for (int v=0; v<n; v++) {
        color[v] = NIL;
    }
    int id = 0; // Cluster id
    for (int v=0; v<n; v++) {
        if (color[v]==NIL) {
            // If not clustered yet
            dfs_visit(v, id++);
        }
    }
}

int main() {
    int s,t,m,q;
    cin >> n >> m;
    for (int i=0; i<m; i++) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    dfs();

    cin >> q;
    for (int i=0; i<q; i++) {
        cin >> s >> t;
        if (color[s]==color[t]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }

 return 0;
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

const int SIZE = 1e5+100;
ll n,k;
const ll ama = 1000000007;
ll a[SIZE],b[SIZE];
ll num[SIZE];
vector<vector<ll>> vec(SIZE),vec2(SIZE);

int main(){
    cin >> n >> k;
    for(int i = 0; i < n-1; i++){
        cin >> a[i] >> b[i];
        vec[a[i]].push_back(b[i]);
        vec[b[i]].push_back(a[i]);
    }

    stack<ll> st;
     vector<ll> are;

    ll ans = k;
    for(int i = 0; i < vec[1].size(); i++){
        are.push_back(vec[1][i]);
        st.push(vec[1][i]);
    }

    num[1] = num[0] = 1;
    while(!st.empty()){
        ll mem = st.top();
        st.pop();
        num[mem] = 1;
        if(vec[mem].size() != 0){
            for(int i = 0; i < vec[mem].size(); i++){
                if(num[vec[mem][i]] == 0){
                    num[vec[mem][i]] = 1;
                    vec2[mem].push_back(vec[mem][i]);
                    st.push(vec[mem][i]);
                }
            }
        }
    }
    for(int i = 0; i < vec[1].size(); i++){
        are.push_back(vec[1][i]);
        st.push(vec[1][i]);
        ans *= k-1-i;
        ans %= ama;
    }

    while(st.size() != 0){
        ll mem = st.top();
        st.pop();
        if(vec2[mem].size() != 0){
            for(int i = 0; i < vec2[mem].size(); i++){
                ans *= k-2-i;
                ans %= ama;
                st.push(vec2[mem][i]);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 13568
n = gets.chomp.to_i
s = gets.split.map(&:to_i)
s = s.sort
#p s
ans = 0
n.times{ |i|
	0.upto(i){ |j|
		0.upto(j){ |k|
		if s[i]!=s[j] && s[j]!=s[k] && (s[j]+s[k])>s[i]
			ans += 1
		end
		}
	}
}
puts ans


Measured memory_bytes: 14396
#include <stdio.h>
#include <stdlib.h>
#define int long long

int max(int a, int b){
	if(a > b){
		return a;
	}
	else{
		return b;
	}
}
signed main(){
	int N, K, i, j, t, ans = 0, sum;
	scanf("%lld%lld", &N, &K);
	int *A = (int *)malloc(sizeof(int) * N);
	int *B = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &A[i], &B[i]);
	}
	for(i = 1; i <= K; i <<= 1){
		if((i & K) != 0){
			t = (K | (i - 1)) ^ i;
			for(j = 0, sum = 0; j < N; j++){
				if((A[j] | t) == t){
					sum += B[j];
				}
			}
			ans = max(ans, sum);
		}
	}
	for(j = 0, sum = 0; j < N; j++){
		if((A[j] | K) == K){
			sum += B[j];
		}
	}
	printf("%lld\n", max(ans, sum));
	return 0;
}

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

using namespace std;

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

int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  if(e - a <= k)cout << "Yay!" << endl;
  else cout << ":(" << endl;
}


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

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

using namespace std;
using ll = long long;

ll n;

bool check(int a, int b) {
  int c = n-a*b;

  if (n == a*b+c && c > 0)
    return true;

  return false;
}

int main(void)
{
  cin >> n;

  ll res = 0;
  for (int a = 1; a <= n; ++a) {
    for (int b = 1; b <= n; ++b) {
      if (a*b > n) break;
      if (check(a, b)) ++res;
    }
  }
  cout << res << endl;
}

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

int main(){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  char s10 = s1[0], s20 = s2[0], s30 = s3[0];
  int x = s10 - 'a', y = s20 - 'a', z = s30 - 'a';
  char ans1 = 'A' + x, ans2 = 'A' + y, ans3 = 'A' + z;
  cout << ans1 << ans2 << ans3 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,d;
char c[52][52];
int main(){
    cin>>a>>b;
    for(int i=0;i<a;i++)
        for(int j=0;j<b;j++)cin>>c[i][j];
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            d=0;
            if(c[i][j]=='#')cout<<"#";
            else{
                if(c[i-1][j-1]=='#')d++;
                if(c[i-1][j]=='#')d++;
                if(c[i-1][j+1]=='#')d++;
                if(c[i][j-1]=='#')d++;
                if(c[i][j+1]=='#')d++;
                if(c[i+1][j-1]=='#')d++;
                if(c[i+1][j]=='#')d++;
                if(c[i+1][j+1]=='#')d++;
                cout<<d;
            }
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> h(N);
    rep(i, 0, N) cin >> h[i];

    sort(h.begin(), h.end());
    ll ans = 1e18;
    rep(i, 0, N-K+1){
        ans = min(ans, h[i+K-1] - h[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<time.h>
#include<climits>
#include<string>
//#define IONAME "cttf"
//#define E_DEBUG
//#define TIMECOMP

int n,t,da[111000],db[111000],dc[111000];

void marota(){
    std::cin>>n;
    int a,b,c;
    for (int i=1;i<=n;i++){
        std::cin>>a>>b>>c;
        da[i]=std::max(db[i-1],dc[i-1])+a;
        db[i]=std::max(da[i-1],dc[i-1])+b;
        dc[i]=std::max(da[i-1],db[i-1])+c;
    }   
    std::cout<<std::max(std::max(da[n],db[n]),dc[n]);
}

int main(){
    #ifdef TIMECOMP
    clock_t tStart = clock();
    #endif
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    #if defined(IONAME)
    freopen(IONAME".INP","r",stdin);
    freopen(IONAME".OUT","w",stdout);
    #endif
    marota();
    #ifdef TIMECOMP
    printf("Time taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    #endif
    return 0;
}

Measured memory_bytes: 4780
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

N, K = rl()

m = (N-1)*(N-2)//2
if K > m:
	print(-1)
	exit()

ans = []
for i in range(1, N):
	ans.append((1, i+1))
remains = []
for i in range(1, N):
	for j in range(i+1, N):
		remains.append((i+1, j+1))
k = m-K
for i in range(k):
	ans.append(remains[i])
print(len(ans))
for p in ans:
	print(*p)


Measured memory_bytes: 74504
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n>999){
		cout<<"ABD";
	}else{
		cout<<"ABC";
	}
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict 
import sys

sys.setrecursionlimit(10**8)


N,M = map(int,input().split())
dict = defaultdict(set)

for i in range(M):
	a,b = list(map(int,input().split()))
	dict[a].add(b)
	dict[b].add(a)


color = [0 for i in range(N+1)]
nibu = True

def dfs(v,c):
	u'''
	v : 現在のグラフの頂点
	c : vのグラフのcolor
	queue : 探索済みのグラフの頂点
	res   : 二部グラフの判定 bool
	'''

	global color
	global nibu 

	for i in list(dict[v]):
		if color[i] == c:#隣の頂点が同じ値を与えられている際Falseを返す
			nibu = False
			break
		elif color[i] == 0:	#探索済みでなければ再帰する
			color[i] = c*-1		#0ならcとは異なる値を格納
			dfs(i,-c)		#引数に-cとすることで,cが1=>-1=>1を繰り返す


color[1] = 1  #始点色分けする

dfs(1,1)

if nibu:
	b = color.count(1)
	w = color.count(-1)
	ans = b * w - M
else:
	ans = N * (N-1)//2 - M
	
print(ans)

Measured memory_bytes: 58392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define tr(container, it) \
    for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const double pi = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
const int X10=1024,X11=2048,X12=4096,X13=8196,X14=16392,X15=32786,X16=65536,X17=131072,X18=262144,X19=524288,X20=1048576;

int A[X17];
void _() {
    int n,k;
    cin >> n >>k;
    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }
    auto pos=find(A,A+X17,1)-A;
    cout << (n<=k ? 1 :ceil((n-1)/(k-1.)));
//    cout << (ceil((pos-k+1.)/(k-1.))+1)+(ceil((n-pos+0.)/(k-1))+1);

}


int main() {
#if __MINGW32__
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Input.txt", "r", stdin);
    freopen("E:\\Workspace\\Desktop\\cpp\\IO\\Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}








Measured memory_bytes: 640
n = int(input())
s = input()

A_num = ord('A')
Z_num = ord('Z')
ans = ''

for char in s:
  next_char_num = ord(char) + n
  
  if next_char_num > Z_num:
    next_char_num = A_num - 1 + (next_char_num % 90)
  ans += chr(next_char_num)

print(ans)

Measured memory_bytes: 43152
n = int(input())
a = [[i for i in input().split()] for i in range(n)]
taroup = 0
hanakop = 0
for i in range(n):
    array =[]
    array.append(a[i][0])
    array.append(a[i][1])
    array.sort()
    if array[1] == a[i][0] and  array[1] != a[i][1]:
        taroup += 3
    elif array[1] == a[i][1] and  array[1] != a[i][0]:
        hanakop += 3
    elif array[0] == array[1]:
        taroup += 1
        hanakop += 1
print(str(taroup)+" "+str(hanakop))

Measured memory_bytes: 7764
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int n, i, j;
    scanf("%d", &n);
    if(n < 4) printf("No\n");
    else{
        for(i=4; i<=100; i+=4) if(n == i){ printf("Yes\n"); exit(0);}
        for(i=7; i<=100; i+=7) if(n == i){ printf("Yes\n"); exit(0);}
        for(i=7; i<=100; i+=7){
            for(j=4; j<=100; j+=4){
                if(i + j == n){
                    printf("Yes\n");
                    exit(0);
                }
            }
        }
        printf("No\n");
    }
    
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication32
{
    class Program
    {  
      static void Main()
      {
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
		Array.Sort(a);
		Console.WriteLine("{0} {1} {2}",a[0],a[1],a[2]);
		}
	 }
 }

      
      

Measured memory_bytes: 9636
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }eni(!=) cerr  << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
} sim dor(rge<c> d) { *this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
#define err(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll=long long;
using vi=vector<int>;



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

    int h , w;
    cin >> h >> w;
    vector< string > a(h);
    for(string & s : a)
        cin >> s;
    const int inf = 1e9 + 1213;
    vector < vi > dp(h + 1, vi(w + 1, 0));
    const int md = int(1e9 + 7);
    dp[0][0] = 1;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if((i==0 && j==0 )||a[i][j] == '#')continue;
            dp[i][j] = ( ( i==0 ? 0: dp[i - 1][j] )+ (j==0 ? 0 : dp[i][j - 1] ) )% md;
        }
    }
    cout << dp[h - 1][w - 1] << '\n';


    return 0;
}



Measured memory_bytes: 5376
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	string s,b="",e="";
	cin>>s;
	cin>>t;
	ll be=0;
	while(t--)
	{
		cin>>n;
		char ch;
		if(n==1)
			be=(be+1)%2;
		else
		{
			cin>>c>>ch;
			if(c==1)
			{
				if(be==0) b=ch+b;
				else e+=ch;
			}
			else
			{
				if(be==0) e=e+ch;
				else b=ch+b;
			}
		}

		
	}
		if(be)
		{
			reverse(all(e));
			reverse(all(b));
			reverse(all(s));
			s=e+s+b;
		}
		else s=b+s+e;//reverse(all(s)); 
		cout<<s;
		cout<<"\n";
	return 0;
}

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

const int maxn = 82;
int H, W;
int a[maxn][maxn], b[maxn][maxn];

int dp[maxn][maxn][15000];

int f(int i, int j, int offset) {
    int& res = dp[i][j][offset];    
    if (res != -1) return res;
    int o1 = abs(offset + a[i][j] - b[i][j]);
    int o2 = abs(offset - a[i][j] + b[i][j]);
    if (i == H-1 && j == W-1) return res = min(o1,o2);
    res = 30000;
    if (i < H-1) {
        res = min(res,f(i+1,j,o1));
        res = min(res,f(i+1,j,o2));
    }
    if (j < W-1) {
        res = min(res,f(i,j+1,o1));
        res = min(res,f(i,j+1,o2));
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> b[i][j];
        }
    }
    memset(dp,-1,sizeof dp);
    int ans = f(0,0,0);
    cout << ans << '\n';
}



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

#define MAX_N 10001

int main()
{
	int seq[MAX_N];
	int a=1;
	for(int i=0;i<MAX_N;i++){
		seq[i] = a;
		a += i + 1;
	}
	
	int n;
	while(cin>>n){
		cout<<seq[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
def factors(n):
    f = []
    c = 0
    while n % 2 == 0:
        n //= 2
        c += 1
    if c > 0:
        f.append([2, c])
    p = 3
    while p * p <= n:
        if n % p == 0:
            c = 0
            while n % p == 0:
                n //= p
                c += 1
            if c > 0:
                f.append([p, c])
        p += 2
    if n != 1:
        f.append([n, 1])
    return f

MOD = 1000000007
N, M = map(int, input().split())

fact = [0] * (N+35)
finv = [0] * len(fact)
inv  = [0] * len(fact)

fact[0] = fact[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, len(fact)):
    fact[i] = fact[i-1] * i % MOD
    inv[i] = - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD

ans = 1

for _, x in factors(M):
    ans = ans * nCr(x+N-1, x) % MOD

print(ans)

Measured memory_bytes: 14836
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int left,right;
  left = a + b;
  right = c + d;
  if (left > right){
    cout << "Left" << endl;
  } else if (left < right) {
    cout << "Right" << endl;
  } else if (left == right) {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
import sys
import math
import itertools

N,M,C=list(map(int,input().split()))
b=list(map(int,input().split()))
count=0
for i in range(N):
	value=0
	a=list(map(int,input().split()))
	for j in range(M):
		value+=a[j]*b[j]
	if value+C>0:
		count+=1

print(count)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using tp3 = tuple<int, int, int>;
using Mat = vector<vector<ll>>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
template<typename T>
T minch(T& l, T r) {
    return l = min(l, r);
}
template<typename T>
T maxch(T& l, T r) {
    return l = max(l, r);
}
template<typename T>
void output(const T& val) {
    cout << val << endl;
}
template<typename T>
void output(const vector<T>& vec, const bool newline = false) {
    for (const T& val : vec)cout << val << (newline ? '\n' : ' '); cout << endl;
}
template<typename T>
void output(const vector<vector<T>>& mat) {
    for (const auto& row : mat)output(row);
}
// ============ template finished ============

bool canup(string& s, int idx) {
    if (s[idx] == '9')return false;
    return (s[idx] - '0') + 1 <= (s[idx + 1] - '0') + 1;
}
void make_slider(string& s, int idx) {
    for (int i = idx - 1; i >= 0; i--) {
        s[i] = max((char)(s[i + 1] - 1), '0');
    }
}
ll fixed(string& s) {
    reverse(s.begin(), s.end());
    return stoll(s);
}
ll next(ll n) {
    if (n < 10)return n + 1;
    string s = to_string(n);
    reverse(s.begin(), s.end());
    rep(idx, (int)s.size() - 1) if (canup(s, idx)) {
        s[idx]++;
        make_slider(s, idx);
        return fixed(s);
    }
    if (s.back() != '9') {
        s.back()++;
        make_slider(s, s.size() - 1);
        return fixed(s);
    }
    else {
        int siz = s.size();
        s = "";
        rep(i, siz)s += "0";
        s += "1";
        return fixed(s);
    }
}
int main()
{
    ll K;
    cin >> K;
    K--;
    ll res = 1;
    rep(i, K)res = next(res);
    output(res);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
#define MAX_N 100000
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

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

  int n, k;
  cin >> n >> k;
  ll t[n], d[n];
  for(int i = 0; i < n; i++) cin >> t[i] >> d[i];

  vector< pll > a;
  for(int i = 0; i < n; i++){
    a.push_back(make_pair(d[i], t[i]));
  }

  sort(a.begin(), a.end(), greater< pll >());

  bool used[n + 1];
  fill(used, used + n + 1, false);

  int count = 0;
  ll sum = 0;
  priority_queue< 
    pii, vector< pll >, greater< pll > > pq;
  for(int i = 0; i < k; i++){
    pii p = a[i];
    sum += p.first;
    if(!used[p.second]) ++count;
    else pq.push(p);
    used[p.second] = true;
  }

  ll best = sum + (ll)count * count;

  for(int i = k; i < n && !pq.empty(); i++){
    if(!used[a[i].second]){
      sum -= pq.top().first;
      pq.pop();
      sum += a[i].first;
      ++count;
      used[a[i].second] = true;
      best = max(best, sum + (ll)count * count);
    }
  }

  cout << best << endl;

  return 0;
}


Measured memory_bytes: 5104
n=int(input());l=list(map(int,input().split()));p=[0]*n;d=[0]*n
for i in range(n):p[i]=l[i]+(p[i-2]if i>1else 0)
for i in range(1,n):
  d[i]=p[i-1]if(i&1)else d[i-1]
  d[i]=max(d[i],l[i]+(d[i-2]if i>1else 0))
print(d[-1])

Measured memory_bytes: 39484
N = int(input())
A = tuple(map(int, input().split()))

dupcount = [0] * (N + 1)
for a in A:
    dupcount[a] += 1

allc = 0
for a in range(1, N + 1):
    c = dupcount[a]
    if c > 1:
        allc += (c * (c - 1) // 2)

for a in A:
    ans = allc
    c = dupcount[a]
    if c > 0:
        ans -= (c - 1)
    print(ans)

Measured memory_bytes: 32796
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   
   	long int n,k;
   	cin>>n>>k;

   	vector<long int> v(n);
   	for(long int i =0 ; i < n; i++)
   		cin>>v[i];

   	sort(v.begin(),v.end());
   	long int sum = 0;
   	for(long int i = 0; i < n-k; i++)
   		sum += v[i];

   	cout<<sum;
   return 0;
}


Measured memory_bytes: 1792
//    _____                   _                       _
//   / ____|                 | |                     (_)
//  | (___   ___  _ __     __| | ___ _ __    ______ _ _
//   \___ \ / _ \| '_ \   / _` |/ _ \ '_ \  |_  / _` | |
//   ____) | (_) | | | | | (_| |  __/ |_) |  / / (_| | |
//  |_____/ \___/|_| |_|  \__,_|\___| .__/  /___\__,_|_|
//                                  | |
//                                  |_|

#include <bits/stdc++.h>
#define nmax 500005
#define oo 10000000007
#define mod 1000000007
#define reset(x) memset(x, 0, sizeof x)
#define F first
#define S second
#define sonin cin
#define sonout cout
#define PB(x) push_back(x)
#define debug(x) cout << "Loli -> " << #x << " : " << x << "\n"
#define filename ""
#define fileNX freopen(filename".inp", "r", stdin); freopen(filename".out", "w", stdout);
#define fileN freopen(filename".inp", "r", stdin);
#define fileX freopen(filename".out", "w", stdout);
#define toiuuhoa ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define SZ(a) (int) a.size()
#define FOU(x,a,b) for (lli x=a;x<=b;x++)
#define FOD(x,a,b) for (lli x=a;x>=b;x--)
#define FOA(a,b) for(auto &a:b)
#define ALLvec(a) a.begin(),a.end()
#define REU(x,a,b) for (lli x=a;x<b;x++)
#define RED(x,a,b) for (lli x=a;x>b;x--)
#define AutoCinAry(a,b,x) for(int a = 1; a<=b; a++) cin >> x[i];
#define dembit1(x) __builtin_popcount(x)
#define bit(x,i) (x>>(i-1)&1ll)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1ll<<(i-1)))
#define EL cout << "\n";
#define EX exit(0);
#define Ary(x, i, j, a) x[(i - 1) * a + j]
#define epsinon 1e-8
using namespace std;
typedef long long lli;
typedef long double ldo;
typedef double dou;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli, lli> pii;
typedef vector<pii> vpi;

string s;
lli fa[nmax], fb[nmax];

int main(){
    //fileNX
    toiuuhoa
    sonin >> s;
    s = ' ' + s;
    FOU(i,1,s.length()-1){
        fa[i+1] = fa[i];
        if(s[i] == '<')
            fa[i+1] += 1;
        else
            fa[i+1] = 0;
    }
    FOD(i,s.length()-1,1){
        fb[i] = fb[i+1];
        if(s[i] == '>')
            fb[i] += 1;
        else
            fb[i] = 0;
    }
    lli res = 0;
    FOU(i,1,s.length()){
        res += max(fa[i], fb[i]);
    }

    sonout << res;

    return 0;
}


Measured memory_bytes: 8624
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main {
    public static void main(String[] args) throws IOException {
        try (PrintWriter writer = new PrintWriter(System.out); InputReader reader = new InputReader(System.in)) {
            int numOf500 = reader.readInt();
            int numOf100 = reader.readInt();
            int numOf50 = reader.readInt();
            int target = reader.readInt();

            int count = 0;
            for (int i_500 = 0; i_500 <= numOf500; i_500++) {
                for (int i_100 = 0; i_100 <= numOf100; i_100++) {
                    for (int i_50 = 0; i_50 <= numOf50; i_50++) {
                        int sum = 500 * i_500 + 100 * i_100 + 50 * i_50;
                        if (sum == target) {
                            count++;
                        }
                    }
                }
            }

            writer.println(count);
            writer.flush();
        }
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readLine().split(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readLine().split(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    @Override
    public void close() throws IOException {
        this.br.close();
    }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define hyperspeed ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long  
#define ull unsigned long long
#define ui unsigned int
#define li long int
#define uli unsigned long int
#define pb push_back
#define ld long double
#define vi vector<int>
#define vvi vector<vector<int>>
#define vli vector<li>
#define vll vector<ll>
#define all(v) v.begin(),v.end()
#define pi pair<int,int>
#define FOR(i,s,n) for(auto i=s;i<n;++i)
#define FORN(i,s,n) for(auto i=s;i<=n;++i)
#define FORR(i,s,n) for(auto i=s;i>=n;--i)
#define FORE(i,a) for(auto i : a)
#define mp make_pair
const int MOD = 1e9+7;

void solve() {
    int n;
    cin >> n;
    int a[n+1];
    FOR(i,1,n+1) {
        cin >> a[i];
    }
    int cnt = 0;
    for(int i=1;i<n+1;i+=2) {
        if(a[i]&1)
            cnt++;
    }
    cout << cnt << endl;
}

int32_t main()
{
    hyperspeed
    int test=1;
    // cin >> test;
    while(test--) {
        solve();
    }
    return 0;
}

//--n1m5


Measured memory_bytes: 3648
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int sum = 0;
    rep(i, 4){
        int t;
        cin >> t;
        sum += t;
    }

    cout << sum / 60 << endl << sum % 60 << endl;

    cout << flush;

    return 0;
}


Measured memory_bytes: 3152
N = input()

if int(N[-1])%2 == 1:
    print(0)
else:
    N = int(N)
    ans = N//10
    for i in range(2,1000):
        tmp = 2*5**i
        if tmp > N:
            break
        else:
            ans += N//tmp
    print(ans)

Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
    int n;
    int a;
    int min = 1000 * 1000 + 1;
    int max = -min;
    long sum = 0;

    scanf("%d", &n);

    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &a);
        sum += a;
        if (a > max)
            max = a;
        if (a < min)
            min = a;
    }

    printf("%d %d %ld\n", min, max, sum);

    return 0;
}



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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int dp[100001][3];

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

  int a[3][n];
  for(int i = 0; i < n; i++){
    cin >> a[0][i] >> a[1][i] >> a[2][i];
  }

  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(j == k) continue;

        dp[i+1][j] = max(dp[i+1][j], dp[i][k] + a[j][i]);
      }
    }
  }

  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;

  return 0;
}


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

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (0 <= (x-r) && 0 <= (y-r) && (x+r) <= W && (y+r) <= H)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <cstring>
using namespace std;

int main() {
  int c,e,n;
  int b = 0;
//  int a[100];
  long long int x,y;
  cin >> x >> y;
  while(x <= y){
    x *= 2;
    b++;
  }
  cout << b <<'\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;

int main(){
	string a;
	cin >> a;
	mp::cpp_int n;
	cin >> n;

	if (a.length() == 1) {
		cout << n / 2;
		return 0;
	}

	if (a.length() == 2) {
		if (a[0] == a[1]) {
			cout << n;
			return 0;
		}
		cout << 0;
		return 0;
	}

	bool flag = true;
	for (int i = 0; i < a.length() - 1; i++) {
		if (a[i] != a[i+1]) {
			flag = false;
		}
	}
	if (flag && a.length() % 2 == 1) {
		cout << (a.length() / 2) * n + (n / 2);
		return 0;
	}

	flag = false;

	char temp = a[0];
	char next = a[1];
	mp::cpp_int sum = 0;
	mp::cpp_int count = 1;
	mp::cpp_int head_count = 1;
	for (int i = 0; i < a.length() - 1; i++) {
		temp = a[i];
		next = a[i+1];

		if (temp == next) {
			count++;
		} else {
			sum += count / 2;
			if (!flag) {
				head_count = count;
				flag = true;
			}
			count = 1;
		}
	}

	sum += count / 2;
	sum *= n;
	
	if (a[0] == a[a.length()-1] && count % 2 == 1 && (count + head_count) % 2 == 0) {
		sum += n-1;
	}

	cout << sum;
	return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    r=I()
    print(3*r**2)
            
            
            
    

        
    
            
        

        
if __name__=="__main__":
    main()


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

int main(){
 int a,b,c,d,e;
 cin >> a >> b >> c;
 d = max({a,b,c});
 e = a+ b+c-d;

 if(d == e){
 	cout << "Yes" << endl;
 }
 else{
 	cout << "No" << endl;
 }

}


Measured memory_bytes: 256
/**akshaykumar99**/
 
#include<bits/stdc++.h>
using namespace std;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define pu push_back           
#define pp pop_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const int MOD=1e9+7 ;
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=2e5+1;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> ivc;
typedef pair<ll,ll> ipr;
int main()
{
    IOS();
    
    int n,i;
    cin>>n;
    vector<pair<int,int>> v;
    f(i,0,n)
    {	
    	int x;
    	cin>>x;
    	v.pu({x,i+1});
    }
    sort(all(v));
    f(i,0,n)
    {
    	cout<<v[i].S<<" ";
    }


    return 0;
}

Measured memory_bytes: 1780
# -*- coding:utf-8

def main():
	N = int(input())
	A = list(map(int, input().split()))
	insertionSort(A, N)
	print(' '.join(map(str, A)))

def insertionSort(A, N):
	for i in range(1, N):
		print(' '.join(map(str, A)))
		v = A[i]
		j = i-1
		while(j>=0 and A[j]>v):
			A[j+1] = A[j]
			j -= 1
		A[j+1] = v
			
if __name__ == '__main__':
	main()

Measured memory_bytes: 5608
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define mod 1000000007
typedef long long ll;
using namespace std;

const int MAX = 100005;
vector<int> G[MAX];
int D[MAX][2];
void dfs(int cur, int pre, int d, int id){
  D[cur][id] = d;
  for(int v:G[cur]){
    if(v==pre) continue;
    dfs(v,cur,d+1,id);
  }
}

int main(){
  int n,s,t;
  cin >> n >> s >> t;
  s--; t--;
  for(int i=0;i<n-1;i++){
    int a,b; cin >> a >> b;
    a--; b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  dfs(s,-1,0,0);
  dfs(t,-1,0,1);

  int mx = 0;
  for(int i=0;i<n;i++){
    if(D[i][0] < D[i][1]) mx = max(mx,D[i][1]);
  }

  cout << mx - 1 << endl;
  return 0;
}

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

int dp[100010];

int main() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  for (int i = 0; i < 100010; i++) {
    dp[i] = 1100000000;
  }
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> pi;

int n, a[2000005];

int median(int x, int y, int z){
	int w[3] = {x, y, z};
	sort(w, w+3);
	return w[1];
}
int main(){
	int n, x;
	cin >> n >> x;
	if(x == 2*n-1 || x == 1){
		puts("No");
		return 0;
	}
	for(int i=0; i<2*n-1; i++) a[i] = i+1;
	if(x > n) rotate(a+n-1, a+x-1, a+2*n-1);
	else if(x < n){
		rotate(a, a+x, a+n);
	}
	puts("Yes");
	for(int i=0; i<2*n-1; i++) printf("%d\n",a[i]);
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define mod 1000000007
using namespace std;

int main(){
    int n;
    cin >> n;
    long long ans=0;
    rep(i,1,n/2){
        if(i!=(n-i) && i>0)++ans;
    }

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

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

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

    if (S.size() <= K)
    {
        cout << S << endl;
    }
    else
    {
        cout << S.substr(0, K) << "..." << endl;
    }
}

Measured memory_bytes: 3628
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
 
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false); // 🏁 👀 💕
  cin.tie(NULL);
  
  int s;
  cin >> s;
  string str;
  cin >> str;
  for (auto &it : str) {
    int v = it - 65;
    v += s;
    v %= 26;
    it = 'A' + v;
  }  
  cout << str << endl;

  return 0;
}

Measured memory_bytes: 256