akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
//#define   Y            imag()
//#define   X            real()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<double>
#define     PI                       acos(-1)
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=0;
string st;
int main(){
    GO();
    ll n;
    cin>>n;
    ll ans=0;
    ll F=n/500;
    ans+= F*1000;
    n=n-F*500;
    ans+= (n/5)*5;
    cout<<ans<<endl;
}












































































































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

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


int main(void){

    int n;
    cin >> n;
    set<string> ans;
    rep(i, n){
        string s;
        cin >> s;
        ans.insert(s);
    }
    int cnt = ans.size();
    cout << cnt << endl;
    return 0;
}


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

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

    double ans = 0;
    for (int i = 1; i <= min(n, k - 1); i++) {
        int tmp = i;
        double p = 1.0 / n;
        while (tmp < k) {
            tmp *= 2;
            p /= 2;
        }
        ans += p;
    }
    ans += max(0, n - k + 1) / (double)n;
    printf("%.12f\n", ans);

    return 0;
}

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

int main() {
  int N,A;
  cin >> N >> A;
  if(N % 500 == N){
    if(N <= A){
      cout << "Yes";
    }
    else{
      cout << "No";
    }
  }
    else{
      if(N - N/500 * 500 <= A){
         cout << "Yes";
      }
      else{
        cout << "No";
      }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))

typedef struct weightEdge{
  double w;
  int a,b;
} node;

int cmp(const void *a,const void *b){
  double p=((node *)a)->w;
  double q=((node *)b)->w;
  return p==q?0:p<q?-1:1;
}

int root(int *u,int x){
  if(u[x]==x) return x;
  return u[x]=root(u,u[x]);
}

int same(int *u,int x,int y){
  return root(u,x)==root(u,y);
}

void unite(int *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  u[y]=x;
}

void run(void){
  int n;
  scanf("%d",&n);
  int x[15],y[15],a[15];
  int i,j,k;
  for(i=0;i<n;i++) scanf("%d%d%d",x+i,y+i,a+i);
  double d[15*15];
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      int dx=x[i]-x[j];
      int dy=y[i]-y[j];
      d[i*n+j]=sqrt((double)dx*dx+(double)dy*dy);
    }
  }
  double *dp=(double *)calloc(1<<n,sizeof(double));
  for(i=1;i<(1<<n);i++){
    double sum=0;
    int c[15];
    int len=0;
    for(j=0;j<n;j++){
      if((i>>j)&1){
	c[len++]=j;
	sum+=a[j];
      }
    }
    if(len==1){
      dp[i]=sum;
      continue;
    }
    node t[15*15];
    int lent=0;
    for(j=0;j<len;j++) for(k=j+1;k<len;k++) t[lent++]=(node){d[c[j]*n+c[k]],c[j],c[k]};
    qsort(t,lent,sizeof(node),cmp);
    int u[15];
    for(j=0;j<n;j++) u[j]=j;
    double weight=0;
    int cnt=0;
    for(j=0;cnt<len-1;j++){
      if(same(u,t[j].a,t[j].b)) continue;
      unite(u,t[j].a,t[j].b);
      weight+=t[j].w;
      cnt++;
    }
    double local=MAX(0,(sum-weight)/len);
    for(j=1;j<(1<<len)-1;j++){
      int bit=0;
      for(k=0;k<len;k++) if((j>>k)&1) bit|=1<<c[k];
      local=MAX(local,MIN(dp[bit],dp[i^bit]));
    }
    dp[i]=local;
  }
  printf("%.9lf\n",dp[(1<<n)-1]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 508
L, R = map(int, input().split())

if R - L >= 2050:
    print(0)
else:
    ans = 20000000
    for i in range(L, R):
        for j in range(i+1, R+1):
            x = (i*j)%2019
            if x < ans:
                ans = x
    print(ans)


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

int main() {
    string S;
    cin >> S;
    bool hi = true;
    if(S.length()%2==0){
        for(int i=1;i<S.length();i+=2){
            if(S[i-1]!='h'||S[i]!='i'){
                hi = false;
            }
        }
    }else{
        hi = false;
    }

    if(hi) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    val a = sc.nextInt //最初の整数が読み込まれる
    a.toString.contains("7") match{
    case true => println("Yes")
    case false => println("No")
    }
  }
}


Measured memory_bytes: 55372
#include <iostream>
//#include <conio.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int dem =0;
	int a[100000];
	for (int i =0; i < n; i++)
		cin>>a[i];
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = n - 1; j > i; j--)
		{
			if (a[j] < a[j - 1])
			{
				int temp = a[j];
				a[j] = a[j -1];
				a[j - 1] = temp;
				dem++;
			}
		}        
	}
	cout<<a[0];
	for (int i = 1; i < n; i++)
		cout << " "<< a[i];
	cout<< endl;
	cout<< dem << endl;
	return 0;
}

