akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int N,SS[400010],NN=1e9;
int hyouka(int a,int b){return a<b?a:b;}
void ssset(int n,int *d){
	int i;
	for(N=1;N<n;N*=2);
	for(i=0;i<n;i++)SS[i+N]=d[i];
	for(   ;i<N;i++)SS[i+N]=NN;
	for(i=N-1;i;i--)SS[i]=hyouka(SS[i*2],SS[i*2+1]);
}
//[l,r)?????????x??????????????????i??????????????????[a,b)
//ssud(l,r,x,1,0,N);
void ssud(int l,int r,int x,int i,int a,int b){
	int t;
	if(b<=l||r<=a)return;
	if(l<=a&&b<=r){
		SS[i]+=x;
		return;
	}
	ssud(l,r,x,i*2  ,a,(a+b)/2);
	ssud(l,r,x,i*2+1,(a+b)/2,b);
	t=hyouka(SS[i*2],SS[i*2+1]);
	SS[i    ]+=t;
	SS[i*2  ]-=t;
	SS[i*2+1]-=t;
	return;
}
//[l,r)????????????????????????i??????????????????[a,b)
//ssout(l,r,1,0,N);
int ssout(int l,int r,int i,int a,int b){
	if(r<=a||b<=l)return 0;
	if(l<=a&&b<=r)return SS[i];
	return ssout(l,r,i*2,a,(a+b)/2)+ssout(l,r,i*2+1,(a+b)/2,b)+SS[i];
}
int main(){
	int n,m,d[100010],i,a,b,c,q;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++)d[i]=0;
	ssset(n,d);
	while(m--){
		//for(i=1;i<N*2;i++)printf("%d %d\n",i,SS[i]);printf("\n");fflush(stdout);
		scanf("%d",&q);
		if(q){
			scanf("%d",&a);
			printf("%d\n",ssout(a-1,a,1,0,N));
		}
		else{
			scanf("%d %d %d",&a,&b,&c);
			ssud(a-1,b,c,1,0,N);
		}
	}
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a<b && b<c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3096
fun main(args: Array<String>) {
    val (W, H, x, y, r) = readLine()!!.split(" ").map(String::toInt)

    if ((x - r) < 0 || (x + r) > W) {
        println("No")
    } else if ((y - r) < 0 || (y + r) > H) {
        println("No")
    } else {
        println("Yes")
    }
}


Measured memory_bytes: 32076
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define F first
#define S second
#define fast std::ios_base::sync_with_stdio(false)
#define mod 1000000007
#define pi 3.14159265
int main() {
    fast;
    lli n,d;
    cin>>n>>d;
    lli a[n],b[n],i,count=0;
    fr(i,n)
    {
        cin>>a[i]>>b[i];
        if(a[i]*a[i]+b[i]*b[i]>d*d)
            count++;
    }
    cout<<n-count;
    
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    int a[4];
    for (int i = 0; i < 4; ++i) {
        a[i] = 0;
    }
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        if (s == "AC") {
            a[0]++;
        } else if (s == "WA") {
            a[1]++;
        } else if (s == "TLE") {
            a[2]++;
        } else if (s == "RE") {
            a[3]++;
        }
    }
    cout << "AC x " << a[0] << endl;
    cout << "WA x " << a[1] << endl;
    cout << "TLE x " << a[2] << endl;
    cout << "RE x " << a[3] << endl;

}


Measured memory_bytes: 3628
let n = Int(readLine()!)!

let m = n % 10

let hon = [2, 4, 5, 7, 9]
let pon = [0, 1, 6, 8]

if hon.contains(m) {
  print("hon")
} else if pon.contains(m) {
  print("pon")
} else {
  print("bon")
}


Measured memory_bytes: 7652
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include <unordered_map>
//#include"testlib.h"
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define sz(s)    (int)(s.size())
#define PI acos(-1)
#define EPS 1e-8
#define watch(x) cout << (#x)<<" = "<<x<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	//freopen("street.in", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	vii v1{ {599, 8}, {799, 7}, {999, 6}, {1199, 5}, {1399, 4}, {1599, 3}, {1799, 2}, {1999, 1} };
	int n; cin >> n;
	for (auto& it : v1) {
		if (n <= it.first)
			RT(it.second << endl);
	}
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[50],dp2[50],b[50];
signed main(){
  int N,K;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    int A;
    cin>>A;
    for(int i=0;A>0;A/=2,i++)b[i]+=A%2;
  }
  for(int i=48;i>=0;i--){
    if((K>>i)&1){
      dp2[i]=dp2[i+1]+(N-b[i])*(1LL<<i);
      if(dp[i+1])dp[i]=max(dp[i+1]+max(b[i],N-b[i])*(1LL<<i),dp2[i+1]+b[i]*(1LL<<i));
      else dp[i]=dp2[i+1]+b[i]*(1LL<<i);
    }else{
      dp2[i]=dp2[i+1]+b[i]*(1LL<<i);
      if(dp[i+1])dp[i]=dp[i+1]+max(b[i],N-b[i])*(1LL<<i);
    }
  }
  cout<<max(dp[0],dp2[0])<<endl;
}

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

double pi = 3.14159265359;

int main(void) {
    cout << fixed;
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double theta = abs((pi*(60*h-11*m))/360.0);
    if (theta > pi) {
        theta = 2*pi-theta;
    }
    double ans = sqrt(a*a+b*b-2*a*b*cos(theta));
    cout << setprecision(20) << ans << endl;
    return 0;
}

