akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 自力で解けた。
const ll INF = 1e18;

int main() {
  int n;
  cin >> n;

  vector<vector<ll> > A(n, vector<ll>(n, 0)), dist(n, vector<ll>(n, INF));
  rep(i, n) rep(j, n) {
    cin >> A[i][j];
    dist[i][j] = A[i][j];
  }

  rep(k, n) {
    rep(i, n) {
      rep(j, n) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      } 
    } 
  }

  ll ans = 0;
  rep(i, n) {
    rep(j, n) {
      if (dist[i][j] < A[i][j]) {
        cout << -1 << endl;
        return 0;
      }
      ans += dist[i][j];
    }
  }
  ans /= 2;
  
  for(int i = 0; i < n - 1; i++) {
    for(int j = i + 1; j < n; j++) {
      for(int k = 0; k < n; k++) {
          if (k == i || k == j) continue;
          if (dist[i][k] + dist[k][j] == dist[i][j]) {
            ans -= dist[i][j];
            break;
          }
      }
    }
  }

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


Measured memory_bytes: 5040
#include <stdio.h>
#define ll long long int

int main() {
    int n;
    scanf("%d", &n);
    ll arr[n], max = 1e18, prod = 1, flag = 0, zero = 0;
    for (int i = 0; i < n; i++) {
        scanf("%lld", &arr[i]);
        flag = arr[i] > max ? 1 : flag;
        prod *= arr[i];
        arr[i] ? max /= arr[i] : zero = 1;
    }
    if (zero) {
        printf("0\n");
    }
    else {
        flag ? printf("-1\n") : printf("%lld\n", prod);
    }
    return 0;
}


Measured memory_bytes: 2456
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1)/ (y))
#define MOD 1000000007ULL

u64 N;
u64 *evenPrefixSum;
u64 *oddPrefixSum;

void init();

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

    cin >> N;

    evenPrefixSum = new u64[(N + 1) / 2]();
    oddPrefixSum = new u64[(N + 3) / 2]();

    u64 A;
    for (int i = 1; i <= N; ++i)
    {
        cin >> A;
        if (i % 2 == 0) // even
        {
            evenPrefixSum[i / 2] = A + evenPrefixSum[(i - 2) / 2];
        }
        else // odd
        {
            oddPrefixSum[(i + 1) / 2] = A + oddPrefixSum[(i - 1) / 2];
        }
    }

    u64 total = oddPrefixSum[(N + 1) / 2] + evenPrefixSum[(N - 1) / 2];

    for (int i = 1; i <= N; ++i)
    {
        if (i % 2 == 1) // odd
        {
            cout << (total / 2 - (oddPrefixSum[(i - 1)/ 2] + (evenPrefixSum[(N - 1) / 2] - evenPrefixSum[(i - 1)/ 2]))) * 2 << " ";
        }
        else
        {
            cout << (total / 2 - (evenPrefixSum[(i - 2) / 2] + (oddPrefixSum[(N + 1) / 2] - oddPrefixSum[i / 2]))) * 2 << " ";
        }
    }

    cout << "\n";

    return 0;
}



Measured memory_bytes: 2176
import java.util.Scanner;

class Main {

	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();

		scan.close();

		System.out.printf("%d %d %f", a/b, a%b, (double)a / b);
	}

}

