akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>

int main(){
  int n, i, j, k, len, cnt;
  char str[1030], ans[80];

  scanf("%d", &n);
  
  for(i=0; i<n; i++){
    scanf("%s", str);

    len=strlen(str);

    // printf("%d\n", str[0]);
    
    cnt=0;
    k=0;
    for(j=0; j<len; j++){
      if(str[j]!=48){
	cnt++;
	//      	printf("%d", cnt);
      }else if(str[j]==48 && j!=0 && str[j-1]!=48){
	switch(str[j-1]){
	case 49:
	  switch(cnt%5){
	  case 1: ans[k]='.'; break;
	  case 2: ans[k]=','; break;
	  case 3: ans[k]='!'; break;
	  case 4: ans[k]='?'; break;
	  default: ans[k]=' '; break;
	  }
	  break;
	case 50:
	  switch(cnt%3){
	  case 1: ans[k]='a'; break;
	  case 2: ans[k]='b'; break;
	  default: ans[k]='c'; break;
	  }
	  break;
	case 51:
	  switch(cnt%3){
	  case 1: ans[k]='d'; break;
	  case 2: ans[k]='e'; break;
	  default: ans[k]='f'; break;
	  }
	  break;
	case 52:
	  switch(cnt%3){
	  case 1: ans[k]='g'; break;
	  case 2: ans[k]='h'; break;
	  default: ans[k]='i'; break;
	  }
	  break;
	case 53:
	  switch(cnt%3){
	  case 1: ans[k]='j'; break;
	  case 2: ans[k]='k'; break;
	  default: ans[k]='l'; break;
	  }
	  break;
	case 54:
	  switch(cnt%3){
	  case 1: ans[k]='m'; break;
	  case 2: ans[k]='n'; break;
	  default: ans[k]='o'; break;
	  }
	  break;
	case 55:
	  switch(cnt%4){
	  case 1: ans[k]='p'; break;
	  case 2: ans[k]='q'; break;
	  case 3: ans[k]='r'; break;
	  default: ans[k]='s'; break;
	  }
	  break;
	case 56:
	  switch(cnt%3){
	  case 1: ans[k]='t'; break;
	  case 2: ans[k]='u'; break;
	  default: ans[k]='v'; break;
	  }
	  break;
	case 57:
	  switch(cnt%4){
	  case 1: ans[k]='w'; break;
	  case 2: ans[k]='x'; break;
	  case 3: ans[k]='y'; break;
	  default: ans[k]='z'; break;
	  }
	  break;
 	}
	k++; cnt=0;
      }
    }
    
    for(j=0; j<k; j++){
      printf("%c", ans[j]);
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 572
n = gets.chomp.to_i
ary = gets.chomp.split(" ").map(&:to_i)

# puts "#{ary}"
cnt = 0

(1..n-2).each do |a|
    ary2 = []
    ary2 << ary[a-1] << ary[a] << ary[a+1] 
    # puts "#{ary2}"
    # puts "#{ary2.sort[1]}"
    # puts "#{a}"

    if ary[a] == ary2.sort[1]
        cnt += 1 
    end
end
puts cnt


Measured memory_bytes: 1788
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    int ans = 0;
    String[]b = a.split("");
    for(int i = 0; i < b.length; i++){
      ans = ans + Integer.parseInt(b[i]);
    }
    if(Integer.parseInt(a) % ans == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}
    

Measured memory_bytes: 21844
n = gets.to_i
a = gets.split.map(&:to_i)

cro = 1
for i in 0..(n-1)
  cro *= a[i]
end
sum = 0
for i in 0..(n-1)
  sum += cro / a[i]
end

puts cro * 1.0 / sum

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

using namespace std;

template<typename T>
T lcm(T a, T b) {
    if (a == 0 || b == 0) return 0;
    return (a * b) / __gcd(a, b);
}

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

    cout << lcm(a, b) << endl;
    return 0;
}



Measured memory_bytes: 256
char buf[99];sz;
int N,A,B;
long mod=1e9+7;
long p(long a,long b){return b?p(a*a%mod,b>>1)*(b&1?a:1)%mod:1;}
main()
{
	read(0,buf,99);
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		N=N*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		A=A*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		B=B*10+c-'0';
	}
	long ans=p(2,N)-1;
	long x=1,y=1;
	for(int i=1;i<=A;i++)
	{
		x=x*(N-i+1)%mod;
		y=y*i%mod;
	}
	ans-=x*p(y,mod-2)%mod;
	for(int i=A+1;i<=B;i++)
	{
		x=x*(N-i+1)%mod;
		y=y*i%mod;
	}
	ans-=x*p(y,mod-2)%mod;
	printf("%d\n",(ans%mod+mod)%mod);
}

Measured memory_bytes: 128
S = list(input())
if len(S) != 1:
    t = 0
    for n in range(2**(len(S) - 1)):
        f = S[0]
        b = bin(n)[2:]
        b = "0"*(len(S) - len(b) - 1) + b
        for a in range(len(b)):
            if b[a] == "1":
                f += "+"
            f += S[a+1]
        t += eval(f)
    print(t)
else:
    print(S[0])

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

const double one = 1.0;
const double PI = 3.141592653589;

int main() 
{
	string s;
	cin>>s;
	if(s[s.size()-1] == 's')cout<<s<<"es"<<Endl;
	else cout<<s<<"s"<<Endl;
	return 0;
}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

inline void proc_status()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) <<endl;
}