Measured memory_bytes: 4188
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	lint a, b, c;
	cin >> a >> b >> c;

	if (c - a - b <= 0)
	{
		cout << "No" << endl;
		return;
	}

	if (4 * a * b < (c - a - b) * (c - a - b))
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
n = int(input())

def makediv(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

k = makediv(n)

ans = 0
for i in k:
	targ = i-1
	if targ != 0:
		if n // targ == n % targ:
			ans += targ

print(ans)

Measured memory_bytes: 9376
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
typedef long long ll;
const int MYINF = 1e9+7;

static char save_suit[64];
static int  save_rank[64];
static int  save_seq[64];
static char suit[64];
static int  rank[64];
static int  seq[64];
static int N;

void swap(int i, int j) {
	int tmp;
	tmp = suit[i];
	suit[i] = suit[j];
	suit[j] = tmp;

	tmp = rank[i];
	rank[i] = rank[j];
	rank[j] = tmp;

	tmp = seq[i];
	seq[i] = seq[j];
	seq[j] = tmp;
}

void bubble_sort() {
	int i, j;
	for (i = 0; i < N; i++) {
		for (j = N - 1; j > i; j--) {
			if (rank[j] < rank[j-1]) swap(j, j-1);
		}
	}
}

void selection_sort() {
	int i, j, mini;
	for (i = 0; i < N; i++) {
		mini = i;
		for (j = i; j < N; j++) {
			if (rank[j] < rank[mini]) mini = j;
		}
		if (i != mini) swap(i, mini);
	}
}

int is_stable() {
	int i, prev;
	prev = seq[0];
	for (i = 1; i < N; i++) {
		if (rank[i] > rank[i-1]) {
			prev = seq[i];
			continue;
		}
		if (seq[i] < seq[i-1]) return 0;
	}
	return 1;
}

void reset() {
	int i;
	for (i = 0; i < N; i++) {
		suit[i] = save_suit[i];
		rank[i] = save_rank[i];
		seq[i] = save_seq[i];
	}
}

void print_cards() {
	int i;
	const char *sp = "";
	for (i = 0; i < N; i++) {
		printf("%s%c%d", sp, suit[i], rank[i]);
		sp = " ";
	}
	putchar('\n');
}

int main(int argc, char **argv)
{
	int i;
	char buf[16];

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		scanf("%s", buf);
		save_suit[i] = buf[0];
		save_rank[i] = buf[1] - '0';
		save_seq[i] = i;
	}

	reset();
	bubble_sort();
	print_cards();
	if (is_stable()) puts("Stable");
	else puts("Not stable");

	reset();
	selection_sort();
	print_cards();
	if (is_stable()) puts("Stable");
	else puts("Not stable");

	return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define ll long long
#define f   first
#define s   second
#define pb          push_back
#define mod         1000000007
#define hell        998244353
#define inf         1000000000000000000LL
using namespace std;
ll n,k,m;
//ll dp[15][1005];
void solve()
{   
    cin>>n;
    vector<ll> a(n),b(n),c(n);
    for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
    ll dp[n][3];
    memset(dp,0,sizeof(dp));
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
        {
            dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
            dp[i][1]=b[i]+max(dp[i-1][2],dp[i-1][0]);
            dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
        }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

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

}

Measured memory_bytes: 4992
x,k,d = map(int,input().split(' '))
a = abs(x) % d 
b = -(a - d)
if abs(x) // d > k:
    ans = abs(x) - k * d
else:
    if a == b:
        ans = a
    else:
        if a < b:
            n1 = a
            n2 = b
        if b < a:
            n1 = b
            n2 = a
        if k % 2 == (abs(x) // d) % 2:
            ans = a
        else:
            ans = b
print(ans)

Measured memory_bytes: 9132
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}


int n;
vector<int> a;
void input(){
    cin>>n;
    a.resize(n);
    rep(i,n){
        cin>>a[i];
    }
}
void src(){
    double mean = accumulate(a.begin(),a.end(),0.0)/a.size();
    cout<<distance(a.begin(),min_element(a.begin(),a.end(),[&](auto a,auto b){return fabs(a-mean)<fabs(b-mean);}));
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
int org_grid[30][30];
int grid[30][30];
int tmp_col[30];

void show(int H, int W){
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << grid[i][j];
    }
    cout << endl;
  }
  return;
}


void slide(int H, int W){
  for(int i = 0; i < W; i++){
    int real_height = 0;
    for(int j = 0; j < H; j++){
      if(grid[j][i] != 0){
        tmp_col[real_height] = grid[j][i];
        real_height ++;
      }
    }
    for(int j = 0; j < H; j++){
      grid[j][i] = 0;
    }
    for(int j = 0; j < real_height; j++){
      grid[j][i] = tmp_col[j];
    }
  }
}

void update(int H, int W, int K, int &score, int coeff, bool &updated){
  for(int i = 0; i < H; i++){
    int range_begin = -1;
    int range_color = -1;
    for(int j = 0; j < W; j++){
      if(range_color != grid[i][j]){
        if(j - range_begin >= K && range_color > 0){
          updated = true;
          for(int k = range_begin; k < j; k++){
            score += coeff * grid[i][k];
            grid[i][k] = 0;
          }
        }
        range_begin = j;
        range_color = grid[i][j];
      }
    }
    if(W - range_begin >= K && range_color > 0){
      updated = true;
      for(int k = range_begin; k < W; k++){
        score += coeff * grid[i][k];
        grid[i][k] = 0;
      }
    }
  }
}

