akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

namespace {
// 色々設定
enum {
	MaxSize =1000	// 地図の大きさの最大値
};

enum {
	SpaceSymbol = '.',	// 空白を示すシンボル
};

typedef unsigned short ScoreType; // 空白数を保持するための型, MaxSize*MaSizeに連動して変える


// 色々定義
template <class T>
T max(const T& A, const T& B){
	return (A > B) ? A : B;
}

template <class T>
T min(const T& A, const T& B){
	return (A < B) ? A : B;
}

template <class T>
T min(const T& A, const T& B, const T& C){
	return min(min(A, B), C);
}

// 空白か？
char isSpace(const char& ch) {
	return (ch == SpaceSymbol) ?  1 : 0;
}

} // unnamed namespace 

int main()
{
	unsigned char _map[MaxSize][MaxSize];
	const unsigned char (&map)[MaxSize][MaxSize] = _map;
	ScoreType score[MaxSize][MaxSize];

	while (1) {
		int n;
		// データサイズ読み取り
		std::cin >> n;
		if (n == 0) { break; } // n==0ならば終了
		
		// データを読み取り
		for (int i=0; i<n; ++i) {
			std::cin >> _map[i];
		}

		// 一応, Width, Height
		const int Width  = n;
		const int Height = n;

		// スコア計算(境界)
		for (int i=0; i<Height; ++i) {
			score[i][0] = isSpace(map[i][0]);
		}
		for (int j=0; j<Width; ++j) {
			score[0][j] = isSpace(map[0][j]);
		}

		// スコア計算(境界以外)
		ScoreType max_score =0;
		for (int i=1; i<Height; ++i) {
			for (int j=1; j<Width; ++j) {
				// 更新ルール
				if (isSpace(map[i][j])) {
					score[i][j] = min(score[i-1][j-1], score[i-1][j  ],
									  score[i  ][j-1]				    )+1;
				}else{
					score[i][j] = 0;
				}
				// 最大値を覚えておく
				max_score = max(max_score, score[i][j]);
			} // for (int j...)
		} // for (int i...)
		// 結果を出力
		std::cout << max_score << std::endl;
	} // while(1)
	return 0;
}

Measured memory_bytes: 4088
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    s = list(input())

    def check(p):
        for i in range(1, N):
            if s[i]=='o' and p[i]=='S':
                p += p[i-1]
            elif s[i]=='o' and p[i]=='W':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            elif s[i]=='x' and p[i]=='S':
                if p[i-1]=='S':
                    p += 'W'
                else:
                    p += 'S'
            else:
                p += p[i-1]
        if p[0]==p[N]:
            if s[0]=='o' and p[0]=='S':
                if p[N-1]==p[1]:
                    print(p[:N])
                    exit()
            elif s[0]=='x' and p[0]=='S':
                if p[N-1]!=p[1]:
                    print(p[:N])
                    exit()
            elif s[0]=='o' and p[0]=='W':
                if p[N-1]!=p[1]:
                    print(p[:N])
                    exit()
            else:
                if p[N-1]==p[1]:
                    print(p[:N])
                    exit()

    for i in ['SS', 'SW', 'WS', 'WW']:
        check(i)
    print(-1)
    


if __name__ == '__main__':
    main()

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

typedef long long ll;
typedef long long int lld;
using namespace std;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define sum(v) accumulate(ALL(v),0)

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    map<string, ll> mp;
    cin>>n;

    rep(i,n){
        string s;
        cin >> s;
        sort(ALL(s));
        mp[s] += 1;
    }
    ll ans=0;
//    for (auto i = mp.begin(); i != mp.end(); ++i) {
//        cout << i->first << "=>" << i->second <<endl;
//    }
    for (auto i = mp.begin(); i != mp.end(); ++i) {
        ll c = i->second;
        if(c>1){
            ans += c*(c-1)/2;
        }
    }
    cout << ans << endl;
    return  0;
}


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

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){return a/GCD(a,b)*b;}

const int INF=1e9;
const double eps=0.0000000001;

int main(){
  int n,l;
  cin >> n >> l;
  vector<string> v;
  string s;
  FOR(i,n){
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(),v.end());
  FOR(i,v.size()){
    cout << v[i];
  }

  cout << endl;
}

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

using namespace std;