template <typename T> T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int Maxn = 300 + 10;

int N, Sum[4];
double Dp[Maxn][Maxn][Maxn];

inline double Calc (int i, int j, int k)
{
	if (Dp[i][j][k]) return Dp[i][j][k];
	if (i + j + k == 0) return 0;
	double ans = 1;
	if (i) ans += Calc(i - 1, j, k) * i / N;
	if (j) ans += Calc(i + 1, j - 1, k) * j / N;
	if (k) ans += Calc(i, j + 1, k - 1) * k / N;
	if (i + j + k != N) ans *= 1.0 * N / (1.0 * i + j + k);
	return Dp[i][j][k] = ans;
}

inline void Solve ()
{
	printf("%.10lf\n", Calc(Sum[1], Sum[2], Sum[3]));
}

inline void Input ()
{
	N = read<int>();
	for (int i = 1; i <= N; ++i) ++Sum[read<int>()];
}

int main()
{
#ifdef hk_cnyali
	freopen("J.in", "r", stdin);
	freopen("J.out", "w", stdout);
#endif
	Input();
	Solve();
	return 0;
}


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

typedef struct{
    int x;
    int y;
} point;

typedef struct{
    double x;
    double y;
} vector;

double distp(point *a, point *b);
double distv(vector *a, vector *b);
vector *relative(const point *a, const point *b, vector *r);
vector *normalize(vector *v);
void solve(int n);
double min(double a, double b);
int is_on_a_line(point *a, point *b, point *c);

int main()
{
    int n;
    char buf[128];
    while(1){
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, "%d", &n);
        if(n == 0) break;
        solve(n);
    }

    return 0;
}

void solve(int n)
{
    int i;
    char buf[128];
    int x, y;
    point points[512];
    int visited[512];
    int pos;
    int mp;
    int all_visited;
    double len;
    double m;
    double d;
    vector dir;
    vector r;

    // initialize
    for(i = 0; i < n; i++) visited[i] = 0;
    for(i = 0; i < n; i++){
        fgets(buf, sizeof(buf), stdin);
        sscanf(buf, " %d %d", &x, &y);
        points[i].x = x;
        points[i].y = y;
    }
    points[n].x = 0; points[n].y = 0; 
    pos = n;
    len = 0;
    dir.x = 0; dir.y = 1.0;

    // solve
    while(1){
        all_visited = 1;
        m = 3;
        // direction
        for(i = 0; i < n; i++){
            if(!visited[i]){
                all_visited = 0;
                d = distv(normalize(&dir), normalize(relative(points+pos, points+i, &r)));
                if(d < m){
                    m = d;
                    mp = i;
                }
            }
        }
        if(all_visited) break;

        // on a line
        for(i = 0; i < n; i++)
            if(!visited[i] && i != mp)
                if(is_on_a_line(points+pos, points+mp, points+i))
                    if(distp(points+pos, points+mp) > distp(points+pos, points+i))
                        mp = i;

        // update
        visited[mp] = 1;
        len += distp(points+pos, points+mp);
        relative(points+pos, points+mp, &dir);
        pos = mp;
    }

    printf("%.1lf\n", len);
}

int is_on_a_line(point *a, point *b, point *c)
{
    int dx1 = a->x - b->x;
    int dy1 = a->y - b->y;
    int dx2 = a->x - c->x;
    int dy2 = a->y - c->y;
    return dx1*dy2 == dx2*dy1;
}

vector *relative(const point *a, const point *b, vector *r)
{
    r->x = b->x - a->x;
    r->y = b->y - a->y;
    return r;
}