int main(void){
  int H;
  int W;
  int K;
  cin >> H >> W >> K;
  for(int i = 0; i < H; i++){
    string tmp;
    cin >> tmp;
    for(int j = 0; j < W; j++){
      org_grid[H - i - 1][j] = (int) (tmp[j] - '0');
    }
  }

  int ans = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      for(int k = 0; k < H; k++){
        for(int l = 0; l < W; l++){
          grid[k][l] = org_grid[k][l];
        }
      }
      grid[i][j] = 0;
      int cur_score = 0;
      int cur_coeff = 1;
      while(true){
        bool updated = false;
        slide(H, W);
        update(H, W, K, cur_score, cur_coeff, updated);
        if(!updated){
          break;
        }
        cur_coeff *= 2;
      }
      ans = max(ans, cur_score);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
typedef long long ll;
//#include <algorithm>
using namespace std;

int main() {

  int dish[5];
  for(int i = 0; i < 5; i++){
    cin >> dish[i];
  }

  int tendish[5];
  int maxamari = 0;
  int maxamariIndex = -1;

  for(int i = 0; i < 5; i++){
    int tenmod = dish[i] / 10;
    if(dish[i] % 10 != 0){
      tendish[i] = (tenmod + 1) * 10;
    }else{
      tendish[i] = dish[i];
    }

    if(tendish[i] - dish[i] > maxamari){
      maxamari = tendish[i] - dish[i];
      maxamariIndex = i;
    }
  }

  int value = 0;
  for(int i = 0; i < 5; i++){
    if(i == maxamariIndex){
      value += dish[i];
    }else{
      value += tendish[i];
    }
  }

  cout << value << endl;


}


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


#define ll long long 
ll mincost(ll n,ll h[],ll k)
{
	ll dp[n+1],a,b,j;
	
	dp[1]=0;
		
	for(ll step=2;step<=n;step++)
	{

	   dp[step]=INT_MAX;
	   for(j=1;j<=k;j++)
	   {
	   	if(step-j>0)
	   	{
	   		dp[step]=min(dp[step],abs(h[step]-h[step-j])+dp[step-j]);
	   	}
	   	 else
	   	 {
	   	 	break;
	   	 }
	   }
	   
	}
	return(dp[n]);
}
int main()
{
    
    
    ll n,k;
    cin>>n>>k;
    ll h[n+1],i;

    for(i=1;i<=n;i++)
    {
    	cin>>h[i];
    }
    cout<<mincost(n,h,k)<<endl;
	
}

Measured memory_bytes: 1792
s = list(input().replace("\r", "").replace("\n", ""))
n = int(input())
for i in range(n):
    li = list(input().split())
    if li[0] == "print":
        a = int(li[1])
        b = int(li[2])
        print("".join(s[a:b+1]))
    elif li[0] == "replace":
        a = int(li[1])
        b = int(li[2])
        p = list(li[3])
        s[a:b+1] = p
    elif li[0] == "reverse":
        a = int(li[1])
        b = int(li[2])
        p = s[a:b+1]
        p.reverse()
        s[a:b+1] = p



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


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; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;



int main() {
    int h,w; cin >> h >> w;
    char field[h][w];
    rep(i,h){rep(j,w){cin >> field[i][j];}}


    int dp[1010][1010];


    dp[0][0]=1;

    /*
    rep(i,w){
        if(field[0][i]=='#'){
            for(int j=i; j<w; j++) dp[0][j]=0;
            break;
        }
        else dp[0][i]=1;
    }
    rep(i,h){
        if(field[i][0]=='#'){
            for(int j=i; j<h; j++) dp[j][0]=0;
            break;
        }
        else dp[i][0]=1;
    }
    */


    /*
    rep(i,h-1){
        rep(j,w-1){
            if(field[i+1][j]=='#') dp[i+1][j]=0;
            if(field[i][j+1]=='#') dp[i][j+1]=0;
            dp[i+1][j+1]=(dp[i+1][j]%MOD+dp[i][j+1]%MOD)%MOD;
        }
    }
    */
   rep(i,h){
       rep(j,w){
           if(field[i+1][j]!='#') dp[i+1][j]+=dp[i][j]%MOD;
           if(field[i][j+1]!='#') dp[i][j+1]+=dp[i][j]%MOD;
           dp[i+1][j]%=MOD; dp[i][j+1]%=MOD;
       }
   }

    COUT(dp[h-1][w-1]);
    //COUT(dp[h][w]);
    cout << endl;

    //rep(i,h){rep(j,w){cout << dp[i][j];}cout << endl;}

}

Measured memory_bytes: 5120
#include <stdio.h>
#include <math.h>
#define N 10000
int isPrime();
int main(){
  int i,n,x[N],count = 0,y;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
  }
for(i=0;i<n;i++){
  y = x[i];
  if(isPrime(y) == 1) count++;
}
printf("%d\n",count);
return 0;
    }

int isPrime(int x){
  int i,re=1;
  if(x == 2)  re=1;
  else if(x<2 || x%2 == 0) re =  0;

else{
for(i=3;i<=sqrt(x);i+=2){
    if(x%i == 0) re=0;
  }
}
return re;
}


