akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::vector<std::string> image;
	std::string buf;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		image.clear();
		image.push_back(buf);
		for(int i = 0; i < 7; i++){
#if INPUT_FROM_FILE
			std::getline(ifs, buf);
#else
			std::getline(std::cin, buf);
#endif
			
			image.push_back(buf);
		}
#if INPUT_FROM_FILE
		std::getline(ifs, buf);
#else
		std::getline(std::cin, buf);
#endif

		int w = 8;
		int h = 8;
		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				if(image[y][x] == '1'){
					//A
					if(x < w - 1 && y < h - 1 && image[y][x + 1] == '1' && image[y + 1][x] == '1' && image[y + 1][x + 1] == '1'){
						std::cout << "A" << std::endl;
						y = h;
						break;
					}
					//B
					else if(y < h - 3 && image[y + 1][x] == '1' && image[y + 2][x] == '1' && image[y + 3][x] == '1'){
						std::cout << "B" << std::endl;
						y = h;
						break;
					}
					//C
					else if(x < w - 3 && image[y][x + 1] == '1' && image[y][x + 2] == '1' && image[y][x + 3] == '1'){
						std::cout << "C" << std::endl;
						y = h;
						break;
					}
					//D
					else if(x >= 1 && y < h - 2 && image[y + 1][x] == '1' && image[y + 1][x - 1] == '1' && image[y + 2][x - 1] == '1'){
						std::cout << "D" << std::endl;
						y = h;
						break;
					}
					//E
					else if(x < w - 2 && y < h - 1 && image[y][x + 1] == '1' && image[y + 1][x + 1] == '1' && image[y + 1][x + 2] == '1'){
						std::cout << "E" << std::endl;
						y = h;
						break;
					}
					//F
					else if(x < w - 1 && y < h - 2 && image[y + 1][x] == '1' && image[y + 1][x + 1] == '1' && image[y + 2][x + 1] == '1'){
						std::cout << "F" << std::endl;
						y = h;
						break;
					}
					else{
						std::cout << "G" << std::endl;
						y = h;
						break;
					}
				}
			}
		}
	}

	return 0;
}


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

