akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,a[3][4040];
string s;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>s;
	a[0][0]=a[1][0]=a[2][0]=0;
	fo(i,0,n+1){
		a[0][i+1]=a[0][i]+(s[i]=='R');
		a[1][i+1]=a[1][i]+(s[i]=='G');
		a[2][i+1]=a[2][i]+(s[i]=='B');
	}
	ll ans=0;
	fo(i,0,n-2) fo(j,i+1,n-1) if(s[i]!=s[j]){
		if((s[i]=='R'&&s[j]=='G')||(s[i]=='G'&&s[j]=='R'))ans+=a[2][n]-a[2][j+1]-(s[2*j-i]=='B');
		else if((s[i]=='R'&&s[j]=='B')||(s[i]=='B'&&s[j]=='R'))ans+=a[1][n]-a[1][j+1]-(s[2*j-i]=='G');
		else ans+=a[0][n]-a[0][j+1]-(s[2*j-i]=='R');
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3672
import java.util.*;

 // Compiler version JDK 11.0.2

 public class Main
 {
   public static void main(String args[])
   { 
    Scanner sc= new Scanner(System.in);
    int n=sc.nextInt();
    if(n==0)
    System.out.println("1");
    else 
    System.out.println("0");
   }
 }


Measured memory_bytes: 35728
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.awt.Point;
import java.util.*;
   
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str;
while(!(str=br.readLine()).equals("0 0")){
String[] value=str.split(" ");
int h=Integer.parseInt(value[0]);
int w=Integer.parseInt(value[1]);
char[][] map=new char[h][w];
for(int i=0;i<h;i++){
map[i]=br.readLine().toCharArray();
}
Deque <Point> fifo  =new  ArrayDeque<Point>();
  int ans=0;
   for(int m=0;m<h;m++){
   for(int n=0;n<w;n++){
if(map[m][n]!='.'){
ans++;
Point p = new Point(n,m);
fifo.addLast(p);
while(fifo.peekFirst()!=null){
p=fifo.pollFirst();
int x=p.x;
 int y=p.y;
  char crop = map[y][x];
map[y][x]='.';
 int [] dx ={0,1,0,-1};
 int [] dy ={1,0,-1,0};                   
     for(int i=0;i<4;i++){
      int nx =x+dx[i];
   int ny =y+dy[i];
if(nx>=0&&nx<w&&0<=ny&&ny<h&&map[ny][nx]==crop&&map[ny][nx]!='.'){
          Point np = new Point();
                        np.x=nx;
                        np.y=ny;
                     fifo.addLast(np);                       
}
}
}
}
}
}System.out.println(ans);
}
}
}

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

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数の入力
            long n = long.Parse(Console.ReadLine());

			int sp = 26;
			char[] ch = getChar(26);
			string result = "";

			long amari = 0;
			while (true)
			{
				if (n <= sp)
				{
					result = ch[n-1] + result;
					break;
				}
				amari = n % sp == 0 ? 26 : n%sp;
				n = (n-1) / sp;
				result = ch[amari-1] + result;
			}

            Console.WriteLine(result);

            Console.Out.Flush();
		}
		/// <summary>
		/// 文字テーブルを作成します。
		/// </summary>
		/// <param name="count"></param>
		/// <returns></returns>
		private static char[] getChar(int count)
		{
			char[] result = new char[count];
			for (int i = 0; i < count; i++)
			{
				result[i] = (char)('a' + ((char)i));
			}
			return result;
		}
	}
}


Measured memory_bytes: 27504
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#include <iomanip>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}


ll modpow(ll a,ll p){
    if(p==0) return 1;
    if(p%2==0){
        ll halfp = p/2;
        ll half = modpow(a,halfp);
        return half * half % MOD;
    }else{
        return a * modpow(a,p-1) % MOD;
    }
}

ll calcComb(ll a,ll b){
    if (b > a-b){
        return calcComb(a,a-b);
    }
    ll ansMul = 1;
    ll ansDiv = 1;
    REP(i,b){
        ansMul *= (a - i);
        ansDiv *= (i + 1);
        ansMul %= MOD;
        ansDiv %= MOD;
    }
    ll ans = ansMul * modpow(ansDiv,MOD-2) ;
    ans %= MOD;
    return ans;
}

int checkab(string tmp){
    int cnt = 0;
    REP(i,tmp.size()-1){
        if (tmp[i] == 'A' and tmp[i+1] == 'B'){
            cnt++;
        } 
  }
  return cnt;
}