Measured memory_bytes: 3092
#include "bits/stdc++.h"
#define MOD 1000000007
#define inf 0x3f3f3f3f3f3f3f3f
#define pi acos(-1.0)
#define ri register int
#define Abs(x) ((x) < 0 ? (-(x)) : (x))
#define int long long
const int maxn = 505;
inline int Max(int a, int b) { return a > b ? a : b; }
inline int Min(int a, int b) { return a > b ? b : a; }
namespace FastIO {
inline int read()
{
    int f = 1, r = 0;
    char c = getchar();
    while (!isdigit(c)) {
        if (c == '-') {
            f = -1;
        }
        c = getchar();
    }
    while (isdigit(c)) {
        r = 10 * r + c - '0';
        c = getchar();
    }
    return f * r;
}
inline void write(int x)
{
    if (x < 0)
        putchar('-'), x = -x;
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
};
using namespace FastIO;
int N, M;
char map[maxn][maxn], ans1[maxn][maxn], ans2[maxn][maxn];
signed main()
{
    //freopen("C:\Users\hjw\Downloads\testdata (4).in", "r", stdin);
    N = read(), M = read();
    for (ri i = 1; i <= N; ++i) {
        scanf("%s", map[i] + 1);
    }
    for (ri i = 1; i <= N; ++i) {
        ans1[i][1] = '#', ans1[i][M] = '.';
        for (ri j = 2; j < M; ++j) {
            if (map[i][j] == '#') {
                ans1[i][j] = '#';
            } else if (i & 1) {
                ans1[i][j] = '#';
            } else {
                ans1[i][j] = '.';
            }
        }
    }
    for (ri i = 1; i <= N; ++i) {
        ans2[i][M] = '#', ans2[i][1] = '.';
        for (ri j = 2; j < M; ++j) {
            if (map[i][j] == '#') {
                ans2[i][j] = '#';
            } else if (~i & 1) {
                ans2[i][j] = '#';
            } else {
                ans2[i][j] = '.';
            }
        }
    }
    for (ri i = 1; i <= N; ++i) {
        printf("%s\n", ans1[i] + 1);
    }
    puts("");
    for (ri i = 1; i <= N; ++i) {
        printf("%s\n", ans2[i] + 1);
    }
    return 0;
}

Measured memory_bytes: 1536
#include<stdio.h>
int main(){
  int Ntw,Btw,Ctw=0,i,j,minj;
  scanf("%d",&Ntw);
  int Atw[Ntw];
  for(i=0;i<Ntw;i++){
    scanf("%d",&Atw[i]);
  }
  for(i=0;i<Ntw;i++){
    minj=i;
    for(j=i;j<Ntw;j++){
      if(Atw[j]<Atw[minj])minj=j;
    }
    if(Atw[i]!=Atw[minj]){
      Btw=Atw[i];
      Atw[i]=Atw[minj];
      Atw[minj]=Btw;
      Ctw++;
    }
  }
    
  for(i=0;i<Ntw;i++){
    if(i>0)printf(" ");
    printf("%d",Atw[i]);
  }
  printf("\n%d\n",Ctw);
  return 0;
}



Measured memory_bytes: 2048
import sys
from statistics import median_low
inputs = sys.stdin.readlines()

n = int(inputs[0])
A = list(map(int, inputs[1].split()))

B = list(map(lambda x: x[1]-x[0], enumerate(A, 1)))
b = median_low(B)
print(sum(map(lambda x: abs(x-b), B)))

Measured memory_bytes: 29412
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1)
    {
        if(b==1)
            cout<<"Draw";
        else
            cout<<"Alice";
    }
    else if(b==1)
    {
        if(a==1)
            cout<<"Draw";
        else
            cout<<"Bob";
    }
    else if(a>b)
        cout<<"Alice";
    else if(a<b)
        cout<<"Bob";
    else
        cout<<"Draw";
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  map<string, int> mp;
  int mxcnt = 0;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    mxcnt = max(mxcnt, ++mp[S]);
  }
  vector<string> ans;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    if (mxcnt == itr->second) ans.push_back(itr->first);
  }
  sort(ans.begin(), ans.end());
  for (auto a : ans) cout << a << endl;
  return 0;
}


Measured memory_bytes: 27208
function main(input) {
    const args = input.split(' ');
    const a = parseInt(args[0], 10);
    const b = parseInt(args[1], 10);

    if ((a * b) % 2 === 0) { console.log('Even'); } 
    else { console.log('Odd'); }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;

char a[10000][10000];
int main()
{
	int n, l;
	cin >> n >> l;
	for (int i = 0; i < n; i++)
	{
		scanf("%s", a[i]);
	}
	for (int i = 0; i < n-1; i++)
	{
		for (int j = 0; j < n - 1 - i; j++)
		{
			if (strcmp(a[j], a[j + 1])>0)
			{
				char t[1000];
				strcpy(t, a[j]);
				strcpy(a[j], a[j + 1]);
				strcpy(a[j + 1], t);
			}
		}
	}
	for (int i = 0; i < n; i++)
	{
		printf("%s", a[i]);
	}
}


Measured memory_bytes: 640
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a;
    cin >> a;
    cout << 3 * a * a << endl;
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())
i = 0
while i < k:
    if a >= b:
        b *= 2
    elif b >= c:
        c *= 2
    i += 1