Measured memory_bytes: 2140
a, b = map(int, input().split())
judge = ""
if a == b:
    judge = "Draw"
elif a == 1:
    judge = "Alice"
elif b == 1:
    judge = "Bob"
elif a < b:
    judge = "Bob"
elif a > b:
    judge = "Alice"
else:
    judge = "Draw"

print(judge)

Measured memory_bytes: 3060
import java.util.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int price, money, times;
      	price = Integer.parseInt(sc.next());
      	money = Integer.parseInt(sc.next());
      	times = Integer.parseInt(sc.next());
      	if(price * times <= money) System.out.println(times);
      	else System.out.println(money / price);
    }
}

Measured memory_bytes: 21716
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    let n = s.len() + 1;
    let mut span = vec![2i64];
    for i in 1..s.len() {
        if s[i] == s[i - 1] {
            let last_idx = span.len() - 1;
            span[last_idx] += 1;
        } else {
            span.push(2);
        }
    }

    let mut accum = vec![0; n + 1];
    for i in 1..n + 1 {
        accum[i] = accum[i - 1] + i as i64;
    }

    let mut ans = 0i64;
    for &num in span.iter() {
        ans += accum[num as usize - 2];
    }
    for i in 1..span.len() {
        if i % 2 == 1 && s[0] == '<' {
            ans += max(span[i], span[i - 1]) - 1;
        } else if i % 2 == 0 && s[0] == '>' {
            ans += max(span[i], span[i - 1]) - 1;
        }
    }
    if s[s.len() - 1] == '<' {
        ans += span[span.len() - 1] - 1;
    }
    if s[0] == '>' {
        ans += span[0] - 1;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 13556
// NK
#include <bits/stdc++.h>
using namespace std;
#define ii pair<int,int>
#define ll long long
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define psf push_front
#define pof pop_front
#define mkp make_pair
#define mkt make_tuple
#define all(x) x.begin(), x.end()

//string maxi="3234566667";
vector<string> gen;

string aux="";

void dfs(char bef, int len){
	aux.pb(bef);
	if (len+1>10) return;
	
	gen.pb(aux);
		
	for (char i=bef-1; i<=bef+1; i++){
		if (bef=='0' and i==bef-1) continue;
		if (bef=='9' and i==bef+1) continue;
		dfs(i, len+1);
		aux.pob();
	}
	
}

int main(){
	ios::sync_with_stdio(false), cin.tie(nullptr);
	for (char i='1'; i<='9'; i++){
		dfs(i,0);
		aux.pob();
	}
	//sort(all(gen));
	//int k; cin>>k;
	//cout<<gen[k];
	vll ans;
	int gs=gen.size();
	for (int i=0; i<gs; i++) ans.eb(stol(gen[i]));
	sort(all(ans));
	//for (int i=0; i<20; i++) cout<<ans[i]<<' ';
	int k; cin>>k;
	cout<<ans[k-1]<<endl;
	
	return 0;
}


Measured memory_bytes: 15088
S = list(input())
isConditionA = S[0] == 'A'
C_count = S[2:len(S) - 1].count('C')
memo = -1
for i in range(0, len(S)):
    if S[i] == 'C' and 1 < i < len(S) - 1:
        memo = i
if memo != -1:
    S.pop(memo)

S.pop(0)
#print(S)
#print(isConditionA,C_count,''.join(S).islower())
if isConditionA and C_count == 1 and ''.join(S).islower():
    print('AC')
else:
    print('WA')

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

namespace ABC086A_Product
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int a = input[0];
            int b = input[1];
            if (a * b % 2 == 0)
            {
                Console.WriteLine("Even");
            }
            else
            {
                Console.WriteLine("Odd");
            }
        }
    }
}


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

#define pow(n) (n)*(n)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  string S;    // input
  char ans;    // output

  int  i;    // subscript
  char char_cnt;
  int  place;


  /* Input, Array_Proclamation */
  cin >> S;
  set<char> alp;


  /* Initialize */
  ans   = ' ';
  place = 0;


  /* Calculation */
  // sort( all(S) ); // sortの有無で計算量が少し変わる
  for(i=0; i<S.size(); i++)
  {
    alp.insert( S.at(i) );
  }

  for(char_cnt = 'a';  char_cnt <= 'z';  char_cnt++)
  {

    for(i=0; i<alp.size(); i++)
    {
      if( !(alp.count(char_cnt)) )
      {
        ans = char_cnt;
        goto ENDLOOP;
      }
    }

  }
  ENDLOOP:
  

  /* Output */
  if(ans != ' ')
  {
    cout << ans << endl;
  }
  else
  {
    cout << "None" << endl;
  }
  


  return 0;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const long double PI = 3.14159265359;

int main() {
    
    long double a,b,h,m;
    cin >> a >> b >> h >> m;

    long double ans = sqrt(a*a+b*b-2*a*b*cos(PI*(abs((30*h+m/2)-(6*m))/180)));
    printf("%.10Lf",ans);


 return 0;
}


Measured memory_bytes: 4156
import sys
sys.setrecursionlimit(10 ** 9)