double distp(point *a, point *b)
{
    int dx = a->x - b->x;
    int dy = a->y - b->y;
    int sq = dx * dx + dy * dy;
    
    return sqrt((double)sq);
}

double distv(vector *a, vector *b)
{
    double dx = a->x - b->x;
    double dy = a->y - b->y;
    double sq = dx * dx + dy * dy;
    
    return sqrt((double)sq);
}

vector *normalize(vector *v)
{
    double norm = sqrt(v->x * v->x + v->y * v->y);
    v->x /= norm;
    v->y /= norm;
    return v;
}

double min(double a, double b)
{
    return (a < b ? a : b);
}



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

int main() {
	
	int n;
	cin>>n;
	bool sePuede = false;
	
	for(int i =1;i<10;i++){
		for(int j =1;j<10;j++){
			sePuede |= (i*j == n);
		}
	}
	if(sePuede) cout<<"Yes"<<endl;
	else        cout<<"No"<<endl;
	return 0;
}

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

int main() {
  int n;cin >> n;
  long long mod=1000000007;
  long long ans=1;
  for (int i=1;i<n+1;i++) {
    ans *= i;
    ans %= mod;
  }
  cout << ans << endl;
}

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

inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') f = -1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
	return x * f;
}

const int N = 1e5 + 5;
int fa[N], deg[N];
vector<int> G[N];

int find(int x){ return x == fa[x] ? x : fa[x] = find(fa[x]); }

void dfs(int u, int fa)
{
	for (int v : G[u]) 
		if (v != fa) dfs(v, u);
	
	if (fa)
	{
		if (deg[u] & 1)
			printf("%d %d\n", u, fa);
		else
			printf("%d %d\n", fa, u), ++deg[fa];
	}
}

int main()
{
	int n = read(), m = read();
	if (m & 1) return puts("-1"), 0;
	
	for (int i = 1; i <= n; ++i) fa[i] = i;
	for (int i = 1; i <= m; ++i)
	{
		int u = read(), v = read();
		int fu = find(u), fv = find(v);
		if (fu != fv)
		{
			fa[fu] = fv;
			G[u].push_back(v);
			G[v].push_back(u);
		}
		else
		{
			printf("%d %d\n", u, v);
			++deg[u];
		}
	}
	
	dfs(1, 0);
	
	return 0;
}


Measured memory_bytes: 13816
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(), v.end()
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

void partial_calc(string &S,vector<ll>&ans,ll i)
{
    if(i>(S.size()-1))
      return;

  ll temp1=1,temp2=1,temp3=1,sum=0;
  rep(j,i)
  {
    temp2 = temp2 * 2;
  }

  rep(j, (S.size()-i))
  {
    temp3 = 1;
    if((i+j+2)<S.size())
    rep(k, S.size() - (i + j+2))
    {
      temp3 = temp3 * 2;
    }
    sum = sum + (S[i]-'0') * temp1 * temp2*temp3;
    temp1 = temp1 * 10;
  }

  ans[i] = sum;

  partial_calc(S, ans, i + 1);
}

ll sum_calc(string &S)
{
  ll sum=0;
  vector<ll> ans(S.size());
  partial_calc(S, ans, 0);
  rep(i,S.size())
  {
    sum += ans[i];
  }
  return sum;
}

int main()
{
  string S;
  cin >> S;
  cout << sum_calc(S) << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int d[101010][26];

int main(){
    string s, t;
    cin >> s >> t;
    memset(d, -1, sizeof(d));
    int n = s.size();
    vector<int> now(26, -1);
    for(int i=2*n-1; i>=0; i--){
        rep(j, 26){
            d[i%n][j] = now[j];
        }
        now[s[i%n]%26] = i;
    }
    // rep(i, n){
    //     rep(j, 26) cout << d[i][j] << " ";
    //     cout << endl;
    // }

    LL ans = s.find(t[0]);
    int nw = ans;
    // cout << nw << endl;
    if(ans == string::npos){
        cout << -1 << endl;
        return 0;
    }
    rep1(i, t.size()){
        int j = t[i]%26;
        if(d[nw][j] == -1){
            cout << -1 << endl;
            return 0;
        }
        int diff = d[nw][j] - nw;
        ans += d[nw][j] - nw;
        nw = (d[nw][j])%n;
        // cout << "nw: " << nw << " / plus: " << diff << endl;

    }
    cout << ans+1 << endl;

    
}

Measured memory_bytes: 10880
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

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

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

#define int long long 

signed main(){
	int a;
	cin>>a;
	int g=0;
	for(int i=1;i<=a;i++){
		if(i%5!=0&&i%3!=0){
				g=g+i;
		}
	}
	cout<<g;
	return 0;
}

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

int main() {
  int N, K, Q;
  cin >> N >> K >> Q;
  vector<int> q(Q);
  for (int i = 0; i < Q; i++) {
    cin >> q.at(i);
  }
  vector<int> a(N, Q);
  for (int i = 0; i < Q; i++) {
    a.at(q.at(i) - 1)--;
  }
  for (int i = 0; i < N; i++) {
    if (a.at(i) < K) {
      cout << "Yes" <<endl;
    }
    else {
      cout << "No" <<endl;
    }
  }
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int W = sc.nextInt();

		int[][] a = new int[N][2];
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 2; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		long[][] dp = new long[N + 1][W + 1];

		for (int i = 0; i < N; i++) {
			int weight = a[i][0];
			int value = a[i][1];

			for (int j = 0; j < W + 1; j++) {
				if (j + weight <= W) {
					dp[i + 1][j + weight] = Math.max(dp[i + 1][j + weight], dp[i][j] + value);
				}

				dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j]);
			}
		}

		System.out.println(dp[N][W]);
	}

}

