akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
struct edge {int from, to;};
vector<int> G[100010];

int N, M;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    cin >> N >> M;

    vector<ll> H(N);
    rep(i, N)
    {
        cin >> H[i];
    }

    
    rep(i, M)
    {
        int a1, a2; 
        cin >> a1 >> a2;
        a1--; a2--;

        G[a1].push_back(a2);
        G[a2].push_back(a1);
    }
    int ans=0;
    rep(i, N)
    {
        if(G[i].size()==0)
        {
            ans++;
        }

        rep(j, G[i].size())
        {
            if(H[G[i][j]]>=H[i])
            {
                break;
            }
            if(j==G[i].size()-1)
            {
                ans++;
            }
        }
    }
    
    cout << ans << endl;

 

 

    return 0;
}



Measured memory_bytes: 9280
N,M=map(int,input().split())
n=[0,1,2,3,4,5,6,7,8,9]
H=[0,2,5,5,4,5,6,3,7,6]

L=[]
A=list(map(int,input().split()))
A.sort(reverse=True)

for i in range(M):
    for j in range(10):
        if A[i]==n[j]:
            L.append([H[j],n[j]])
#print(L)
dp=["" for i in range(N+1)]
dp[0]="0"
for i in range(len(L)):
    for j in range(L[i][0],N+1):
        if dp[j-L[i][0]]!="":
            if len(dp[j])>len(dp[j-L[i][0]]+str(L[i][1])):
                continue
            elif len(dp[j])<len(dp[j-L[i][0]]+str(L[i][1])):
                dp[j]=dp[j-L[i][0]]+str(L[i][1])
            else:
                if dp[j]<dp[j-L[i][0]]+str(L[i][1]):
                    dp[j]=dp[j-L[i][0]]+str(L[i][1])
print(dp[N][1:])

Measured memory_bytes: 29396
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};

typedef struct node * Node;
#define NIL NULL

void insert(int);
void inorder(Node);
void preorder(Node);

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

	while(x!=NIL){
		y=x;
		if((z->key) < (x->key)) x=x->left;
		else x=x->right;
	}

	z->p=y;
	
	if(y==NIL) root=z;
	else if((z->key) < (y->key)) y->left=z;
	else y->right=z;

}

void inorder(Node u){

	if(u!=NIL){
		inorder(u->left);
		printf(" %d",u->key);
		inorder(u->right);
	}
}
	