N, K = map(int, input().split())
V = list(map(int, input().split()))
V2 = V * 2
answer = 0
for i in range(1, min(N, K)+1): # iは宝石を取り出す個数
    for j in range(0, min(i, K-i)+1): # jは何個の宝石を手離すか
        for k in range(max(0, N-i), N+1): # V2の中で何番目から取り出すか
            use = V2[k:k+i]
            use.sort()
            s = sum(use[j:])
            if s > answer:
                answer = s

print(answer)


Measured memory_bytes: 3064
# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int, input().split()))
# limit=10**18

# if 0 in a:
#     print(0)
#     exit()

ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(n):
  ans *= a[i]
  if ans > 10 ** 18:
  # if a[i] == 0:
  #   break
  # elif (ans*a[i]) > limit:
    ans = -1
    break

for i in range(n):
  if a[i] == 0:
      ans = 0

# if ans > limit:
#   print(-1)
# else:
print(ans)


Measured memory_bytes: 21628
/*https://atcoder.jp/contests/agc014/tasks/agc014_a*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	long long a, b, c, d, e, f, count = 0;
	cin >> a >> b >> c;
	int flag = 0;
	if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0 )
	{
		cout << count;
		return 0;
	}
	if (a == b && a == c)
	{
		cout << "-1";
		return 0;
	}
	do {
		count++;
		d = b / 2 + c / 2;
		e = a / 2 + c / 2;
		f = a / 2 + b / 2;
		a = d, b = e, c = f;
		if (a % 2 != 0 || b % 2 != 0 || c % 2 != 0 )
			flag = 1;
		// cout << a << " " << b << " " << c << "->" << flag << endl;

	} while (flag == 0);
	cout << count;
}

Measured memory_bytes: 3580
import Data.Array.IO
import Control.Monad

main = do
  s <- getLine
  let [n,m] = map (read::String->Int) . words $ s
  v <- newArray (0,n) [0]::IO (IOArray Int [Int])

  forM_ [0..n-1] $ \i -> do
    s <- getLine
    writeArray v i $ map (read::String->Int) . words $ s

  s <- getContents
  let list = map (read::String->Int) $ lines $ s

  forM_ [0..n-1] $ \i -> do
    a <- readArray v i
    putStrLn . show . sum $ zipWith (*) a list

Measured memory_bytes: 7580
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>

using namespace std;
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

long long n, q;
vector<vector<long long>> tree, lazy;

void push(long long l, long long r, long long ind) {
	for (auto type : {0, 1}) {
		if (lazy[ind][type] != n) {
			tree[ind][type] = min(tree[ind][type], lazy[ind][type]);
			if (l != r) {
				lazy[2 * ind][type] = min(lazy[2 * ind][type], lazy[ind][type]);
				lazy[2 * ind + 1][type] = min(lazy[2 * ind + 1][type], lazy[ind][type]);
			}
			else {
				;
			}
			lazy[ind][type] = n;
		}
	}
}

void pull(long long ind) {
	for (auto type : {0, 1}) {
		tree[ind][type] = min(tree[2 * ind][type], tree[2 * ind + 1][type]);
	}
}

void update(long long ul, long long ur, long long uval, long long l, long long r, long long ind, long long type) {
	push(l, r, ind);
	if (ur < l or r < ul) return;

	if (ul <= l and r <= ur) {
		lazy[ind][type] = uval;
		push(l, r, ind);
		return;
	}

	long long mid((l + r) >> 1);
	update(ul, ur, uval, l, mid, 2 * ind, type);
	update(ul, ur, uval, mid + 1, r, 2 * ind + 1, type);

	pull(ind);
}

long long query(long long qi, long long l, long long r, long long ind, long long type) {
	push(l, r, ind);
	if (l == r) {
		if (l == qi) return tree[ind][type];
		return INT_MAX;
	}

	long long mid((l + r) >> 1);
	if (qi <= mid) return query(qi, l, mid, 2 * ind, type);
	else return query(qi, mid + 1, r, 2 * ind + 1, type);
}

int main() {

	cin >> n >> q;

	tree.resize(4 * n + 1, vector<long long>(2, n));
	lazy.resize(4 * n + 1, vector<long long>(2, n));

	long long ans = (n - 2) * (n - 2);
	while (q--) {
		long long qt, x; cin >> qt >> x;
		if (qt == 1) {
			//place at (1,x)
			long long j = query(x, 1, n, 1, 1);
			ans -= (j - 2);
			update(2, j, x, 1, n, 1, 0);
		}
		else {
			//place at (x,1);
			long long j = query(x, 1, n, 1, 0);
			ans -= (j - 2);
			update(2, j, x, 1, n, 1, 1);
		}
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 90820
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, k int
	var s string
	fmt.Scan(&n, &k, &s)
	fmt.Printf("%s%s%s", s[0:k-1], strings.ToLower(s[k-1:k]), s[k:n])
}


Measured memory_bytes: 1848
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >> s;
    int ans = 700;
    if (s[0] == 'o') ans += 100;
    if (s[1] == 'o') ans += 100;
    if (s[2] == 'o') ans += 100;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long ll;

int main() {
	int w, h;
	while ( cin >> h >> w, h || w ) {

		for (int y = 0; y < h; ++y) {
			for (int x = 0; x < w; ++x) {
				if ((x + y) % 2) {
					cout << '.';
				}
				else {
					cout << '#';
				}
			}
			cout << endl;
		}
		cout << endl;
	}
}


Measured memory_bytes: 3060
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(read())

def output(A):
    print('\n'.join(''.join(row) for row in A))

a = 'a'; b = 'b'; c = 'c'; d = 'd'; e = 'e'; f = 'f'; g = 'g'; h = 'h'; x = '.'

A3 = np.array([
        [a,a,x],
        [x,x,a],
        [x,x,a]
],dtype='U1')

A4 = np.array([
    [a,a,c,d],
    [b,b,c,d],
    [e,f,g,g],
    [e,f,h,h]
],dtype='U1')

A5 = np.array([
    [a,a,c,a,a],
    [b,b,c,x,c],
    [x,a,b,b,c],
    [b,a,x,x,a],
    [b,x,b,b,a]
],dtype='U1')

A7 = np.array([
    [a,b,a,x,x,x,x],
    [a,b,a,x,x,x,x],
    [c,c,b,a,a,x,x],
    [x,a,b,c,c,x,x],
    [x,a,x,x,a,b,b],
    [a,x,x,x,a,c,c],
    [a,x,b,b,x,a,a],
],dtype='U1')

def solve(N):
    if N <= 2:
        print(-1)
        return
    if N == 3:
        output(A3)
        return
    if N == 6:
        A = np.full((6,6),'.','U1')
        A[:3,:3] = A3
        A[3:,3:] = A3
        output(A)
        return
    if N == 7:
        output(A7)
        return
    if N == 11:
        A = np.full((11,11),'.','U1')
        A[:4,:4] = A4
        A[4:,4:] = A7
        output(A)
        return
    # 4,5,8,9,10,12以上
    # このときは、4x+5yと書ける
    x = 0
    while (N - 4 * x) % 5:
        x += 1
    y = (N - 4 * x) // 5
    A = np.full((N,N),'.','U1')
    for i in range(x):
        A[4*i:4*i+4,4*i:4*i+4] = A4
    for j in range(y):
        A[4*x+5*j:4*x+5*j+5,4*x+5*j:4*x+5*j+5] = A5
    output(A)
    return

solve(N)

Measured memory_bytes: 21144
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'
 
int main()
{
    fastio;
    string s,t;
    cin>>s>>t;
    int f = 1;
    if(s.length() + 1 != t.length())f = 0;

    if(f){
        rep(i,s.length(),0)f &= (s[i] == t[i]);
    }

    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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


template<int mod>
struct ModInt{
	int x;

	ModInt() : x(0){}
	ModInt(long long y) : x(y>=0 ? y%mod : (mod-(-y)%mod)){}

	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}

	ModInt operator-() const{return ModInt(-x);}
	ModInt operator+(const ModInt &p) const{return ModInt (*this)+=p;}
	ModInt operator-(const ModInt &p) const{return ModInt (*this)-=p;}
	ModInt operator*(const ModInt &p) const{return ModInt (*this)*=p;}
	ModInt operator/(const ModInt &p) const{return ModInt (*this)/=p;}
	bool operator==(const ModInt &p) const{return x==p.x;}
	bool operator!=(const ModInt &p) const{return x!=p.x;}
	friend ostream &operator<<(ostream &os, const ModInt &p){return os<<p.x;}
	friend istream &operator>>(istream &is,ModInt &a){
		int t;
		is>>t;
		a=ModInt<mod>(t);
		return (is);
	}

	ModInt inverse() const{
		int a=x, b=mod, u=1, v=0, t;
		while(b>0){
			t=a/b;
			a-=t*b;
			swap(a,b);
			u-=t*v;
			swap(u,v);
		}
		return ModInt(u);
	}
	
	ModInt pow(int e) const{
		long long a=1,p=x;
		while(e>0){
			if(e%2==0){p=(p*p)%mod; e/=2;}
			else {a=(a*p)%mod; e--;}
		}
		return ModInt(a);
	}
};

const int p=1000000007;
using modint =ModInt<p>;

modint dp[30][(1<<21)+10];

signed main(){
	int N; cin>>N;
	vector<vector<int>> a(N,vector<int>(N));
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)cin>>a[i][j];
	dp[0][0]=1;
	for(int i=0;i<N;i++){
		for(int bit=0;bit<(1<<N);bit++){
			if(dp[i][bit]!=0){//枝を刈ってる 
				for(int j=0;j<N;j++){
					if(!(bit&(1<<j)) && a[i][j])
					dp[i+1][bit | (1<<j)]+=dp[i][bit];
				}
			}
		}
	}
	cout<<dp[N][(1<<N)-1]<<endl;
}

Measured memory_bytes: 491776
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>

using namespace std;


int main(){
    int n;
    cin >> n;
    vector<int> w(n);
    for(int i = 0; i < n; i++){
        cin >> w[i];
    }

    vector<int> sum(n+1);
    sum[0] = 0;

    for(int i = 0; i < n; i++){
        sum[i+1] = sum[i] + w[i];
    }

    int min_val = 1e7;
    int kotae;
    for(int i = 0; i < n; i++){
        int tmp = sum[i+1];
        int tmp2 = sum[n] - sum[i+1];

        int ans = abs(tmp - tmp2);

        min_val = min(min_val, ans);
    }

    cout << min_val << endl;


    return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <stdio.h>

#define MAX_N 100'000
#define MAX_A 1'000'000'000

using namespace std;

int A[MAX_N];

int main() {
  int N;
  cin >> N;
  int a = MAX_A;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    a = min(a, A[i]);
  }
  int b = a;
  while (true) {
    for (int i = 0; i < N; ++i) {
      int _b = A[i] % a;
      if (_b > 0 && _b < a) {
        b = _b;
      }
    }
    if (a == b) {
      printf("%d\n", b);
      return 0;
    }
    a = b;
  }
}

Measured memory_bytes: 3520
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	ll n, m;
	cin >> n >> m;

	if (n <= 1 && m <= 1) {
		cout << 0 << endl;
		return 0;
	}
	int ans = 0;

	if (n >= 2) {
		ans += n * (n - 1) / 2;
	}
	if (m >= 2) {
		ans += m * (m - 1 )/ 2;
	}


	cout << ans << endl;
	return 0;
}


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

int main() {
  int n,k,R,S,P;
  string t;
  cin >> n >> k >> R >> S >> P >> t;
  int ans = 0;
  vector<bool>po(n,false);
  rep(i,0,k){
    if(t[i] == 'r') ans += P;
    if(t[i] == 's') ans += R;
    if(t[i] == 'p') ans += S;
    po[i] = true;
  }
  rep(i,k,n){
    if(po[i-k] && t[i] == t[i-k]) continue;
    if(t[i] == 'r') ans += P;
    if(t[i] == 's') ans += R;
    if(t[i] == 'p') ans += S;
    po[i] = true;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3780
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
typedef long long LL;
using namespace std;

const LL mod = 1e9 + 7;
const int MAXN = 1e3 + 10;
char str[MAXN];

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c); 
	if(a + b == c || a + c == b || b + c == a) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int maxn = 234567;
long long f[2][maxn];
void upd(int w, int x, int v){
	for(; x < maxn ; x += x & - x) f[w][x] += v;
}
long long sum(int w, int x){
	long long ans = 0;
	for(; x; x -= x & - x) ans += f[w][x];
	return ans;
}
int main(){
	vector<pair<int,int> > qe;
	vector<int> where;
	int q; cin >> q;
	const int ten9 = 1000000000;
	for(int i = 0; i < q; i++){
		int ty; cin >> ty;
		if(ty == 1){
			int a, b; cin >> a >> b;
			qe.push_back({a, b});
			where.push_back(a);
		} else {
			qe.push_back({ten9 + 1, ten9 + 1});
		}
	}
	sort(where.begin(), where.end());
	where.erase(unique(where.begin(), where.end()), where.end());
	long long add = 0;
	for(int i = 0; i < q; i++){
		int x, y; tie(x, y) = qe[i];
		if(x == ten9 + 1 && y == ten9 + 1){
			auto fdx = [&](int pt){
				int h = lower_bound(where.begin(), where.end(), pt) - where.begin(); h++;
				long long onL = sum(0, h - 1);
				long long onR = sum(0, maxn - 3) - onL;
				long long suL = sum(1, h - 1);
				long long suR = sum(1, maxn - 3) - suL;
				return (onL * pt - suL) + (suR - onR * pt); 
			};
			long long best = 1ll<<60, pt = -1;
			int lo = -ten9, hi = ten9;
			while(hi - lo >= 5){
				int mid = (lo + hi) / 2;
				if(fdx(mid) > fdx(mid + 1)) lo = mid + 1;
				else hi = mid;
			}
			while(lo <= hi){
				long long now = fdx(lo);
				if(now < best) best = now, pt = lo;
				lo++;
			}
			cout << pt << " " << best + add << endl;
		} else {
			int pt = lower_bound(where.begin(), where.end(), x) - where.begin(); pt++;
			add += y;
			upd(0, pt, 1);
			upd(1, pt, x);
		}
	}
	return 0;
}


Measured memory_bytes: 6640
#include <iostream>
using namespace std;
 
void include3(int x, int i){
  if(x % 10 == 3) {
    cout  << " " << i;
  }else{
    x /= 10;
    if(x) include3(x, i);
  }
}
 
void call(int n){
  int i, x;
 
  for(i = 1; i < n+1; ++i){
    x = i;
    if(x % 3 == 0) {
      cout << " " << i;
    }else{
      include3(x, i);
    }
  }
   
}
 
int main(){
  int n;
  cin >> n;
 
  call(n);
  cout << endl;
}

Measured memory_bytes: 1164
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

int n;
vector<int> l, x(3);
int ans = INF;
stack<int> st[3];

void solve(int i){
    if(i >= n){
        rep(j, 3){
            if(st[j].empty()){
                return;
            }
        }
        int tmp = -30;
        vector<int> y(3);
        rep(j, 3){
            stack<int> sst = st[j];
            while(not sst.empty()){
                y[j] += sst.top();
                sst.pop();
                tmp += 10;
            }
            tmp += abs(x[j] - y[j]);
        }
        ans = min(ans, tmp);
        return;
    }

    rep(j, 4){
        if(j == 3){
            solve(i + 1);
            continue;
        }
        st[j].push(l[i]);
        solve(i + 1);
        st[j].pop();
    }
}

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

    cin >> n;
    rep(i, 3) cin >> x[i];
    l = vector<int>(n);
    rep(i, n) cin >> l[i];

    solve(0);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def evaluation(m, f, r)
  grade = ""
  if m == -1 || f == -1
    grade = "F"
  elsif m + f >= 80
    grade = "A"
  elsif m + f >= 65
    grade = "B"
  elsif m + f >= 50 || r >= 50
    grade = "C"
  elsif m + f >= 30 
    grade = "D"
  else
    grade = "F"
  end
  return grade
end

input_values = []
while true
  input_value  = gets.chomp.split.map(&:to_i)
  if input_value == [-1,-1, -1]
    break
  end
  input_values.push(input_value)
end
length = input_values.length
for i in 0..(length-1)
  m = input_values[i][0]
  f = input_values[i][1]
  r = input_values[i][2]
  puts evaluation(m, f, r)
end

Measured memory_bytes: 8564
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
 
// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
template <class T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
template <class T>
bool chmin(T& a, const T& b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion
lint n;
vl a;
bool isOK(int index, int key) {
	if (a[index] >= key) return true;
	else return false;
}
 
int binary_search(int key) {
	int ng = -1; 
	int ok = (int)a.size();
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if (isOK(mid, key)) ok = mid;
		else ng = mid;
	}
	if (a[ok] == key)
		return ok;
	else
		return -1;
}
 
 
int main(void) {
    vl e = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592,17179869184};
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	lint ans = 0;
	lint cnt = 0;
 	while (a.size() > 1) {
		for (lint i = 30; i >= 0; i--) {
			if (a[a.size() - 1] >= e[i]) {
				cnt = e[i + 1];
				break;
			}
		}
		lint d = a[a.size() - 1];
		a.pop_back();
		lint x = binary_search(cnt - d);
		if (x != -1 && x != a.size()) {
			ans++;
            a.erase(a.begin() + x);
		}
	}
	printf("%lld\n", ans);
 
    return 0;
}


Measured memory_bytes: 4820
#include <stdio.h>
int main(){
 
  int d[6],i,blank;
  char ENSW[100];
 
  for(i = 0; i < 6; i++){
 
    scanf("%d",&d[i]);
 
  }
 
  scanf("%s",ENSW);
   
  for(i = 0; ENSW[i] != '\0'; i++){
 
    if(ENSW[i] == 'N'){
 
      blank=d[0];
      d[0]=d[1];
      d[1]=d[5];
      d[5]=d[4];
      d[4]=blank;
 
    }
 
    if(ENSW[i] == 'E'){
 
      blank=d[0];
      d[0]=d[3];
      d[3]=d[5];
      d[5]=d[2];
      d[2]=blank;
 
    }
 
    if(ENSW[i] == 'S'){
 
      blank=d[0];
      d[0]=d[4];
      d[4]=d[5];
      d[5]=d[1];
      d[1]=blank;
 
    }
 
    if(ENSW[i] == 'W'){
 
      blank=d[0];
      d[0]=d[2];
      d[2]=d[5];
      d[5]=d[3];
      d[3]=blank;
 
    }
 
  }
   
  printf("%d\n",d[0]);
 
  return 0;
 
}


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

int main(){
  int N,D;
  cin >> N >> D;
  if(N%(2*D+1)==0){
    cout << N/(2*D+1) << endl;
  }else{
    cout << N/(2*D+1) +1 << endl;
  }
}

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


using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v.at(i);
	}
	int c = 0;
	for (int i = N - 1; i > 0; i--) {
		if (v.at(i - 1) - v.at(i) > 1) {
			c += 2;
		}
		else if (v.at(i - 1) - v.at(i) == 1) {
			v.at(i - 1)--;
		}


	}
	if (c <= 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

}

Measured memory_bytes: 768
using System;

class Program {
    static void Main(string[] args) {
        //入力
        string s = Console.ReadLine();
        string[] t = s.Split(' ');
        //数字の割り当て
        int A = int.Parse(t[0]);
        int B = int.Parse(t[1]);
        int K = int.Parse(t[2]);
        
        //K回の操作を行う
        for (int i = 1; i <= K; i++) {
            //奇数回目
            if (i % 2 == 1) {
                B += A / 2;
                A /= 2;
                //偶数回目
            } else {
                A += B / 2;
                B /= 2;
            }
        }

        //出力
        Console.WriteLine(A + " " + B);
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <fstream>
#include <climits>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>

#define FOR(i,n) for(int i = 0 ; i < n ; i++)
#define ALL(a) a.begin(),a.end()

typedef long long int LLD; 

using namespace std;

long long int MOD = 1000000007;

long long int sumN(long long int num) {
	if(num % 2 == 0) {
		return ((num / 2) * (num + 1)) % MOD;
	}
	else 
		return (num * ((num + 1) / 2) ) % MOD;
} 

int main() {
	int n , k;
	cin>>n>>k;
	int a[n];
	FOR(i , n) {
		cin>>a[i];
	}
	LLD lessRight[n] , lessLeft[n];
	FOR(i , n) {
		LLD left = 0 , right = 0 ;
		FOR(j , n) {
			if(j < i && a[i] > a[j]) {
				left++;
			} 
			if(j > i && a[i] > a[j]) {
				right++;
			}
		}
		lessRight[i] = right ;
		lessLeft[i] = left;
	}
	LLD ans = 0;
	FOR(i , n) {
		ans += ((lessRight[i] * sumN(k) ) % MOD + (lessLeft[i] * sumN(k - 1) ) % MOD) % MOD;
		ans %= MOD;
	}
	cout<<ans;
}

Measured memory_bytes: 764