Measured memory_bytes: 128340
n,k = map(int,input().split())
p = list(map(int,input().split()))
cur_sum = sum(p[:k])
max_sum = cur_sum
for i in range(n-k):
    cur_sum = cur_sum + p[k+i] - p[i]
    max_sum = max(max_sum,cur_sum)
print(k*(1/2)+max_sum*(1/2))

Measured memory_bytes: 71792
#include <iostream>
typedef long long ll;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); i++)

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n ;
    std::cin >> n ;
    ll ans = 0 ;
    ll a, b ;
    REP(i,n){
        std::cin >> a ;
        if(i==0 || a==0){
            ans += a/2 ;
            b = a%2 ;
            continue ;
        }
        ans += b+ (a-b)/2 ;
        a -= b ;
        b = a%2 ;
    }
    std::cout << ans << std::endl ;
    return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	num, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return num
}

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	n := nextInt()
	s := make(map[string]bool)
	for i := 0; i < n; i++ {
		key := nextStr()
		s[key] = true
	}
	fmt.Println(len(s))
}

Measured memory_bytes: 15684
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe



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


int n;
cin >> n;
cout << 3*n*n << endl;





//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
s = input()
for i in range(2**3):
    check = [0]*3
    op = []
    tmp = int(s[0])
    ans = s[0]
    for j in range(3):
        if (i>>j)&1:
            check[j] = 1
    for k in range(3):
        if check[k] == 1:
            op.append("+")
        else:
            op.append("-")
    for k in range(1,4):

        if op[k-1] == "+":
            tmp += int(s[k])
            ans = ans+op[k-1]
            ans = ans+s[k]
        else:
            tmp -= int(s[k])
            ans = ans+op[k-1]
            ans = ans+s[k]

    if tmp == 7:
        ans = ans + "=7"
        print(ans)
        exit()

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e3+23;

char s[N][N];
int a[N][N], b[N][N];

void solve() {
  int h, w; scanf("%d%d", &h, &w);
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      scanf(" %c", s[i]+j);
    }
  }
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '#') continue;
      a[i][j] = 1;
      if (j) a[i][j] += a[i][j-1];
    }
    int m = 0;
    for (int j = w-1; j >= 0; --j) {
      if (s[i][j] == '#') {
	m = 0;
	continue;
      }
      if (m) {
	a[i][j] = m;
      } else {
	m = a[i][j];
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < w; ++i) {
    for (int j = 0; j < h; ++j) {
      if (s[j][i] == '#') continue;
      b[j][i] = 1;
      if (j) b[j][i] += b[j-1][i];
    }
    int m = 0;
    for (int j = h-1; j >= 0; --j) {
      if (s[j][i] == '#') {
	m = 0;
	continue;
      }
      if (m) {
	b[j][i] = m;
      } else {
	m = b[j][i];
      }
      ans = max(ans, m+a[j][i]-1);
    }
  }
  printf("%d", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  
	string S,T;
	cin>>S>>T;

	if(T == S + T[T.length()-1])
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;

	
	return 0;
}

Measured memory_bytes: 3656
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<double,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll D;
    cin >> D;
    vector<double> c(27,0);
    for(ll i=0;i<26;++i)cin>>c[i+1];
    vector<vector<double>> S(D+1, vector<double>(27, 0));
    for(ll i=0;i<D;++i)
        for(ll j=0;j<26;++j)cin>>S[i+1][j+1];
    ll Maxscore=-INF;
    vl ans;
    for(double k=1.0;k<=47;k+=0.02){
        vector<ll> last(27,0);
        ll score=0;
        vector<ll> t(D+1,0);
        for(ll i=1;i<=D;++i){
            set<P> hoge;
            for(ll j=1;j<=26;++j){
                hoge.insert(P(S[i][j]+c[j]*(min(k,(double)D-i)),j));
            }
            t[i]=(*--hoge.end()).second;
            last[t[i]]=i;
            score+=S[i][t[i]];
            for(ll j=1;j<=26;++j)score-=c[j]*(i-last[j]);
        }
        if(chmax(Maxscore,score))ans=t;
    }
    for(ll i=1;i<=D;++i)prt(ans[i]);

    return 0;
}



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