#print(a,b,c)
if a < b < c:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 61600
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int m,d;
    cin>>m>>d;
    int ans=0;
    for(int i=1;i<=m;i++)
        for(int j=1;j<=d;j++)
            if(i==(j/10)*(j%10)&&j/10>=2&&j%10>=2)
                ans++;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	int k, x;
	cin >> k >> x;
	
	if(k*500 >= x)
		cout << "Yes";
	else
		cout << "No";

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
#define MOD 1000000007
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

  ll A,B,C,K; cin>>A>>B>>C>>K;
  ll res;
  if(K<=A+B)res=min(A,K);
  else res=A-(K-A-B);
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>
#include <algorithm>
#include<iomanip>
#define INF 1000000000
#define LM 55555
#define LL long long
using namespace::std;


long long  p[10], c[10],d[10],now,num, N, K, M, ans, A[100000], AA[100000];
string S, s[100];
bool h,w[10], k[100];
char cc;


int main() {
	cin >> N>>M;
	ans = 10000000;
	for (int i = 0; i < N; i++) {
		cin >> p[i] >> c[i];
	}

	for (int i = 0; i < (1 << N); i++) {
		num = 0; 
		now = 0;
		LL ma = -1;
		for (int j = 0; j < N; j++) {
			if ((1 & i >> j) == 1) {
				now += p[j] * (j+1) * 100;
				now += c[j];
				num += p[j];
			}
			else {
				ma = j;
			}
		}
		if (M - now > 0) {
			if (ma >= 0) {
				if ((M - now) % (100 * (ma + 1)) == 0) {
					if ((M - now) / (100 * (ma + 1)) <= p[ma] - 1) {
						ans = min(ans, num + ((M - now) / (100 * (ma + 1))));
					}
				}
				else {
					if ((M - now) / (100 * (ma + 1)) < p[ma] - 1) {
						ans = min(ans, num + 1 + ((M - now) / (100 * (ma + 1))));
					}
				}
			}
			else {
				ans = min(ans, num);
			}
		}
		else {
			ans = min(ans, num);
		}
	}

	cout << ans << endl;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

LL x, y, z, k;

int main() {
	cin >> x >> y >> z >> k;
	vector<LL> a(x), b(y), c(z);
	inc(i, x) { cin >> a[i]; }
	inc(i, y) { cin >> b[i]; }
	inc(i, z) { cin >> c[i]; }
	
	vector<LL> ab;
	inc(i, x) {
	inc(j, y) {
		ab.PB(a[i] + b[j]);
	}
	}
	sort(RALL(ab));
	sort(RALL(c));
	
	LL la = min(SL(ab), k);
	LL lc = min(SL(c), k);
	
	vector<LL> ans;
	inc(i, la) {
	inc(j, lc) {
		ans.PB(ab[i] + c[j]);
	}
	}
	sort(RALL(ans));
	
	inc(i, k) { cout << ans[i] << "\n"; }
	
	return 0;
}


Measured memory_bytes: 42984
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n;cin>>n;
    ll d;
    set<ll> st;
    REP(i,n)cin>>d, st.insert(d);
    ll ans=st.size();
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
import math
import fractions
#import sys
#input = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

#################################################
#################################################
#################################################
#################################################

n = int(input())
s = input()

num = [[0,0,0,0,0] for i in range(n)]
ans = 0

info = []
for i in range(n):
    if(s[i]=='R'):
        info.append(0)
    elif(s[i]=='G'):
        info.append(1)
    else:
        info.append(2)
        
#print(info)

for i in range(n):
    for j in range(i):
        if((3+info[i]-info[j])%3 == 1):
            num[i][0]+=1
        elif((3+info[i]-info[j])%3 == 2):
            num[i][1]+=1
    for j in range(n-1-i):
        if((3+info[i] - info[i+1+j])%3 == 1):
            num[i][2]+=1
        elif((3+info[i] - info[i+1+j])%3 == 2):
            num[i][3]+=1
    for j in range(min(i,n-1-i)):
        if(s[i-j-1]!=s[i+1+j] and s[i]!=s[i-j-1] and s[i]!=s[i+1+j]):
            num[i][4]+=1
            #print(j,i,i+1+j)
    #print(num[i])
    ans += num[i][0]*num[i][3] + num[i][1]*num[i][2] - num[i][4]

    
print(ans)




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

constexpr int INF = 1e9;
int s[200010];
int dp[200010];
int hsh[1 << 26];
int main() {
	string _s; cin >> _s;
	int n = _s.size();
	for(int i = 1; i <= n; ++i) {
		s[i] = s[i - 1] ^ (1 << (_s[i - 1] - 'a'));
		dp[i] = INF;
	}
	for(int i = 0; i < (1 << 26); ++i) {
		hsh[i] = INF;
	}
	hsh[0] = 0;
	for(int i = 1; i <= n; ++i) {
		dp[i] = min(dp[i], hsh[s[i]] + 1);
		hsh[s[i]] = min(hsh[s[i]], dp[i]);
		for(int j = 0; j < 26; ++j) {
			int pre = s[i] ^ (1 << j);
			dp[i] = min(dp[i], hsh[pre] + 1);
			hsh[s[i]] = min(hsh[s[i]], dp[i]);
		}
	}
	cout << dp[n] << '\n';
	return 0;
}

Measured memory_bytes: 267424
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

bool isKaibun(string const & s, int l, int r) {
    
    int len = r-l+1;
    int half = len/2;
    for(int i=0; i<half; ++i) if(s[l+i] != s[r-i]) return false;
    return true;
    
}

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

    string s; cin >> s;
    int n = s.size();
    n--;
    if(isKaibun(s, 0, n) && isKaibun(s, 0, (s.size()-1)/2-1) && isKaibun(s, (s.size()+3)/2-1, n)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 3 != 0 && i % 5 != 0) {
      ans += i;
    }
  }
  printf("%lld\n", ans);
}