int main ()
{
    ll N;cin>>N;
    ll cnt = 0;
    vector<string> ss(N);
    vector<ll> na (N),nb(N);
    REP(i,N){
        cin>>ss[i];
        cnt += checkab(ss[i]);
        if(ss[i][0] == 'B'){
            nb[i] = 1;
        }else{
            nb[i] = 0;
        }
        if(ss[i].back() == 'A'){
            na[i] = 1;
        }else{
            na[i] = 0;
        }
    }
    int numab = 0;
    REP(i,N){
        if (na[i] ==1 and nb[i] == 1){
            numab ++;
            na[i] = 0;
            nb[i] = 0;
        }
    }
    ll numb = accumulate(ALL(nb),0);
    ll numa = accumulate(ALL(na),0);
    if(numa == numb and numa == 0){
        cout<<cnt+max(numab-1,0)<<endl;
        return 0;
    }
    if(numa == numb){
        cout<<cnt+numab+numa<<endl;
        return 0;
    }
    cout<<cnt+numab+min(numa,numb)<<endl;
    return 0;
}

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

class Magatro
{
    public void Solve()
    {
        var N = int.Parse(Console.ReadLine());
        int ans = 0;
        for (int i = 1; i * i <= N; i++)
        {
            ans = i * i;
        }
        Console.WriteLine(ans.ToString());
    }
    static void Main(string[] args)
    {
        new Magatro().Solve();
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
	}

	void solve() {
		int N, P;
		cin >> N >> P;
		vector<int> A( N );
		for( auto& v: A ) { cin >> v; }

		if( any_of( A.begin(), A.end(), []( int v ) { return v%2 != 0; } ) ) {
			cout << (1LL << (N-1)) << endl;
		}
		else {
			cout << (P == 1 ? 0LL : 1LL << N) << endl;
		}
	}
};

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


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

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

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

ll n, W;
ll w[200], v[200];

void solve() {
    ll dp[n + 100][half_inf + 10];
    rep(i, n + 100)rep(j, half_inf + 10) dp[i][j] = ll_inf;
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, half_inf + 10) {
            if (j >= v[i]) {
                chmin(dp[i + 1][j], min(dp[i][j], dp[i][j - v[i]] + w[i]));
            } else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }
    ll ans = 0;
    rep(j, half_inf + 10) {
        if (dp[n][j] <= W) ans = max(j, ans);
    }
    cout << ans << endl;
}

int main() {
    cin >> n >> W;
    rep(i, n) cin >> w[i] >> v[i];
    solve();
    return 0;
}

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

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

int field[11][11];
int n,m;
int ci,cj;

int flag[11][11];

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

int dfs(int cnt, int ni, int nj){
	//cout << cnt << " "  <<  ni << " " << nj <<  " " <<  " nij" << endl;
	if(cnt == 0){
		if(ni == ci || nj == cj) return 1;
		else return 0;
	}
	int ret = 0;
	for (int i = 0;i < 4;i++){
		int ti = ni,tj = nj;
		while(true){
			ti += dy[i]; tj += dx[i];
			if(ti < 0 || ti >= n || tj < 0 || tj >= m) break;
			else if(flag[ti][tj] == 1){
				flag[ti][tj] = 0;
				ret += dfs(cnt-1,ti,tj);
				flag[ti][tj] = 1;
				break;
			}
		}
	}
	return ret;
}

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

	while(true){

			cin >> m >> n;
			if(m == 0) break;

			int cnt = 0;

			for (int i = 0;i < n;i++){
				for (int j = 0;j < m;j++){
					cin >> field[i][j];
					flag[i][j] = field[i][j];
					if(field[i][j] == 2){
						cj = j; ci = i;
					}
					if(field[i][j] == 1) cnt++;
				}
			}

			cout << dfs(cnt,ci,cj) << endl;
	}

	return 0;

}