string s;

// 連続する箇所がない
string good = "Good";
// 連続する箇所がある
string bad = "Bad";

void solve();

int main() {
  cin >> s;
  solve();
}

void solve() {
  bool isGood = true;
  if (s[0] == s[1]) {
    isGood = false;
  }
  if (s[1] == s[2]) {
    isGood = false;
  }
  if (s[2] == s[3]) {
    isGood = false;
  }
  if (isGood) {
    cout << good << endl;
  } else {
    cout << bad << endl;
  }
}

Measured memory_bytes: 256
def resolve():
    N = int(input())
    Hs = list(map(int, input().split(" ")))
    cnt = 0
    while(any(Hs)):
        start = 0
        for i in range(N):
            # print("start: {}".format(start))
            if Hs[i] == 0:
                if i != start:
                    for j in range(start, i):
                        Hs[j] -= 1
                    cnt += 1
                start = i + 1 
            elif i == N-1:
                for j in range(start, N):
                    Hs[j] -= 1
                cnt += 1
        # print(Hs)
        # print(cnt)
        # input()

    print(cnt)
    

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 3064
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int

func main() {
	reader.Split(bufio.ScanWords)
	var N, K int
	var c string
	fmt.Scan(&N, &K, &c)
	for i := 1; i < N; i++ {
		if string(c[i]) == string(c[i-1]) {
			ans++
		}
	}
	fmt.Println(min(ans+2*K, N-1))
}

/*  ----------------------------------------  */

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; i++ {
		fac[i] = fac[i-1] * i % mod
		inv[i] = mod - inv[mod%i]*(mod/i)%mod
		finv[i] = finv[i-1] * inv[i] % mod
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC162D()
{
	int N;
	string S;
	cin >> N;
	cin >> S;
	vvi ct(3, vi(N+1));
	for (int i = N - 1; i > -1; --i)
	{
		for (int j = 0; j < 3; ++j)
			ct[j][i] = ct[j][i + 1];
		if (S[i] == 'R')
		{
			++ct[0][i];
		}
		if (S[i] == 'G')
		{
			++ct[1][i];
		}
		if (S[i] == 'B')
		{
			++ct[2][i];
		}
	}

	char Y[3] = { 'R','G','B' };

	ll sum = 0;
	for (int i = 0; i < N; ++i)
	{
		char x1 = S[i];
		for (int j = i + 1; j < N; ++j)
		{
			char x2 = S[j];
			if (x1 == x2)
				continue;
			int y = -1;
			for (int k = 0; k < 3; ++k)
			{
				if (x1 != Y[k] && x2 != Y[k])
				{
					y = k;
					break;
				}
			}
			sum += ct[y][j];
			int d = j - i;
			int e = j + d;
			if (e < N && S[e] == Y[y])
			{
				--sum;
			}
		}
	}
	cout << sum << endl;
}
int main()
{
	ABC162D();
	return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    string s;
    cin>>n>>s>>k;
    for(int i=0;i<n;i++)
    {
        if(s[i]!=s[k-1])
        cout<<"*";
        else
        cout<<s[k-1];
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define all(x)              (x).begin(), (x).end()
#define inf                 1e18

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//	ifstream cin("input.txt");
//	ofstream cout("output.txt");
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); ++i) {
		cout << 'x';
	}
}

Measured memory_bytes: 256
#pragma GCC optimize(2)

#include "bits/stdc++.h"

using namespace std;