Measured memory_bytes: 17368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    cin >> N;
    string S;
    cin >> S;

    set<ll> st;
    rep(i, N){
        if (S[i] == 'R') st.emplace(i);
    }

    ll ans = 0, cnt = st.size();
    rep(i, N){
        if (cnt == 0) break;
        if(S[i]=='W'){
            ll r = *st.rbegin();
            swap(S[i], S[r]);
            st.erase(st.lower_bound(r));
            cnt--;
            ans++;
            // err(i, r, S);
        }
        else{
            cnt--;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 12928
import sys
input = sys.stdin.readline

H,W=map(int,input().split())
MAP=[input().strip() for i in range(H)]

ANS=[[1<<30]*W for i in range(H)]

if MAP[0][0]==".":
    ANS[0][0]=0
else:
    ANS[0][0]=1

for i in range(H):
    for j in range(W):
        if i+1<H:
            if MAP[i][j]==MAP[i+1][j]:
                ANS[i+1][j]=min(ANS[i+1][j],ANS[i][j])
            else:
                ANS[i+1][j]=min(ANS[i+1][j],ANS[i][j]+1)

        if j+1<W:
            if MAP[i][j]==MAP[i][j+1]:
                ANS[i][j+1]=min(ANS[i][j+1],ANS[i][j])
            else:
                ANS[i][j+1]=min(ANS[i][j+1],ANS[i][j]+1)
            
print((ANS[-1][-1]+1)//2)




Measured memory_bytes: 41712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i <= (n); ++i)
#define repD(i, a, n) for(ll i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define mem(a) memset(a, 0, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define endl '\n'
#define MAXN 5000000
const long double PI = 3.141592653589793238462643383;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
ll mod = 1000000007;
int Ceil(int a, int b){
	if(a%b==0) return a/b;
	else return (a/b)+1;
}

int main() {
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);   
	// freopen("output.txt", "w", stdout);
	// #endif
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
	string a,b,c;
  cin >> a >> b >> c;
  cout << "A" << b[0] << "C" << "\n";

	return 0;
}

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

int main() {
    int n, temp, ans = 0;
    string str;
    cin >> n >> str;
    rep(i, n - 1) {
        temp = 0;
        vector<bool> x(26, false), y(26, false);
        rep(j, i + 1) x.at(str.at(j) - 'a') = true;
        rep(j, n - i - 1) y.at(str.at(j + i + 1) - 'a') = true;
        rep(j, 26) if(x.at(j) && y.at(j)) temp++;
        ans = max(ans, temp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define eps 0.00000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define f(n) for(int i=0;i<n;++i)
#define REP(i,n) for(long long i = 0;i < n;++i)
int geko[200] = {};
int main(){
	int n;
	cin >> n;
	for(int i = 1;i < 8;i *= 2){
		int x;
		cin >> x;
		REP(q,x){
			int a;
			cin >> a;
			geko[a] += i;
		}
	}
	int ans = 0;
	for(int i = 0;i < n;++i){
		if(geko[i+1] == 4||geko[i+1] == 6||geko[i+1]==7)ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3120
N = int(input())
List=list(map(int,input().split()))
ans = 0
a = 1

for i in List:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      a=1      
    else:
      ans = 1
      
if ans == 1:
  print("DENIED")
else:
  print("APPROVED")

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <math.h>

#define N_MAX 12
#define EPS (1e-7)

int width;
int n;
int r[N_MAX];

double best[N_MAX][1<<N_MAX];

int judge(int prev,int used,double cur_width) {
	int i;
	if(best[prev][used]>EPS && cur_width+EPS>best[prev][used])return 0;
	best[prev][used]=cur_width;
	if(cur_width>width+EPS)return 0;
	if(used==(1<<n)-1) {
		cur_width+=r[prev];
		return cur_width<width+EPS;
	}
	for(i=0;i<n;i++) {
		if((used&(1<<i))==0) {
			/* sqrt((r1+r2)^2 - (r1-r2)^2) */
			double delta=2.0*sqrt(r[prev]*r[i]);
			if(judge(i,used|(1<<i),cur_width+delta))return 1;
		}
	}
	return 0;
}

int main(void) {
	char input_buffer[1024];
	while(fgets(input_buffer,sizeof(input_buffer),stdin)!=NULL) {
		int cur_num=0;
		int cur_index=-1;
		int i;
		int ok=0;
		for(i=0;;i++) {
			if('0'<=input_buffer[i] && input_buffer[i]<='9') {
				cur_num=cur_num*10+input_buffer[i]-'0';
			} else {
				if(cur_num>0) {
					if(cur_index<0)width=cur_num; else r[cur_index]=cur_num;
					cur_index++;
				}
				cur_num=0;
				if(input_buffer[i]=='\0') {
					n=cur_index;
					break;
				}
			}
		}
		memset(best,0,sizeof(best));
		for(i=0;i<n;i++) {
			ok=ok || judge(i,1<<i,(double)r[i]);
		}
		puts(ok?"OK":"NA");
	}
	return 0;
}

Measured memory_bytes: 884
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long int n,a,b,c,d,e,mi,ans;
    cin>>n>>a>>b>>c>>d>>e;
    mi=min(a,min(b,min(c,min(d,e))));
    ans=5+(n-1)/mi;
    cout<<ans<<endl;
}

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize,
        a: usize,
        b: usize,
    }
    if n * a < b {
        println!("{}", n * a);
    } else {
        println!("{}", b);
    }
}


Measured memory_bytes: 4352
/***********************************************************
 *This code By @1353055672(Ligen)                          *
 *[Warning]You're not excepted to understand this code!    *
 *RP++                                                     *
 ***********************************************************/
//#pragma GCC optimize(3)
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#define ll long long
#define ull unsigned long long
#define mn 100020
#define inf (ll)(1e18)
#define mod (int)(1e9+7)
#define FOR(a,b,c) for (register ll a=b;a<=c;a++)
#define FORD(a,b,c) for (register ll a=b;a>=c;a--)
using namespace std;
inline ll read(){
    ll x=0,f=1;
    char c=getchar();
    while (c<'0'||c>'9'){
        if (c=='-')f=-1;
        c=getchar();
    }
    while (c>='0'&&c<='9'){
        x=x*10+c-'0';
        c=getchar();
    }
    return x*f;
}
inline void writeln(ll a){
    if(a==0){puts("0");return;}
    if(a<0)putchar('-'),a=-a;
    char c1[120];
    int h=0;
    while(a)c1[++h]=a%10+'0',a/=10;
    FORD(i,h,1)putchar(c1[i]);putchar('\n');
    return;
}
inline ll Max(ll a,ll b){return (a>b)?a:b;}
inline ll Min(ll a,ll b){return (a<b)?a:b;}
inline ll Abs(ll x){return (x<0)?-x:x;}
inline void Swap(ll &x,ll &y){ll t=x;x=y;y=t;}
inline ll gcd(ll a,ll b){return a==0?b:gcd(b%a,a);}
//---------------------Head Files--------------------------//
int n,a[mn],b[mn];
ll ans,num;
int main(){
	n=read();FOR(i,1,n)a[i]=read();sort(a+1,a+1+n);
	int l=1,r=n,m=(l+r)>>1;
	b[m]=a[r--];
	if(n%2){
		FORD(i,m-1,1)if((m-i)%2)b[i]=a[l++],b[m+m-i]=a[l++];
		else b[i]=a[r--],b[m+m-i]=a[r--];
		num=0;
		FOR(i,2,n)num+=Abs(b[i]-b[i-1]);ans=num;
		l=1,r=n;
		b[m]=a[l++];
		FORD(i,m-1,1)if((m-i)%2==0)b[i]=a[l++],b[m+m-i]=a[l++];
		else b[i]=a[r--],b[m+m-i]=a[r--];
		num=0;
		FOR(i,2,n)num+=Abs(b[i]-b[i-1]);ans=Max(ans,num);
		writeln(ans);
		return 0;
	}
	l=1,r=n;
	b[m]=a[r--];b[m+1]=a[l++];
	FORD(i,m-1,1)if((m-i)%2)b[i]=a[l++],b[n-i+1]=a[r--];
	else b[i]=a[r--],b[n-i+1]=a[l++];
	num=0;
	FOR(i,2,n)num+=Abs(b[i]-b[i-1]);ans=num;
	l=1,r=n;
	b[m+1]=a[r--];b[m]=a[l++];
	FORD(i,m-1,1)if((m-i)%2==0)b[i]=a[l++],b[n-i+1]=a[r--];
	else b[i]=a[r--],b[n-i+1]=a[l++];
	num=0;
	FOR(i,2,n)num+=Abs(b[i]-b[i-1]);ans=Max(ans,num);
	writeln(ans);
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

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

    map<int, int> m;

    int d = s;
    for(int i = 1; i <= 1000000; ++i)
    {
        auto p = m.insert(make_pair(d, i));
        if(!p.second)
        {
            cout << i << endl;
            break;
        }
        if(d % 2)
            d = 3 * d + 1;
        else
            d = d / 2;
    }
    return 0;
}

Measured memory_bytes: 888
#include<stdio.h>

int main(){
  long n, i, x, temp, min = 20000000000, max=-20000000000;
  scanf("%ld", &n);
  scanf("%ld", &min);
  for(i=1;i<n;i++){
    scanf("%ld", &temp);
    if (max<temp-min) max=temp-min;
    if (min>temp) min=temp;
    }
  printf("%ld\n", max);
  return 0;
}

Measured memory_bytes: 1852
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll H,W;
  cin >> H >> W;

  //4通りの分け方
  ll ans = 1000000000LL;

  //---に分割
  if(H%3 == 0) ans = min(ans,0LL);
  else ans = min(ans,W);

  //|||に分割
  if(W%3 == 0) ans = min(ans,0LL);
  else ans = min(ans,H);

  //|--に分割
  for(int i=1;i<=W;i++){
    ll sz[3];
    sz[0] = i * H;
    sz[1] = (W - i) * (H / 2);
    sz[2] = (W - i) * (H - H / 2);
    sort(sz,sz+3);
    ans = min(ans, sz[2]-sz[0]);
  }

  //-||に分割
  for(int i=1;i<=H;i++){
    ll sz[3];
    sz[0] = i * W;
    sz[1] = (H-i) * (W / 2);
    sz[2] = (H-i) * (W - W/2);
    sort(sz,sz+3);
    ans = min(ans, sz[2]-sz[0]);
  }

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

Measured memory_bytes: 256
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
l=list(mi())
l=sorted(l)
ans=0
for i in range(a-2):
  for j in range(i+1,a-1):
    s=bisect.bisect_left(l,l[i]+l[j])
    ans+=s-j-1
print(ans)

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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;
}

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

const int inf=100000000;


vector<llong> enum_div(llong n)//nの約数を列挙
{
    std::vector<llong> ret;
    for(llong i=1 ; i*i<=n ; ++i)
    {
        if(n%i == 0)
        {
            ret.push_back(i);
            if(i!=1 && i*i!=n)
            {
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    llong n;
    cin>>n;
    llong ans=0;
    if(n==1||n==2) ans=0;
    llong g=sqrt(n);

    vector<llong> bc=enum_div(n);
    bc.push_back(n);


    for(llong i=0; i<bc.size(); i++)
    {
        if(bc[i]>g-1&&(bc[i]-1)>n/bc[i]) ans+=(bc[i]-1);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;
ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}
ll LCM(ll x, ll y) { 
  return x / GCD(x, y) * y;
}

int main(){
  ll n; cin >> n;
  cout << n*(n-1)/2 << endl;
}


Measured memory_bytes: 256
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);
        Lamp solver = new Lamp();
        solver.solve(1, in, out);
        out.close();
    }

    static class Lamp {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();

            int[][] g = new int[h][w];
            for (int i = 0; i < h; i++) {
                char[] chars = in.next().toCharArray();
                for (int j = 0; j < w; j++) {
                    if (chars[j] == '#') {
                        g[i][j] = Integer.MAX_VALUE;
                    } else {
                        g[i][j] = 1;
                    }
                }
            }

            int[][] left = new int[h][w];
            for (int i = 0; i < h; i++) {
                int step = 0;
                for (int j = 0; j < w; j++) {
                    if (g[i][j] > 1) {
                        step = 0;
                    } else {
                        step++;
                    }
                    left[i][j] = step;
                }
            }
            int[][] right = new int[h][w];
            for (int i = 0; i < h; i++) {
                int step = 0;
                for (int j = w - 1; 0 <= j; j--) {
                    if (g[i][j] > 1) {
                        step = 0;
                    } else {
                        step++;
                    }
                    right[i][j] = step;
                }
            }

            int[][] up = new int[h][w];
            for (int i = 0; i < w; i++) {
                int step = 0;
                for (int j = 0; j < h; j++) {
                    if (g[j][i] > 1) {
                        step = 0;
                    } else {
                        step++;
                    }
                    up[j][i] = step;
                }
            }
            int[][] down = new int[h][w];
            for (int i = 0; i < w; i++) {
                int step = 0;
                for (int j = h - 1; 0 <= j; j--) {
                    if (g[j][i] > 1) {
                        step = 0;
                    } else {
                        step++;
                    }
                    down[j][i] = step;
                }
            }

            long result = 0;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    int score = left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3;
                    result = Math.max(result, score);
                }
            }

            out.println(result);

        }

    }
}