Measured memory_bytes: 1732
import math


def kock(n, p1, p2):
    if n == 0:
        return

    s = ((p1[0]*2 + p2[0]) / 3, (p1[1]*2 + p2[1]) / 3)
    t = ((p1[0] + p2[0]*2) / 3, (p1[1] + p2[1]*2) / 3)

    rad60 = math.radians(60)
    sin60 = math.sin(rad60)
    cos60 = math.cos(rad60)

    ux = (t[0]-s[0])*cos60 - (t[1]-s[1])*sin60 + s[0]
    uy = (t[0]-s[0])*sin60 + (t[1]-s[1])*cos60 + s[1]
    u = (ux, uy)

    kock(n-1, p1, s)
    print(*s)
    kock(n-1, s, u)
    print(*u)
    kock(n-1, u, t)
    print(*t)
    kock(n-1, t, p2)


n = int(input())
p1 = (0, 0)
p2 = (100, 0)
print(*p1)
kock(n , p1, p2)
print(*p2)


Measured memory_bytes: 5792
#include <bits/stdc++.h>
#define rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a) ; i < (int)(b) ; i++)


#define SZ(x) ((int)(x).size())


typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
struct Vec{
    double x, y;
};

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;
}

template<class T>
T min(T a, T b)
{
    if (a < b) return a;
    return b;
}

template<class T>
T max(T a, T b)
{
    if (a > b) return a;
    return b;
}

using namespace std;

int main()
{
    int A, B;
    cin >> A >>B;
    double t = 25 * (double)A / 2;
    double f = 25 * (double)(A+1) / 2;
    repi(i, 10*B, 10*(B+1)){
        if (i >= t && i < f){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define se set<ll>
#define inf 10000000000000000

ll a[5005][5005];
pll prv[5005][5005];

int main()
{    
 

	#ifdef APNA_IO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 

string s,t;
cin>>s>>t;
ll n=s.size();
ll m=t.size();

    
    vector<char> ans;

    for(ll i=1;i<=n;i++)
    {
    	for(ll j=1;j<=m;j++)
    	{
    		if(s[i-1]==t[j-1])
    		{
    			a[i][j]=a[i-1][j-1]+1;
    			prv[i][j]={i-1,j-1};
    		}
    		else
    		{
    			a[i][j]=max(a[i-1][j],a[i][j-1]);
    			if(a[i-1][j]>a[i][j-1])
    				prv[i][j]={i-1,j};
    			else
    				prv[i][j]={i,j-1};
    		}
    	}
    }
  
  	ll x=n,y=m;
  	while(x && y)
  	{
  		if(prv[x][y].ff==x-1 && prv[x][y].ss==y-1)
  			ans.push_back(s[x-1]);
  		ll xx=prv[x][y].ff,yy=prv[x][y].ss;
  		x=xx;y=yy;
  	}
    reverse(ans.begin(), ans.end());
  
   for (auto i:ans) 
        cout << i;




}





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

int main()
{
    int N;
    cin>>N;
    vector<long double> A(N);
    for (long double &a: A)
        cin>>a;

    long long f[20][20] = {};
    for (long double a: A)
    {
        long long ai = (long long)(a*1000000000.+.5);
        int n2 = 0;
        int n5 = 0;
        while (ai%2==0)
            n2++,
            ai /= 2;
        n2 = min(n2, 19);
        while (ai%5==0)
            n5++,
            ai /= 5;
        n5 = min(n5, 19);
        f[n2][n5]++;
    }

    long long ans = 0;
    for (int n21=0; n21<20; n21++)
    for (int n22=0; n22<20; n22++)
    for (int n51=0; n51<20; n51++)
    for (int n52=0; n52<20; n52++)
        if (n21+n22>=18 && n51+n52>=18)
            if (n21==n22 && n51==n52)
                ans += f[n21][n51]*(f[n21][n51]-1);
            else
                ans += f[n21][n51]*f[n22][n52];
    ans /= 2;
    cout<<ans<<endl;
}


Measured memory_bytes: 5976
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,sum=0;
    cin>>n;
    vector<ll> a(n+2);
    a[0]=0;
    rep(i,n){
        cin>>a[i+1];
        sum+=abs(a[i+1]-a[i]);
    }
    a[n+1]=0; sum+=abs(a[n]);
    rep(i,n) cout<<sum-abs(a[i+1]-a[i])-abs(a[i+2]-a[i+1])+abs(a[i+2]-a[i])<<endl;
    return 0;
}

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

const ll INF = 1LL << 62;
const double PI = acos(-1);
const double eps = 1e-10;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3620
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N =  reader.nextInt();
		HashSet<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < N; i++) {
			set.add(reader.nextInt());
		}

		System.out.println(set.size());
		reader.close();
	}


}