Measured memory_bytes: 3140
/*input
codefestival
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int main()
{
	IOS;
	string s;
	cin>>s;
	int n=SZ(s);
	int id=-1;
	REP(i,n) if(s[i]=='C'){
		id=i;break;
	}
	if(id==-1){
		cout<<"No\n";
		return 0;
	}
	for(int i=id;i<n;i++){
		if(s[i]=='F'){
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
	return 0;
}


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

const int N = (int) 1e5;
vector<int> graph[N];
int lab[N], small[N];
bool visited[N][2];
int smallest[N][2];
int n, m;

int get(int u) {
	return lab[u] < 0 ? u : lab[u] = get(lab[u]);
}

void join(int u, int v) {
	u = get(u);
	v = get(v);
	if (u == v) return;
	if (lab[u] < lab[v]) swap(lab[u], lab[v]);
	lab[v] += lab[u];
	small[v] = min(small[v], small[u]);
	lab[u] = v;
}

void bfs() {
	for (int u = 0; u < n; ++u) if (small[get(u)] == u) {
		queue<tuple<int, int> > q;
		q.emplace(u, 0);
		visited[u][0] = true;
		while (!q.empty()) {
			int u, odd;
			tie (u, odd) = q.front();
			q.pop();
			for (auto v : graph[u]) {
				if (!visited[v][1 - odd]) {
					q.emplace(v, 1 - odd);
					visited[v][1 - odd] = true;
				}
			}
		}
	}
}

void dijkstra() {
	memset(smallest, 0x3f, sizeof smallest);
	priority_queue<tuple<int, int, int> > q;
	for (int u = 0; u < n; ++u) {
		q.emplace(-u, u, 0);
		smallest[u][0] = u;
	}
	while (!q.empty()) {
		int small, u, odd; tie (small, u, odd) = q.top(); small = -small; q.pop();
		if (small != smallest[u][odd]) continue;
		for (auto v : graph[u]) {
			if (small < smallest[v][1 - odd]) {
				smallest[v][1 - odd] = small;
				q.emplace(-small, v, 1 - odd);
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 0; i < n; ++i) lab[i] = -1, small[i] = i;
	for (int i = 0; i < m; ++i) {
		int x, y; cin >> x >> y; --x; --y;
		graph[x].push_back(y);
		graph[y].push_back(x);
		join(x, y);
	}

	bfs();
	dijkstra();

	long long res = 0;
	int degree0 = 0;
	int n0 = 0, n1 = 0, n01 = 0;
	for (int i = 0; i < n; ++i) if (graph[i].size() == 0) ++degree0;
	for (int i = 0; i < n; ++i) {
		if (smallest[i][0] >= i) ++n0;
		if (smallest[i][1] >= i) ++n1;
		if (smallest[i][0] >= i && smallest[i][1] >= i) ++n01;
	}
	for (int a = 0; a < n; ++a) {
		long long old = res;
		if (graph[a].size() == 0) {
			res += n;
		} else if (small[get(a)] < a) {
			res += degree0;
		} else {
			if (visited[a][0] && visited[a][1]) res += n01;
			else if (visited[a][0]) res += n0;
			else if (visited[a][1]) res += n1;
		}
		//cout << a << ' ' << small[get(a)] << ' ' << res - old << '\n';
	}
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 13020
#include<bits/stdc++.h>
#define ll long long
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
using namespace std;
int main(){
	nes;
	ll n,k;
	cin>>n>>k;
	ll dp[n+1]={0};
	dp[0]=1;
	for(int i=1;i<=n;++i) dp[i]=min(dp[i-1]*2,dp[i-1]+k);
	cout<<dp[n];
	return 0;
}


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

int main()
{
    int n, ans;
    vector<int> c1, c2;
    for (int i = 0; i <= 53; i++) {
        c1.push_back(i * i * i);
    }
    for (int i = 0; i <= 95; i++) {
        c2.push_back(i * (i + 1) * (i + 2) / 6);
    }
    while (cin >> n && n) {
        ans = 0;
        for (int i = 0; i < c1.size(); i++) {
            for (int j = 0; j < c2.size(); j++) {
                if (c1[i] + c2[j] > n) {
                    continue;
                }
                ans = max(ans, c1[i] + c2[j]);
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1216
S = input()
T = input()
def checker(s, t):
	for i in range(len(s)):
		if s[i] != "?" and s[i] != t[i]:
			return False
	return True


for i in reversed(range(len(S) - len(T) + 1)):
    if checker(S[i:(i + len(T))], T):
        S = S.replace('?', 'a')
        print(S[:i] + T + S[i + len(T):])
        exit()
print('UNRESTORABLE')
exit()

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

using namespace std;

int main(void){
    int N=0;
    int M =0;
    cin >> N;

    int T[N];
    int total_time = 0;
    for(int i=0;i<N;i++){
        cin >> T[i];
        total_time = total_time + T[i];
    }
    cin >> M;

    /*int P[M];
    int X[M];
    */
    int result_time = 0;
    int P = 0;
    int X = 0;
    for(int i=0;i<M;i++){
        cin >> P >> X;
        result_time = total_time - (T[P-1] - X);
        cout << result_time << endl;
    }
    return 0;

}

Measured memory_bytes: 256
import math

a,b,x = map(int, input().split())

tant = 2*b/a - 2*x/a**3

if tant >= 0 and tant <= b/a:
  ans = math.atan(tant)/math.pi*180
else:
  tant = 0.5 * a*b**2/x
  ans  = math.atan(tant)/math.pi*180
  
print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int N,A;
    cin>>N>>A;
    
    ll x[N+1];
    for(int i=1;i<=N;i++) cin>>x[i];
    
    ll dp[N+1][N+1][N*50+1];
    for(int i=0;i<=N;i++){
        for(int j=0;j<=N;j++){
            for(int s=0;s<=N*50;s++){
                dp[i][j][s]=0;
            }
        }
    }
    dp[0][0][0]=1;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N;j++){
            for(int s=0;s<=N*A;s++){
                dp[i][j][s]+=dp[i-1][j][s];
                if(s>=x[i])dp[i][j][s]+=dp[i-1][j-1][s-x[i]];
            }
        }
    }
    
    
    ll ans=0;
    for(int k=1;k<=N;k++) ans+=dp[N][k][A*k];
    cout<<ans<<endl;
}