using ll = long long;

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

    constexpr ll MOD = 1e9 + 7;

    int n;
    string s;
    cin >> n >> s;

    vector<int> cur(n + 1, 1), nxt(n + 1);
    cur[0] = 0;

    for (int i = 2; i <= n; ++i) {
        if (s[i - 2] == '<') {
            for (int j = 1, sum = 0; j <= n - i + 1; ++j)
                nxt[j] = ((sum += cur[j]) %= MOD);
        }
        else {
            for (int j = n - i + 1, sum = 0; 1 <= j; --j)
                nxt[j] = ((sum += cur[j + 1]) %= MOD);
        }
        swap(cur, nxt);
    }

    cout << cur[1] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_a_genius = 0; ngtkana_is_a_genius < int(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (int i = int(begin); (i) < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) 0;
#endif

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  std::string s; std::cin >> s;
  int n = s.length();
  bool ans = (s.front() == s.back()) ^ (n % 2 == 0);
  std::cout << (ans ? "Second" : "First") << std::endl;
  return 0;
}

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

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    string s; cin >> s;
    ll k; cin >> k;


    for(ll i=0; i<s.size(); i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
        else if(i>=k-1){
            cout << s[i] << endl;
            return 0;
        }
        
    }
}

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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

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

int a, b, res;

int main() {
  init_ios();
  cin >> a >> b;
  for (int i = 1; i <= 12; ++i)
    for (int j = 1; j <= 31; ++j) {
      if (i == a && j > b)
        break;
      if (i > a)
        break;
      if (i == j)
        ++res;
    }
  cout<<res<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    std::map<pair<int,int>, int> seen;
    int x=sx,y=sy;
    for (int i=0;i<2;i++) {
    seen[pair(tx,ty)]=0;
    seen[pair(x,y)]++;
    while (1) {
        if (x<tx&&seen[pair(x+1,y)]==0) {
            cout<<"R";
            seen[pair(x+1,y)]++;
            x++;
        } else if (y<=ty&&seen[pair(x,y+1)]==0) {
            cout<<"U";
            seen[pair(x,y+1)]++;
            y++;
        } else if (seen[pair(x-1,y)]==0) {
            cout<<"L";
            seen[pair(x-1,y)]++;
            x--;
        } else if (seen[pair(x,y-1)]==0) {
            cout<<"D";
            seen[pair(x,y-1)]++;
            y--;
        }
        if (x==tx&&y==ty) {
            break;
        }
    }
    seen[pair(sx,sy)]=0;
    //cout<<endl;
    while (1) {
        if (x>sx&&seen[pair(x-1,y)]==0) {
            cout<<"L";
            seen[pair(x-1,y)]++;
            x--;
        } else if (y>=sy&&seen[pair(x,y-1)]==0) {
            cout<<"D";
            seen[pair(x,y-1)]++;
            y--;
        } else if (seen[pair(x+1,y)]==0) {
            cout<<"R";
            seen[pair(x+1,y)]++;
            x++;
        } else if (seen[pair(x,y+1)]==0) {
            cout<<"U";
            seen[pair(x,y+1)]++;
            y++;
        }
        if (x==sx&&y==sy) {
            break;
        }
    }
    //cout<<endl;
    }
    cout<<endl;
}

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

int main(){
  int N;
  cin >> N;
  long long sum=0;
  vector<int> num(100000);
  for(int i=0;i<N;i++){
    int A;
    cin >> A;
    sum+=A;
    num.at(A-1)++;
  }
  int Q;
  cin >> Q;
  for(int i=0;i<Q;i++){
    int B,C;
    cin >> B >> C;
    sum+=(C-B)*num.at(B-1);
    num.at(C-1)+=num.at(B-1);
    num.at(B-1)=0;
    cout << sum << endl;
  }
}