#define all(a) begin(a), end(a)
#define MOD 1000000007
#define PII pair<int, int>
#define REP(x, l, u) for (ll x = l; x < u; x++)
#define RED(x, l, u) for (ll x = l; x >= u; x--)
#define complete_unique(a) a.erase(unique(begin(a), end(a)), end(a))
#define mst(x, a) memset(x, a, sizeof(x))
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b) {
    long long res = 1;
    while (b) {
        if (b & 1) {
            res = a * res;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll gcd(ll a, ll b) {
    a = abs(a), b = abs(b);
    while (b != 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

bool is_prime(int n) {
    if (n == 0)return false;
    if (n == 1)return false;
    if (n == 2)return true;
    if (n % 2 == 0)
        return false;
    int j = sqrt(n);
    for (int i = 2; i <= j; ++i) {
        if (n % i == 0)
            return false;
    }
    return true;
}

ll reverse_num(ll n) {
    ll x = 0, t = n;
    while (t != 0) {
        x = x * 10 + t % 10;
        t /= 10;
    }
    return x;
}

void solve() {
    //    freopen("C:\\Users\\26019\\Downloads\\P1195_4.in", "r", stdin);
    //    fclose(stdin);
    int t = 1;
//    cin >> t;
    while (t--) {
        int k;
        cin >> k;
        ll cur = 7;
        for (int i = 1; i <= 1000000; ++i) {
            if (cur % k == 0) {
                cout << i;
                return;
            }
            cur = cur*10+7;
            cur %= k;
        }
        cout << -1;
    }

}


int main() {
    // 加速输入和输出
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}



Measured memory_bytes: 3584
n,m=map(int,input().split())
h=list(map(int,input().split()))
c=0
d=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    d[a-1]=max(d[a-1],h[b-1])
    d[b-1]=max(d[b-1],h[a-1])
for i in range(n):
    if h[i]>d[i]:
        c+=1
print(c)

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

int main(){

  string S;
  cin>>S;
  int Q;
  cin>>Q;
  
  int check;
  int F;
  char c;
  
  string H="";
  string T="";
  int parity=0;
  rep(i,Q){

    cin>>check;
    if(check==1){
      parity=(parity+1)%2;
    }
    else {

      cin>>F>>c;
      if(F==1 && parity==0)H=c+H;
      else if(F==2 && parity==0)T=T+c;
      else if(F==2 && parity==1)H=c+H;
      else if(F==1 && parity==1)T=T+c;
	
      
      
    }

  }

   if(parity==1){

        reverse(S.begin(),S.end());
        string temp=T;   
        reverse(H.begin(),H.end());
        T=H;
        reverse(temp.begin(),temp.end());
        H=temp;
   }
  
  cout<<H<<S<<T<<endl;
  
}


Measured memory_bytes: 1160
/**
 *   author: malviyanshiv
 *   created: 09 January 2019  23:27:27
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define MAX 100005

typedef long long ll;
typedef pair< int, int > PII;

void fastscan(int &x){
    bool neg=false;
    register int c;
    x =0;
    c=getchar();
    if(c=='-'){
        neg = true;
        c=getchar();
    }
    for(;(c>47 && c<58);c=getchar())
        x = (x<<1) + (x<<3) +c -48;
    if(neg)
        x *=-1;
}

void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

vector<int> adj[MAX];
vector<int> rev[MAX];
int cnt = 0;
vector<int> top(MAX);
vector<int> vis(MAX, 0);
vector<int> dp(MAX, -1);

void dfs(int node){
    vis[node] = 1;
    for(int a : adj[node])
        if( !vis[a] )
            dfs(a);
    vis[node] = 2;
    top[cnt++] = node;
}

int cal(int idx){
    if( vis[idx] )
        return dp[idx];
    int res = 0;
    for(int a: rev[idx])
        if( !vis[a])
            res = max(res, cal(a)+1);
        else
            res = max(res, dp[a]+1);
    vis[idx] = 1;
    return dp[idx] = res;
}


int main(){
	optimizeIO();
    int n, m, a, b;
    cin >> n >> m;
    REP(i, 0, m){
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        rev[b].push_back(a);
    }
    // finding topological sorting
    REP(i, 0, n)
        if( !vis[i] )
            dfs(i);
    // printing the order
    reverse(top.begin(), top.begin()+n);
    /*cout << "Odering : " << endl;
    REP(i, 0, n)
        cout << top[i] << " ";
    cout << endl;*/
    REP(i, 0, n)
        vis[i] = false;

    int maxi = 0;
    for(int i = n-1; i>=0; i--){
        if( !vis[top[i]] ){
            maxi = max(cal(top[i]), maxi);
            vis[top[i]] = 1;
        }else{
            maxi = max(dp[top[i]], maxi);
        }
    }
    cout << maxi << endl;
	return 0;
}


Measured memory_bytes: 17024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

string s;

int main() {
	cin >> s;
	if ((s[1] == s[2] && s[2] == s[3])||(s[0] == s[1] && s[1] == s[2]))cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
N,L=map(int,input().split())
i = 1-L
if 1<=1-L and 1-L<=N:
  print(N*(2*L+N-1)//2)
elif 1-L<1:
  print(N*(2*L+N-1)//2-L)
elif 1-L>N:
  print(N*(2*L+N-1)//2-(N+L-1))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
const ll mod=1e9+7;


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

    double ans;
    ll n;
    cin>>n;
    ans=2*3.14159*n;
    cout<<ans;


    return 0;
}

Measured memory_bytes: 3804
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

def divisor(n)
  result = SortedSet.new
  result.add(1); result.add(n)
  i = 1
  num = Math.sqrt(n)
  while i <= num do
    remainder = n % i
    if remainder == 0
      result.add(i)
      result.add(n/i)
    end
    i += 1
  end
  result.to_a
end

require 'prime'

N = get_int
A = [*1..N]


@array = Array.new(N+1) { 0 }
[*2..N].each do |n|
  Prime.prime_division(n).each do |p, num|
    @array[p] += num
  end
end

# 74
# 14, 4
# 24, 2
# 4 , 4, 2
# のパターンのみ

def count_array(num)
  @array.count { |a| a >= num }
end

# 最後の2で割っているのは、4が2つあってかぶるため通り数が2分の1に減る
puts count_array(74) + count_array(14) * (count_array(4) - 1) + count_array(24) * (count_array(2) - 1) + count_array(4) * (count_array(4) - 1) * (count_array(2) - 2) / 2



Measured memory_bytes: 14580
#include<bits/stdc++.h>
using namespace std;
int m = 1e9+7;
int main ()
{
    int n,i;
    long long int ans =1;
    cin >> n;
    vector <int> a(n);
    fill (a.begin(),a.end(),0);
    int temp = n;
    while (temp--)
    {
        cin >> i;
        a[i]++;
    }
    if (n%2)
    {
        if (a[0]!= 1)
        {
            cout << "0\n";
            return 0;
        }
        for ( i =1 ; i<n; i++)
        {
            if(i%2&& a[i]!=0)
            {
                cout << "0\n";
                return 0;
            }
            if(i%2 == 0)
            {
                if (a[i]!= 2)
                {
                    cout << "0\n";
                    return 0;
                }
                else
                {
                    ans = (ans *2 ) % m;
                }
            }
        }
    }
    else{
        if (a[0]!= 0){ cout << "0\n"; return 0;}
        for ( i =1 ; i< n ; i++){
            if (i%2 == 0 && a[i]!= 0){cout << "0\n"; return 0;}
            else if (i%2){
                if(a[i]!= 2){cout << "0\n"; return 0;}
                ans = ans*2%m;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int num[200005];
int nm[200005][2];
int maxn=200000;
inline int lb(int x){return x&-x;}
void add(int x,int d)
{
    while(x<=maxn)
    {
        num[x]+=d;
        x+=lb(x);
    }
}
int query(int x)
{
    int ans=0;
    while(x>0)
    {
        ans+=num[x];
        x-=lb(x);
    }
    return ans;
}
void qadd(int i,int d,int f)
{
    add(max(i-nm[i][f],1),d);
    add(min(i+nm[i][f],maxn)+1,-d);
}
int main()
{
    int n,k;
    cin >> n >> k;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&nm[i][0]);
        qadd(i,1,0);
    }
    int f=0,bt=1;
    for(int i=0;i<k && bt;i++)
    {
        bt=0;
        for(int j=1;j<=n;j++)
        {
            nm[j][f^1]=query(j);
            if(nm[j][f^1]!=nm[j][f])
                bt=1;
        }
        for(int j=1;j<=n;j++)
        {
            qadd(j,-1,f);
            qadd(j,1,f^1);
        }
        f^=1;
    }
    for(int i=1;i<=n;i++)
        printf("%d ",nm[i][f]);
    return 0;
}


Measured memory_bytes: 6184
#include <bits/stdc++.h>
   
using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define deb(x) cout << #x << "=" << x << endl
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define vi vector<int>
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define mod 1000000007
#define int long long
set < ll> primes;
 
int n,m;

bool isvalid(int x,int y)
{
    return (x>=0 && x<n && y>=0 && y<m);
}
int dx[]={0,0,1,-1,-1,1,1,-1};
int dy[]={1,-1,0,0,-1,1,-1,1};
void Sieve(ll n) 
{ 
    bool prime[n+1];
	for(ll i=0;i<n+1;++i)
		prime[i]=true;
    for (ll p=2;p*p<=n;++p) 
    {
        if (prime[p] == true) 
        {  
            for (ll i=2*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
    for(ll p=2; p<=n; p++) 
       if (prime[p]) 
		primes.insert(p);  
}

ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
        return gcd(b % a, a); 
} 
ll powermod(ll x, ll y){
    if(y==0)
    return 1;
        
    if(y%2==0)
    return (powermod(x,y/2)*powermod(x,y/2))%mod;
    else
    return (((powermod(x,y/2)*powermod(x,y/2))%mod)*x)%mod;
}

 
 

int32_t main()
{
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    string s;
    cin>>s;
    if(s.size()>=6){
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout<<"Yes";
    }
    else cout<<"No";
    }
    else cout<<"No";
        
    
    
   
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
  
  int N;
  
  scanf("%d", &N);
  
  long long A[300];
  
  int i;
  
  for (i=0; i < N; i++){
  scanf("%lld", &A[i]);
  }
  
  int j;
  
  int p=0;
  
  for (i=0; p==0; i++) {
    
    for (j=0; j < N; j++){
      p = p + A[j] % 2;
      A[j] = A[j]/2;
    }
  }
  
  printf("%d", i-1);
  
  return 0;
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, m;
void solve(){
	cin >> n >> m;
	
	cout << (1<<m)*(1900*m+100*(n-m)) << endl;
}

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


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

#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // #ifndef ONLINE_JUDGE
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/in.txt","r",stdin);
    // 	freopen("/home/akmittal/Desktop/Competitive Programming/out.txt","w",stdout);
    // #endif

    int n,k;
    cin>>n>>k;
    int a[n];
    f1(i,0,n)
    cin>>a[i];

    long double ans=0.0;
    f1(i,0,k)
    {
    	ans+=((a[i]+1)/2.00);
    }

    long double filans=ans;
    f1(i,k,n)
    {
    	ans-=((a[i-k]+1)/2.00);
    	ans+=((a[i]+1)/2.00);
    	//cout<<a[i]<<endl;
    	filans=max(filans,ans);
    }

    cout<<setprecision(10)<<fixed<<filans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int n, l;
    cin >> n >> l;
    int ans = 0;
    int mn = INF;
    rep(i, n) {
        int L = l+i;
        if (abs(mn) > abs(L)) mn = L;
        ans += L;
    }
    ans -= mn;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <iomanip>
using namespace std;

int main()
{
  string s;
  cin >> s;
  bool y = false;
  if(s[0]=='7'||s[1]=='7'||s[2]=='7') y=true;
  
  if(y) cout << "Yes" << endl;
  else  cout << "No" << endl;
}


Measured memory_bytes: 3628
import java.util.*;

import sun.net.www.content.text.plain;

import java.math.*;
public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double l = (double)n/3;
        System.out.println(BigDecimal.valueOf(l*l*l).toPlainString());
    }       
}






Measured memory_bytes: 23764
// Marcin Knapik
#include<bits/stdc++.h>
#include<unistd.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
 
typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define REP(i, a, b)            for (int i = (a); i <= (b); i++)
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define TRAV(i, n)              for(auto&i:n)
#define beg(x)                  (*(x.begin()))
#define re(x)                   int x; cin >>x;   
#define f                       first
#define s                       second
 
template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }
 
const ll T = 1 << 20;
const ll INF = 1e9 + 7;
// const ll mod = 998244353;
const ll BIG_INF = 1e18 + 7;
const ll  N = 1e6+7;
const int LOG = 17;
 
int n, m, q;
string w;

signed main(){
	boost;
	cin >> n >> m;
	int ans= 0;
	FOR(i, n){
		int temp;
		cin >> temp;
		 ans+= (temp>=m?1:0);
	}
	cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 INF = 1LL<<60;
const ll M = 1000000007;
ll mpow(ll a,ll b){ll res=1;while(b!=0){if(b&1)res=res*a%M;a=a*a%M;b=b>>1;}return res;}
ll mcomb(ll n,ll k){if(k>n/2)return mcomb(n,n-k);ll res=1;for(ll i=0;i<k;i++){res=res*(n-i)%M;res=res*mpow(k-i,M-2)%M;}return res;}
/*template*/

int main()
{
  ll n;string s;cin>>n>>s;
  ll ans=0;
  for(ll i=0;i<n-2;i++){
    if(s.substr(i,3)=="ABC")ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256