Measured memory_bytes: 137904
#include <bits/stdc++.h>
#ifdef DEBUG
#include "_debug.cpp"
#include "callable.hpp/callable.hpp"
#endif
#define endl '\n'
using namespace std;
using ll = long long;
#define N 50
#define INF 4'000'000'000'000'000'000ll
ll x[N], y[N];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    ll ans = INF;
    for(int x1 = 0; x1 < n; x1++) {
        for(int x2 = 0; x2 < n; x2++) {
            for(int y1 = 0; y1 < n; y1++) {
                for(int y2 = 0; y2 < n; y2++) {
                    int inside = 0;
                    ll min_x = min(x[x1], x[x2]);
                    ll max_x = max(x[x1], x[x2]);
                    ll min_y = min(y[y1], y[y2]);
                    ll max_y = max(y[y1], y[y2]);
                    for(int l = 0; l < n; l++) {
                        inside += min_x <= x[l] and x[l] <= max_x and min_y <= y[l] and y[l] <= max_y;
                    }
                    if(inside >= k) {
                        ans = min(ans, (max_x - min_x) * abs(max_y - min_y));
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

ll gcd(ll a,ll b){
    if(min(a,b)==0){
        return max(a,b);
    }else{
        return gcd(min(a,b), max(a,b)%min(a,b));
    }
}
ll lcm(ll a, ll b){
    return a/gcd(a,b)*b;
}


ll n,t[100];

int main() {
    std::cin >> n;
    ll result =0;
    for (int i = 0; i < n; i++) {
        std::cin >> t[i];
        if(i==0){
            result = t[i];
        }else{
            result = lcm(result,t[i]);
        }
    }
    std::cout << result << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    int x;
	cin >> x;
	if(x % 10 == 7 || x / 100 == 7 || x / 10 % 10 == 7) cout<<"Yes";
	else cout<<"No"; 
    return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>

using namespace std;

#define rep(i,N) for(int i=0;i<N;i++) //0から


typedef long long ll;




ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

ll gcd(ll a,ll b){
    if(a<b){
        swap(a,b);
    }
    //a>=b
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

#define MOD ((ll)1e+9 + 7)




//cout<<fixed<<setprecision(10);
int main(){
    int n;
    cin>>n;
    vector<pair<ll,ll>> p(n);
    rep(i,n){
        cin>>p[i].second>>p[i].first;
    }
    ll t=0;
    bool a=true;
    sort(p.begin(),p.end());
    rep(i,n){
        t+=p[i].second;
        if(t>p[i].first){
            a=false;
        }
    }
    if(a){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }


    return 0;
}



Measured memory_bytes: 6340
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int v[51];

int main(void){
	scanf("%d",&n);
	ll sum=0;
	for(int i=0;i<n;i++){
		scanf("%d",&v[i]);
	}
	priority_queue<double,vector<double>,greater<double> > que;
	for(int i=0;i<n;i++){
		que.push(v[i]);
	}
	for(int i=0;i<n-1;i++){
		double a=que.top();
		que.pop();
		double b=que.top();
		que.pop();
		que.push((a+b)/2.0);
	}
	printf("%.10f\n",que.top());
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Prog
{
    public void run()
    {
        var input = Console.ReadLine().Split();
        long W = long.Parse(input[0]);
        long H = long.Parse(input[1]);
        long x = long.Parse(input[2]);
        long y = long.Parse(input[3]);
        string middle;
        int ans2 = 0;
        if (W / 2 == x && H / 2 == y && W % 2 == 0 && H % 2 == 0)
        {
            ans2 = 1;
        }
        long ans11 = W * H;
        if(ans11 % 2 == 1)
        {
            middle = ".5 ";
        }
        else
        {
            middle = " ";
        }
        long ans1 = ans11 / 2;
        Console.WriteLine(ans1 + middle + ans2);
    }
    public static void Main()
    {
        //var input = Console.ReadLine().Split();
        //int[] X = Array.ConvertAll(input, int.Parse);
        var prog = new Prog();
        prog.run();
    }
}

//Array.ConvertAll(int.Parse)


Measured memory_bytes: 11220
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if( ch == 'A') return 1;
  else if( ch == 'C') return 2;
  else if( ch == 'G') return 3;
  else if( ch == 'T') return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for(i = 0; i < strlen(str); i++){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M;}
int h2(int key){return 1 + (key % (M - 1));}

int find(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i = 0;;i++){
    h = (h1(key) + i * h2(key)) % M;
    if( strcmp(H[h],str) == 0) return 1;
    else if( strlen(H[h]) == 0) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key = getKey(str);
  for(i = 0;;i++){
    h = (h1(key) + i * h2(key)) % M;
    if( strcmp(H[h],str) == 0) return 1;
    else if( strlen(H[h]) == 0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n;
  char str[L], com[9];
  for(i = 0; i < M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0] == 'i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }
  return 0;
}



Measured memory_bytes: 15964
#include <stdio.h>
#include <iostream>

using namespace std;

int main(void)
{
	int n, l;
	int answer = 0;

	cin >> n >> l;

	if(l >= 0) {
			for(int i = 0 ; i < n - 1 ; i++) {
				answer += l + 1;
				l++;
			}
	} else {
		if(l + n - 1 < 0) {
			for(int i = 0 ; i < n - 1 ; i++) {
				answer += l;
				l++;
			}
		} else {
			for(int i = 0 ; i < n ; i++) {
				answer += l;
				l++;
			}
		}
	}
	cout << answer;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
const int maxb = 20;
int n, tot, cas;
ll ans;
vector<int> E[maxn], G[maxn], s[maxn];
int c[maxn], L[maxn], dep[maxn], fa[maxn], anc[maxn][maxb], stk[maxn], h[maxn], vis[maxn], siz[maxn];
ll val[maxn];
ll calc(ll x) { return x * (x - 1) / 2 + x;}
void getanc()
{
	for(int j = 1; j < maxb; ++j)
		for(int i = 1; i <= n; ++i)
			anc[i][j] = anc[anc[i][j - 1]][j - 1];
}
int lca(int u, int v)
{
	if(dep[u] < dep[v]) swap(u, v);
	for(int j = maxb - 1; ~j; --j) if(dep[anc[u][j]] >= dep[v]) u = anc[u][j];
	if(u == v) return u;
	for(int j = maxb - 1; ~j; --j) if(anc[u][j] != anc[v][j]) u = anc[u][j], v = anc[v][j];
	return anc[u][0];
}
int getu(int u, int l)
{
	for(int j = maxb - 1; ~j; --j) if((1 << j) <= l) { l -= (1 << j); u = anc[u][j];};
	return u;
}
void dfs(int x)
{
	siz[x] = 1;
	L[x] = ++tot;
	dep[x] = dep[fa[x]] + 1;
	for(auto v : E[x])
		if(v != fa[x])
		{
			anc[v][0] = fa[v] = x;
			dfs(v);
			siz[x] += siz[v];
			val[x] += calc(siz[v]);
		}
}
inline bool cmp(const int &i, const int &j) {
    return L[i] < L[j];
}
inline void addEdge(const int & u, const int & v) { if(u != v) G[u].push_back(v);}
void build(int vectrices[], int k) {
    int sz = 0;
    sort(vectrices + 1, vectrices + k + 1, cmp);
    stk[sz++] = 1;
    for (int i = 1; i <= k; ++i) {
        int u = vectrices[i], lca = ::lca(u, stk[sz - 1]);
        if (lca == stk[sz - 1]) stk[sz++] = u;
        else {
            while (sz - 2 >= 0 && dep[stk[sz - 2]] >= dep[lca]) {
                addEdge(stk[sz - 2], stk[sz - 1]);
                sz--;
            }
            if (stk[sz - 1] != lca) {
                addEdge(lca, stk[--sz]);
                stk[sz++] = lca;
            }
            stk[sz++] = u;
        }
    }
    for (int i = 0; i < sz - 1; ++i) addEdge(stk[i], stk[i + 1]);
}
ll dp(int x, int fa)
{
	if(vis[x] == cas)
	{
		ll cur = val[x];
		for(auto v : G[x])
			if(v != fa)
			{
				ans -= calc(siz[getu(v, dep[v] - dep[x] - 1)] - dp(v, x));
				cur -= calc(siz[getu(v, dep[v] - dep[x] - 1)]);
			}
		ans -= cur;
		G[x].clear();
		return siz[x];
	}
	else
	{
		ll ret = 0;
		for(auto v : G[x])
			if(v != fa)
				ret += dp(v, x);
		G[x].clear();
		return ret;
	}
} 
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d", &c[i]);
		s[c[i]].push_back(i);
	}
	for(int i = 1; i < n; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	dfs(1);
	getanc();
	for(cas = 1; cas <= n; ++cas)
	{
		int k = s[cas].size();
		for(int j = 1; j <= k; ++j) h[j] = s[cas][j - 1], vis[h[j]] = cas;
		build(h, k);
		ans = calc(n);
		ans -= calc(n - dp(1, 0));
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 68664
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		for(;;)
		{
			int N=sc.nextInt(),M=sc.nextInt();
			if ((N|M)==0)break;
			
			int[][] pc = new int[N + 1][2]; // who uses
			
			boolean[][] uses = new boolean[M + 1][1441];
			
			int r = sc.nextInt();
			for (int i = 0; i < r; i++)
			{
				int t=sc.nextInt(),n=sc.nextInt(),m=sc.nextInt(),s=sc.nextInt();
				if (s == 1) // login
				{
					pc[n][0] = m;
					pc[n][1] = t;
				}
				else // logout
				{
					for (int k = pc[n][1]; k < t; k++)
					{
						uses[m][k] = true;
					}
					pc[n][0] = 0;
				}
			}
			
			int q = sc.nextInt();
			for (int i = 0; i < q; i++)
			{
				int ts=sc.nextInt(),te=sc.nextInt(),m=sc.nextInt();
				int count = 0;
				for (int t = ts; t < te; t++)
				{
					if (uses[m][t]) count++;
				}
				System.out.println(count);
			}
		}
	}
}

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

int main() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 18500000
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    int n, i;
    string s, s1, s2;
    cin >> n >> s;
    if (n%2) cout << "No" << endl;
    else {
        i=n/2;
        s1=s.substr(0, i);
        s2=s.substr(i, i);
        if (s1==s2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
A, S_A = map(int, input().split(' '))
B, S_B = map(int, input().split(' '))
T = int(input())

if A < B:
    is_catchable = S_A * T + A >= S_B * T + B
else:
    is_catchable = -1 * S_A * T + A <= -1 * S_B * T + B

if is_catchable:
    print('YES')
else:
    print('NO')




Measured memory_bytes: 9180
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

//最大公約数
ll gcd(ll a,ll b){
    if(b == 0LL) return a;
    return gcd(b , a % b);
}

//最小公倍数
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;

}

//前後を比較
bool compare(int pos,vector<int>& a){
    if(a[pos] == a[pos + 1]) return true;
    else return false;
}

int main(){
    
    int n;
    int x;
    cin >> n >> x;
    vector<int> a(n);
    for(int i=0;i < n;i++) cin >> a[i];
    //並べ替え
    sort(a.begin(),a.end());

    int num = 0;
    int sum = 0;
    for(int i=0;i < n;i++){
        x -= a[i];
        if(x < 0){
            break;
        }else if(x == 0){
            num++;
            break;
        }else if(x > 0 && i == n-1){
            break;
        }
        num++;

    }

    cout << num << endl;




}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;


void solve(){
	string s;
	cin >> s;
	int ans = 0;
	for (int i =0 ; i< s.length(); i++)
		ans += s[i] - '0';
	if (ans % 9)
		cout << "No\n";
	else cout << "Yes\n";
}

int main(){
	int TC = 1;
	//cin >> TC;
	for (int tcc = 1; tcc <= TC; tcc++){
		//cout << "Case #"<< tcc << ": ";
		solve();
	}
	return 0;
		
}

Measured memory_bytes: 3696
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;

int main() {
	ll n, t;
	int table[200002];
	ll cnt = 0,end=0;
	cin >> n >> t;
	rep(i, 0, n)cin >> table[i];
	rep(i, 0, n) {
		cnt += t;
		if (end > table[i]) {
			cnt -= end - table[i];
		}
		end = table[i] + t;
	}
	print(cnt);
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
using namespace std;
int A[10];
int N;
int flag;

void dfs(int x, int l, int r) {
  if (x == 10) return;
  if (flag) return;
  if (A[x] > l)
    dfs(x + 1, A[x], r);
  else if (A[x] > r)
    dfs(x + 1, l, A[x]);
  else {
    flag = 1;
    return;
  }
}

int main() {
  scanf("%d", &N);
  while (N--) {
    for (int i = 0; i < 10; i++) scanf("%d", &A[i]);
    flag = 0;
    dfs(0, 0, 0);
    if (flag)
      printf("NO\n");
    else
      printf("YES\n");
  }
}


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

typedef long long ll;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(M+1), b(M+1), cnt(N+1);
    for(int i=1; i<=M; i++){
        cin >> a[i] >> b[i];
        
        cnt[a[i]]++; cnt[b[i]]++;
    }
    for(int i=1; i<=N; i++){
        cout << cnt[i] << endl;
    }
}


Measured memory_bytes: 256
/* author   : mpily :-()
title : Competing.cpp
time :Sun Jun 14 13:11:23 2020

*/
#include<random>
#include<cassert>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<utility>
#include<cstdint>
#include<queue>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdio>
//4611686018427387903

using namespace std;
void solve(int cnum){	
	int h, w,n;
	cin >> h >> w >> n;
	if(h < w)
		swap(h,w);
	int num = 0;
	for(int i = 0; i < w+1; ++i){
		if(num >= n){
			cout << i;
			return;
		}
		num+=h;
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	//cout.tie(nullptr);
	int t;
	int count = 1;
	for(t = 1;t--; solve(count),count++);
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
//using lint = long long;

struct P
{
    int x,y;

    /*bool operator<(const P &a)const{
        if(x!=a.x)
              return x>a.x;
        return y>a.y;
    }*/

};

vector<int> v;

//bitset<4001000> b;
int i,n,d,m,k,a,b,c,h;

int o[1];
int l[1];
int j[1];
int e;


//int dx[10]={2,2,-2,-2,1,1,-1,-1},dy[10]={1,-1,1,-1,2,-2,2,-2};

int dx[10]={0,1,0,-1,1,1,-1,-1},dy[10]={1,0,-1,0,1,-1,1,-1},dz[10]={0,0,0,0,1,-1};
long long mod=1000000007,mod2=1000000009,mod3=2017;
long long x,z,y;
double pi=3.14159265;
P u[3];
stack<int> s;
//set<int> s[222][22];
//priority_queue<int> q;
//queue<int> q;
//2147483647
//'1'==49;
//'A'==65;
//'a'==97;
//unordered_
map<int,int> p;
/*
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
unordered_map<long long, int, custom_hash> safe_map;
*/
//list<int> l;

string r;
//char r[222253];
//deque<int> de;
//srand((int)time(NULL));
/*bool as(P a,P b)
{
    if(a.x!=b.x)
    return a.x<b.x;
    return a.y<b.y;
}*/



bool as(P a,P b)
{
    if(a.x!=b.x)
        return a.x<b.x;
    return a.y<b.y;
}



int main()
{
    scanf("%d",&a);
    printf("Christmas");
    a=25-a;
    for(;a;a--)
        printf(" Eve");

}






Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

vector<ll> factors(ll n){
    vector<ll> ret;
    for(ll i = 1; i*i <= n; i ++) if(n % i == 0) ret.push_back(i), ret.push_back(n/i);
    Sort(ret);
    Unique(ret);
    return ret;
}

int main(void){
    Cin(int, a, b, c);
  	Cout(c, " ", a, " ", b);
}




Measured memory_bytes: 256
N = int(input())
A = [list(map(int, input().strip().split())) for _ in range(2)]
ans = [[0]*N for _ in range(2)]
ans[0][0] = A[0][0]
ans[1][0] = ans[0][0] + A[1][0]
for i in range(1, N):
  ans[0][i] = ans[0][i-1] + A[0][i]

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

print(ans[1][-1])


Measured memory_bytes: 3188
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================
//using系

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using Graph = vvi;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
using kaage = priority_queue<int, vector<int>, greater<int>>;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;

// ========================================================================
//define系

#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)

// ========================================================================


ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a)
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a)
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll mch(ll n) {
	if (n == 1) return 1;
	else return n * mch(n - 1);
}
//1から整数nまでの階乗を出す(INFで割っていない)
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double m = sqrt(a);
	for (int i = 3; i <= m; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定
ll modpow(ll a, ll n, ll mod) {
	ll hi = 1;
	while (n > 0) {
		if (n & 1) hi = hi * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return hi;
}
//いろいろやります（ただの前座）
ll mg(ll a, ll mod) {
	return modpow(a, mod - 2, mod);
}
//割り算の10^9+7等対策で逆元を出します 


// ========================================================================


//ある程度のテンプレ
//これとBFS、あとその時その時で使うものはここに書く


// ========================================================================


signed /*int*/ main() {
	vl a(1000001, 0);
	for (int i = 1; i <= 1000001; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			a[i - 1] = i;
		}
	}
	ll n; cin >> n;
	ll ans = 0;
	for (int i = 0; i < n; i++) ans += a[i];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 11004
def main():
  s = str(input())
  
  f = "" # 前回のステップの文字 "<" or ">" 
  ans = 0 # Answer
  count = 0 # Ai
  continuous = 0 # ">" が何回連続するか
  
  for m in s:
    if m=="<":
      if f==">" and count>0:
        # 清算
        ans-=count*continuous
        count=0
      count+=1
        
    else:
      if f=="<":
        # セット
        continuous=0
      count-=1
      continuous+=1
      if count==-1:
        ans+=continuous
        count=0
        continue

    ans+=count
    f=m

  print(ans)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 4120
#include <bits/stdc++.h>
using  namespace std ;
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define ALL(x) (x).begin(),(x).end() 
#define UNQ(x) (x).erase( unique(ALL(x)) , (x).end() ) 
#define lwb( x , y ) lower_bound(ALL(x) , (y) ) - (x).begin() 
#define upb( x , y ) upper_bound(ALL(x) , (y) ) - (x).begin() 
#define sz(x) (int)(x).size() 
#define pb push_back
typedef long long ll ;

int n , m , arr[100010] ; 

int main(){
	// freopen("in.txt" , "r" , stdin);
	// freopen("out.txt" , "w" , stdout) ;
	scanf("%d",&n) ;
	for(int i=0;i<n;i++) scanf("%d" , arr+i  );
	ll m1 = 0 , m2 = 0 , res = 0; 
	sort(arr , arr + n ) ;
	for(int i=0;i<n;){
		int cur = arr[i] , cnt = 0 ;
		while(i < n && arr[i] == cur){
			cnt++ ;
			i++ ;
		}
		if(cnt >=2 ) m2 = m1 , m1 = cur ;
		if(cnt>=4) res = max(res , 1LL*cur*cur) ;
	}
	res = max(res , m1 * m2) ; 
	printf("%lld\n" , res ) ;
	return  0 ;
}


Measured memory_bytes: 640