void preorder(Node u){
	
	if(u==NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


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

using namespace std;

const int N = 1e5 + 10;

int n, x;

int cnt[N];

int main() {
 scanf("%d", &n);
 int res = 0;
 for (int i = 1; i <= n; i++) {
  scanf("%d", &x);
  if (x > n) res++;
  else cnt[x]++;
 }
 for (int i = 1; i <= n; i++) {
  res += cnt[i];
  if (cnt[i] >= i) res -= i;
 }
 cout << res;
 return 0;
}


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N + 1), B(N);
    rep(i, N + 1) cin >> A[i];
    rep(i, N) cin >> B[i];
    ll ans = 0;
    rep(i, N) {
        ans += min(A[i], B[i]);
        if (B[i] > A[i]) {
            ans += min(A[i + 1], B[i] - A[i]);
            A[i + 1] = max(0LL, A[i + 1] - B[i] + A[i]);
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <unordered_map>

// Return the max length to arrive at this node from anywhere
int traverse(std::unordered_map<int, std::vector<int>> &graph, std::vector<int>& dp, int n, int v) {
    if (dp[v] != -1) return dp[v];

    // If no nodes point to this one, the longest path to this node must be zero
    // There *will* be such a node in the graph, since we are guaranteed to have no cycles
    if (graph.find(v) == graph.end()) {
        dp[v] = 0;
        return 0;
    }

    const auto incoming = graph[v];

    int maxDist = 0;
    for (const int i : incoming) {
        maxDist = std::max(maxDist, traverse(graph, dp, n, i)+1);
    }

    dp[v] = maxDist;
    return maxDist;
}

int main() {

    /*
     *
     * Longest path in the graph between any two nodes
     * When we find an edge connecting nodes X and Y, then it's possible to increase the max path
     * for each node in the graph.
     *
     * When we add an edge from X to Y, let's say there are some other nodes A and B that also
     * connect to X.
     *
     * A --> X --> Y
     * B ----^
     *
     *
     * Longest path to get to node X from any node is equal to one more than the longest path to get
     * to any node this is connected to X.
     *
     * dp[x] = std::max({dp[i] for i in v}) + 1
     *
     * */

    int n, numEdges;
    std::cin >> n >> numEdges;

    std::vector<std::pair<int, int>> edges;
    for (int i = 0; i < numEdges; i++) {
        int from, to;
        std::cin >> from >> to;
        edges.push_back(std::make_pair(from-1, to-1));
    }

    // Adjacency list of vertices that point to the given one
    std::unordered_map<int, std::vector<int>> graph;
    std::vector<int> dp(n, -1);

    // Fill edges
    for (int i = 0; i < numEdges; i++) {
        graph[edges[i].second].push_back(edges[i].first);
    }

    int maxDist = 0;
    for (int i = 0; i < n; i++) {
        maxDist = std::max(maxDist, traverse(graph, dp, n, i));
    }

    // for (int i = 0; i < n; i++) {
    //     for (int j = 0; j < n; j++) {
    //         std::cout << graph[i][j] << "\t";
    //     }
    //     std::cout << "\n";
    // }

    // std::cout << "DP table: ";
    // for (int i = 0; i < n; i++) std::cout << dp[i] << " ";
    // std::cout << "\n";

    std::cout << maxDist << "\n";

    return 0;
}



Measured memory_bytes: 20724
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int gcd(int a, int b){ return ((b == 0) ? a : gcd(b, a % b)); }

int up[2005][2005];
int down[2005][2005];
int le[2005][2005];
int ri[2005][2005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int h, w;
	cin >> h >> w;
	string s[h];
	rep(i, h) cin >> s[i];
	rep(i, 2005) rep(j, 2005) up[i][j] = 0;
	rep(i, 2005) rep(j, 2005) down[i][j] = 0;
	rep(i, h) rep(j, w) if(i){
		up[i][j] = up[i - 1][j] + 1;
		if(s[i - 1][j] == '#') up[i][j] = 0;
		if(s[i][j] == '#') up[i][j] = 0;
	}
	for(int i = h - 2; i >= 0; i--) rep(j, w){
		down[i][j] = down[i + 1][j] + 1;
		if(s[i + 1][j] == '#') down[i][j] = 0;
		if(s[i][j] == '#') down[i][j] = 0;
	}
	rep(i, h) rep(j, w) if(j){
		le[i][j] = le[i][j - 1] + 1;
		if(s[i][j] == '#') le[i][j] = 0;
		if(s[i][j - 1] == '#') le[i][j] = 0;
	}
	rep(i, h) for(int j = w - 2; j >= 0; j--){
		ri[i][j] = ri[i][j + 1] + 1;
		if(s[i][j] == '#') ri[i][j] = 0;
		if(s[i][j + 1] == '#') ri[i][j] = 0;
	}
	int ans = 0;
	rep(i, h) rep(j, w){
		ans = max(ans, down[i][j] + up[i][j] + le[i][j] + ri[i][j] + 1);
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 67328
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"

using namespace std;

int main() {
    long long  a, b ,x;
    cin >> a >> b >> x;
    if (a == 0){
        cout << b / x + 1;
    } else {
        cout << b / x - (a - 1) / x;
    }
    return 0;
}



Measured memory_bytes: 256
//--- pC ---//
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Scanner scanner;
	public Solution() {
		scanner = new Scanner(System.in);

		// scanner.nextLine();
		while (scanner.hasNext()) {
			run_case();
		}
	}
	private void run_case() {
		scanner.nextLine();
		String line = scanner.nextLine();


		// int H = Integer.parseInt(line.split("\\s+")[0]);
		// int K = Integer.parseInt(line.split("\\s+")[1]);

		int[] arr = strToIntArray(line);

		int res = 0;

		TreeMap<Integer, Integer> map = new TreeMap<>();
		for (int u : arr) {
			map.put(u, 1);
			if (map.lowerKey(u) == null) res ++;	
		}

		System.out.println(res);
		return;
	}

	private int[] strToIntArray(String str) {
	    String[] vals = str.split("\\s+");
	    int sz = vals.length;
	    int[] res = new int[sz];
	    for (int i=0; i<sz; i++) {
	        res[i] = Integer.parseInt(vals[i]);
	    }
	    return res;
	}
}

// class Num implements Comparable<Num>{
// 	public int val;
//
// }


Measured memory_bytes: 61884
import fractions
import numpy as np


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

def main():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    res = 1
    for e in T:
        res = lcm(res, e)
    print(res)

if __name__ == '__main__':
    main()


Measured memory_bytes: 21992
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = Integer.parseInt(in.next());
            int D = Integer.parseInt(in.next());
            int cnt = 0;
            for (int i = 0; i < N; i++) {
                long X = Long.parseLong(in.next());
                long Y = Long.parseLong(in.next());
                if (Math.sqrt((X * X) + (Y * Y)) <= D)
                    cnt++;
            }
            out.println(cnt);
        }

    }
}



Measured memory_bytes: 57968
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=405;
#define infl 		9223372036854775807
//each node represents a range
struct node{
	int v=infl; //sum of values in range
	int cj=infl; //minimum cost of joining them
};

node dp[N][N];

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//input
	int n;
	cin>>n;
	int a[n+1];
	for(int i=1; i<=n; ++i){
		cin>>a[i];
		dp[i][i].v=a[i];
		dp[i][i].cj=0;
	}
	//presum
	int ps[n+1]={};
	for(int i=1; i<=n; ++i){
		ps[i] = a[i] + ps[i-1];
	}

	for(int gap=1; gap<=n-1; ++gap)
	{
		for(int i=1; i+gap<=n; ++i){
			int l=i, r=i+gap;
			
			dp[l][r].v = ps[r]-ps[l-1];
			
			for(int lend=l; lend<r; ++lend){
				if(dp[l][lend].cj + dp[lend+1][r].cj +dp[l][r].v<= dp[l][r].cj)
				{
					dp[l][r].cj = dp[l][lend].cj + dp[lend+1][r].cj +dp[l][r].v;
				}
			}

		}
	}

	cout<<dp[1][n].cj<<endl;

	return 0;	
}

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