Measured memory_bytes: 51072
N,D = map(int,input().split())
#X = [input().split() for i in range(N)]
#a = [list(map(int,input().split(" "))) for i in range(N)]
X = [list(map(int,input().split(" "))) for i in range(N)]
import math


def diff(lis1,lis2):
	l = 0
	#lis3 = [0]*len(lis1)
	for i in range(len(lis1)):
		l += abs(lis1[i] - lis2[i])**2
	return math.sqrt(l)


cnt = 0
for i in range(N):
	for j in range(i+1,N):
		if diff(X[i],X[j]).is_integer():
			cnt += 1
		#print("diff(X[i],X[j]),cnt",diff(X[i],X[j]),cnt)

print(cnt)

Measured memory_bytes: 3064
/*Anuranjan Srivastava (codersaty)*/
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define pinf INT_MIN
#define minf INT_MAX
#define loop(i,j) for(int i=1;i<=j;i++)
#define rep(i,j) for(int i=0;i<j;i++)
#define deb(x) cout<< #x << "=" << x<< endl
#define deb1(x,y) cout<< #x << "=" << x<<","<< #y << "=" << y<< endl
#define endl "\n"
#define F first
#define S second
#define mp make_pair
#define all(x) x.begin(),x.end()
#define clr(x) memset(x,0,sizeof(x))
#define  sortall(x) sort(all(x))
#define  tr(it,a) for(auto it=a.begin();it!=a.end();it++)
#define  pii pair<int,int>
#define  pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pii>
#define vpl vector<pl>
#define  vvi vector<vi>
#define mi map<int,int>
#define ml map<ll,ll>
const double pi=3.141592653589793238;
using namespace std;