Measured memory_bytes: 22868
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t[] = new int[n];
		int total = 0;
		for (int i = 0; i < n; i++) {
			int temp = scan.nextInt();
			total = total + temp;
			t[i] = temp;
		}
		int m = scan.nextInt();
		int p[] = new int[m];
		for (int i = 0; i < m; i++) {
			p[i] = total - t[scan.nextInt() - 1] + scan.nextInt();
		}
		for (int ans : p) {
			System.out.println(ans);
		}

	}
}

Measured memory_bytes: 23508
n=int(input())
l1=sorted(list(map(int,input().split())))
m=int(input())
l2=sorted(list(map(int,input().split())))
def nibutan(a,k):
    l=0
    r=len(a)
    while r>l:
        m=(r+l)//2
        if a[m]==k:
            return m
        elif k<a[m]:
            r=m
        else:
            l=m+1
    return -1
c=0
for i in l2:
    if nibutan(l1,i)!=-1:
        c+=1
print(c)


Measured memory_bytes: 16712
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;

ll dp[101][100001];

int main(){
  ll N,W;
  cin>>N>>W;
  ll w[N+1],v[N+1];
  for(int i=1;i<=N;i++)cin>>w[i]>>v[i];
  for(int i=0;i<=100;i++)for(int j=0;j<=100000;j++)dp[i][j]=(ll)1e12;
  for(int i=0;i<=N;i++)dp[i][0]=0;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=100001;j++){
      if(j-v[i]>=0)dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
      dp[i][j]=min(dp[i][j],dp[i-1][j]);
    }
  }
  ll ans=0;
  for(int i=0;i<=100000;i++){
    if(dp[N][i]<=W)ans=max(ans,(ll)i);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 82504
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int M = 1000000007;

int n, m;
bool c[N];
int a[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int x;
        cin >> x;
        c[x] = true;
    }
    a[0] = 1;
    for (int i = 1; i <= n; ++i)
    {
        if (c[i])
            continue;
        if (i - 2 >= 0)
            a[i] += a[i - 2];
        a[i] += a[i - 1];
        a[i] %= M;
    }
    cout << a[n] << endl;
    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rep2(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rev(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define rev2(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pll = pair<long long, long long>;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
long long TEN(int i) {return !i ? 1 : TEN(i -  1) * 10LL;}
template<class T, class U> 
bool chmin(T& a, const U& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T, class U> 
bool chmax(T& a, const U& b) {if (a < b) {a = b; return 1;} return 0;}
 
struct IoSetup {
  	IoSetup() {
    	cin.tie(nullptr);
    	ios::sync_with_stdio(false);
    	cout << fixed << setprecision(15);
  	}
} iosetup;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

int H, W, Ch, Cw, Dh, Dw;
V<string> S(1005);

const int INF = TEN(9);

#define int long long

signed main() {
	cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
	rep (i, H) cin >> S[i];

	Ch--, Cw--, Dw--, Dh--;

	VV<int> val(1005, V<int>(1005, INF));
	val[Ch][Cw] = 0;

	deque<P> Q;
	VV<bool> visited(1005, V<bool>(1005, false));
	Q.emplace_front(-1, -1);
	Q.emplace_front(Ch, Cw);
	int d = 0;
	while (Q.size() > 1) {
		
		auto [y, x] = Q.front();
		Q.pop_front();
		if (y == -1) {
			d++;
			Q.emplace_back(-1, -1);
			tie(y, x) = Q.front();
			Q.pop_front();
		}
		else {
			visited[y][x] = true;
		}
		rep2 (i, -2, 3) rep2 (j, -2, 3) {
			int ny = y + i;
			int nx = x + j;
			if ((!i && !j) || ny < 0 || ny >= H || nx < 0 || nx >= W || S[ny][nx] == '#' || visited[ny][nx]) {
				continue;
			}
			if (abs(i) + abs(j) <= 1) {
				chmin(val[ny][nx], d);
				Q.emplace_front(ny, nx);
			}
			else {
				chmin(val[ny][nx], d + 1);
				Q.emplace_back(ny, nx);
			}
		}
	}

	if (val[Dh][Dw] == INF) cout << -1 << endl;
	else cout << val[Dh][Dw] << endl;

	return 0;
}


Measured memory_bytes: 15972
#include<stdio.h>
 
#define SIZE 20000
 
int get_area(char* str, int len, int s, int t){
  int depth = 0, i;
  double ans = 0;
  for(i = s; i < t; i++){
    if(str[i] == '/'){
      ans += (double)depth-0.5;
      depth--;
    }
    if(str[i] == '\\'){
      ans += (double)depth+0.5;
      depth++;
    }
    if(str[i] == '_')ans += depth;
  }
  return ans;
}
 
int main(){
 
  char str[SIZE];
  int height[SIZE]={0}, vec[SIZE]={0};
  int len,h=0;
  int pos=0, cur=0, nex;
  int i,sum=0;

  scanf("%s",str);
  for(i=0;;i++){
    height[i] = h;
    if(str[i] == '/') h++;
    if(str[i] == '\\') h--;
    if(str[i] == '\0') break;
  }
  len=i;
 
  while(pos < len){
    while(str[pos] != '\\' && pos < len) pos++;
    nex = pos+1;
 
    while(nex <= len && height[nex] != height[pos]) nex++;
    if(nex <= len){
      vec[cur++] = get_area(str, len, pos, nex);
      pos = nex;
    }else{
      pos++;
    }
  }
   
  for(i = 0; i < cur; i++) sum += vec[i];
  printf("%d\n%d", sum, cur);
  for(i = 0; i < cur; i++) printf(" %d", vec[i]);
  printf("\n");
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  int d[n];
  REP(i,n){
    cin>>d[i];
  }
  sort(d,d+n,greater<int>());
  int dan=1;
  REP(i,n-1){
    if (d[i]>d[i+1])
    {
      /* code */
      dan++;
    }
    
  }
  cout<<dan<<endl;
  }

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

int N;
string s;

void input(void){
    cin >> N;
    cin >> s;
}

void solve(void){
    if (N % 2 == 1) {
        cout << "No" << endl;
        return;
    }


    int n = N / 2;
    if (s.substr(0, n) == s.substr(n,n)) {
        cout << "Yes" << endl;
        return;
    }
    else {
        cout << "No" << endl;
        return;
    }

}

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

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    string ss;
    cin>>ss;
    if(ss[0]=='7'||ss[1]=='7'||ss[2]=='7')
        puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 3628
n, q = (int(x) for x in input().split())
s = (input())
l = [0]*q
r = [0]*q
t = [0]*n
for i in range(q):
    l[i], r[i] = (int(x) for x in input().split())

for i in range(n-1):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)

for i in range(q):
    print(t[r[i]-1] - t[l[i]-1])

Measured memory_bytes: 15788
n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n-1):
  if ans > A[i+1]:
    print('No')
    exit()
  if A[i+1]-A[i] >= -1:
    ans = max(A[i+1]-1,A[i]-1,ans)
    if A[i+1] >= A[i] and A[i+1] > ans :
      A[i+1] -=1
  else:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 14224
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void AGC031B();

int main()
{
	AGC031B();
	fflush(stdout);
	return 0;
}

static void AGC031B()
{
	int N;
	getint(N);

	std::vector<int> ci(N + 1, 0);
	for (int i = 1; i <= N; i++) {
		getint(ci[i]);
	}

	std::map<int, int> lastPos;
	std::vector<LLONG> dp(N + 1, 0);
	dp[0] = 1;
	for (int i = 1; i <= N; i++) {
		dp[i] = dp[i - 1];
		int lpos = lastPos[ci[i]];
		if ((lpos > 0) && (lpos < (i - 1))) {
			dp[i] = (dp[i] + dp[lpos]) % MOD_NUM;
		}
		lastPos[ci[i]] = i;
	}
	printf("%lld\n", dp[N]);
}


Measured memory_bytes: 11904
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    
    int start,end;
    int ans = 0;
    for(int i=0;i<N;i++){
        cin >> start >> end;
        ans += end - start+1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 764
import sys
def input():
	return sys.stdin.readline()[:-1]
MOD = 998244353
n = int(input())
a = [int(input()) for _ in range(n)]
s = sum(a)
dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
dp[0][0] = 1
for i in range(n):
	for j in range(s+1):
		dp[i+1][j] += dp[i][j] * 2
		dp[i+1][j] %= MOD
		if j+a[i] <= s:
			dp[i+1][j+a[i]] += dp[i][j]
			dp[i+1][j+a[i]] %= MOD
#print(*dp, sep="\n")
res = 0
for j in range(s+1):
	if j*2 >= s:
		res += dp[n][j] * 3
		res %= MOD

if s%2 == 0:
	dpp = [0 for _ in range(s+1)]
	dpp[0] = 1
	for i in range(n):
		for j in range(s-a[i], -1, -1):
			dpp[j+a[i]] += dpp[j]
			dpp[j+a[i]] %= MOD
	res -= dpp[s//2] * 3

print((pow(3, n, MOD) - res) % MOD)

Measured memory_bytes: 308664
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        char c = sc.next().charAt(0);
                        if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
                                System.out.println("vowel");
                        } else {
                                System.out.println("consonant");
                        }
                }
        }
}

Measured memory_bytes: 9676
n = int(input())
Edges = [list(map(int,input().split())) for i in range(n-1)]
for edge in Edges:
    edge[0] -= 1
    edge[1] -= 1
    edge[2] %= 2

Graph = [[] for i in range(n)]
for edge in Edges:
    Graph[edge[0]].append([edge[1],edge[2]])
    Graph[edge[1]].append([edge[0],edge[2]])

Color = [-1 for i in range(n)]
Color[0] = 0

stack = [0]

while stack:
    node = stack.pop()
    for adj in Graph[node]:
        if Color[adj[0]] == -1:
            if adj[1] == 0:
                Color[adj[0]] = Color[node]
            elif Color[node] == 0:
                Color[adj[0]] = 1
            else:
                Color[adj[0]] = 0
            stack.append(adj[0])

for color in Color:
    print(color)


Measured memory_bytes: 59288
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
using namespace std;

struct cdnt{double x;double y;}; 
int n;
cdnt koch(cdnt p,cdnt q,int n)
{
	cdnt pp;pp.x=(p.x*2+q.x)/3;pp.y=(p.y*2+q.y)/3;
	cdnt qq;qq.x=(p.x+q.x*2)/3;qq.y=(p.y+q.y*2)/3;
	double vx=(q.x-p.x)/3;
	double vy=(q.y-p.y)/3;
	cdnt rr;rr.x=pp.x+vx/2-sqrt(3)*vy/2;rr.y=pp.y+sqrt(3)*vx/2+vy/2;
	if(n==0)
	{
		cout<<p.x<<" "<<p.y<<endl<<pp.x<<" "<<pp.y<<endl<<rr.x<<" "<<rr.y<<endl<<qq.x<<" "<<qq.y<<endl;
	}
	else
	{
		koch(p,pp,n-1);
		koch(pp,rr,n-1);
		koch(rr,qq,n-1);
		koch(qq,q,n-1);
	}
}

int main()
{
	cin>>n;n--;
	cdnt p;p.x=0;p.y=0;
	cdnt q;q.x=100;q.y=0;
	if(n+1)koch(p,q,n);
	else cout<<"0 0"<<endl;
	cout<<"100 0"<<endl;
	return 0;
}

Measured memory_bytes: 3240
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a+b >= c)puts("Yes");
	else puts("No");
	return 0;
}


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

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