int main() {
  int N, M; cin >> N >> M;
  vector<int> cnt(M);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int k; cin >> k;
    for (int j = 0; j < k; j++) {
      int a; cin >> a;
      a--;
      cnt.at(a)++;
    }
  }
  for (int i = 0; i < M; i++) {
    if (cnt.at(i) == N) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using namespace atcoder;
using LL = long long;

int main(){
  int T;
  cin >> T;
  while(T--){
    LL N, M, A, B;
    cin >> N >> M >> A >> B;
    cout << floor_sum(N, M, A, B) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3632
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
LL h, w, n, m, s, ans = 0, num = 0, sum = 0;
Pll a[100000];
int flag = 0;
string str,stt;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a, a+n, [](Pll x, Pll y) { return x.first < y.first; });
	for (int i = 0; i < n; i++) {
		if (a[i].second % 2 == 0 && i%2 == 1)
			ans++;
		if (a[i].second % 2 == 1 && i%2 == 0)
			ans++;
	}

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


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
typedef long long ll;
using namespace std;
int main(void){
    int n,m,x;
    cin>>n>>m>>x;
    int right=0,left=0;
    for(int i=0;i<m;i++){
        int a;
        cin>>a;
        if(a<x){
            left++;
        }else{
            right++;
        }
    }
    cout<<min(right,left)<<endl;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
p = gets.chomp.split.map(&:to_i)
cnt = 0
1.upto(n-2) do |i|
  if (p[i-1] - p[i]) * (p[i] - p[i+1]) > 0
    cnt += 1
  end
end
puts cnt


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k; cin >> n >> k;
	if(n<=k) k = n-1;
	long long int h[100005];
	long long int cost[100005];
	for(int i=0;i<n;i++){
		cin >> h[i];
	}
	cost[0] = 0LL;
	cost[1] = abs(h[1]-h[0]);
	if(n==2){
		cout << cost[1] << endl;
		return 0;
	}
	for(int i=2;i<n;i++){
		cost[i] = cost[i-1]+abs(h[i]-h[i-1]);
		for(int j=1;j<=k;j++){
			if(i-j<0) continue;
			long long int a = cost[i-j]+abs(h[i]-h[i-j]);
			cost[i] = min(cost[i],a);
		}
	}
	cout << cost[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.util.stream.Collectors;
import static java.lang.System.*;

public class Main extends CodingSupport {
    protected void solve() {
        int input = scanInt();
        double dept  = 100000.0;

        for( int i = 0; i < input ; i++ ) {
            dept = dept * 1.05;
            if(dept % 1000 != 0 ) {
                dept -= dept % 1000;
                dept += 1000;
            }
        }
        print((int)dept);
    }
}

abstract class CodingSupport {
    protected Scanner sc;
    protected CodingSupport() {
        sc = new Scanner(in);
    }
    
    public static void main(String[] args) throws Exception {
        new Main().solve();
    }
    
    protected abstract void solve();
    
    protected void print(Object o) {
        out.println(o);
    }
    
    protected Double[] scanDoubles() {
        return 
          Arrays
              .stream(scanInts())
              .map(Integer::doubleValue)
              .toArray(Double[]::new);
    }
    
    protected Integer[] scanInts() {
       return strArrayToIntArray(sc.nextLine().split(" "));
    }
    
    protected String[] scanLineToTokens(String delimiter) {
        return sc.nextLine().split(delimiter);
    }
    
    protected int scanInt() {
       return sc.nextInt();
    }

    protected List<Integer> strArrayToIntList(String[] strArray) {
        List<Integer> intList =
          Arrays
            .stream(strArray)
            .map(Integer::valueOf)
            .collect(Collectors.toList());
        return intList;
    }
    
    protected Integer[] strArrayToIntArray(String[] strArray) {
        Integer[] intArray =
        Arrays
            .stream(strArray)
            .map(Integer::valueOf)
            .toArray(Integer[]::new);
        return intArray;
    }
}


Measured memory_bytes: 26188
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d;
  cin>>a>>b>>c;
  d=max(a,b)+1;
  while(c>0){
    d--;
    if(a%d==0 && b%d==0) c--;
  }
  cout<<d;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

template<int M>
class Combination
{
public:
  int n;
  vector<int> fac, finv;

  Combination(int n_) : n(n_), fac(n_), finv(n_)
  {
    fac[0] = 1;
    for(int i = 1; i < n; i++) fac[i] = fac[i-1]*i%M;
    finv[n-1] = pow(fac[n-1], M-2);
    for(int i = n-1; i > 0; i--) finv[i-1] = finv[i]*i%M;
  }

  int pow(int a, int b)
  {
    if(b == 0) return 1; 
    return pow(a*a%M, b/2)*(b%2?a:1)%M;
  }

  int C(int a, int b)
  {
    if(b < 0 or a < b) return 0;
    return fac[a]*finv[a-b]%M*finv[b]%M;
  }

  int P(int a, int b)
  {
    if(b < 0 or a < b) return 0;
    return fac[a]*finv[a-b]%M; 
  }

  int H(int a, int b){
    if(a == 0 and b == 0) return 1;
    return C(a+b-1, b);
  }
};

signed main()
{
  Combination<mod> comb(200010);

  int B, W;
  cin >> B >> W;

  int n = B+W;
  int inv2 = comb.pow(2, mod-2);
  int p = 0, q = 0;
  rep(i, 0, n){
    int ans = (1-p+q)%mod;
    while(ans < 0) ans += mod;
    ans = ans*inv2%mod;
    cout << ans << endl;

    p = p + comb.C(i, B-1)*comb.pow(inv2, i+1)%mod;
    q = q + comb.C(i, W-1)*comb.pow(inv2, i+1)%mod;
  }

  return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll md = 1000000007;
string S;

ll dp[100000][11];

void solve() {
    for(int i = 0; i <= S.size(); i++) {
        for(int j = 0; j <= 10; j++) {
            dp[i][j] = 0;
        }
    }
    S = "#" + S;
    ll ans = 0;
    for(ll i = 1; i < S.size(); i++) {
        for(int before = 0; before <= 10; before++) {
            int after = (before * 10 + S[i] - '0') % 11;
            dp[i][after] += dp[i-1][before];
        }
        if(S[i] != '0') {
            dp[i][S[i] - '0']++;
        }
        ans += dp[i][0];
    }
    cout << ans << endl;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        cin >> S;
        if(S == "0") break;
        solve();
    }
    return 0;
}


Measured memory_bytes: 10196
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    x %= mod;
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    return (x * powll(y,mod-2)) % mod;
}

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

    ll x = 1, y = 1;
    REP(i,k-2){
        x = (x * (n * m - 2 - i)) % mod;
        y = (y * (i + 1)) % mod;
    }
    x = divll(x, y);

    ll s = 0;
    for (ll i = 0; i <= n + m - 2; i++){
        s = (s + i * (min(m - 1, i) - max(0LL, i - n + 1) + 1)) % mod;
    }
    ll sum = 0;
    REP(j,m){
        sum = (sum + s) % mod;
        ll tmp = n * (-m + 2 * (j + 1));
        s = (s + tmp % mod) % mod;
        s = (s + mod) % mod;
    }
    ll all = 0;
    REP(i,n){
        all = (all + sum) % mod;
        ll tmp = (m * (-n + 2 * (i + 1))) % mod;
        tmp = (tmp * m) % mod;
        sum = (sum + tmp % mod) % mod;
        sum = (sum + mod) % mod;
    }
    all = divll(all, 2);
    ll ans = (all * x) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int r,d,x;
  cin >> r >> d >> x;
  int s[11],i;
  s[0]=x;
  for(i=0;i<10;i++){
    s[i+1]=r*s[i]-d;
    cout << s[i+1] << endl;
  }
}
  

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

int main() {
    char s;
   cin >> s;

   if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a"<< endl;
   }
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double x = sc.nextDouble();

        double ans = 0;

        double h = 0;

        if (a*a*b*Math.pow(2, -1)<=x){
            h = 2*b - 2*x*Math.pow(a, -2);
            ans = h*Math.pow(a, -1);
            System.out.print(Math.toDegrees(Math.atan(ans)));
        }else {
            ans = a*b*b*Math.pow((2*x), -1);
            System.out.print(Math.toDegrees(Math.atan(ans)));

        }


    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <cstdlib>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main() 
{
	long long  cale=0,mid,len,l,r,i,n;
	cin>>n;
	long long pref[n],a[n],dp[n][n];
	for(i=0;i<n;i++)
	{
	 cin>>a[i];
	}
	pref[0]=a[0];
	for(i=1;i<n;i++)
	{
	  pref[i]=pref[i-1]+a[i];
	}
	for( len=1;len<=n;len++)
	{
	 for( l=0;l<n;l++)
	  {
	   int r=l+len-1;
	   if(r==n) {break;}
	   if(len==1) {dp[l][l]=0;}
	   else {dp[l][r]=2e18;}
	   for( mid=l;mid<r;mid++)
	     {
	         if(l==0) { cale=dp[l][mid]+dp[mid+1][r]+pref[r];
	                    dp[l][r]=min(dp[l][r],cale);
		              }
			 else { cale=dp[l][mid]+dp[mid+1][r]+pref[r]-pref[l-1];
	                dp[l][r]=min(dp[l][r],cale);
                  }
		 }  
	  }
	}
	cout<<dp[0][n-1];
	
	
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> > 
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, x;
	cin >> n;
	bool poss = true;
	for(int i = 0; i < n; i++){
		cin >> x;
		if(x % 2 == 0 && x % 3 && x % 5)
		poss = false;
	}
	cout << (poss ? "APPROVED" : "DENIED");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef pair<ll, ll> P;

int main(){
    int n, a, b;
        cin >> n;
    vec v(n); 
    ll ans = pow(3.0, n), cnt=1;
            for(int i=0; i<n; i++) cin >>  v.at(i);
            for(int i=0; i<n; i++)
                if(v.at(i)%2==0) cnt *= 2;
        cout << ans - cnt << endl;
        
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int INF = 1e9;
const int MOD = INF+7;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.rbegin(),v.rend()
#define MP make_pair
#define pb push_back
using P = pair<int,int>;
//b

signed main(){
    int N,K;
    string S;
    cin >> N >> S >> K;
    char c = S[K - 1];

    for(int i=0;i<N;i++){
        if(S[i] != c) S[i] = '*';
    }

    cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define m_p			make_pair
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define sz(x)       (int)x.size()
#define f			first
#define debug		cout<<"##########3"<<endl
#define mod			1000000007
#define ll			long long int
#define lMax		LLONG_MAX
// queue<int> , prefix_sum(a,a+n) , reverse(a,a+n) , priority_queue <int> max heap , priority_queue <int, vector<int>, greater<int> > min heap;
// == precedence gretaer then &
ll n,m;
string s,s1,s2;
priority_queue <long long int> pq;
map<ll, char> mp;
vector<pair<int,int> > inc;
vector<pair<int,int> > de;
ll arr[300005],barr[300005];
//EG
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
	int i,j,k,z,ans=0,c=0,x=0,y=0;
	
	cin>>n;
	if(n%2==0)
		cout<<0.5000;
	else{
		x = n/2+1;
		long double q = x/double(n);
		cout<<setprecision(12)<<q;
	}
 	return 0;
}

Measured memory_bytes: 256
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << std::endl;
}

using namespace std;

int main() {
    ll n; cin >> n;
    map<ll,int> mp;
    rip(i, 1000100, 2) {
        if(n%i == 0) {
            mp[i] = 0;
            while(n%i == 0) {
                mp[i]++;
                n/=i;
            }
        }
    }
    if(n > 1) {
        mp[n] = 1;
    }
    int ans = 0;
    for(auto i:mp) {
        int now = 0;
        rip(j,100,1) {
            now += j;
            if(now > i.second) {
                ans += j-1;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = sum(b)
for i in range(1, n):
    if a[i] - a[i - 1] == 1:
        ans += c[a[i - 1] - 1]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}

vector<pair<ll, int>> Pfact(ll num) {
    vector<pair<ll, int>> res;
    for (ll i = 2; i * i <= num; i++) {
        int cnt = 0;
        while (num % i == 0) {
            cnt++;
            num /= i;
        }
        if (cnt) res.emplace_back(i, cnt);
    }
    if (num != 1) res.emplace_back(make_pair(num, 1));
    return res;
}

ll gcd(ll a, ll b) {
  if(a<b) swap(a,b);
  ll c = -1;
  while(c != 0){
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
  
int main() {
  ll A,B;
  cin >> A >> B;
  ll c = gcd(A,B);
  vector<pair<ll,int>> res = Pfact(c);
  ll ans = 0;
  for(auto x: res) {
    ans++;
  }
  cout << ans+1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <iomanip>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


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

    sort(a.begin(), a.end(), greater<ll>());
    ll ans = 0;
    priority_queue<ll> p;
    int cnt = 1;
    p.push(a[0]);
    for(int i = 1; i < n; i++){
        auto j = p.top();
        if(cnt == 1){
            p.pop();
            cnt = 0;
        } else {
            cnt = 1;
        }
        ans += j;
        p.push(a[i]);
    }

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

Measured memory_bytes: 5872
from math import factorial as fac
from itertools import combinations as comb

n = int(input())
x = ["M", "A", "R", "C", "H"]
x_l = [[], [], [], [], []]
l = [ input() for i in range(n)]

for s in l:
  if s[0] in x:
    x_l[x.index(s[0])].append(s)
    
    
x_l = [len(x_l[i]) for i in range(5) if len(x_l[i]) != 0]
leng = len(x_l)


if leng < 3:
  print(0)
else:
  ans = 0
  for number in comb([ i for i in range(leng)], 3):
    ans += x_l[number[0]]*x_l[number[1]]*x_l[number[2]]
  print(ans)

Measured memory_bytes: 10824
def solve():
    H, W, M = map(int, input().split())
    N = 3 * 10 ** 5
    cnth = [0] * N
    cntw = [0] * N
    dic = dict()
    for i in range(M):
        h, w = map(lambda x: int(x) - 1, input().split())
        cnth[h] += 1
        cntw[w] += 1
        dic[(h, w)] = 1
    mh = max(cnth)
    mw = max(cntw)
    Y = []
    X = []
    for i in range(H):
        if cnth[i] == mh:
            Y.append(i)
    for i in range(W):
        if cntw[i] == mw:
            X.append(i)
    for y in Y:
        for x in X:
            if not (y, x) in dic:
                return mh + mw
    return mh + mw - 1

print(solve())


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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int a, b, c, d, e, f;
bool ok[31];
bool dp[3001];

int main(){
    cin >> a >> b >> c >> d >>e >> f;
    ok[0] = true;
    for(int i = 1; i <= 30; i++) {
        if(i-a >= 0) {
            ok[i] |= ok[i-a];
        }
        if(i-b >= 0) {
            ok[i] |= ok[i-b];
        }
    }
    double ans = 0.0;
    int ret1 = 100*a, ret2 = 0;
    for(int i = 1; i <= 30; i++) {
        if(!ok[i]) continue;
        memset(dp, sizeof(dp), false);
        dp[0] = true;
        for(int j = 1; j <= i*e; j++) {
            if(i*100+j > f) break;
            if(j-c >= 0) {
                dp[j] |= dp[j-c];
            }
            if(j-d >= 0) {
                dp[j] |= dp[j-d];
            }
        }
        for(int j = i*e; j >= 0; j--) {
            if(dp[j]) {
                if(ans < (double)j/(double)(i*100+j)) {
                    ans = (double)j/(double)(i*100+j);
                    ret1 = i*100+j;
                    ret2 = j;
                }
            }
        }
    }
    cout << ret1 << " " << ret2 << endl;
}
































Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
using namespace std;
int a[26];
int main()
{
    char c;
    int n, m, x=0, y=0, g=0, gg=0;
    scanf("%d%d",&n,&m);
    gg = (n/2)*(m/2);
    for(int i=0; i<n; ++i)
    {
        getchar();
        for(int j=0; j<m; ++j)
        {
            scanf("%c",&c);
            ++a[c-'a'];
        }
    }
    for(int i=0; i<26; ++i)
    {
        if(a[i]&1)
        {
            ++x;
            --a[i];
        }
        int tmp = min(gg, a[i]/4);
        gg -= tmp;
        a[i] -= tmp*4;
        if(a[i]) y+=a[i]/2;
    }
    if((!(n&1) && !(n&1) && x) || x > 1) return 0*puts("No");
    if(n&1) g += m/2;
    if(m&1) g += n/2;
    if(y <= g) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

steps = 0
cur = 1
visited = [-1] * (n+1)
while k:
    if visited[cur] != -1:
        k = k % (steps - visited[cur])
        break
    visited[cur] = steps
    cur = a[cur]
    k -= 1
    steps += 1

for i in range(k):
    cur = a[cur]

else:
    print(cur)

Measured memory_bytes: 32328
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = input()
ans = [0] * N
for i in range(N):
  if T[i] == 'r':
    if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
      pass
    else:
      ans[i] += P
  elif T[i] == 's':
    if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
      pass
    else:
      ans[i] += R
  else:
    if i > K-1 and T[i-K] == T[i] and ans[i-K]>0:
      pass
    else:
      ans[i] += S
print(sum(ans))

Measured memory_bytes: 7156
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s,a="Sunny", b="Cloudy",c="Rainy";
    cin>>s;
    if(s[0]=='S')
        cout<<b<<endl;
    else if(s[0]=='C')
        cout<<c<<endl;
    else
        cout<<a<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);
const double pi = 3.14159265358979323846264;
//----------------------------------------------------------------
vector<vector<bool>> noneed(310, vector<bool>(310, false));
ll n;
vector<vector<ll>> d1(310, vector<ll>(310, infll));
vector<vector<ll>> d2(310, vector<ll>(310, infll));
vector<pair<ll, pair<ll, ll>>> vec;
bool dame = false;
ll sum = 0;
void wf(int n)
{
    for (auto f : vec)
    {
        ll s = f.second.first;
        ll g = f.second.second;
        bool tmp = false;
        for (ll i = 0; i < n; i++)
        {
            if (i == s || i == g)
            {
                continue;
            }
            if (d1[s][g] > d1[s][i] + d1[i][g])
            {
                dame = true;
            }
            else if (d1[s][g] == d1[s][i] + d1[i][g])
            {
                tmp = true;
            }
        }
        if (tmp)
        {
            noneed[s][g] = true;
            noneed[g][s] = true;
        }
        else
        {
            sum += d1[s][g];
        }
    }
}

int main()
{
    cin >> n;
    for (ll i = 0; i < n; i++)
    {
        for (ll j = 0; j < n; j++)
        {
            ll a;
            cin >> a;
            if (j == i)
            {
                continue;
            }
            vec.push_back(make_pair(a, make_pair(i, j)));
            d1[i][j] = a;
            d2[i][j] = a;
        }
    }
    sort(vec.begin(), vec.end());
    wf(n);
    if (dame)
    {
        cout << "-1" << endl;
    }
    else
    {
        cout << sum / 2 << endl;
    }
}


Measured memory_bytes: 7952
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int sum = 0;
    for(int i = 0; i < N;  i++) {
        cin >> A[i];
        sum += A[i];
    }
    int count = 0;
    for(int i = 0; i < N; i++){
        if(A[i] >= (sum + 4 * M - 1)/ (4 * M)) count++;
    }
    if(count >= M) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3632
#include<stdio.h>

int main(){

  int x,y,r,swap;

  scanf("%d%d",&x,&y);

  if(x < y){
    swap = x;
    x = y;
    y = swap;
  }

  while(y > 0){
    r = x % y;
    x = y;
    y = r; 
  }

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

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

int main(void) {
    int n;
    cin >> n;
    vector<string> add(n);
    rep(i,n) {
      cin >> add[i];
    }
    int m;
    cin >> m;
    vector<string> minus(m);
    rep(i,m) {
      cin >> minus[i];
    }
    int ans=0;
    rep(i,n) {
        int count = 0;
        rep(j,n) {
          if(add.at(i) == add.at(j)) {
            count++;
          }
        }
        rep(j,m) {
            if(add.at(i) == minus.at(j)) {
                count--;
            }
        }
       if(count > ans )
           ans = count;
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(5)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<short, short> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 114514810;
const int MOD = 100000007;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator > (const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

string s;
vector<pair<char,int>> v;
int main()
{
	cin >> s;
	if (s.size() < 3)
	{
		cout << 0 << endl;
		return 0;
	}
	int i = 0;
	char c = s[0];
	int cnt = 0;
	while (i<s.size())
	{
		if (s[i] == c)
		{
			cnt++;
		}
		else
		{
			v.push_back(make_pair(c, cnt));
			cnt = 1;
			c = s[i];
		}
		i++;
	}
	v.push_back(make_pair(c, cnt));
	int ans = 0;
	if (v.size() > 2)
	{
		REP(i, v.size() - 2)
		{
			if (v[i].first == 'J'&&v[i + 1].first == 'O'&&v[i + 2].first == 'I')
			{
				if (v[i + 1].second <= v[i].second&&v[i + 1].second <= v[i + 2].second) ans = max(ans, v[i + 1].second);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define ull unsigned long long

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
    ll N;
    ll prev = LONG_MIN;
    ll maxCount = 0;
    ll count = 0;
    cin >> N;
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        if(temp > prev) {
            maxCount = max(maxCount, count);
            count = 0;
        } else {
            count++;
        }
        prev = temp;
    }
    maxCount = max(maxCount, count);
    cout << maxCount << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
char a[55],b[55];
int main()
{
    cin>>a>>b;
    for (int i=0;a[i];++i)
    {
        cout<<a[i];
        if (!a[i+1]&&!b[i])
            continue;
        cout<<b[i];
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int X = sc.nextInt();
        int Y = sc.nextInt();
        int count = 0;
        if(A+B>2*C){
            if(X>=Y){
                if(A>=2*C){
                    count = 2*C*X;
                }else{
                    count = 2*C*Y + A*(X-Y);
                }
            }else{
                if(B>=2*C){
                    count = 2*C*Y;
                }else{
                    count = 2*C*X + B*(Y-X);
                }
            }
        }else{
            count = A*X+B*Y;
        }
        
          System.out.println(count);
        }
    }


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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

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

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

    int N, K;
    std::cin >> N >> K;

    string S;
    std::cin >> S;

    int ans = 0;
    REP(i, N - 1) {
        ans += (S[i] == S[i + 1]) ? 1 : 0;
    }
    std::cout << min(N - 1, ans + K * 2) << std::endl;

    return 0;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = 1e9 + 7;

long long x, k, d;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> x >> k >> d;
	x = abs(x);
	if (k < (x + d - 1) / d) {
		cout << x - k * d << E;
	}
	else {
		long long tmp = k - (x + d - 1) / d, ans;
		if (tmp % 2) {
			ans = abs(x - (k - tmp + 1) * d);
			ans = min(ans, abs(x - (k - tmp - 1) * d));
		}
		else {
			ans = abs(x - (k - tmp) * d);
			ans = min(ans, abs(x - (k - tmp - 2) * d));
		}
		cout << ans << E;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    string b;

    cin >> a >> b;

    long long int z = a.size();

    long long int count = 0;

    for(int i=0; i<a.size(); i++)
    {
        if(a[i] != b[i])
        {
            count++;
        }
    }

    cout << count;

    return 0;

}


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

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X;
  cin >> X;
  int N = X / 100;
  int r = X % 100;
  cout << (r <= N * 5 ? 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 3640