int main()
{
    int n;
    string b;
    int bn[4]={0};
    while(cin>>n)
    {
        cin.ignore();
        cin>>b;
        if(b=="A")bn[0]++;
        if(b=="B")bn[1]++;
        if(b=="AB")bn[2]++;
        if(b=="O")bn[3]++;
    }
    for(int i=0;i<4;++i)cout<<bn[i]<<endl;
    return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
int n,ai[3][101];
int dp[3][101];

int fun(int i,int j)
{
    if(i>=2||j>=n)return 0;
    if(dp[i][j]!=-1)return dp[i][j];

    return dp[i][j]=max(fun(i+1,j),fun(i,j+1))+ai[i][j];
}

int main()
{
    cin>>n;
    for(int i=0; i<2; i++)
    {
        for(int j=0; j<n; j++)scanf("%d", &ai[i][j]);
    }
    memset(dp,-1,sizeof dp);

    printf("%d\n",fun(0,0));
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
vector<int> dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vector<int> dy = {-1, 0, 1, -1, 1, -1, 0, 1};

const ll INF = 1e18;

int pow2(int x) {
    int res = 1;
    while (x--) res *= 2;
    return res;
}

int main () {
    int n; cin >> n;
    vector<ll> x(n), y(n), p(n);
    rep(i, n) cin >> x[i] >> y[i] >> p[i];

    vector<vector<ll>> dist_x(n, vector<ll> (n)), dist_y(n, vector<ll> (n));
    rep(i, n) rep(j, n) {
        dist_x[i][j] = dist_x[j][i] = abs(x[i] - x[j]);
        dist_y[i][j] = dist_y[j][i] = abs(y[i] - y[j]);
    }

    vector<vector<ll>> ver(1<<n, vector<ll> (n)), hor(1<<n, vector<ll> (n));
    rep(i, 1<<n) {
        vector<int> c;//路線通す都市
        rep(j, n) {
            if ((i >> j) & 1) c.push_back(j);
        }
        rep(j, n) {
            {
                ll cost = min(abs(x[j]) * p[j], abs(y[j]) * p[j]);
                for (int q : c) {
                    cost = min(cost, abs((x[j] - x[q]) * p[j]));
                }
                ver[i][j] = cost;
            }
            {
                ll cost = min(abs(x[j]) * p[j], abs(y[j]) * p[j]);
                for (int q : c) {
                    cost = min(cost, abs((y[j] - y[q]) * p[j]));
                }
                hor[i][j] = cost;
            }
            
        }
    }

    vector<ll> ans(n+1, INF);
    vector<ll> zero(n);
    rep(i, n) zero[i] = min(abs(x[i]), abs(y[i]));
    for (int i = 0; i < (1 << n); i++) {
        int k = _popcnt32(i);
        vector<int> city;
        rep(j, n) {
            if ((i >> j) & 1) city.push_back(j);
        }
        for (int j = 0; j < (1 << k); j++) {
            int _ver = 0, _hor = 0;
            rep(l, k) {
                if ((j >> l) & 1) _ver += pow2(city[l]);
                else _hor += pow2(city[l]);
            }
            ll cost = 0;
            rep(l, n) {
                cost += min(ver[_ver][l], hor[_hor][l]);

            }
            ans[k] = min(ans[k], cost);
            /*
            vector<ll> cnt = zero;
            rep(l, n) {
                rep(m, k) {
                    if ((j >> m) & 1) cnt[l] = min(cnt[l], dist_x[l][city[m]]);
                    else cnt[l] = min(cnt[l], dist_y[l][city[m]]);
                }
                cnt[l] *= p[l];
            }
            ll s = 0;
            rep(l, n) s += cnt[l];
            ans[k] = min(ans[k], s);
            */
        }
    }
    for (int k = 0; k <= n; k++) cout << ans[k] << endl;
    return 0;
}

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

int n, m;
string s;
// n,m
int memo[130][13] = {0};
//現在の状態がvのときに、最悪残り手数がどうなっているか(int)のメモ
map<vector<int>, int> mp;

int solve(vector<int> now, int asked);

int main() {
  int i, j;
  while(1) {
    vector<int> start;
    cin >> m >> n;
    if(m + n == 0) break;
    for(i = 0; i < n; ++i) {
      cin >> s;
      for(j = 0; j < m; ++j) memo[i][j] = s[j] - '0';
    }
    for(i = 0; i < n; ++i) start.push_back(i);
    cout << solve(start, 0) << endl;
    mp.erase(mp.begin(), mp.end());
  }
  return 0;
}

int solve(vector<int> now, int asked) {
  //既に探索済み
  // if(mp.find(now) != mp.end()) return mp[now];
  //特定できたら戻る(手数はもちろん0)
  if(now.size() == 1) {
    mp[now] = 0;
    return 0;
  }
  int ans = 1000000;
  //調べる
  for(int i = 0; i < m; ++i) {
    //質問済みならcontinue
    if((asked & (1 << i)) == (1 << i)) continue;
    vector<int> yes, no;
    int dummy = -1;
    // yesとnoにわける
    for(int j = 0; j < n; ++j) {
      //現時点の範囲外なら無視
      if(find(now.begin(), now.end(), j) == now.end())
        continue;
      //メモを参照
      if(memo[j][i])
        yes.push_back(j);
      else
        no.push_back(j);
    }
    // yes側でまだ残ってるものがあり、未探索なら再帰
    if(yes.size() > 0 && yes.size() != now.size()) {
      if(mp.find(yes) == mp.end())
        mp[yes] = solve(yes, asked + (1 << i));
      dummy = max(dummy, mp[yes]);
    }
    // no側も同様
    if(no.size() > 0 && no.size() != now.size()) {
      if(mp.find(no) == mp.end())
        mp[no] = solve(no, asked + (1 << i));
      dummy = max(dummy, mp[no]);
    }
    if(dummy != -1) ans = min(ans, dummy);
  }
  return ans+1;
}


Measured memory_bytes: 5320
N=gets.chomp.to_i
A=gets.chomp
S=A.split(//)
L=S.length
X=nil
F=Array.new()
for j in 0..L-1 do #convert S to binary array
	if S[j]=="o" then
		S[j]=0;
	else
		S[j]=1;
	end
end
for i in 0..3 do
	if i%2==0 then #0 is sheep 1 is wolf
		F[0]=0 #F will be answer
	else
		F[0]=1
	end
	if i/2>=1 then
		F[1]=0
	else
		F[1]=1
	end
	for j in 2..L-1 do
		F[j]=(F[j-2]+S[j-1]+F[j-1])%2
	end
	if F[0]==(F[L-2]+S[L-1]+F[L-1])%2 then
		if F[1]==(F[L-1]+S[0]+F[0])%2 then
			X=Marshal.load(Marshal.dump(F))  #X is answer
		end
	end
end
if X==nil then
	print -1
else
	for i in 0..L-1 do
		if X[i]==0 then
			print "S"
		else
			print "W"
		end
	end
end
		

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

int main() {
  int k, s;
  int answer = 0;
  cin >> k >> s;
  for(int i = 0; i <= k; i++) {
    for (int j = i; j <= k; j++) {
      for (int l = j; l <= k; l++) {
	if(i + j + l == s) {
	  if (i == j && j == l) {
	    answer += 1;
	  }
	  else if (i == j ||
		   j == l ||
		   k == i) {
	    answer += 3;
	  }
	  else {
	    answer += 6;
	  }
	}
      }
    }
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
a = list(map(int, input().split()))
a = [-ai for ai in a]
a.sort()
for i in range(M):
    tmp = heapq.heappop(a)
    tmp = (tmp+1)//2
    heapq.heappush(a, tmp)

print(-sum(a))

Measured memory_bytes: 14180
u[];D(s,v){int i,r;if(!s)return!v;if(v<0||v>s*-~s*5)return 0;for(r=i=0;i<=9;++i)!u[i]?u[i]=1,r+=D(s-1,v-i*s),u[i]=0:0;return r;}main(n,v){while(~scanf("%d%d",&n,&v))printf("%d\n",D(n,v));exit(0);}

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

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll c = a + b;
    cout << (n / c) * a + min(n % c, a) << endl;
    return 0;
}

Measured memory_bytes: 256
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int x = c - a, y = d - b;
  string res;
  res += string(x, 'R') + string(y, 'U') + string(x, 'L') + string(y, 'D');
  res += "L" + string(y + 1, 'U') + string(x + 1, 'R') + string("D");
  res += "R" + string(y + 1, 'D') + string(x + 1, 'L') + string("U");
  cout << res << endl;
}


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

using namespace std;

typedef long long ll;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

const int inf = 1e9 + 7;
const int mod = 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}

inline int mul(int a, int b) {
  return (a * (ll) b) % mod;
}

inline int pw(int x, int n) {
  int res = 1;
  while (n > 0) {
    if (n % 2) {
      res = mul(res, x);
      n--; 
    } else {
      x = mul(x, x);
      n /= 2;
    }
  }
  return res;
}

const int N = 1e5 + 7;

ll dp[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, mx;
  cin >> n >> mx;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = mx; j >= 0; j--) {
      if (j + a <= mx) {
        dp[j + a] = max(dp[j + a], dp[j] + b);
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i <= mx; i++) {
    ans = max(ans, dp[i]);
  }
  cout << ans << '\n';
  return 0;
}

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

int main() {
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    int ans;
    if(X>=Y){
        ans=min(A*X+B*Y,Y*2*C+(X-Y)*A);
        ans=min(ans,X*C*2);
    }
    else{
        ans=min(A*X+B*Y,X*2*C+(Y-X)*B);
        ans=min(ans,Y*2*C);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define mod (int)1000000007
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = DBL_EPSILON;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
int n, a[55], b[55];
bool used[55];
vector<int> ans;
bool check() {
	rep(i, n) {
		fill(used, used + 51, false);
		used[a[i]] = true;
		for (int j = a[i]; j >= 1; j--) {
			for (int k : ans)used[j % k] |= used[j];
		}
		if (!used[b[i]])return false;
	}
	return true;
}
void func(int ma) {
	REP(i, ma - 1) {
		if (check()) {
			rep(j, ans.size()) {
				if (ans[j] < i - 1) {
					ans.erase(ans.begin() + j);
					j--;
				}
			}
			if (i > 2)func(i - 1);
			return;
		}
		ans.push_back(i);
	}
	if (!check()) {
		cout << -1 << endl;
		exit(0);
	}
	rep(j, ans.size()) {
		if (ans[j] < ma - 1) {
			ans.erase(ans.begin() + j);
			j--;
		}
	}
	if (ma > 2)func(ma - 1);
}
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	func(51);
	int res = 0;
	for (int i : ans) {
		res += 1LL << i;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,K,Q;
  cin>>N>>K>>Q;
  vector<int>A(N,K-Q);
  for(int i=0;i<Q;i++){
    int a;
    cin>>a;
    a--;
    A.at(a)++;
  }
  for(int i=0;i<N;i++){
    if(A.at(i)<=0){
      cout<<"No"<<endl;
    }
    else{
      cout<<"Yes"<<endl;
    }
  }
}
  

Measured memory_bytes: 3720
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n - 1; i++) {
            int num = sc.nextInt() - 1;
            array[num]++;
        }
        
        for (int i = 0; i < n; i++) {
            System.out.println(array[i]);
        }
    }
}


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

public class Main {

    public static void main(String[] args) throws Exception{

        FastReader fs = new FastReader();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int x = fs.nextInt();
        int y= fs.nextInt();int z = fs.nextInt();
        out.println(z+" "+x+" "+y);




        out.close();
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


Measured memory_bytes: 20564
N,M = map(int,input().split())
bulbs = []
for _ in range(M):
  bulbs.append(list(map(int,input().split())))
P = list(map(int,input().split()))
res = 0
for i in range(1<<N):
  on = []
  for j in range(N):
    if (i>>j)&1:
      on.append(j)

  ok = True
  for i,b in enumerate(bulbs):
    b = [ k-1 for k in b[1:] ]
    p = P[i]
    o = 0
    for s in on:
      if s in b: o += 1
    if o%2 != p:
      ok = False
      break

  if ok:
    res += 1

print(res)


Measured memory_bytes: 43740
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll k=0,a=0,b=0;
    cin>>k>>a>>b;
    for(ll i=a;i<=b;++i){
        if(i%k==0){
            cout<<"OK";
            return 0;
        }
    }
    cout<<"NG";
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 200001;

int main(){
    int a, b, c;
    scanf("%d%d%d",&a, &b, &c);
    swap(a, b);
    swap(a, c);
    printf("%d %d %d\n", a, b, c);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c;
    char op;
    cin>>a>>op>>b;
    while(op!='?'){
        if(op == '+'){
            c=a+b;
        }else if(op == '-'){
            c=a-b;
        }else if(op == '*'){
            c=a*b;
        }else if(op == '/'){
            c=a/b;
        }
        cout<<c<<endl;
        cin>>a>>op>>b;
    }
}


Measured memory_bytes: 3088
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N,K;
	cin >> N >> K;
	VI A[2];
	A[0].resize(N + 2, 0);
	A[1].resize(N + 2, 0);
	for (int n = 1; n <= N; n++)cin >> A[1][n];
	int last = -1;
	for (int k = 0; k < K; k++) {
		int t = k % 2;
		int rev = 1 - t;
		for (int n = 0; n <= N + 1; n++)A[t][n] = 0;
		for (int n = 1; n <= N; n++) {
			A[t][max(1, n - A[rev][n])]++;
			A[t][min(N + 1, n + A[rev][n] + 1)]--;
		}
		bool nonNflag = false;
		for (int n = 1; n <= N; n++) {
			A[t][n] += A[t][n - 1];
			if (A[t][n] != N)nonNflag = true;
		}
		last++;
		if (!nonNflag)break;
	}
	for (int n = 1; n <= N; n++) {
		cout << A[last & 1][n] << " ";
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 4348
N = int(input())
A = list(map(int,input().split()))
dls = []
A.sort()
A.reverse()
now = 0
for i in range(N-1):
  if now >= N-1:
    break
  else:
    if A[now] == A[now+1]:
      dls.append(A[now])
      now += 2
    else:
      now += 1
if len(dls) >= 2:
  print(dls[0]*dls[1])
else:
  print(0)


Measured memory_bytes: 14252
/**
 *  author: nayakashutosh9
 *	[2020-09-22 19:29]
**/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define modd 998244353
#define inf 1e18
#define ff first
#define ss second
#define pb push_back
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update> pbds;
const int N = 300005;
/*******************************************************/


void solve() {
	int n; cin >> n;
	vi a(n);
	for (int i = 1; i <= n; i++) cin >> a[i];
	map<int, set<int>> m;
	for (int i = 1; i <= n; i++) {
		m[a[i]].insert(i);
	}
	for (int i = 1; i <= n; i++) {
		if (m.count(i)) cout << sz(m[i]) << endl;
		else cout << "0\n";
	}
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int T = 1;
	// cin >> T; cin.ignore();
	for (int i = 1; i <= T; i++) {
		// cout << "Case #" << i << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 33036
<?php
list($n, $k) = explode(" ", trim(fgets(STDIN)));
$numbers = explode(" ", trim(fgets(STDIN)));
$dp = [0];
for($i=0; $i<$n; $i++){
	for($j=1; $j<=$k; $j++){
		$cost = $dp[$i] + abs($numbers[$i+$j] - $numbers[$i]);
		if(!isset($dp[$i+$j])){
			$dp[$i+$j] = $cost;
		}else{
			if($cost<$dp[$i+$j]){
				$dp[$i+$j] = $cost;
			}
		}
	}
}

echo $dp[$n-1] . "\n";


Measured memory_bytes: 18932
# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N, X, T = map(int, input().split())

val = (N + X - 1) // X
print(val * T)


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

#define ll long long

int main()
{
    int n,a,cnt=0,i,ev=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a;
        if(a%2==0)
        {
            ev++;
            if(a%3==0||a%5==0)
                cnt++;
        }
    }
    if(cnt!=ev)
        cout<<"DENIED\n";
    else
        cout<<"APPROVED\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>

#define div1 1000000007

using namespace std;

int main(void)
{
    string S;
    long long K, i, N;

    cin >> S >> K;

    N = S.size();

    for(i=0; i<K; i++){
        if(S[i] != '1'){
            cout << S[i] << endl;

            break;
        }

        else if(i == K-1){
            cout << '1' << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
k=int(input())  
l=[1,2,3,4,5,6,7,8,9]  
for i in range(k):  
  x=l[i]  
  if x%10!=0:  
    l.append(10*x+x%10-1)  
  l.append(10*x+x%10)  
  if x%10!=9:  
    l.append(10*x+x%10+1)  
print(x)  

Measured memory_bytes: 15784
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main()
{
    int n,k;
    cin>>n>>k;
    int sum=0;
    vector<int> vec;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        vec.push_back(x);
    }
    sort(vec.begin(),vec.end(),greater<int>());
    for(int i=k;i<vec.size();i++)
    sum+=vec[i];
    cout<<sum<<endl;
}

Measured memory_bytes: 2420
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <array>
#include <queue>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

int main()
{
    // std::cout<<std::fixed<<std::setprecision(6);
    // std::cout << std::defaultfloat;
    double W, H, x, y;
    cin >> W >> H >> x >> y;

    cout << (double)H*(double)W/2.0 << " ";
    cout << (x+x == W and y+y == H) << endl;
}

Measured memory_bytes: 256
#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--)
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;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3])cout<<"Bad"<<endl;
    else cout<<"Good"<<endl;
}


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

#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
using namespace std;
const int N=2005;
int a[N][N],b[N][N],c[N][N];
int n,D;
int calc(int x){
	int l=0,r=400,ans=-1;
	while (l<=r){
		int mid=(l+r)/2;
		if (mid*mid<x)
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	return ans;
}
int SUMB(int l,int r,int x,int y){
	if (l>r||x>y) return 0;
	return b[r][y]-(l?b[l-1][y]:0)-(x?b[r][x-1]:0)+(l&&x?b[l-1][x-1]:0);
}
int SUMC(int l,int r,int x,int y){
	if (l>r||x>y) return 0;
	return c[r][y]-(l?c[l-1][y]:0)-(x?c[r][x-1]:0)+(l&&x?c[l-1][x-1]:0);
}
bool check(int mid,int v){
	memset(b,0,sizeof(b));
	memset(c,0,sizeof(c));
	int sum=0;
	For(i,0,D-1)
		For(j,0,D-1)
			if (a[i][j])
			{
				if (a[i][j]<=v) b[i][j]++;
				else c[i][j]++,sum++;
			}

	For(i,0,2*D-1) For(j,0,2*D-1)
		b[i][j]=b[i%D][j%D],c[i][j]=c[i%D][j%D];
	For(i,1,2*D-1) For(j,0,2*D-1)
		b[i][j]+=b[i-1][j],c[i][j]+=c[i-1][j];
	For(i,0,2*D-1) For(j,1,2*D-1)
		b[i][j]+=b[i][j-1],c[i][j]+=c[i][j-1];
	For(i,0,D-1) For(j,0,D-1){
		int s1=SUMB(i+mid,i+D-1,j+mid,j+D-1);
		int s2=SUMC(i,i+mid-1,j,j+mid-1);
		if (s1==0&&s2==sum) return 1;
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&D);
	For(i,1,n){
		int x,y;
		scanf("%d%d",&x,&y);
		a[x%D][y%D]++;
	}
	int mx=0;
	For(i,0,D-1) For(j,0,D-1)
		mx=max(mx,calc(a[i][j]));
	For(i,0,D-1) For(j,0,D-1)
		a[i][j]=max(0,a[i][j]-mx*mx);
	int l=0,r=D,ans=23333;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid,mx)) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",mx*D+ans-1);
}


Measured memory_bytes: 41216
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k; cin >> n >> k;
    vector<bool> a(10, 1);
    for (int i = 0; i < k; i++) {
        int x; cin >> x;
        a[x] = 0;
    }
    int mx = 0;
    for (int i = 0; i < 10; i++) {
        if(a[i]) {
            mx = i;
        }
    }
    int digit = 1;
    int cmx = mx;
    while(mx < n) {
        digit *= 10;
        mx *= 10;
        mx += cmx;
    }
    int ans = 0;
    int i = 0;
    while (digit > 0) {
        if (a[i])  {
            if (ans + (i * digit) + (mx / 10) >= n) {
                ans += i * digit;
                digit /= 10;
                mx /= 10;
                i = -1;
            }
        }
        i++;
    }
    cout << ans;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <list>
#include <fstream>
#include <iomanip>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

struct Edge {
	int from, to;
};

signed main()
{
	int h, w;

	cin >> h >> w;

	char mp[501][501] = {}, a[501][501] = {}, b[501][501] = {};

	REP(i, h) {
		REP(j, w)
			a[i][j] = '.', b[i][j] = '.';
		REP(j, w - 1) {
			if (i%2) {
				a[i][j] = '#';
			}
			else {
				b[i][j + 1] = '#';
			}
		}

		a[i][0] = '#';
		b[i][w-1] = '#';
	}

	REP(i, h) {
		string str;
		cin >> str;
		REP(j, w) {
			if (str[j] == '#') {
				if (i%2) {
					b[i][j] = '#';
				}
				else {
					a[i][j] = '#';
				}
			}
		}
	}
	


	REP(i, h) {
		cout << a[i]<< endl;
	}
	cout<< endl;


	REP(i, h) {
		cout << b[i] << endl;
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;


int main() {

	int N, C, K;
	cin >> N >> C >> K;

	vector<int> T(N);
	for (int i = 0;i < N;i++) {
		cin >> T.at(i);
	}
	sort(T.begin(), T.end());

	int bus = 0;
	for (int i = 0;i < N;) {
		int count_i = 0;
		for (int j = i;j < N;j++) {
			if (T.at(j) > T.at(i) + K) {
				break;
			}
			count_i++;
		}
		bus++;
		if (count_i <= C) {
			i += count_i;
		}
		else {
			i += C;
		}
	}
	cout << bus;

}

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

int main(){
  string a,b,sr,ans;
  cin >> a >> b;
  sr = a + b;
  int sq = 0;
  sq = stoi(sr);
  ans = "No";
  for(int i = 1;i*i < sq+1;i++){
    if(sq == i * i){
      ans = "Yes";
    }
  }

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

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n, x;
  cin >> n >> x;

  vector<int> a(n);
  ll total = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    total += a[i];
  }

  int ans = 0;

  if (total < x) {
    ans = n - 1;
  } else {
    sort(a.begin(), a.end());
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      if (sum + a[i] <= x) {
        sum += a[i];
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
// ABC_110_A

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

	int maxi = max(a, max(b, c));

	cout << 10 * maxi + a + b + c - maxi << "\n";

	return 0;
}


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

#define int long long
#define MAX_N (200005)
#define debug(x) cout << #x <<":"<< x << endl;
#define debugArray(x) for(auto p:(x)) cerr << p <<" "; cerr << endl;
#define debugIdx(i, x) cerr << #i <<" : "<< i <<" "<< #x <<" : "<< x << endl;
const int MOD = (int)1e9+7;

signed main() {
	int A, B;
    cin >> A >> B;
    if(A==B){
        cout << A+B << endl;
    } else {
        cout << max(A,B) + max(A-1,B-1) << endl;
    }


}

Measured memory_bytes: 256
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&c^-1;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=1e5;
char c[yuzu|10];
int main(){
scanf("%s",c);
int cnt=0,i,len=strlen(c);
for (i=0;i<len;++i){
  cnt+=c[i]=='p';
  }
write(len/2-cnt);
}

Measured memory_bytes: 384
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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")
    };
}

//入力マクロここまで

fn main() {
    input! {
        n: usize,
        h: [i64;n],
    }

    let mut h = h;
    let mut t = vec![0];
    t.append(&mut h);
    let h = t;

    let mut cost = vec![0; n + 1];

    cost[0] = 0;
    cost[1] = 0;
    cost[2] = (h[1] - h[2]).abs();

    for i in 3..n + 1 {
        cost[i] = std::cmp::min(
            cost[i - 1] + (h[i] - h[i - 1]).abs(),
            cost[i - 2] + (h[i] - h[i - 2]).abs(),
        )
    }
    println!("{}", cost[n]);
}


Measured memory_bytes: 6396
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;

double a,b,C;
int main(){
	cin >> a >> b >> C;
	double S = a/2*b*sin(C/180*M_PI);
	double c = sqrt(a*a+b*b-2*a*b*cos(C/180*M_PI));
	double L = (a+b+c);
	double h = 2*S/a;
	printf("%.6f\n",S);
	printf("%.6f\n",L);
	printf("%.6f\n",h);
}



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

int main(){
  int n,i,s;
  cin >> n;
  vector<int> h(n+1);
  h.at(0)=0;
  for(i=1;i<=n;i++){
    cin >> h.at(i);
  }
  
  s=0;
  for(i=1;i<=n;i++){
    s += max(h.at(i)-h.at(i-1),0);
  }
  
  cout << s << endl;
}

Measured memory_bytes: 3604
import copy

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

Y = copy.deepcopy(X)
Y.sort()

largeMedian = Y[int(N / 2)]
smallMedian = Y[int(N / 2)-1]

for i in range(N):
    if X[i] <= smallMedian:
        X[i] = largeMedian
    else:
        X[i] = smallMedian

for i in range(N):
    print(X[i])


Measured memory_bytes: 27156
# E - Rem of Sum is Num
import queue
N, K = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (N + 1)
for i in range(N):
    S[i + 1] = (S[i] + A[i] - 1) % K

v_set = set(S)
mp = {v: 0 for v in v_set}
ans = 0
q = queue.Queue()
for i in range(N + 1):
    ans += mp[S[i]]
    mp[S[i]] += 1
    
    q.put(S[i])
    if q.qsize() == K:
        mp[q.get()] -= 1

print(ans)

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

#define int long long
#define mod 1000000007

using namespace std;

int32_t main()
{
    string s;
    cin >> s;

    int cnt = 0;
    int ans = 0;

    for(char i:s)
    {
        if(i == 'B')
            cnt++;
        else
            ans += cnt;
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main (){
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    int ans=inf;
    for(int i=-100;i<=100;i++){
        int sum=0;
        rep(j,n){
            int x=(i-a[j])*(i-a[j]);
            sum+=x;
        }
        ans=min(ans,sum);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
list = [0]
for i in range(100):
    list.append(0)

m = 0

while True:
    try:
        a = int(raw_input())
        list[a] += 1
        #print a,list[a]                                                                                

        if list[a] > m:
            m = list[a]

    except EOFError:
        break

for i in range(100):
    if list[i] == m:
        print i

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 50;
int main()
{
    std::ios::sync_with_stdio(false);
    int x;
    cin >> x;
    x ^= 1;
    cout <<  x << endl;
    return 0;
}


Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
int main(void)
{
	int a,b,i,j,s,x[101][101],len;
	char kumo[101][101];
	scanf("%d %d",&a,&b);
	for(i=0;i<a;i++){
			scanf("%s",kumo[i]);
	}
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			x[i][j]=-1;
			if(kumo[i][j]=='c'){
				x[i][j]=0;
			}
		}
	}
	for(i=0;i<a;i++){
		for(j=1;j<b;j++){
			if(x[i][j]==-1 && x[i][j-1]!=-1){	
				x[i][j]=x[i][j-1]+1;
			}
		}
	}
	for(i=0;i<a;i++){
		for(j=0;j<b;j++){
			printf("%d",x[i][j]);
				if(j<b-1){
					printf(" ");
				}
		}
			printf("\n");
	}

	return 0;
}

Measured memory_bytes: 1080
//IIT Kanpur FacelessMen India
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

pii zo[N];
int ans[N];
int main(){
  // freopen("product.in","r",stdin);
  // freopen("product.out","w",stdout);
  int n,l,t; scanf("%d%d%d",&n,&l,&t);
  int c1=0,c2=0;

  REP(i,n) scanf("%d%d",&zo[i].X,&zo[i].Y);
  REP(i,n) if(zo[i].Y==1) c1++; else c2++;
  int zp=(t/l)*2;
  t%=l;
  
  if((l+1)/2<=t){
    t-=(l+1)/2;
    zp++;
    REP(i,n) {
      if(zo[i].Y==1){
        zo[i].X=(zo[i].X+(l+1)/2)%l;
      }else{
        zo[i].X=(zo[i].X-(l+1)/2+l)%l;
      }
     // printf("%d %d\n",zo[i].X,zo[i].Y);
    }
  }
  //printf("t= %d\n",t);
  vector<int> a1,b1;
  REP(i,n) if(zo[i].Y==2){
    a1.pb(zo[i].X);
    a1.pb(zo[i].X+l);
    b1.pb(zo[i].X-t);
    b1.pb(zo[i].X-t+l);
  }
  sort(all(a1));
  sort(all(b1));
  //printf("%d\n",zp);
  REP(i,n) if(zo[i].Y==1){
    int x1 = lower_bound(all(a1),zo[i].X)-a1.begin() -(lower_bound(all(b1),zo[i].X+t)-b1.begin());
    x1*=-1;
   // printf("z1 %d %d %d %d %d %lld\n",x1,zo[i].X,zo[i].Y,zp,n,(x1+i+1ll*zp*c2)%n);
    ans[(x1+i+1ll*zp*c2)%n]=(zo[i].X+t)%l;
    // REP(j,pos.size()) printf("gg%d\n",pos[j]);
    //printf("%d %d\n",z,pl); 
    
  } 
  a1.clear(),b1.clear();
  REP(i,n) if(zo[i].Y==1){
    a1.pb(zo[i].X);
    a1.pb(zo[i].X-l);
    b1.pb(zo[i].X+t);
    b1.pb(zo[i].X+t-l);
  }
  sort(all(a1));
  sort(all(b1));
  REP(i,n) if(zo[i].Y==2){
    int x1 = lower_bound(all(a1),zo[i].X)-a1.begin() -(upper_bound(all(b1),zo[i].X-t)-b1.begin());
    x1*=-1;
   // printf("z2 %d %d %d %d %d %lld\n",x1,zo[i].X,zo[i].Y,zp,n,(i+(x1-1ll*zp*c1)%n+n)%n);
    ans[(i+(x1-1ll*zp*c1)%n+n)%n]=(zo[i].X-t+l)%l;
    // REP(j,pos.size()) printf("gg%d\n",pos[j]);
    //printf("%d %d\n",z,pl); 
    
  }

  REP(i,n) printf("%d\n",ans[i]);//,assert(ans[i]!=0);
  return 0;
}


Measured memory_bytes: 7148
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
/*迷路移動*/const int dx[4]={1,0,-1,0};const int dy[4]={0,1,0,-1};
llfor;//ll ans=0;////////////////////////////////////////////////////////////
int main(){
 ll n,k;
 cin>>n>>k;
  
 ll ans;
 if(n>1)ans=llpow(k-1,n-1)*k;
 else ans=k;
 cout<<ans<<endl;
 return 0;}

Measured memory_bytes: 3632
S = raw_input()

max_count = 0
length = len(S)
for idx in xrange(length):
    count = 0
    for i in range(idx, length):
        if 'ACGT'.find(S[i]) >= 0: count += 1
        else: break
    if count > max_count: max_count = count
print max_count

Measured memory_bytes: 2568
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())
L =  list(map(int, sys.stdin.readline().split()))

X = [0] * N

for i in range(1, N):
    if L[i] <= L[i - 1]:
        X[i] = X[i - 1] + 1
    else:
        X[i] = 0

print(max(X))

Measured memory_bytes: 85228
import kotlin.math.*

fun int() = readLine()!!.toInt()
fun list() = readLine()!!.split(" ").map {it.toInt()}

fun main() {
	val (a,v) = list()
	val (b,w) = list()
	val t = int()
	println(if(v>w&&(abs(a-b)+v-w-1)/(v-w)<=t) "YES" else "NO")
}


Measured memory_bytes: 36336