void solve(char n, double p[5][5] ){
	for( ; n>0 ; n-- ){
		double tmp[5][5] = {0};
		
		for(int y=1 ; y <= 3 ; y++ ){
			for(int x=1 ; x <= 3 ; x++ ){
				if( p[y][x] > 0.0 ){
					for(int i=0 ; i<4 ; i++ ){
						int mx = x + dx[i];
						int my = y + dy[i];
						if( room[my][mx] == 0 ){
							tmp[my][mx] += p[y][x]/4.0;
						}else{
							tmp[y][x] += p[y][x]/4.0;
						}
					}
				}
			}
		}
		for(int y=1 ; y <= 3 ; y++ ){
			for(int x=1 ; x <= 3 ; x++ ){
				p[y][x] = tmp[y][x];
			}
		}
	}
}

int main(){
	char fx[256] = {0}, fy[256] = {0};
	int n;
	char s, t, b;
	
	for(int i=0;i<9;i++){
		fx[i+'A'] = i%3+1;
		fy[i+'A'] = i/3+1;
	}
	
	while( scanf("%d", &n) , n ){
		scanf(" %c %c %c ", &s, &t, &b);
		double p[5][5] = {0};
		for(int i=1 ; i<=3 ; i++){
			for(int j=1 ; j<=3 ; j++){
				room[i][j] = 0;
			}
		}
				
		room[ fy[b] ][ fx[b] ] = 1;
		p[ fy[s] ][ fx[s] ] = 1.0;
		
		solve( n , p );
		
		printf("%.9f\n" , p[ fy[t] ][ fx[t] ] );
	}
}