int main()
{
    string s,t;
    cin>>s>>t;
    int ans,diff=0;
    ans=t.length();
    for(int i=0;i<=s.length()-t.length();i++)
    {
        diff=0;
        for(int j=0;j<t.length();j++)
        {
            if(s[j+i]!=t[j])
            diff++;
        }
        ans=min(diff,ans);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>

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

template<typename U>
int sort_bubble(std::vector<U> &x) {
	int swap_count = 0;
	for (int i=0; i<x.size(); ++i) {
		for (int j=x.size()-1; j>i; --j) {
			if (x[j] < x[j-1]) {
				swap_count++;
				U temp = x[j];
				x[j] = x[j-1];
				x[j-1] = temp;
			}
		}
	}
	return swap_count;
}

template<typename T>
void print(std::vector<T> v) {
	for(int i=0;i<v.size();++i){
		if (i==0) std::cout << v[i];
		else std::cout << " " << v[i];
	}
}

using namespace std;

// input
// N
// x[0] x[1] ...
//
int main(){
	int N;
	cin >> N;
	vector<int> x(N);
	rep(i,N) {
		cin >> x[i];
	}
	// print(x); cout << endl;
	int swap_count = sort_bubble(x);
	print(x); cout << endl;
	cout << swap_count << endl;
	return 0;
}




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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

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

using namespace std;

// const long long INF = 1LL << 60;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}


/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMinimum(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMaximum(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {

// 入力
//    int N;
    long long h[100010];

// DP テーブル
    long long dp[100010];
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;


    // ループ
    for (int i = 1; i < N; ++i) {
        changeMinimum(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) changeMinimum(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    cout << dp[N - 1] << endl;


}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
    int a = 0;
    int b = 0;
    scanf("%d", &a);
    scanf("%d", &b);

    if (a > 8 | b > 8) {
        printf(":(\n");
    } else {
        printf("Yay!\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define MAX 25000100
inline ll read()
{
	ll x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
ll f[MAX],n,gA,sA,bA,gB,sB,bB;
int main()
{
	n=read();
	gA=read();sA=read();bA=read();
	gB=read();sB=read();bB=read();
	for(int i=0;i<=n;++i)
	{
		if(i+gA<=n&&gA<gB)f[i+gA]=max(f[i+gA],f[i]+gB);
		if(i+sA<=n&&sA<sB)f[i+sA]=max(f[i+sA],f[i]+sB);
		if(i+bA<=n&&bA<bB)f[i+bA]=max(f[i+bA],f[i]+bB);
	}
	ll mx=0;
	for(int i=0;i<=n;++i)mx=max(mx,f[i]-i);
	n+=mx;
	memset(f,0,sizeof(f));
	for(int i=0;i<=n;++i)
	{
		if(i+gB<=n&&gA>gB)f[i+gB]=max(f[i+gB],f[i]+gA);
		if(i+sB<=n&&sA>sB)f[i+sB]=max(f[i+sB],f[i]+sA);
		if(i+bB<=n&&bA>bB)f[i+bB]=max(f[i+bB],f[i]+bA);
	}
	mx=0;
	for(int i=0;i<=n;++i)mx=max(mx,f[i]-i);
	printf("%lld\n",mx+n);
	return 0;
}


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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


ll maxK(set<ll>& st, map<ll, ll>& m){
    ll maxx = 0;
    ll k = -1;
    for(auto x : st){
        if(maxx < m[x]){
            maxx = m[x];
            k = x;
        }
    }
    return k;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    vector<ll> l;
    vector<ll> r;
    rep(i, n){
        if(i%2 == 0) l.push_back(v[i]);
        else         r.push_back(v[i]);
    }

    set<ll> lst;
    set<ll> rst;
    for(auto x : l) lst.insert(x);
    for(auto x : r) rst.insert(x);

    map<ll, ll> lm;
    map<ll, ll> rm;
    for(auto x : l) lm[x]++;
    for(auto x : r) rm[x]++;

    ll lk = maxK(lst, lm);
    ll rk = maxK(rst, rm);

    if(lk == rk){
        lst.erase(lk);
        rst.erase(rk);
        ll llk = maxK(lst, lm);
        ll rrk = maxK(rst, rm);
        if(lm[lk] + rm[rrk] < lm[llk] + rm[rk]) lk = llk;
        else                                    rk = rrk;
        lst.insert(lk);
        rst.insert(rk);
    }

    cout << l.size()-lm[lk] + r.size()-rm[rk] << endl;




    return 0;
}



Measured memory_bytes: 12788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int gd,sum=0;
    cin>>gd;
    for(int i=1; i<=gd; i++)
    {
        for(int j=1; j<=gd; j++)
        {
            for(int k=1; k<=gd; k++)
            {
                sum=sum+(__gcd(k,__gcd(i,j)));
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


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

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] sizes = Read(Console.ReadLine());
            int ans = sizes.Max();
            if (sizes.Min() < ans - 1) ans += ans - 1;
            else ans += sizes.Min();
            Console.WriteLine(ans);
        }


        private static int[] Read(string input)
        {
            string[] inputs = input.Split(' ');
            int num = inputs.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(inputs[i]);
            }
            
            return ints;
        }


    }
}


Measured memory_bytes: 13268
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <assert.h>

using namespace std;

#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
#define trace(x) cerr << #x << " = " << x << endl;



/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

///////////////////////////////////////////////////////////////////////
#define int long long

void solve(){

	string s;
	cin>>s;
	int ans = 0;
	for(int i = 0 ; i < 3 ; ++i){

		int j = i;
		while(j < 3 && s[i]==s[j] && s[i]=='R')
			++j;
		ans = max(ans , j - i);
	}

	cout<<ans<<endl;
}
signed main(){
 
    fast;
    int t = 1;
    //cin>>t;
    for(int i = 1 ; i <= t ; ++i)
        solve();
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
const int INF = 2147483647;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int main()
{
	int n;
	int a[100005];

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

	int count = 1;
	int ans = 0;
	for (int i = 1;i <= n+1;i++) {
		if (a[i - 1] == a[i]) {
			count++;
		}
		else {
			ans += (count / 2);
			count = 1;
		}
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import itertools
N, M = map(int, input().split())
even = []
odd = []

for i in range(N):
  even.append(2)

for i in range(M):
  odd.append(1)
  
lst = even + odd

ans = 0
for v in itertools.combinations(lst, 2):
  x = v[0] + v[1]
  if x % 2 == 0:
    ans += 1
print(ans)

Measured memory_bytes: 3064
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace EXAWIZARDS2019C
{
    public partial class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var Q = ss.Next(int.Parse);
            var S = "0" + ss.Next() + "0";
            var qs = ss.Next(2, Q).Select(a => new{T = a[0][0], D = a[1][0]});

            var left = 1;
            var right = N + 1;

            foreach (var q in qs.Reverse())
            {
                if (q.D == 'L')
                {
                    if (q.T == S[left]) left++;
                    if (q.T == S[right]) right++;
                }
                if (q.D == 'R')
                {
                    if (q.T == S[left - 1]) left--;
                    if (q.T == S[right - 1]) right--;
                }
            }

            sw.WriteLine(right - left);
            //---------------------------------
        }
    }

    public class StreamScanner
    {
        static readonly char[] Separator = {' '};
        readonly StreamReader streamReader;

        string[] line = new string[0];
        int index = 0;

        public StreamScanner(Stream stream)
        {
            this.streamReader = new StreamReader(stream);
        }

        public string Next()
        {
            return Next(s => s);
        }

        public string[] Next(int x)
        {
            return Next(s => s, x);
        }

        public string[][] Next(int x, int y)
        {
            return Next(s => s, x, y);
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (index < line.Length) return parser(line[index++]);
            index = 0;
            line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }

    public partial class Program
    {
        static void Main()
        {
            Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());
        }

        public static void Excute(Stream input, Stream output)
        {
            var ss = new StreamScanner(input);
            var sw = new StreamWriter(output);
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }
}

Measured memory_bytes: 45036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] f = new int[n + 1];
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j * i <= n; j++) {
        f[j * i]++;
      }
    }
    long sum = 0;
    for (int i = 1; i <= n; i++) sum += (long) i * f[i];
    System.out.println(sum);
  }
}

Measured memory_bytes: 71912
#include<bits/stdc++.h>
using namespace std;
int a[1000001];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int i;
	int mini=2100000000;
	for(i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==1)
			mini=i;
	}
	int ans=210000000;
	for(i=1;i<=n;i++)
	{
		if(mini-k+1>i||mini+k-1<i)
			continue;
		int ll=i-1,rr=i+k;
		if(rr>n)
			rr=n+1;
		int s1=0,s2=0;
		if(ll!=0)
			s1=(ll-1)/(k-1)+1;
		if(rr!=n+1)
			s2=(n-rr)/(k-1)+1;
		ans=min(ans,s1+s2+1);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<string> v;

int main() {
	string s;
	int n;
	ll t=1;
	ll res=0;
	cin>>n;
	rep(i,n){
		cin>>s;
		sort(s.begin(),s.end());
		v.push_back(s);
	}
	sort(v.begin(),v.end());
	rep(i,n-1){
		if(v[i]==v[i+1]){
			t++;
		}else{
			res+=(t*(t-1))/2;
			t=1;
		}
	}
	res+=(t*(t-1))/2;
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 5748
#include <stdio.h>

typedef struct {
  char suit;
  int num;
  int idx;
} Card;

void BubbleSort(Card C[], int N);
void SelectionSort(Card C[], int N);

int main() {
  int N;
  Card C1[36], C2[36];
  int i;

  scanf("%d", &N);
  for(i = 0; i < N; ++i) {
    scanf(" %c%d", &C1[i].suit, &C1[i].num);
    C1[i].idx = i;
    C2[i] = C1[i];
  }

  BubbleSort(C1, N);
  SelectionSort(C2, N);

  return 0;
}

void BubbleSort(Card C[], int N) {
  Card tmp;
  int stable;
  int i, j;
  for(i = 0; i < N-1; ++i) {
    for(j = N-1; j > i; --j) {
      if(C[j].num < C[j-1].num) {
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
      }
    }
  }
  stable = 1;
  for(i = 0; i < N; ++i) {
    printf("%c%d%c", C[i].suit, C[i].num, " \n"[i==N-1]);
    if(i > 0 && C[i].num == C[i-1].num && C[i].idx < C[i-1].idx) stable = 0;
  }
  puts((stable ? "Stable" : "Not stable"));
}

void SelectionSort(Card C[], int N) {
    Card tmp;
    int minj;
    int stable;
    int i, j;
    for(i = 0; i < N; ++i) {
      minj = i;
      for(j = i; j < N; ++j) {
        if(C[j].num < C[minj].num) minj = j;
      }
      tmp = C[i];
      C[i] = C[minj];
      C[minj] = tmp;
    }
    stable = 1;
    for(i = 0; i < N; ++i) {
      printf("%c%d%c", C[i].suit, C[i].num, " \n"[i==N-1]);
      if(i > 0 && C[i].num == C[i-1].num && C[i].idx < C[i-1].idx) stable = 0;
    }
    puts((stable ? "Stable" : "Not stable"));
}
    


Measured memory_bytes: 2744
import java.util.Scanner;
public class Main {
	private static Scanner sc;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc = new Scanner(System.in);
		int N =sc.nextInt();
		int z=0;
		for(int i =0;i<=N;i++){
			z=z+i;
		}
		System.out.println(z);
	}

}


Measured memory_bytes: 23764
N = int(input())
A = list(map(int, input().strip().split()))
B = list(map(int, input().strip().split()))
over = []
under = 0
uc = 0

if sum(A) < sum(B):
  print(-1)
else:
  for a, b in zip(A, B):
    if a > b:
      over.append(a-b)
    elif a < b:
      uc += 1
      under += b-a
  for o in sorted(over, key=lambda x: -x):
    if under <= 0:
      break
    else:
      under -= o
      uc += 1
  print(uc)

Measured memory_bytes: 18708
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto x = readln.chomp.to!long;
  auto ans = x / 11 * 2, mod = x % 11;
  if (1 <= mod && mod <= 6) ans += 1;
  else if (5 <= mod)        ans += 2;
  writeln(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

int main(){
    ll l,r;
    cin>>l>>r;
    r=min(r,l+4038);
    int ans = 2018;
    for(ll i = l; i<=r;i++){
        for(ll j = i+1 ; j <= r; j++){
            int x = i*j%2019;
            ans = min(ans,x);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Monad

main :: IO ()
main = do
  [h, w] <- map read . words <$> getLine
  !al <- replicateM h $ map (== '#') <$> getLine
  let
    red = [1..h] >>= \i -> return $ flip map [1..w] $ \j -> (j == 1 || odd i) && j /= w
    blue = map (map not) red
    po = zipWith (zipWith (||)) al
    printColor = putStrLn . unlines . map (map (\b -> if b then '#' else '.'))
  printColor (po red)
  printColor (po blue)


Measured memory_bytes: 41852
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>

using namespace std;
using ll = long long;
using pint = pair<int, int>;

int INF = 1 << 30;

int main() {
	int V, E, r;
	cin >> V >> E >> r;
	vector<vector<pint>> G(V);
	for (int i = 0; i < E; i++) {
		int s, t, d;
		cin >> s >> t >> d;
		G[s].push_back(make_pair(d, t));
	}
	priority_queue<pint, vector<pint>, greater<pint>> q;
	vector<int> dist(V, INF);
	dist[r] = 0;
	q.push(make_pair(0, r));

	while (!q.empty()) {
		pint p = q.top();
		int v = p.second;
		q.pop();
		for (auto np : G[v]) {
			int nw = np.first;
			int nv = np.second;
			if (dist[nv] > dist[v] + nw) {
				dist[nv] = dist[v] + nw;
				q.push(make_pair(dist[nv], nv));
			}
		}
	}

	for (int i = 0; i < V; i++) {
		if (dist[i] == INF) cout << "INF" << endl;
		else cout << dist[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 13040
#include <cstdio>
#include <cassert>
#include <algorithm>
using namespace std;
 
char *pt;
int parseAtom();
int parseExpr();
int parseTerm();
int parseAtom() {
  if('0' <= *pt && *pt <= '9') {
    int x = *pt-'0';
    pt++;
    while('0' <= *pt && *pt <= '9') {
      x = x*10 + *pt-'0';
      pt++;
    }
    return x;
  }
  if('(' == *pt) {
    pt++;
    int x = parseExpr();
    assert(*pt == ')');
    pt++;
    return x;
  }
  assert(false);
  return -1;
}
int parseExpr() {
  int x = parseTerm();
  while(*pt == '+' || *pt == '-') {
    if(*pt == '+') {
      pt++;
      x += parseTerm();
    } else {
      pt++;
      x -= parseTerm();
    }
  }
  return x;
}
int parseTerm() {
  int x = parseAtom();
  while(*pt == '*' || *pt == '/') {
    if(*pt == '*') {
      pt++;
      x *= parseAtom();
    } else {
      pt++;
      x /= parseAtom();
    }
  }
  return x;
}
 
int main() {
  int tc; scanf("%d", &tc);
  for(int tci = 0; tci < tc; tci++) {
    static char expr[200]; scanf(" %s", expr);
    pt = expr;
    int x = parseExpr();
    assert(*pt == '=');
    printf("%d\n", x);
  }
  return 0;
}

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

bool beki[1000];

int main()
{
    int X;
    cin >> X;
    beki[1] = true;
    for (int i = 2; i <= 1000; i++)
    {
        for (int j = 2; pow(i, j) <= 1000; j++)
        {
            beki[int(pow(i, j))] = true;
        }
    }

    for (int i = X; i >= 0; --i)
    {
        if (beki[i])
        {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ar array

int N,K,R,S,P;
string str;

void solve()
{
    cin>>N>>K;
    cin>>R>>S>>P;

    cin>>str;

    int score = 0;

    for(int i = 0; i < N ; i++)
    {
        if(str[i] == str[i-K] && i >= K)
        {
            str[i] = 'A';
        }

        else
        {
            if(str[i] == 'r')
                score += P;
            if(str[i] == 'p')
                score += S;
            if(str[i] == 's')
                score += R;
        }
    }

    cout<<score<<endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3752
package main

import "fmt"

func main() {
        var a1, a2, a3 int
        fmt.Scanf("%d %d %d", &a1, &a2, &a3)

        if a1+a2+a3 >= 22 {
                fmt.Println("bust")
        } else {
                fmt.Println("win")
        }
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	int n,T,A,p[1005],min=999999,k=0;
	cin>>n>>T>>A;
	double x=(T-A)/0.006;
	for(int i=0;i<n;i++){
		cin>>p[i];
		double y=x-p[i];
		if(y<0) y=-y;
		if(y<min){
			min=y; k=i;
		}
	}
	cout<<k+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ll n,k,A[200001],B[200001];
    cin>>n>>k;
    rep(i,n) cin>>A[i]>>B[i];
    ll ans=0;
    rep(i,n) if((k|A[i])==k) ans+=B[i];
    rep(i,log2(k)+1){
        if(!(k&(1<<i))) continue;
        ll m=k,a=0;
        m&=~(1<<i);
        for(int j=i-1;j>=0;j--) m|=(1<<j);
        rep(i,n) if((m|A[i])==m) a+=B[i];
        ans=max(ans,a);
    }
    cout<<ans<<"\n";
}

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

int main(){
  	int a,b;
  	cin >> a >> b;
  
  	if(a==b){
    	cout << "Draw";
    }else if(a==1){
    	cout << "Alice";
    }else if(b==1){
    	cout << "Bob";
    }else if(a>b){
    	cout << "Alice";
    }else{
    	cout << "Bob";
    }
	return 0;
}

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

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

using namespace std;

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

  int n;
  cin >> n;
  int as[n];
  REP(i, n) {
    cin >> as[i];
  }

  int xs[] = {0, 0, 0};
  REP(i, n) {
    int a = as[i];
    if (a % 4 == 0) {
      ++xs[2];
    } else if (a % 2 == 0) {
      ++xs[1];
    } else {
      ++xs[0];
    }
  }

  int d = xs[0] - xs[2];
  bool ans = d <= 0 || (d == 1 && xs[1] == 0);
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define UM unordered_map
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const long long INF = 1LL << 58;
struct Edge
{
    ll s, t, d;
};
typedef vector<vector<Edge>> Graph;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    string S;
    cin >> S;
    int ans = 0;
    int cnt = 0;
    int tmp;
    REP(i, S.size())
    {
        tmp = cnt;
        if (S[i] == 'A')
            cnt++;
        if (S[i] == 'T')
            cnt++;
        if (S[i] == 'C')
            cnt++;
        if (S[i] == 'G')
            cnt++;
        if (tmp == cnt or i == S.size() - 1)
        {
            chmax(ans, cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;
   // system("pause");
}

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


int main() {
  string s,t,u;
  int a,b;
  
  cin >> s >> t >> a >> b >> u;
  
  if(s==u)
    a--;
  if(t==u)
    b--;
  
  cout << a << ' ' << b;
  
  
  
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return ReadLine().Split().Select(int.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var NQ = Sarray();
            var N = NQ[0];
            var Q = NQ[1];
            var st = new SegmentTree<long>(N, Min, (2L << 30) - 1);

            for (var i = 0; i <Q ; ++i)
            {
                var ln = Sarray();
                if (0 == ln[0])
                    st.update(ln[1], ln[2]);
                else
                    WriteLine(st.query(ln[1], ln[2] + 1));
            }
        }
        class SegmentTree<Monoid>
        {
            int sz;
            Monoid[] seg;
            readonly Func<Monoid, Monoid, Monoid> f;
            readonly Monoid M1;

            public SegmentTree(int n, Func<Monoid,Monoid,Monoid    > f, Monoid M1)
            {
                this.f = f;
                this.M1 = M1;
                sz = 1;
                while (sz < n) sz <<= 1;
                seg = new Monoid[sz * 2].Select(_ => M1).ToArray();
            }
            public void set(int k, Monoid x) => seg[k + sz] = x;
            public void build()
            {
                for (var k = sz - 1; 0 < k; --k)
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            public void update(int k, Monoid x)
            {
                k += sz;
                seg[k] = x;
                while (0 != (k >>= 1))
                    seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
            }
            //区間[a,b)に対して
            public Monoid query(int a,int b)
            {
                Monoid L = M1, R = M1;
                for (a += sz, b += sz; a < b; a >>= 1,b>>=1)
                {
                    if (0 != (a & 1)) L = f(L, seg[a++]);
                    if (0 != (b & 1)) R = f(seg[--b], R);
                }
                return f(L, R);
            }
            Monoid this[int k] => seg[k + sz];

        }
    }
}


Measured memory_bytes: 26168
#include<iostream>
#include<cstdio>
#include<cmath>

int main(){
  int n,ans;
  double total;
  double check;

  scanf("%d",&n);
  total = 100000.0;
  for(int i=0;i<n;i++){
    total = total*1.05;
    check = ceil(total/1000.0);
    total = check*1000.0;
  }

  ans = total;
  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 1188
#include <stdio.h>

int main(void)
{
    int a, b, c, d, e, f;
    int det;
    double x, y;

    while (scanf("%d %d %d %d %d %d",
           &a, &b, &c, &d, &e, &f) != EOF) {
        det = a * e - b * d;
        x = (double)(e * c + -b * f) / det;
        y = (double)(-d * c + a * f) / det;
        // x = (x * 1000 + 5) / 1000;
        // y = (y * 1000 + 5) / 1000;
        printf("%.3f %.3f\n", x + 0, y + 0);
    }

    return 0;
}

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

int main() {
  long n,k,aaa=0,i=0;
  cin >> n >> k;
  vector<long> a(n);
  vector<long> h(n,-1);
  for(long i=0;i<n;i++) cin >> a[i];
  for(;true;i++) {
    if(i==k) break;
    if(h[aaa]==-1) h[aaa]=i;
    else break;
    aaa=a[aaa]-1;
  }
  i=(k-h[aaa])/(i-h[aaa])*(i-h[aaa])+h[aaa];
  for(;true;i++) {
    if(i>=k) break;
    aaa=a[aaa]-1;
  }
  cout << aaa+1 << endl;
}

Measured memory_bytes: 6364