Measured memory_bytes: 3784
/*input
5 1
100 200 300 400 500
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

const int N = 1e5+1;
int a[N];
int n;

void solve(){
  	cin >> n;
  	int k;cin >> k;
  	int ans = 0;
  	RE(i,n){
  		int x;cin >> x;
  		ans += (k <= x);
  	}
  	cout << ans;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}

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

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;

	vector<vector<char>> grid(100, vector<char>(100, '.'));
	for (int i = 0; i < 100; ++i) {
		if (i < 50) {
			for (int j = 0; j < 100; ++j) {
				if ((i % 2 == 0 && j % 2) || i % 2) {
					grid[i][j] = '#';
				}
			}
		} else {
			for (int j = 0; j < 100; ++j) {
				if (i % 2 && j % 2) {
					grid[i][j] = '#';
				}
			}
		}
	}

	int a = 50 * 25 + 1 - A;
	int b = 50 * 25 + 1 - B;
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 100; ++j) {
			if (grid[i][j] == '#') { continue; }
			grid[i][j] = '#';
			--a;
			if (a <= 0) { break; }
		}
		if (a <= 0) { break; }
	}
	for (int i = 99; i >= 0; --i) {
		for (int j = 0; j < 100; ++j) {
			if (grid[i][j] == '.') { continue; }
			grid[i][j] = '.';
			--b;
			if (b <= 0) { break; }
		}
		if (b <= 0) { break; }
	}

	cout << "100 100\n";
	for (int i = 0; i < 100; ++i) {
		for (int j = 0; j < 100; ++j) {
			cout << grid[i][j];
		}
		cout << "\n";
	}

	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
//#include "./libb/lib.hpp"
 
#define rep(i, n) for(int i = 0; i < (n); ++i)
 
using namespace std;
const uint64_t MOD = 1000000007;
const double PI = acos(-1);
 
int main()
{
    uint32_t a = 0;
    cin >> a;

    cout << (a + (a * a) + (a * a * a)) << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main()
{
	int H, W;
	vector<string> A;

	cin >> H >> W;
	A.resize(H);
	rep(i, H) cin >> A.at(i);

	rep(i, H+2) {
		rep(j, W+2) {
			if (i == 0 || i == H+1 || j == 0 || j == W+1) cout << "#";
			else cout << A.at(i-1).at(j-1);
		}
		putchar('\n');
	}

	return 0;
}

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

using namespace std;

int main(){
	string str; cin >> str;
	if (str[0] != str[1])
		if (str[2] == str[3])
			if (str[4] == str[5]){
				cout << "Yes";
				return 0;
			}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N, M = mi()

ans = (1900*M + 100*(N-M)) * 2**M
print(ans)

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

int main(){ 
  string S, T; cin >> S >> T;
  int sum = 0;
  
  rep(i,3) if (S[i] == T[i]) sum++;

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#include<stdlib.h>

#include<string.h>

int main(void){

char num_str[1002];

int num;

long sum=0;

int i;

char tmp;

while(1){

fgets(num_str,sizeof(num_str),stdin);

if(num_str[0]=='0')break;

for(i=0;i<strlen(num_str)-1;i++){

tmp=num_str[i];

num=atoi(&tmp);

sum+=num;

}

printf("%ld\n",sum);

sum=0;

memset(num_str,1002,0);

}

return 0 ;

}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 31;
const int BASE = 26;

int n;
char s[MAXN];
bool used[MAXN];

void init ();
void input ();
void work ();



int main ()
{
	init ();
	input ();
	work ();
}



void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method

	cin >> s;
}

void work ()
{
	// main work

	n = strlen ( s );
	lp ( i, 0, n ) used[s[i] - 'a'] = true;
	if ( n < BASE ) {
		int mini;
		lp ( i, 0, BASE ) {
			if ( !used[i] ) {
				mini = i;
				break;
			}
		}
		s[n] = mini + 'a';
		s[n + 1] = '\0';
	} else {
		lpdi ( i, n - 1, 0 ) {
			int nc = s[i] - 'a', cp = -1;
			lp ( j, nc + 1, BASE ) {
				if ( !used[j] ) {
					cp = j;
					break;
				}
			}
			if ( ~cp ) {
				s[i] = cp + 'a';
				break;
			} else used[s[i]-'a'] = false, s[i] = '\0';
		}
	}

	if ( s[0] == '\0' ) cout << -1 << endl;
	else cout << s << endl;
}

Measured memory_bytes: 764
#include <cstdio>

using namespace std;

const int mod = 1'000'000'007;

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

int pw(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b /= 2;
  }
  return res;
}

int inv(int a) {
  return pw(a, mod - 2);
}

const int N = 1'000'009;

int f[N];
int rf[N];

int choose(int n, int k) {
  return mul(f[n], mul(rf[k], rf[n - k]));
}

int main() {
  f[0] = 1;
  rf[0] = 1;
  for (int i = 1; i < N; ++i) {
    f[i] = mul(f[i - 1], i);
    rf[i] = inv(f[i]);
  }
  int x, y;
  scanf("%d%d", &x, &y);
  int i = 1;
  while (i <= x && i <= y) {
    if ((x - i) + (y - i) == i) {
      break;
    }
    ++i;
  }
  printf("%d\n", i > x || i > y ? 0 : choose(i, x - i));
}


Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b ,c ,d ,e ,f;
  cin >> a >> b;
  c = ( a + b ) / 2;
  d = ( a + b + 1 ) / 2;
  e = ( c + d ) / 2;
  f = ( c + d ) % 2;
  cout << e + f << endl;
}

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

int main() {
    std::vector<int> x(5);

    for(int i = 0; i < 5; i++) {
        std::cin >> x.at(i);
    }

    auto iter = std::find(x.begin(), x.end(), 0);
    auto dist = std::distance(x.begin(), iter);

    std::cout << dist + 1 << std::endl;

    return 0;
}


Measured memory_bytes: 3584
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n,k;
    cin >> n >> k;
    vector<double> dice(n),s(n);
    rep(i,n){
        cin >> dice[i];
        dice[i] = (dice[i]+1)/2;
    }
    s[0] = dice[0];
    rrep(i,n){
        s[i] = s[i-1]+dice[i];
    }
    double ans = s[k-1];
    rrep(i,n-k+1){
        ans = max(s[i+k-1]-s[i-1],ans);
    }
    cout << fixed << setprecision(20) << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
const int MAXN = 1e6+20;
const long long INF = 1e16;
using namespace std;
 
int n,ans,kol;
int a[MAXN];
int main()
{
 
	ios_base::sync_with_stdio(0);
 
//	freopen("longpath.in", "r", stdin);
//	freopen("longpath.out", "w", stdout);
 
 
 
	cin>>n;
	ans = 0;
	for (int i=1; i<=n; i++) cin>>a[i];
	for (int i=n-1; i>=1; i--)
	{
		if (a[i] >= a[i+1]) kol++;
		ans = max(ans,kol);
		if (a[i]<a[i+1]) kol = 0;
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    vector<string> mat(8, string(8, '.'));
    int k; cin >> k;
    vector<P> ini;
    rep(_, k) {
        int x, y; cin >> x >> y;
        mat[x][y] = 'Q';
        ini.emplace_back(x, y);
    }

    vector<int> a(8);
    rep(i, 8) a[i] = i;

    do {
        bool match = true;
        for (const auto& in: ini) {
            if (a[in.fi]!=in.se) match = false;
        }
        if (match) {
            vector<string> tmp(8, string(8, '.'));
            vector<P> arrange;
            rep(i, 8) {
                int ch = i, cw = a[i];
                tmp[ch][cw] = 'Q';
                arrange.emplace_back(ch, cw);
            }
            bool ok = true;
            for (const auto& ar: arrange) {
                int ch = ar.fi, cw = ar.se;
                rep(i, 8) rep(j, 8) {
                    if (i==ch) continue;
                    if (abs(i-ch)==abs(j-cw)) {
                        if (tmp[i][j]=='Q') {
                            ok = false;
                            break;
                        }
                    }
                }
            }
            if (ok) {rep(i, 8) cout << tmp[i] << endl;}
        }
    } while (next_permutation(all(a)));
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//試してて御免

const int cm = 1 << 17;
char ci[cm];
char *cn = ci + cm;
inline char getcha() { 
	if (cn - ci == cm) { fread(ci, 1, cm, stdin); cn = ci; }
	return *cn++;
}

inline int getint() {
	if (cn - ci + 25 > cm) {
		char C = getcha();
		int A = C - '0';
		while ((C = getcha()) >= '0') A = A * 10 + C - '0';
		return A;
	}
	else {
		char C = *cn++;
		int A = C - '0';
		while ((C = *cn++) >= '0') A = A * 10 + C - '0';
		return A;
	}
}

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


	int N, X;
	N = getint();
	X = getint();

	int A = 0;
	ll kotae = 0;
	rep(i, N) {
		int B = getint();
		if (A + B > X) {
			kotae += A + B - X;
			B = X - A;
		}
		A = B;
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  int sum = 1;
  cin >> N >> K;
  
  for( int i = 0; i < N; i++) {
    if ( (sum + K) < (sum * 2) ){
      sum = sum + K;
    } else {
      sum = sum * 2;
    }
  }
  cout << sum << endl; 
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int a;
		int b;

		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();

		if (a + b == 15) {
			System.out.println("+");
		} else if (a * b == 15)

		{
			System.out.println("*");
		} else {
			System.out.println("x");
		}

	}
}

Measured memory_bytes: 21844
A,B=list(map(int,input().split()))
C=list(map(int,input().split()))
C.sort()
ans = 0
for i in C:
    if B >= i:
        ans+=1
        B-=i
    else:
        print(ans)
        exit()
if B > 0:
    ans-=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
    int n, p, a, i;
    cin >> p;
    int data[p];
    
    for(i = 0; i < p; i++ ){
        a = p-1 - i;
        cin >> n;
        data[a] = n; 
    }
    
    for(i = 0; i < p; i++){
        if(i != 0) cout << " ";
        cout << data[i];
    }
    
    cout << endl;
    
}



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

int Sort(int A[], int n){
  int count = 0, flag = 1;

    while(flag){
        flag = 0;
        for(int i = n-1; i > 0; i--){
            if(A[i] < A[i-1]){
                swap(A[i], A[i-1]);
                count++;
                flag = 1;
            }
        }
    }

    return count;
}

int main(){
    int A[100], n, count;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    count = Sort(A,n);

    for(int i = 0; i < n; i++){
        if(i)   cout << " ";
        cout << A[i];
    }

    cout << endl;
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;


int main(){
    int n;
    vector<P> xy;
    cin >> n;
    rep(i,n){
        int x,y; cin >> x >> y;
        xy.pb(P(x,y));
    }
    vector<int> ind;
    rep(i,n){
        ind.pb(i);
    }
    auto dist = [&](int i, int j){
        double dx = xy[i].first-xy[j].first ;
        double dy = xy[i].second-xy[j].second;
        return sqrt(dx*dx+dy*dy);
    };
    double ans = 0;
    rep(i,n)rep(j,n){
        ans += dist(i,j)/n;
    }
    printf("%.10f",ans);
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=jp
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int V = sc.nextInt();
        int E = sc.nextInt();
        Edge[] edges = new Edge[E];
        for (int i = 0; i < E; i++) {
            int s = sc.nextInt();
            int t = sc.nextInt();
            int w = sc.nextInt();
            edges[i] = new Edge(s, t, w);
        }
        Arrays.sort(edges);
        UnionFind uf = new UnionFind(V);
        int weight = 0;
        for (Edge e : edges) {
            if (!uf.equals(e.s, e.t)) {
                weight += e.w;
                uf.merge(e.s, e.t);
                if (uf.groups == 1) {
                    break;
                }
            }
        }
        System.out.println(weight);
    }

    static class UnionFind {
        public int[] v;
        int groups;

        UnionFind(int n) {
            v = new int[n];
            for (int i = 0; i < n; i++) {
                v[i] = i;
            }
            groups = n;
        }

        int find(int p) {
            if (v[p] == p) {
                return p;
            }
            return v[p] = find(v[p]);
        }

        boolean equals(int a, int b) {
            return this.find(a) == this.find(b);
        }

        int merge(int p, int q) {
            p = find(p);
            q = find(q);
            if (p != q) {
                v[q] = p;
                groups--;
            }
            return groups;
        }
    }

    public static class Edge implements Comparable<Edge> {
        public int s, t, w;

        Edge(int s, int t, int w) {
            this.s = s;
            this.t = t;
            this.w = w;
        }

        @Override
        public int compareTo(Edge o) {
            return this.w - o.w;
            // return o.w - this.w;
        }
    }
}

Measured memory_bytes: 107060
#include<bits/stdc++.h>
using namespace std;
bool checkPrime(int num,vector<int>&prime){
    bool chk = true;
    for(int i=0;i<prime.size() && prime[i]*prime[i] <= num;i++){
        if(num % prime[i] == 0){
            chk = false;
            break;
        }
    }
    return chk;
}


int main(){
    int q;
    cin >> q;
    vector<int>prime;
    prime.push_back(2);
    for(int i=3;i<=100000;i+=2){
        bool chk = true;
        for(int j=0;j<prime.size()&&prime[j]*prime[j]<=i;j++){
            if(i%prime[j]==0){
                chk=false;
                break;
            }
        }
        if(chk)prime.push_back(i);
    }
    vector<int>like2017(100000,0);
    for(int i=3;i<=100000;i++){
        like2017[i] = like2017[i-1];
        if(i%2 == 1){
            if(checkPrime(i,prime) && checkPrime((i+1)/2,prime))like2017[i]++;
        }
    }
    int l[q];
    int r[q];
    for(int i=0;i<q;i++)cin >> l[i] >> r[i];
    for(int i=0;i<q;i++){
        cout << like2017[r[i]] - like2017[l[i]-1] << endl;
    }
}


Measured memory_bytes: 1920
n = int(input())
l = {int(i) for i in input().split() if int(i)%2 == 0}
cnt = 0
for i in l:
    if (i%3 == 0) or (i%5 == 0):
        pass
    else:
         cnt += 1
if cnt == 0:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;



int main(void){

    int N;
    cin>>N;
    int data[N];
    //abs()
    int max=0;
    int sa;
    int i,j;
    rep(i,N){
        cin>>data[i];
    }
    rep(i,N){
        for(j=i+1;j<N;++j){
            sa = abs(data[i]-data[j]);

            if(max<sa){
                max=sa;
                //cout << sa << endl;
            }
        }

    }

    cout << max << endl;


    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
int main(){
    ll x=1,i,lb,rb,mid;
    char tp[10];
    for(i=1;i<=13;i++,x*=10){
        printf("? %lld\n",x);fflush(stdout);
        scanf("%s",tp);
        if(tp[0]=='N') break;
    }
    if(i>13){
        for(i=1,x=10;i<=13;i++,x*=10){
            printf("? %lld\n",x-1);fflush(stdout);
            scanf("%s",tp);
            if(tp[0]=='Y') break;
        }
        printf("! %lld\n",x/10);fflush(stdout);
        return 0;
    }
    lb=x-1;rb=x*10;
    while(rb-lb>1){
        mid=lb+rb>>1;
        printf("? %lld\n",mid);fflush(stdout);
        scanf("%s",tp);
        if(tp[0]=='N') lb=mid;
        else rb=mid;
    }
    
    printf("! %lld\n",rb/10);fflush(stdout);
    return 0;
}


Measured memory_bytes: 684
from bisect import bisect_left
I = lambda x: [-1<<50] + [int(input()) for i in range(x)] + [1<<50]

A,B,Q = map(int,input().split())
S,T = I(A),I(B)

for _ in range(Q):
    x = int(input())
    BLS = bisect_left(S,x)  
    BLT = bisect_left(T,x) 

    LS = S[BLS-1] 
    RS = S[BLS] 
    LT = T[BLT-1] 
    RT = T[BLT]  
    
    print(min(  
        x-min(LS,LT),
        max(RS,RT)-x,
        (x-LS)*2+(RT-x),
        (x-LT)*2+(RS-x),
        (RT-x)*2+(x-LS),
        (RS-x)*2+(x-LT)
        ))

Measured memory_bytes: 12816
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 105;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> pl;
typedef pair<ll, ll> pll;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A[NMAX],B,C,D,E;
int dp[NMAX] = {};

string S;
vec v;

ll ans = INFLL;

void solve(){
  // main algorithm
  for (int i = -100; i <= 100; ++i)
  {
    ll cand = 0;
    for (int j = 0; j < N; ++j)
    {
      cand += (i - A[j]) * (i - A[j]);
    }
    ans = min(ans, cand);
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  printf("%lld\n", ans);
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  scanf("%lld", &N);
  for (int i = 0; i < N; ++i)
  {
    scanf("%lld", &A[i]);
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  rep(i,50001){
    double x = i;
    if((ll)(x*1.08) == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	string a;
	getline(cin,a);
	for(int i=0;i<a.size();i++){
		if('A'<=a[i]&&a[i]<='Z'){
			a[i]+=32;
		}
		else if('a'<=a[i]&&a[i]<='z'){
			a[i]-=32;
		}
		cout<<a[i];
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 3108
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int>g;
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
    int A,B,k;scanf("%d%d%d",&A,&B,&k);
//	if(B<A)swap(A,B);
    for(int i=1;i*i<=A;i++)
        if(A%i==0){
            if(B%i==0)g.push_back(i);
          	if(i*i!=A)
			{
				if(B%(A/i)==0)g.push_back(A/i);
			}
        }
	sort(g.begin(),g.end(),cmp);
	printf("%d\n",g[k-1]);
	return  0;
}


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

#define rep(i, n) for(int i=0;i<n;i++)

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

    int n, a, b;

    cin >> n >> a >> b;

    cout << min(n * a, b) << "\n";

    return 0;
} 

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

const int MAX_N = 100005;
ll a[MAX_N] = {0};

int main()
{
    ll n, k;
    cin >> n >> k;
    
    for(int i = 0; i < n; ++i)
    {
        int ai, bi;
        cin >> ai >> bi;
        a[ai] += bi;
    }
    
    for(int i = 0; i < MAX_N; ++i)
    {
        if(k <= a[i])
        {
            cout << i << endl;
            break;
        }
        
        k -= a[i];
    }
    
    
    return 0;
}



Measured memory_bytes: 1024
#include <stdio.h>

#define N 100 

typedef struct {
    int array[N];
} Array;

int selection( Array *, int );

int main() {
    int i = 0,
        num = 0,
        inp = 0,
        ret = 0;

    Array a;

    scanf( "%d", &num );
    for( i=0; i < num; i++ ) {
        scanf( "%d", &a.array[i] );
    }
    ret = selection( &a, num );

    for( i=0; i < num; i++ ) {
        if( i )
            printf(" ");
        printf( "%d", a.array[i] );
    }
    printf( "\n");
    printf( "%d\n", ret );

    return 0;
}

int selection( Array *p, int n ) {
    int i,j = 0,
        count = 0,
        store = 0,
        minj = 0;

    for( i=0; i <= n-1; i++ ) {
        minj = i;
        for( j=i; j <= n-1; j++ ) {
            if( p->array[j] < p->array[minj] ) {
                minj = j;
            }
        }

        if(p->array[i] > p->array[minj]) ++count;

        store = p->array[i];
        p->array[i] = p->array[minj];
        p->array[minj] = store;

    }
    return (count);
}



Measured memory_bytes: 2108
# -*- coding: utf-8 -*-

import sys
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()
# 日数別に報酬の値を格納
days = [[] for i in range(10**5+1)]
for i in range(N):
    a, b = MAP()
    days[a].append(b)

que = []
ans = 0
# 制約の厳しい後半から確認していく
for i in range(M-1, -1, -1):
    a = M-i
    # 残日数aで使えるようになるタスクを追加
    for b in days[a]:
        heappush(que, (-b, a))
    # キューに中身があったら最大のものを取得
    if len(que):
        b, a = heappop(que)
        ans += -b
print(ans)


Measured memory_bytes: 24796
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static long[] fac;
	public static long[] finv;
	public static long[] inv;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int x = parseInt(sc.next());
		int y = parseInt(sc.next());
		sc.close();
		int[] nd = new int[n+1];
		for (i = 1; i < n; i++) {
			for (j = i+1; j <= n; j++) {
				nd[Math.min(j-i,abs(x-i)+abs(y-j)+1)]++;
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		for (i = 1; i < n; i++) {
			pw.println(nd[i]);
		}
		pw.flush();
	}
}


Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int L;cin >> L;
    double tmp = (double)L/3;
    double ans = tmp * tmp * tmp;

    cout << std::fixed << std::setprecision(15) << ans << endl;
}

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


int main(void)
{
	int x = 0;
	int a, b, c = 0;
	cin >> a >> b;
	if (a >= b) c = a;
	if (a < b) c = b;

	vector<int> aa(c);
	vector<int> bb(c);
	
	int count1 = 0, count2 = 0;
	

	for (int i = 0; i < a; i++)
	{
		aa[i] = b;
		count1++;
	}
	for (int i = 0; i < b; i++)
	{
		bb[i] = a;
		count2++;
	}

	if (a==b)
	{
		for (int j = 0; j < count1; j++)
		{
			printf("%d", aa[j]);

			x = 3;
		}
	}
	else {
		for (int i = 0; (i < 9) && (x == 0); i++)
		{
			if (aa[i] < bb[i])
			{
				for (int j = 0; j < count1; j++)
				{
					printf("%d", aa[j]);

				}
				x = 1;
			}
			else if (aa[i] > bb[i])
			{
				for (int j = 0; j < count2; j++)
				{
					printf("%d", bb[j]);

				}
				x = 2;
			}
			
		}
	}

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int h = Integer.parseInt(sa[0]);
		int w = Integer.parseInt(sa[1]);
		int k = Integer.parseInt(sa[2]);
		char[][] s = new char[h][w];
		for (int i = 0; i < h; i++) {
			s[i] = br.readLine().toCharArray();
		}
		br.close();

		int[][] ans = new int[h][w];
		int idx1 = 0;
		label:
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (s[i][j] == '#') {
					idx1 = i;
					break label;
				}
			}
		}

		int[] cnt = new int[h];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (s[i][j] == '#') {
					cnt[i]++;
				}
			}
		}

		int num = 1;
		int prev = -1;
		int next = -1;
		for (int i = 0; i < h; i++) {
			if (cnt[i] == 0) {
				if (prev == -1) {
					prev = i;
				}
				continue;
			}
			for (int j = i + 1; j < h; j++) {
				if (cnt[j] == 0) {
					next = j;
				} else {
					break;
				}
			}
			if (prev == -1) {
				prev = i;
			}
			if (next == -1) {
				next = i;
			}
			for (int j = 0; j < w; j++) {
				for (int x = prev; x <= next; x++) {
					ans[x][j] = num;
				}
				if (s[i][j] == '#' && cnt[i] > 1) {
					num++;
					cnt[i]--;
				}
			}
			i = next;
			prev = -1;
			next = -1;
			num++;
		}
		for (int i = 0; i < h; i++) {
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < w; j++) {
				sb.append(ans[i][j]).append(' ');
			}
			sb.deleteCharAt(sb.length() - 1);
			System.out.println(sb.toString());
		}
	}
}


Measured memory_bytes: 31392
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#define inf 10e8
using namespace std;



int main(){
    int n;
    cin >> n;
    int a[1000],b[1000],c[1000];
    int d[1000];
    int ans=0;
    for (int i=1;i<=100;i++){
        d[i]=0;
    }
    for (int i=1;i<=n;i++){
        cin >> a[i];
        if(i>0){
            if(a[i]==a[i-1]+1) d[a[i-1]]++;
        }
    }
    for (int i=1;i<=n;i++){
        cin >> b[i];
        ans+=b[i];
    }
    for (int i=1;i<=n;i++){
        cin >> c[i];
        if(d[i]!=0) ans+=c[i];
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, x;
    cin>>n>>x;
    vl as(n);
    cin>>as;
    vl ss(n - 1);
    rep(i, n - 1) {
        ss[i] = as[i] + as[i + 1];
    }

    ll ans = 0;
    rep(i, n - 1) {
        if (ss[i] < x) continue;
        if (as[i + 1] >= ss[i] - x) {
            ans += ss[i] - x;
            ss[i + 1] -= ss[i] - x;
        }
        else {
            ans += ss[i] - x;
            ss[i + 1] -= as[i + 1];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  int x = -1, y = 10000;
  double z = 0.2;
  string s2 = "beginner1010";
  long long b = 1LL << 60;
    
  // debug(x, y, z, s, b);
    
  double aux = 1010.0;
  string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  ll n,k,r,s,p,ans = 0,f;
  cin >> n >> k >> r >> s >> p;
  string  s1;
  cin >> s1;
  for (int i = 0; i < n; ++i)
  {
    if ( s1[i] == 'r') f = p;
    if ( s1[i] == 'p') f = s;
    if ( s1[i] == 's') f = r;
    if (i >= k && s1[i-k] == s1[i])
    {
      f = 0;
      s1[i] = '0';
    }
    ans += f;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
n, m = map(int, input().split())
double_dimension = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    double_dimension[a-1][b-1] += 1
tmp = []
for i in range(n):
    row = sum(double_dimension[i])
    column = 0
    for d in double_dimension:
        column += d[i]
    print(row + column)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<iomanip>

using namespace std;

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

  c = double(a*b/(a+b));

  std::cout << std::setprecision(10) << c << std::endl;
  return 0;
}


Measured memory_bytes: 256