akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.IO;

namespace ABC137
{
    class Program2
    {
        static void Main()
        {
            var s = Console.ReadLine().Split(' ').Select(int.Parse);
            var K = s.First();
            var X = s.Skip(1).First();

            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var min = Math.Max(-1000000, X - K + 1);
            var max = Math.Min(1000000, X + K - 1);

            for (int i = min; i < max; i++)
            {
                Console.Write(i + " ");
            }

            Console.WriteLine(max);
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11348
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

int N;
int A ,B;

int main()
{
    cin >> N;
    cin >> A;
    cin >> B;
    cout << min(N * A , B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  bool a=false;
  bool b=false;
  cin>>str;
  if(str[0]=='A'||str[1]=='A'||str[2]=='A'){
    a=true;
  }
  if(str[0]=='B'||str[1]=='B'||str[2]=='B'){
    b=true;
  }
  
  if(a&&b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return(0);
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

typedef struct infant{
	int pos;
	ll a;
}infant;

int main()
{
	int n;
	cin>>n;
	vector<infant> ift(n);
	rep(i,n){
		ll x;
		cin>>x;
		ift[i] = {i+1,x};
	}

	sort(all(ift),
		[&](infant x, infant y){
			return x.a > y.a;
		});


	vector<vector<ll>> dp(n+1,vector<ll>(n+1,0));

	rep(i,n){
		rep(j,n){
			if(i+j>=n) continue;
			dp[i+1][j] = max(dp[i+1][j], dp[i][j] + ift[i+j].a*(abs(ift[i+j].pos-(i+1))));
			dp[i][j+1] = max(dp[i][j+1], dp[i][j] + ift[i+j].a*(abs(ift[i+j].pos-(n-j))));
		}
	}

	ll ans=0;
	rep(i,n+1){
		ans = max(ans,dp[i][n-i]);
	}
	cout<<ans<<endl;

	return 0;
}

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

int main(){
  int a,b=0;
  cin>>a;
  for(int i=0;i<a;i++){
    int c;
    cin>>c;
    if(c%2==0){
      b++;
    }
  }
  cout<<b<<endl;
 
  return 0;
}
   
  
	
	  
	  
	  
	  
	  
	  
     
  
  
  
  
  

  

 
  


 

    
  



Measured memory_bytes: 3092
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int a,b,t;
  cin>>a>>b>>t;
  cout<<floor(t/a)*b;
}


Measured memory_bytes: 256
//
// Created by tac on 2016/10/15.
//

#include <cstdlib>
#include <string>
#include <iostream>

int main() {
    std::string str;

    getline(std::cin, str);

    char r;
    for (auto c: str) {
        if (isupper(c)) {
            r = tolower(c);
        }  else {
            r = toupper(c);
        }
        std::cout << r;
    }
    std::cout << std::endl;

    return EXIT_SUCCESS;
}

Measured memory_bytes: 3184
import java.util.Scanner;

class Calc{

  	byte legs;
  	byte animals;
  
  	public Calc(byte legs, byte animals){
    	this.legs = legs;
      	this.animals = animals;
    }
	
	public String combine(){
    	int base = legs - 2*animals;
      
     	if (base<0||base%2!=0||base/2>animals){
        	return "No";
        }else{
        	return "Yes";
        }
    }

}

class Main{
	
	public static void main(String[] args){
    	
      	Scanner scanner = new Scanner(System.in);
      	String str = scanner.nextLine();
    	String[] input_ = str.split(" ", 0);
      	
      	Calc calc = new Calc(Byte.parseByte(input_[1]), Byte.parseByte(input_[0]));
      
      	System.out.print(calc.combine());
    }

}

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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)2e5 + 9;
vector<int> T[N];
int bit[N];

vector<int> g[2];
vector<int> mod[3];

void dfs(int u, int par){
  g[bit[u]].push_back(u);
  for(auto x : T[u]){
    if(x == par) continue;
    bit[x] = 1 - bit[u];
    dfs(x, u);
  }
}

int ans[N];

int main(){
  fastIO;
  int n;
  cin >> n;
  int u, v;
  for(int i = 1; i < n; i ++ ){
    cin >> u >> v;
    T[u].push_back(v);
    T[v].push_back(u);
  }
  bit[0]=1;
  dfs(1,-1);
  if(g[0].size() > g[1].size()){
    for(int i = 1; i <= n; i ++ )
      bit[i]=1-bit[i];
    swap(g[0],g[1]);
  }
  for(int i = 1; i <= n; i ++ ){
    mod[i % 3].push_back(i);
  }
  if(mod[0].size() >= g[0].size()){
    for(auto x : g[0]){
      ans[x] = mod[0].back();
      mod[0].pop_back();
    }
    for(int i = 1; i <= n; i ++ ){
      if(ans[i] == 0){
        for(int j = 0 ; j < 3; j ++ ){
          if(!mod[j].empty()){
            ans[i]=mod[j].back();
            mod[j].pop_back();
            break;
          }
        }
      }
      cout << ans[i] << " ";
    }
  }
  else{
    for(int i = 1; i <= n; i ++ ){
      if(bit[i] == 0){
        if(!mod[1].empty()){
          cout << mod[1].back() << " ";
          mod[1].pop_back();
        }
        else{
          cout << mod[0].back() << " ";
          mod[0].pop_back();
        }
      }
      else{
        if(!mod[2].empty()){
          cout << mod[2].back() << " ";
          mod[2].pop_back();
        }
        else{
          cout << mod[0].back() << " ";
          mod[0].pop_back();
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 22388
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;

typedef long long ll;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #ifdef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    string str;
    ll k;

    cin>>str;
    cin>>k;

    int len = str.size();

    int cnt = 0, n = -1;
    for(int i = 0; i < len; i++){
        if(str[i] != '1'){
            n = str[i] - 48;
            break;
        }
        else
            cnt++;
    }

    if(k <= cnt || n == -1){
        cout<<"1"<<endl;
    }
    else{
        cout<<n<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define FOR(i,k,n) for((i)=(k);(i)<(n);(i)++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define pb push_back
#define all(a) (a).begin(),(a).end()  //greater<int>()
using namespace std;

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

	if(a==b) cout<<'H'<<endl;

	else cout<<'D'<<endl;
   	return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    ans += (n - 1) / i;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <map>
#include <limits>
using namespace std;
typedef long long ll;

float inf = std::numeric_limits<float>::infinity();
ll mod = 1e9+7;

/* 二次元配列の宣言
  vector<vector<int>> tb;
  tb.resize(H);
  for (size_t i = 0; i < H; i++) {
    tb[i].resize(W);
  }
*/
/*
  A.resize(N);
  for (int i = 0; i < N; i++) {scanf("%d",&A[i]);}
*/

int main(void) {
  int x;
  cin >> x;
  if (x<1200){
    printf("ABC");
  }else{
    printf("ARC");
  }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
accA = [0]*(N+1)
accB = [0]*(N+1)

for i in range(N):
    accA[i+1] = accA[i]+A[i]
    accB[i+1] = accB[i]+B[i]

ans = 0

for i in range(N):
    ans = max(ans, accA[i+1]+accB[N]-accB[i])

print(ans)

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

int main(){
  int k;
  string s,t;
  t = "...";
  
  cin >> k >> s;
  
  if(s.size() <= k)
    cout << s << endl;
  else{
    s = s.erase(k);
    s = s + t;
    cout << s << endl;
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>

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

int main(){
    int N;
    cin >> N;
    string s[N];
    map<string, int> mp;
    int m = 0;
    for(int i = 0; i < N; i++){
         cin >> s[i];
         if(mp.count(s[i]) != 0){
             mp[s[i]]++;
             m = max(m, mp[s[i]]);
         } else {
            mp[s[i]] = 1;
            m = max(m, mp[s[i]]);
         }
    }
    sort(s, s+N);
    int idx = 0;
    while(idx < N){
        if(mp[s[idx]] == m){
            cout << s[idx] << endl;
            idx += m;
        } else {
            idx++;
        }
    }


}


Measured memory_bytes: 26752
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    string s;cin>>s;
    int n=s.size();
    ll now=1;
    ll dp[n+1][13];
    memset(dp,0,sizeof dp);
    dp[n][0]=1;
    rrep(i,n,1){
        rep(k,0,13){
            if(s[i-1]=='?'){
                
                    rep(l,0,10){
                        ll u=k+now*l;
                        u%=13;
                        dp[i-1][u]+=dp[i][k];
                        dp[i-1][u]%=mod;
                    }
                
            }
            else{
                ll u=k+now*(s[i-1]-'0');
                u%=13;
                dp[i-1][u]+=dp[i][k];
                dp[i-1][u]%=mod;
            }
        }
        now*=10;
        now%=13;
    }
    cout<<dp[0][5]<<endl;
}


Measured memory_bytes: 10624
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const toPalindromicNumber = (target: number) => {
  const nums = target.toString().split("");

  return Number(
    `${nums.slice(0, 3).join("")}${nums.slice(0, 2).reverse().join("")}`
  );
};

const main = (input: string[][]) => {
  const [A, B] = input[0].map(Number);

  let answer = Math.floor(B / 100) - Math.floor(A / 100) - 1;

  if (A <= toPalindromicNumber(A)) {
    answer += 1;
  }
  if (B >= toPalindromicNumber(B)) {
    answer += 1;
  }

  return answer;
};

console.log(main(read()));


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

int main(){
    int N;
    cin >> N;
    vector<int> B(N-1);
    for (int i = 0; i < N-1; i++){
        int b;
        cin >> b;
        B.at(i) = b;
    }

    int ans;
    ans = B.at(0);
    for (int i = 1; i < N-1; i++){
        ans += min(B.at(i),B.at(i-1));
    }
    ans += B.at(N-2);

    cout << ans << endl;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=1,a[10000000],b[10000000],c,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> n;
       rep(i,n){cin >> a[i];b[i]=a[i];}
       
       if(n%2==0){
           rep(i,n){
               if(a[i]%2==0){
                   Cout("0");
                   return 0;
               }
           }
       }
       else{
           rep(i,n){
               if(a[i]%2!=0){
                   Cout("0");
                   return 0;
               }
           }
       }
       
       sort(b,b+n);
       reverse(b,b+n);
       rep(i,n-1){
           if(b[i]==0){
               if(b[i]==b[i+1]){
                   Cout("0");
                   return 0;
               }
           }
           else if(b[i]!=b[i+1]){
               Cout("0");
               return 0;
           }
           else{
               i++;
               if(i==n-1){
                   break;
               }
           }
       }
       rrep(i,0,n/2){
           ans*=2;
           ans%=MOD;
       }
       Cout(ans);
return 0;
}


Measured memory_bytes: 3072
import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val graph = Graph(n)

    repeat(n - 1) {
        val (u, v, w) = readLine()!!.split(' ').map { it.toInt() }
        graph.add(u, v, w)
    }

    graph.solve().forEach {
        println(it)
    }
}

private class Graph(val n: Int) {

    private val adjacencyMap = mutableMapOf<Int, MutableMap<Int, Int>>()

    fun add(u: Int, v: Int, w: Int) {
        if (!adjacencyMap.containsKey(u)) {
            adjacencyMap[u] = mutableMapOf()
        }
        adjacencyMap[u]!![v] = w

        if (!adjacencyMap.containsKey(v)) {
            adjacencyMap[v] = mutableMapOf()
        }
        adjacencyMap[v]!![u] = w
    }

    fun solve(): List<Int> {

        val visited = mutableMapOf<Int, Int>()
        val queue: Queue<Int> = ArrayDeque<Int>()

        queue.add(1)
        visited[1] = 0

        while (queue.isNotEmpty()) {
            val e = queue.remove()

            adjacencyMap[e]!!.forEach {
                if (visited.containsKey(it.key)) {
                    return@forEach
                }

                queue.add(it.key)
                visited[it.key] = visited[e]!! + it.value
            }
        }

        return (1..n).map {
            if (visited[it]!! % 2 == 0) 0 else 1
        }
    }

}

Measured memory_bytes: 124136
import statistics
n = int(input())
a = list(map(int, input().split()))

c = [i for i in range(n)]
for i in range(n):
    c[i] = a[i] - i - 1

b = statistics.median(c)
ret0 = 0
ret1 = 0
ret2 = 0
for i in range(n):
    ret0 += abs(a[i] - b - i)
    ret1 += abs(a[i] - b - i - 1)
    ret2 += abs(a[i] - b - i - 2)

print(int(min(ret0, ret1,ret2)))


Measured memory_bytes: 27244
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a[3];
    for(int i=0;i<3;i++){
        cin >> a[i];
    }
    sort(a,a+3);
    if(a[0]==5&&a[1]==5&&a[2]==7)
    {
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {

        in = new BufferedReader(new InputStreamReader(System.in));

        try {
            c = in.read();

            int i = 1;
            while (getToken() == TK_NUM && num != 0) {
                System.out.print("Case ");
                System.out.print(i++);
                System.out.print(": ");
                System.out.println(num);
            }
        } catch (IOException e) {
            System.err.println(e.getMessage());
        }
    }

    private static final int TK_END = 1;
    private static final int TK_NUM = 2;

    private static BufferedReader in;
    private static int c;
    private static int num;

    public static int getToken() throws IOException {
        if (c == -1) {
            return TK_END;
        } else if (Character.isDigit(c)) {
            num = Character.getNumericValue(c);
            while (Character.isDigit(c = in.read()))
                num = num * 10 + Character.getNumericValue(c);
            return TK_NUM;
        }
        while ((c = in.read()) != -1 && !Character.isDigit(c))
            ;
        return getToken();
    }
}

Measured memory_bytes: 32504
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 2010;
char s[SIZE][SIZE];
int v[SIZE][SIZE];
int main(){
    int n,m;
    R(n,m);
    REP(i,n)RS(s[i]);
    REP(i,n){
        for(int j=0,k;j<m;j=k){
            if(s[i][j]=='#'){
                k=j+1;
                continue;
            }
            for(k=j+1;k<m&&s[i][k]=='.';k++);
            REPP(it,j,k)v[i][it]+=k-j-1;
        }
    }
    REP(j,m){
        for(int i=0,k;i<n;i=k){
            if(s[i][j]=='#'){
                k=i+1;
                continue;
            }
            for(k=i+1;k<n&&s[k][j]=='.';k++);
            REPP(it,i,k)v[it][j]+=k-i;
        }
    }
    int an=0;
    REP(i,n)REP(j,m){
        an=max(an,v[i][j]);
    }
    W(an);
    return 0;
}


Measured memory_bytes: 19968
#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const ll INF = 1LL << 60;
ll N, W;
vector<vector<ll>> dp(110, vector<ll>(100010, INF));
ll weight[110], value[110];
int main() {
    cin >> N >> W;
    for (int i = 0; i < N; i++)
    {
        cin >> weight[i] >> value[i];
    }
  
  	dp[0][0] = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= 100010; j++)
        {
            if(j-value[i]>=0){
                chmin(dp[i+1][j], dp[i][j-value[i]]+weight[i]);
            }
            chmin(dp[i+1][j],dp[i][j]);
        }
        
    }
    ll ans = 0;
    for (int i = 0; i < 100010; i++)
    {
        if(dp[N][i]<=W){
            ans = i;
        }
    }
    

    cout << ans << endl;
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<bool>> connected(n, vector<bool>(n));
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    connected.at(a - 1).at(b - 1) = true;
    connected.at(b - 1).at(a - 1) = true;
  }
  vector<int> v(n);
  for (int i = 0; i < n; i++) v.at(i) = i;
  int ans = 0;
  do {
    bool ok = true;
    for (int i = 0; i < n - 1; i++) {
      if (!connected.at(v.at(i)).at(v.at(i + 1))) {
        ok = false;
        break;
      }
    }
    if (ok) ans++;
  } while (next_permutation(v.begin() + 1, v.end()));
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  int a[n+1];
  for(int i=1;i<=n;i++)scanf("%d",&a[i]);
  
  for(int i=k+1;i<=n;i++){
    if(a[i-k]<a[i]){printf("Yes\n");}
    else{printf("No\n");}
  }
  return 0;
}


Measured memory_bytes: 2864
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int p;
  cin>>p;
  
  Int t=1;
  Int k=2;
  vector<Int> ans;
  while(p){
    ans.emplace_back((p*t)%k);
    if(ans.back()<0) ans.back()+=k;
    p-=ans.back()*t;
    p/=k;
    t*=-1;
  }
  if(ans.empty()) ans.emplace_back(0);
  reverse(ans.begin(),ans.end());
  for(Int x:ans) cout<<x;
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		Map<String, Integer> sen = new HashMap<>();
		int max = 0; //単語の登場回数のカウント変数
        int count = 0; //出力が1単語の時の例外処理用変数
        int max_width = 0; //最長の長さ
		String most_frequent_word = null; //再頻出ワード
		String longest_word = null; //最長単語

		while(stdIn.hasNext()){
			String word = stdIn.next();
            
            if(count == 0){
            	most_frequent_word = word; //出力が1単語の際のための処理
            }

			if(max_width < word.length() ){
				max_width = word.length();
				longest_word = word;
			}

			if(sen.get(word) == null){ //入力された単語がなかったら、
                
                sen.put(word, 1); //新しく、箱を作って
                
            }else{
            	int v = sen.get(word) + 1;
                sen.put(word, v);

                if(max <= v){
                	most_frequent_word = word;
                    max = v;
                }

            }
            
            
            count++;
			 
		}
        System.out.println(most_frequent_word + " " + longest_word);
       
		stdIn.close();
	}

}


Measured memory_bytes: 26200
#![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 v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut s = vec![vec![]; m];
    for i in 0..m {
        s[i] = read_vec::<usize>()
            .into_iter()
            .skip(1)
            .map(|x| x - 1)
            .collect::<Vec<_>>();
    }
    let p = read_vec::<usize>();
    let mut ans = 0;
    'outer: for state in 0..1 << n {
        for i in 0..m {
            let mut count = 0;
            for &ss in s[i].iter() {
                if (state >> ss) & 1 == 1 {
                    count += 1;
                }
            }
            if count % 2 != p[i] {
                continue 'outer;
            }
        }
        ans += 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: 2156
#include <bits/stdc++.h>
using namespace std;

int n,m,h,k;
int s[1001],score[1001];
pair<int,int> ab[100001]; // (height,bar)
int bars[10001];
pair<int,int> swp[100001];

int main(){
	while(scanf("%d%d%d%d",&n,&m,&h,&k), n != 0){
		for(int i = 1; i <= n; i++){
			scanf("%d",&s[i]);
			bars[i] = i;
		}
		for(int i = 0; i < m; i++){
			scanf("%d%d",&ab[i].second,&ab[i].first);
		}
		sort(ab,ab+m);
		//end init

		for(int i = 0; i < m; i++){
			int ai = ab[i].second;
			int v1 = bars[ai];
			int v2 = bars[ai+1];
			swp[i] = make_pair(v1,v2);
			bars[ai] = v2;
			bars[ai+1] = v1;
		}
		for(int i = 1; i <= n; i++){
			score[bars[i]] = s[i];
		}
		int df = 0;
		int gain = 0;
		for(int i = 1; i <= k;i++){
			df += score[i];
		}
		for(int i = 0; i < m; i++){
			int i1 = swp[i].first;
			int i2 = swp[i].second;
			int g;
			if(i1 <= k && i2 > k){
				g = score[i2] - score[i1];
			}
			else if(i1 > k && i2 <= k){
				g = score[i1] - score[i2];
			}
			gain = min(gain,g);
		}
		printf("%d\n",gain+df);
		
	}
	return 0;
}



Measured memory_bytes: 4688
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <iomanip>
#include <time.h>
using namespace std;

typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<char> c(N);
    int rcnt=0,wcnt=0;
    for(int i=0; i<N; i++){
        cin >> c[i];
        if(c[i]=='R') rcnt++;
        else wcnt++;
    }

    int ans1=0,ans2=0;
    for(int i=0; i<rcnt; i++){
        if(c[i]=='W')ans1++;
    }
    
    for(int i=0; i<wcnt; i++){
        if(c[N-1-i]=='R')ans2++;
    }

    cout << min(ans1,ans2) << endl;

    
    

    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define REP1(i, n) for(ll i = 1; i <= n; i++)
#define REPR1(i, n) for(ll i = n; i >= 1; i--)
#define FOR1(i, m, n) for(ll i = m; i <= n; i++)
const ld INF = 1e9+123;
#define VEC(type,A,N) vector<type> A(N+10)
#define VECi(type,A,N,i) vector<type> A(N+10,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N+10,vector<type>(M+10))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N+10,vector<type>(M+10,i))
#define ALL(v) v.begin(), v.end()
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    ll N;
    cin>>N;
    vector<ld> v(N);
    ll t=1;
    REP(i,N){
        cin>>v[i];
        t*=2;
    }
    sort(ALL(v),std::greater<ld>());
    ll tt=t/2,ttt=t/4;
    ld sum=0;
    REP(i,N){
        sum+=ttt*v[i];
        ttt/=2;
        if(ttt<2)ttt=1;
    }
    cout<<fixed<<setprecision(10)<<sum/tt;
    //cout<<fixed<<setprecision(32)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> v[100000];
ll n,a[100000];
ll c[100000];
bool ans=1;

ll dfs(int p,int pr){
  if(v[p].size()==1&&pr!=-1)return a[p];
  
  vector<ll> vv;
  for(int i=0;i<v[p].size();i++){
    int np=v[p][i];
    if(np!=pr)vv.push_back(dfs(np,p));
  }

  ll s=0,mx=0;
  for(int i=0;i<vv.size();i++)s+=vv[i],mx=max(mx,vv[i]);

  ll x=s-a[p];
  ll m;
  if(s>=mx*2)m=s/2;
  else m=s-mx;
  if(x>m||x<0)ans=0;

  if(pr==-1){
    if(s!=a[p])ans=0;
  }
  
  return s-2*x;
}


int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0,a,b;i<n-1;i++){
    cin>>a>>b;
    a--,b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  int m=0;
  for(int i=0;i<n;i++)
    if(v[i].size()==1)m=i;
    
  dfs(m,-1);
  cout<<(ans?"YES":"NO")<<endl;
  return 0;
}


Measured memory_bytes: 17408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int[] data = new int[3];
        data[0] = scan.nextInt();
        data[1] = scan.nextInt();
        data[2] = scan.nextInt();
        int sum = data[0] + data[1] + data[2];
        int M = Math.max(Math.max(data[0], data[1]), data[2]);
        int X = 0;
        if (sum % 2 == 0) {
            X = M % 2 == 0 ? M : M + 1;
        } else {
            X = M % 2 == 0 ? M + 1 : M;
        }
        System.out.println((3 * X - sum) / 2);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(void){
   int N;
   cin >> N;
   vector<int> a(N);
   for(int i = 0; i < N; i++) cin >> a[i];
   int j = 1;
   int Count = 0;
   for(int i = 0; i < N; i++){
       if(a[i] != j) Count++;
       else j++;
   }
   if(N == Count) cout << -1 << endl;
   else cout << Count << endl;
}


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

int main() {
  int n;
  cin >> n;
  string s[n];
  int c0=0,c1=0,c2=0,c3=0;
  for(int i=0;i<n;i++){
    cin >> s[i];
    if(s[i]=="AC")	c0++;
    if(s[i]=="WA")	c1++;
    if(s[i]=="TLE")	c2++;
    if(s[i]=="RE")	c3++;
  }
  cout << "AC x "<< c0 << endl
    << "WA x " << c1 << endl
    << "TLE x " << c2 << endl
    << "RE x " << c3 <<endl;

  
  return 0;
}


Measured memory_bytes: 6748
n, m = gets.split.map(&:to_i)
former = (1..m).to_a
latter = (m + 1..2 * m + 1).to_a
rest = m
while rest > 0 && former.size > 1
  puts "#{former.shift} #{former.pop}"
  rest -= 1
end
while rest > 0 && latter.size > 1
  puts "#{latter.shift} #{latter.pop}"
  rest -= 1
end


Measured memory_bytes: 16456
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//                       _oo0oo_                         //
//                      o8888888o                        //
//                      88" . "88      ------ hzt1       //
//                      (| -_- |)                        //
//                      0\  =  /0                        //
//                    ___/`---'\___                      //
//                  .' \|     |// '.                     //
//                 / \|||  :  |||// \                    //
//                / _||||| -:- |||||- \                  //
//               |   | \  -  /// |     |                 //
//               | \_|  ''\---/''  |_/ |                 //
//               \  .-\__  '-'  ___/-. /                 //
//             ___'. .'  /--.--\  `. .'___               //
//          ."" '<  `.___\_<|>_/___.' >' "".             //
//         | | :  `- \`.;`\ _ /`;.`/ - ` : | |           //
//         \  \ `_.   \_ __\ /__ _/   .-` /  /           //
//     =====`-.____`.___ \_____/___.-`___.-'=====        //
//                       `=---='                         //
//                                                       //
//                                                       //
//     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~       //
//                                                       //
//                 God-He Bless All.                     //
//           This Code Will Never Explode.               //
//                                                       //
//                                                       //
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<vector>
#define pb push_back
#define mp make_pair
#define xx first
#define yy second
#define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++)
#define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--)
using namespace std;
const int Size=1<<16;
char buffer[Size],*head,*tail;
inline char Getchar() {
    if(head==tail) {
        int l=fread(buffer,1,Size,stdin);
        tail=(head=buffer)+l;
    }
    if(head==tail) return -1;
    return *head++;
}
inline int read() {
    int x=0,f=1;char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=x*10+c-'0';
    return x*f;
}
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=200010;
const int mod=1000000007;
int fac[maxn],ifac[maxn];
int calc(int a,int b) {return (ll)fac[a+b]*ifac[b]%mod*ifac[a]%mod;}
int main() {
	int n=read(),m=read(),a=read(),b=read();
	ifac[0]=ifac[1]=fac[0]=1;
	rep(i,2,n+m) ifac[i]=(ll)(mod-mod/i)*ifac[mod%i]%mod;
	rep(i,1,n+m) fac[i]=(ll)fac[i-1]*i%mod,ifac[i]=(ll)ifac[i-1]*ifac[i]%mod;
	int ans=calc(n-1,m-1);
	rep(j,1,b) (ans-=(ll)calc(n-a-1,j-1)*calc(a-1,m-j)%mod)%=mod;
	(ans+=mod)%=mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1664
from itertools import combinations_with_replacement

n, m, q = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(q)]

temp = list(combinations_with_replacement([i for i in range(1,m+1)],n))

ans = 0

for a_temp in temp:
    ans_temp = 0
    for i in range(q):
        if a_temp[a[i][1]-1] - a_temp[a[i][0]-1] == a[i][2]:
            ans_temp += a[i][3]
    if ans < ans_temp:
        ans = ans_temp
        
print(ans)

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int h,w;
    cin>>h>>w;
    string s[30][30];
    rep(i,0,h){
        rep(j,0,w)cin>>s[i][j];
    }
    
    rep(i,0,h){
        rep(j,0,w){
            if(s[i][j]=="snuke")cout<<char('A'+j)<<i+1<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<bitset>
#define lson node<<1,st,mid
#define rson node<<1|1,mid+1,ed
#define mem(a,x) memset(a,x,sizeof(a))
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define lowbit(x) x&(-x)
#define up(i,x,y) for(long long i=x;i<y;i++)
#define down(i,x,y) for(long long i=x;i>=y;i--)
#define in freopen("in.txt","r",stdin)
#define out freopen("out.txt","w",stdout)  
#define mod(x) (x%1000000007)
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
const ll INF = 0x3f3f3f3f;
const ll maxn = 1e6 + 5;
const ll N=1e3+5;
const double pi = acos(-1.0);
const double eps=1e-9;
using namespace std;

ll phi(ll x)
{
	ll res=x;
	for(int i=2;i*i<=x;i++)
	{
		if(x%i==0)
		{
			res=res/i*(i-1);
			while(x%i==0)
				x/=i;
		}
	}
	if(x>1)
		res=res/x*(x-1);
	return res;
}
ll ksm(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}
int main()
{
        ll l;
    cin>>l;
		ll mod=l/gcd(7ll,l)*9ll;
		ll p=phi(mod);
		ll res=1e18;
		for(ll x=1;x*x<=p;x++)
		{
			if(p%x!=0) continue;
		if(ksm(10,x,mod)==1) res=min(res,x);
		if(ksm(10,p/x,mod)==1) res=min(res,p/x);
		}
		if(res==1e18)
			cout<<"-1"<<endl;
		else
			cout<<res<<endl;

    
    
    
    
    
    
}

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

using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
 cin>>t;
 if (t % 10 == 7 || (t / 10) % 10 == 7 || (t / 100) % 10 == 7)cout<<"Yes";
 else cout<<"No";

   return 0;
}

Measured memory_bytes: 3532
DEBUG = False

N = int(input())
LEAVES = [int(i) for i in input().split()]

ranges_num_nodes = [[0 for _ in range(2)] for _ in range(N + 1)]
ranges_num_nodes[N][0] = LEAVES[N]
ranges_num_nodes[N][1] = LEAVES[N]

if DEBUG:
    print("ranges_num_nodes: {}".format(ranges_num_nodes))

for depth in range(N, 0, -1):
    ranges_num_nodes[depth-1][0] = LEAVES[depth-1] + (ranges_num_nodes[depth][0] + 1) // 2
    ranges_num_nodes[depth-1][1] = LEAVES[depth-1] + ranges_num_nodes[depth][1]

if DEBUG:
    print("ranges_num_nodes: {}".format(ranges_num_nodes))

num_nodes = [0] * (N + 1)
num_nodes[0] = 1

if DEBUG:
    print("num_nodes: {}".format(num_nodes))

for depth in range(N):
    num_nodes[depth+1] = min((num_nodes[depth] - LEAVES[depth]) * 2, ranges_num_nodes[depth+1][1])

if DEBUG:
    print("num_nodes: {}".format(num_nodes))

for depth in range(N+1):
    if num_nodes[depth] < ranges_num_nodes[depth][0]:
        print(-1)
        break
else:
    print(sum(num_nodes))


Measured memory_bytes: 662964
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// lazy version

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

///
/// # Examples
///
/// # integers
/// input! { n: usize, m: usize, ... }
///
/// # array
/// input! { n: usize, v: [i32; n], }
///
/// # matrix
/// input! { n: usize, m: usize, mat: [[]] }
///
/// # string
/// input! { s: chars }

fn main() {
    input!{
        k: usize
    }
    let ans = if k % 2 == 0 {
        (k/2) * (k/2)
    } else {
        (k / 2 + 1) * (k/2)
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
typedef long long                   ll;
typedef long double                 ld;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<double,double>         pdd;
typedef pair<ld,ld>                 pld;
typedef pair<string , string>       pss;
#define pb(x)                       push_back(x)
#define ts(x)                       to_string(x)
#define ti(x)                       stoi(x)
#define all(x)                      (x).begin(),(x).end()
#define F                           first
#define S                           second
#define Mp                          make_pair
#define tab                         '\t'
#define sep                         ' '
#define mine(v)                     *min_element(all(v))
#define maxe(v)                     *max_element(all(v))
#define error(x)                    cerr << #x << " = " << x << endl
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io                     freopen("in.txt" , "r+" , stdin) ; freopen("out.txt" , "w+" , stdout);
#define endl                        "\n"
inline ll input(){ll n; cin >> n ; return n;}
ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int MOD2 = 998244353;
const ll INF = 8e18;
int a[MAXN],b[MAXN],c[MAXN];
int dp[MAXN][3];
int n;

int main()
{
    cin >> n;
    for (int i = 0; i < n;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    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] = max(dp[i-1][1],dp[i-1][2]) + a[i];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + b[i];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + c[i];
    }
    int ans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    cout << ans;
}


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

using namespace std;
#define int long long
#define double long double
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
#define FI first
#define SE second
typedef pair<int, int> pii;
#define l_b lower_bound
#define u_b upper_bound

int A, B, C, D, E, F;

signed main() {
    cin >> A >> B >> C >> D >> E >> F;
    double ma = -INF;
    int maw, mas;
    rep(a, 10000) {
        if (a * A * 100 > F)break;
        rep(b, 10000) {
            if (a * A * 100 + b * B * 100 > F)break;
            rep(c, 10000) {
                if (a * A * 100 + b * B * 100 + c * C > F)break;
                rep(d, 10000) {
                    if (a * A * 100 + b * B * 100 + c * C + d * D > F)break;
                    if (c * C + d * D > E * (a * A + b * B))continue;
                    double no = 100. * (c * C + d * D) / (100 * (a * A + b * B) + c * C + d * D);
                    if (no > ma) {
                        maw = 100 * (a * A + b * B) + c * C + d * D;
                        mas = c * C + d * D;
                        ma = no;
                    }
                }
            }
        }
    }
    cout << maw << " " << mas << endl;
}

Measured memory_bytes: 256
using System;

namespace cont01
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, k, x, y, result = 0;
            n = int.Parse(Console.ReadLine());
            k = int.Parse(Console.ReadLine());
            x = int.Parse(Console.ReadLine());
            y = int.Parse(Console.ReadLine());
            if (n < k)
            {
                k = n;
            
                for (int i = 0; i < k; i++)
                {
                
                    result += x;
                }
            }
            else
            {
                for (int i = 0; i < k; i++)
                {

                    result += x;
                }
            }
            for (int i = k; i < n; i++)
            {

                result += y;
            }
            Console.WriteLine(result);

        }
    }
}

Measured memory_bytes: 27152
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut r: usize = 0;
    let mut g: usize = 0;
    let mut b: usize = 0;

    for c in &s {
        match c {
            'R' => r+=1,
            'G' => g+=1,
            'B' => b+=1,
            _ => {}
        }
    }

    let mut ans = r * g * b;
    for i in 0..n {
        for j in i+1..n {
            let k = j + (j - i);
            
            if k < n && s[i] != s[j] && s[i] != s[k] && s[j] != s[k] {
                ans -= 1;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2184
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main()
{
    int N, L;
    cin >> N >> L;
    vector<int> apple;
    for (int i = 1; i <= N; ++i){
        apple.push_back(L + i - 1);
    }

    int val = 1<<30;
    int pie = 0;

    int acc = accumulate(apple.begin(),apple.end(),0);
    for (int i = 0; i < N; ++i){
        int accc = acc - apple[i];
        if( abs(accc-acc) < val){
            val = abs(accc - acc);
            pie = accc;
        }
    }

    cout << pie << endl;

    return 0;
}

Measured memory_bytes: 256