Measured memory_bytes: 0
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

LL n, k;
const LL MOD = 1000000007;
LL combi(LL N_, LL C_) {
	const int NUM_ = 400001;
	static LL fact[NUM_ + 1], factr[NUM_ + 1], inv[NUM_ + 1];
	if (fact[0] == 0) {
		inv[1] = fact[0] = factr[0] = 1;
		for (int i = 2; i <= NUM_; ++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
		for (int i = 1; i <= NUM_; ++i) fact[i] = fact[i - 1] * i%MOD, factr[i] = factr[i - 1] * inv[i] % MOD;
	}
	if (C_<0 || C_>N_) return 0;
	return factr[C_] * fact[N_] % MOD*factr[N_ - C_] % MOD;
}

LL hcomb(int P_, int Q_) { return (P_ == 0 && Q_ == 0) ? 1 : combi(P_ + Q_ - 1, Q_); }

LL modpow(LL a, LL n = MOD - 2) {
	LL r = 1;
	while (n) r = r*((n % 2) ? a : 1) % MOD, a = a*a%MOD, n >>= 1;
	return r;
}

long long power(long long n, long long k, long long m) {
	if (k == 0) {
		return 1;
	}
	else if (k % 2 == 1) {
		return power(n, k - 1, m)*n%m;
	}
	else {
		long long t = power(n, k / 2, m);
		return t*t%m;
	}
}

int main() {
	cin >> n >> k;
	LL ans = 0;
	for (int i = 1; i <= k; i++) {
		if ((k - i) % 2) {
			ans -= combi(k, i)*power(i, n, MOD) % MOD;
		}
		else {
			ans += combi(k, i)*power(i, n, MOD) % MOD;
		}
		ans = (ans + MOD) % MOD;
	}
	cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 12464
#include <cstdio>
#include <iostream>
#include <sstream>

#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

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

int main() { 
  int n;
  cin >> n;
  string s;
  cin >> s;
  for(auto&& c:s){
    c = (c + n - 'A') % 26 + 'A'; 
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    typedef long long LL;
     
    int main(){
    	LL x, k;
    	cin >> x >> k;
    	LL r[k];
    	for(int i = 0; i < k; i++) cin >> r[i];
    	LL q;
    	cin >> q;
    	vector<LL> t;
    	vector<LL> a;
    	for(int i = 0; i < q; i++){
    		LL p, r;
    		cin >> p >> r;
    		t.push_back(p);
    		a.push_back(r);
    	}
     
    	LL minv = 0;
    	LL maxv = x;
    	LL dx = 0;
    	LL sgn = -1;
     
    	LL s1 = 0;
    	LL s2 = 0;
    	LL lastt = 0;
    	while(s2 < t.size()){
    		if(s1 == k || t[s2] < r[s1]){
    			// answer
    			LL f = max(minv, min(maxv, a[s2] + dx));
    			f += sgn*(t[s2] - lastt);
    			f = max(0LL, min(x, f));
    			printf("%lld\n",f);
    			s2++;
    		} else {
    			LL diff = r[s1] - lastt;
    			diff *= sgn;
    			minv += diff;
    			maxv += diff;
    			dx += diff;
    			minv = max(0LL, min(x, minv));
    			maxv = max(0LL, min(x, maxv));
    			sgn *= -1;
    			lastt = r[s1];
    			s1++;
    			//cout << minv << " " << maxv << " " << dx << " " << sgn << endl;
    		}
    	}
    }

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define lli long long int



int main () {
	vector<string> a,b;
	int aa,bb;

	cin >> aa >> bb;

	for(int i=0;i<aa;i++){
		string j;
		cin >> j;
		a.push_back(j);
	}

	for(int i=0;i<bb;i++){
		string j;
		cin >> j;
		b.push_back(j);
	}



	for(int i=0;i<aa-bb+1;i++){
		for(int j=0;j<aa-bb+1;j++){
			int k=0;
			for(int m=0;m<bb;m++){
				for(int n=0;n<bb;n++){
					if(a[i+m][j+n]!=b[m][n]){
						k = -1;
						break;
					}
				}
				if(k == -1){
					break;
				}
			}
			if(k==0){
				cout << "Yes" << endl;
				return 0;
			}	
		}
	}

	cout << "No" << endl;

    return 0;
}




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

const long long INF=1e18l+5;
int main(){
	int n,w;
	cin>>n>>w;
  vector<int>weights(n);
  vector<int>values(n);
  int sum_ans=0;
  for(int i=0;i<n;i++) {
    cin>>weights[i]>>values[i];
    sum_ans+=values[i];
  }
  vector<vector<long long>>dp(n+1,vector<long long> (sum_ans+1,INF));
  for(int i=0;i<n+1;i++) dp[i][0]=0;
  for(int i=1;i<n+1;i++){
    for(int j=1;j<sum_ans+1;j++){
      dp[i][j]=dp[i-1][j];
      if (j-values[i-1]>=0){
        dp[i][j]=min(dp[i][j],dp[i-1][j-values[i-1]]+weights[i-1]);
      }
    }
  }
  int ans=0;
  for(int i=0;i<=sum_ans;i++){
    if(dp[n][i]<=w) ans=max(ans,i);
  }
  cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 83040