akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

long long beki(long long a,int n)
{
  long long s=1LL;
  while(n){
    if(n%2)s=(s*a)%MOD;
    a=(a*a)%MOD;
    n/=2;
  }
  return s;
}

int main(void) {
  int i,j;
  string s;
  while(1){
    cin>>s;
    if(s=="#")break;
    vi v;
    for(i=s.size()-1;i>=0;i--)
      if(s[i]=='w')v.push_back(1);
      else if(s[i]=='n')v.push_back(0);

    int a=v[0]*90;
    int n=v.size();

    loop(i,1,n){
      if(v[i]==0)a=max(0,2*a-90);
      else a=2*a+90;
    }

    int b=beki(2,n-1);

    if(a%b==0)
      cout<<a/b<<endl;
    else
      cout<<a/__gcd(a,b)<<"/"<<b/__gcd(a,b)<<endl;
  }
}

Measured memory_bytes: 3052
import qualified Data.Vector as V

lowerBound :: Ord a => a -> V.Vector a -> Int
lowerBound x xs = go (-1) (V.length xs) where
  go l r
    | l==r-1 = r
    | x<=(xs V.! m) = go l m
    | otherwise = go m r
    where m = (l+r)`div`2

inf = 1000000000

solv :: V.Vector Int -> Int -> Int
solv xs k = go inf rini (k-rini) where
  base = lowerBound 0 xs
  rini = min k base
  go m r l
    | r<0 || l+base>V.length xs = m
    | r==0 = go (min m ld) (r-1) (l+1)
    | l==0 = go (min m rd) (r-1) (l+1)
    | otherwise = go (min m (min (2*rd+ld) (rd+2*ld))) (r-1) (l+1)
    where
      rd = if r==0 then 0 else abs $ xs V.!(base-r)
      ld = if l==0 then 0 else abs $ xs V.!(base+l-1)


main = do
  [n,k] <- map read . words <$> getLine :: IO [Int]
  xs <- V.fromList . map read . words <$> getLine
  print $ solv xs k
  

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

int main(){
    int A , B ;
    cin >> A >> B ;
    if( A >= 13 ){
        cout << B << endl ;
    }
    else if( 13 > A && A >= 6){
        cout << B/2 << endl ;
    }
    else{
        cout << 0 << endl ;
    }
}

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

int main() {
  int N;
  int p[20000], q[20000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p[i]; p[i]--;
    q[p[i]] = i;
  }
  int a[20000], b[20000];
  for (int i = 0; i < N; i++) {
    a[i] = i+1;
    b[i] = N-i;
  }
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      a[j] += q[i];
    }
    for (int j = 0; j <= i; j++) {
      b[j] += q[i];
    }
  }
  cout << a[0];
  for (int i = 1; i < N; i++) {
    cout << ' ' << a[i];
  }
  cout << endl;
  cout << b[0];
  for (int i = 1; i < N; i++) {
    cout << ' ' << b[i];
  }
  cout << endl;
}


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

ll locate(ll a,vector<ll> b){
    for(ll i=0;i<b.size();i++){
        if(a<b[i])return b[i];
    }
    return 0;
}

int main() {
    
    ll N;
    cin >> N;
    string S;
    cin >> S;
    vector<vector<ll>> A(10,vector<ll>(0));
    for(ll i=0;i<N;i++){
        A[S[i]-'0'].push_back(i);
    }
    
    ll count=0;
    for(int i=0;i<=9;i++){
        if(!A[i].size())continue;
        for(int j=0;j<=9;j++){
            ll con = locate(A[i][0], A[j]);
            if(!con)continue;
            for(int k=0;k<=9;k++){
                if(locate(con, A[k]))count++;
            }
        }
        
    }
    cout << count << endl;
    
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

ll res = 0;
ll h[101];
ll N;

void rec(ll l, ll r){
	if(l==r) return;
	ll mi = 1001010;
	ll mind;
	for(int i=l;i<r;i++){
		if(mi>h[i]){
			mi = h[i];
			mind = i;
		}
	}
	res += mi;
	for(int i=l;i<r;i++){
		h[i] -= mi;
	}
	/*
	dump(l)
	dump(r)
	dump(mind)
	dump(res)
	REP(i, N){
		cout << h[i] << " ";
	}
	cout << endl;
	cout << endl;
	*/
	rec(l, mind);
	rec(mind+1, r);
	return;
}

int main(){
	cin >> N;
	REP(i, N) cin >> h[i];

	rec(0, N);
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

Measured memory_bytes: 3620
package main

import "fmt"

const inf = 1 << 60

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n, l int
	fmt.Scan(&n, &l)

	sumTaste := 0
	for i := 0; i < n; i++ {
		taste := i + l
		sumTaste += taste
	}

	minDiff := inf
	var ans int
	for i := 0; i < n; i++ {
		taste := i + l
		tmp := sumTaste - taste
		if abs(sumTaste-tmp) < minDiff {
			minDiff = abs(sumTaste - tmp)
			ans = tmp
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
from collections import deque
from copy import copy

N = int(input())
result = [0]*N

if N < 6:
    for i in range(N):
        print(0)
    exit()

result[5] += 1

coord = deque()
coord.append([[1, 1, 1], 6, 0])

while len(coord):
    sol, ans, level = coord.popleft()
    for i in range(level, 3):
        new_sol = copy(sol)
        new_sol[i] += 1
        new_ans = ans + sum(sol) + sol[i] + 1
        if new_ans <= N:
            coord.append([new_sol, new_ans, i])
            result[new_ans-1] += 1

print(*result, sep='\n', end='')



Measured memory_bytes: 10700
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
  Scanner sc;

  void run() {
    for (; ; ) {
      int W = ni();
      int H = ni();

      if ( (W | H) == 0 ) break;

      boolean[][] field = new boolean[ H + 2 ][ W + 2 ];

      int sx = 0;
      int sy = 0;
      for ( int i = 1; i <= H; ++i ) {
        char[] str = sc.next().toCharArray();
        for ( int j = 1; j <= W; ++j ) {
          if ( str[ j - 1 ] == '@' ) {
            sx = j;
            sy = i;
          }
          if ( str[ j - 1 ] == '.' ) {
            field[ i ][ j ] |= true;
          }
        }
      }

      int cnt = 1;
      Queue<Integer> qx = new LinkedList<Integer>();
      Queue<Integer> qy = new LinkedList<Integer>();
      qx.add(sx);
      qy.add(sy);
      boolean[][] done = new boolean[ H + 2 ][ W + 2 ];
      done[ sy ][ sx ] = true;
      while ( qx.size() > 0 ) {
        int x = qx.poll();
        int y = qy.poll();

        for ( int[] d : ofs ) {
          int nx = x + d[ 0 ];
          int ny = y + d[ 1 ];
          if ( !done[ ny ][ nx ] && field[ ny ][ nx ] ) {
            done[ ny ][ nx ] |= true;
            qx.add(nx);
            qy.add(ny);
            ++cnt;
          }
        }
      }

      System.out.println(cnt);
    }
  }

  int[][] ofs = new int[][]{
      { 0, 1 },
      { 1, 0 },
      { -1, 0 },
      { 0, -1 }
  };

  Main() {
    sc = new Scanner(System.in);
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}

Measured memory_bytes: 32456
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll ans=1;a%=mod;for(;b;b>>=1){if(b&1) ans=ans*a%mod;a=a*a%mod;}return ans;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N = 2e5 + 10;
string s[N];
string ans[N];
map<string,int>mp;
int main()
{
    sync;
    int n,ma=0;
    cin>>n;
    fup(i,1,n)
    {
        cin>>s[i];
        mp[s[i]]++;
        if(mp[s[i]]>ma)
        {
            ma=mp[s[i]];
        }
    }
    int j=0;
    fup(i,1,n)
    {
        if(mp[s[i]]==ma)
        {
            ans[j++]=s[i];
            mp[s[i]]=0;
        }
    }
    sort(ans,ans+j);
    fup(i,0,j-1)
    {
        cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 27008
n = int(input())
twos = [0]*n
fives = [0]*n


table = [[0 for _ in range(100)] for _ in range(100)]
table_acm = [[0 for _ in range(100)] for _ in range(100)]
offset = 20

def divisor(x,mod):
    ret = 0
    while True:
        if x % mod == 0:
            x //= mod
            ret+=1
        else:
            return ret

def factor(x):
    two = 0
    five = 0
    if '.' not in x:
        y = int(x)
        two = divisor(y,2)
        five = divisor(y,5)
    else:
        order = x.find('.')
        order = len(x) - 1 - order
        two = -order
        five = -order
        y = int(x.replace(".",""))
        two += divisor(y,2)
        five += divisor(y,5)
    return (two,five)

for i in range(n):
    x = input()
    two,five = factor(x)
    table[two+offset][five+offset] += 1
    table_acm[two+offset][five+offset] += 1

for i in range(99,0,-1):
    for j in range(99,0,-1):
        table_acm[i-1][j-1] = table_acm[i-1][j] + table_acm[i][j-1] - table_acm[i][j] + table[i-1][j-1]

ret = 0
for i in range(100):
    for j in range(100):
        ret += table[i][j] * table_acm[max(2*offset - i,0)][max(2*offset - j,0)]

#print(table_acm[offset][offset])
print((ret-table_acm[offset][offset])//2)

Measured memory_bytes: 78792
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> s(n,0);
    rep(i,0,n-1){
        int a; cin >> a;
        a--;
        s[a]++;
    }
    rep(i,0,n){
        cout << s[i] << endl;
    }
}

Measured memory_bytes: 3992
N = gets.to_i
C = Array.new(4,0)
gets.split.map(&:to_i).each{|v| C[v % 4] += 1 }
C[1] += C[3]

puts C[0] >= (C[2] == 0 ?  C[1] - 1 : C[1]) ? "Yes" : "No"


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    //lol result{0};
    lol n; cin >> n;
    lol k; cin >> k;
    /*
    vector<lol> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    if(n <= k)
        cout << "unsafe" << endl;
    else
    {
        cout << "safe" << endl;
    }
    

    //cout << result << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<iostream>
#include<string>

int main()
{
	int n;
	char buf[1100];
	std::cin>>n;
	std::cin.getline(buf,1);

	for(int i=0;i<n;i++)
	{
		std::cin.getline(buf,1100);
		
		std::string str(buf);
		bool found=true;
		int index=0;
		int place;

		while(found)
		{
			found=false;
			place=str.find("Hoshino",index);
			
			if(place!=std::string::npos)
			{
				str.replace(place,7,"Hoshina");
				found=true;
			}
		}
		std::cout<<str<<std::endl;
	}
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,k,c;
  cin>>n>>k>>c;
  string s;
  cin>>s;

  vector<deque<ll>> g(n/(c+1)+1);
  ll cnt=0;
  ll preb=-1;
  REP(i,n){
    if(s[i]=='o'){
      g[cnt].push_back(i);
      cnt++;
      i+=c;
    }
  }

  if(cnt!=k)
    return 0;


  ll lim=cnt;
  cnt--;
  for(ll i=n-1; i>=0; i--){
    if(s[i]=='o'){
      g[cnt].push_back(i);
      cnt--;
      i-=c;
    }
  }



  REP(i,lim){
    ll l=g[i].front();
    ll r=g[i].back();
    if(r==l)
      cout<<r+1<<endl;
  }


}



Measured memory_bytes: 136084
while True:
    try:
        a,b,c,d,e,f=map(int,raw_input().split())
        if a*d-b*c==0:
            print "not exist answer"
        else:
            x = (float((c*e-b*f)) / (a*e-b*d))+0
            y = (float((a*f-c*d)) / (a*e-b*d))+0
            print ('%.3f' % round(x,3)), ('%.3f' % round(y,3))
    except:
        break

Measured memory_bytes: 4676
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int A, B, C, D, L; cin >> L >> A >> B >> C >> D;
	int kokugo = A / C, sugaku = B / D;
	if (A%C != 0)kokugo++;
	if (B%D != 0)sugaku++;
	cout << L - max(kokugo,sugaku) << endl;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

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

	int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;

	cout << (h2 * 60 + m2) - (h1 * 60 + m1) - k << endl;

	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    int ans=0,total=0;
    while(total<b){
        ans++;
        if(ans>1) total-=1;
        total+=a;
    }
    if(b==1) ans=0;
    
    cout << ans << endl;
}


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,m,ans=0;
  cin >> n >> m;
  while(n!=0||m!=0){
    ans = 0;
    n++;
    vector<int>a(m,0),b(m,0),hito(n,0),one(n,0);
    rep(i,m){
      cin>>a[i]>>b[i];
      if(a[i]==1){
	hito[b[i]]++;
	one[b[i]]++;
      }
      if(b[i]==1){
	hito[a[i]]++;
	one[a[i]]++;
      }
    }
    rep(i,n){
      if(i==0||i==1)continue;
      rep(j,m){
	if(one[i]!=0){
	  if(i==a[j])hito[b[j]]++;
	  if(i==b[j])hito[a[j]]++;
	}
      }
    }
    rep(i,n){
      if(i==0||i==1)continue;
      if(hito[i]!=0){
	ans++;
      }
    }
    cout<<ans<<endl;
    cin >> n >> m;
  }
  return (0);
}

Measured memory_bytes: 3168
#include<cstdio>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+100;
int n,a,b,max0,max1,i,num[N],fa[N],m;
int find(int a)
{
    if(a == fa[a])
    {
        return a;
    }
    else
    {
        return fa[a]=find(fa[a]);
    }
}
void f1(int x,int y)
{
    int nx,ny;
    nx=find(x);
    ny=find(y);
    if(nx != ny)
    {
        fa[nx]=ny;
        num[ny]+=num[nx];        //合并两个集合的数量
    }
}
int main()
{
      cin>>n>>m;
        for(i = 1 ; i <= N ; i++)
        {
            fa[i]=i;
            num[i]=1;        //刚开始集合只有本身
        }
        max0=0;
        if(m==0)
            {cout<<1<<endl;
             return 0;}
           
        for(i = 0 ; i < m ; i++)
        {
            cin>>a>>b;
            max0=max(max0,max(a,b));        //找出关系中编号最大的人
            f1(a,b);
        }
        max1=0;
        for(i = 1 ; i <= max0 ; i++)
        {
            if(max1 < num[i])                //比较每个集合的大小
            {
                max1=num[i];
            }
        }
        cout<<max1<<endl;

    
 }


Measured memory_bytes: 5180
import java.util.*;

class Main{
   public static void main(String[] args)
   {
      Scanner scan = new Scanner(System.in);
      int     N    = scan.nextInt();
      int     m    = 1;

      int[]    Rcount = new int[100];
      String[] red    = new String[N];

      for(int i = 0; i < N; i++){
          red[i] = scan.next();
          }
      Arrays.sort(red);


      int      M      = scan.nextInt();
      int[]    Bcount = new int[M];
      String[] blue   = new String[M];
      for(int i = 0; i < M; i++){
          blue[i] = scan.next();
          }
      Arrays.sort(blue);
      for(int i = 0; i < 100; i++){
          Rcount[i] = 0;
          }
      for(int i = 0; i < N; i++){
          for(int j = 0; j < N; j++){
              if(red[i].equals(red[j])){
                 Rcount[i]++;
                 //System.out.println(red[i] + "+1" + red[j]);
                 }
              }
          for(int k = 0; k < M; k++){
              if(red[i].equals(blue[k])){
                 //System.out.println(red[i] + "-1" + blue[k]);
                 Rcount[i]--;
                 }
              }
          }
      Arrays.sort(Rcount);

      System.out.println(Rcount[99]);
   }
}


Measured memory_bytes: 23124
/*" بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ -In the name of Allah."
   Never stop chasing!-MD.SOURAV.

   ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
   ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
   ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
   [███████████████████].░░░░░░░░░░░░░░
   ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░
*/

#include <bits/stdc++.h>

#define yes            cout<<"YES"<<endl
#define no             cout<<"NO"<<endl
#define sz(x)          x.size()
#define ll             long long int
#define li              ong int
#define start          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test           int t;cin>>t;while(t--)
#define f(i, a, n)     for(int i=a; i<n;i++)
#define gcd(a,b)       __gcd(a,b)
#define lcd(a,b)       (a*b)/gcd(a,b)
#define pb             push_back
#define mp(x,y)        make_pair(x,y)
#define rsrt(v)        sort(v.begin(),v.end(),greater<int>())
#define srt(v)         sort(v.begin(),v.end())
#define basrt(a,n)     sort(a,a+n,greater<int>())
#define asrt(a,n)      sort(a,a+n)
#define F              first
#define S              second
#define deb(x)         cout << #x << ": " << x << endl;
#define enter(v,n)     for(ll i=0;i<n;i++){ll x;cin>>x;v.pb(x);}
#define MOD 	       1000000007
#define unique(v)      v.erase(unique(v.begin(),v.end()),v.end())
#define ignore         cin.ignore (std::numeric_limits<std::streamsize>::max(),'\n');
#define MAX 32000

using namespace std;

double pi=3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664 ;
typedef vector<ll> vll ;
typedef vector<int> vii ;
typedef vector<pair<ll,ll>> vpllll;
typedef vector<pair<int,int>> vpiiii;
typedef map<ll,ll> mllll;
typedef map<char,ll> mchll;
typedef map<string,ll>msll;

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v)
{
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}

void solve()
{

      string s;
      cin>>s;
      int cnt=0;
      int mx=0;
      for(int i=0;i<s.size();i++)
	  {
	  	if(s[i]=='R')
		{
			cnt++;
		}
		else
		{
			 mx=max(mx,cnt);
			 cnt=0;
		}
	  }
	  mx=max(mx,cnt);
	  cout << mx << endl;



}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll test_case=1;
    //cin>>test_case ;
    while(test_case--)
	{
		 solve();
	}

	return 0;
}

Measured memory_bytes: 3608
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n =getN()
t, a = getNM()
high = getList()

diff = 100000000
for i, h in enumerate(high):
    temp = t - h*0.006
    if abs(temp-a) < diff:
        ans = i
        diff = abs(temp-a)


print(ans+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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

int main()
{   
   int x,y; cin >> x >> y;
   cout << x+y/2 << endl;
}
    

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0203

"""
import sys
from sys import stdin
from collections import deque, defaultdict
input = stdin.readline


def solve(field):
    BLANK, OBSTACLE, JUMP = 0, 1, 2
    ans = 0                     #  ??????????????°???????????°

    dy = [1, 1, 1]  # ?????????????????????????????????????§???????
    dx = [0, -1, 1]
    x_limit = len(field[0])
    y_limit = len(field)

    path = defaultdict(int)     #  ??????????????????????????°???????????°????????????'x???_y???'???????????????
    Q = deque()
    for x, m in enumerate(field[0]):
        if m == BLANK:              #  ?????????????????°?????´?????????????????????????????????
            t = '{}_{}'.format(x, 0)
            Q.append((x, 0))
            path[t] = 1
    if y_limit < 2:
        return len(Q)


    while Q:
        cx, cy = Q.popleft()        #  ?????¨??°?????§?¨?
        t = '{}_{}'.format(cx, cy)
        num = path.pop(t)

        if field[cy][cx] == OBSTACLE:
            continue
        elif field[cy][cx] == JUMP: #  ?????£????????§?????°?????????????????£????????°
            if cy+2 > y_limit-1:
                ans += num
            else:
                t = '{}_{}'.format(cx, cy+2)
                if not path[t]:
                    Q.append((cx, cy+2))
                path[t] += num
            continue
        elif cy == y_limit -1:
            ans += num
            continue

        for i in range(len(dx)):
            nx = cx + dx[i]     #  ?????°????????§?¨?
            ny = cy + dy[i]

            if 0<= nx < x_limit:
                if (ny >= y_limit - 1) and field[ny][nx] == BLANK:
                    ans += num
                else:
                    if field[ny][nx] == JUMP and dx[i] == 0: #  ?????£????????°????????£??????????????\????????´???
                        if ny+2 > y_limit - 1:
                            ans += num
                        else:
                            t = '{}_{}'.format(nx, ny+2)
                            if not path[t]:
                                Q.append((nx, ny+2))
                            path[t] += num
                    elif field[ny][nx] == BLANK:
                        t = '{}_{}'.format(nx, ny)
                        if not path[t]:
                            Q.append((nx, ny))
                        path[t] += num
    return ans


def main(args):
    while True:
        X, Y = map(int, input().strip().split())
        if X == 0 and Y == 0:
            break
        field = []
        for _ in range(Y):
            temp = [int(x) for x in input().strip().split()]
            field.append(temp)
        result = solve(field)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 8044
#include <bits/stdc++.h>
#define ll long long
#define mod1 1000000007LL
#define mod2 1000000009LL
#define base1 19
#define base2 31
#define base3 137
#define MAX 1e12
#define MIN -10000000000
#define pi acos(-1)
#define esp 1e-6
#define memz(x) memset(x, 0, sizeof x)
#define memn(x) memset(x, -1, sizeof x)
#define pb push_back
#define nai string::npos
#define in1(a) scanf("%lld", &a)
#define in2(a,b) scanf("%lld%lld", &a, &b)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(i) printf("Case #%lld: ", ++i)
#define FILE    freopen("input.txt", "r", stdin); freopen("out.txt", "w", stdout);
using namespace std;
const ll N = 100010;
ll a[N], n, mem[N][3];
ll dp(ll pos, ll pd, ll pre)
{
//    cout<<pos<<" "<<pd<<" "<<pre<<endl;
    ll &ret = mem[pos][pd];
    if(pos>=n)
    {
//        cout<<"here"<<endl;
        return ret=1;
    }
    if(a[pos]-pre<0)
        return ret=0;
    if(ret!=-1) return ret;
    if(a[pos]-pre>0 && a[pos]>0)
    return ret = (dp(pos+1, 0, a[pos]) | dp(pos+1, 1, a[pos]-1));
    return ret = dp(pos+1, 0, a[pos]);
}
int main()
{
    memn(mem);
    in1(n);
    for(int i=0; i<n; i++)
        in1(a[i]);
    ll x = dp(0, 0, -1);
    if(x)
        printf("Yes\n");
    else printf("No\n");
    return 0;
}



Measured memory_bytes: 8064
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[][] a = new long[n][2];
        long sum = 0;
        for(int i=0; i<n; i++){
            a[i][0] = sc.nextLong();
            a[i][1] = sc.nextLong();
            sum += a[i][0];
        }

        long min = 1000000000000L;
        

        for(int i=0; i<n; i++){
            if(a[i][0] > a[i][1] && a[i][1] < min){
                min = a[i][1];
            }
        }

        if(min > 10000000000L){
            System.out.println(0);
            return;
        }

        System.out.println(sum - min);
    }
}

Measured memory_bytes: 50364
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#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


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

    int a, b;
    cin >> a >> b;

    int ans = -1;
    int i = MIN((int)12.5 * a, 10 * b);
    for (; i <= MAX(12.5 * (a + 1), 10 * (b + 1)); ++i)
    {
        if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)
        {
            ans = i;
            break;
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
using boost::algorithm::split;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using boost::multiprecision::cpp_dec_float_50;
#define rep(i, n) for(int i = 0; i < n; ++i)

int main() {
  int n;
  cin >> n;
  double x = 0.0;
  rep(i, n) {
    int a;
    cin >> a;
    x += 1.0 / a;
  }
cout << setprecision(16) << 1.0 / x << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <deque>
#include <vector>
#include <map>
#include <math.h>
#include <limits.h>

using namespace std;

int main() {
	int q;
	cin >> q;
	map<string, int> m;
	set<string> s;
	int ma = 0;
	for (int i = 0; i < q; i++) {
		string str;
		cin >> str;
		m[str]++;
		ma = max(ma, m[str]);
	}
	for (auto i : m) {
		if (i.second == ma) {
			s.insert(i.first);
		}
	}
	for (auto i : s) {
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 34560
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K=MI()
    A=LI()
    G = 0
    for a in A:
        G=gcd(a,G)
    if(max(A)>=K and K%G==0):
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
if __name__ == '__main__':
    main()

Measured memory_bytes: 84076
import java.util.Scanner;
//int[] date=new int[2];
public class Main {
int i,o,sum,h,s,e,u,ty,yu,ui,n,num,qw;
double m,t,r,j,k,f,d,g,w;
static double l;
String b,c,z,x,v,a,q;
Scanner scan =new Scanner(System.in);
//入力
	public void input() {	
	
	}
	//演算
	public void compute() {
	
		}
//出力
	public void output() {
	int[] date=new int[4];
	for(o=0;o<4;o++) {
		date[o]=scan.nextInt();
	}
while(true) {
	date[2]-=date[1];
	if(date[2]<=0) {
		System.out.println("Yes");
		break;
	}else {
		date[0]-=date[3];
	}
	if(date[0]<=0) {
		System.out.println("No");
		break;
	}
}
		}
	public static void main(String [ ] args) {
		Main p = new  Main ();
		p.input();
		p.compute();
		p.output();
		}
	}

Measured memory_bytes: 35796
/*
      author  : nishi5451
      created : 14.08.2020 23:12:08
*/

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


int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,n-1){
        ans += p[i];
    }
    ans += p[n-1]/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
ascii = 96
N = int(input())
name = ''
while 1:
    q, mod = divmod(N, 26)
    # mod処理
    if mod == 0:
        name += 'z'
    else:
        name += chr(ascii+mod)
    # q処理
    if q >= 0 and q <= 26:
        if mod == 0:
            q -= 1
        if q > 0:
            name += chr(ascii+q)
        break
    else:
        if mod == 0:
            N = q - 1
        else:
            N = q
# name反転
name = name[::-1]
print(name)


Measured memory_bytes: 9220
sx,sy,tx,ty=map(int,input().split())
ans=[]
for i in range(abs(sx-tx)):
    ans.append("R")
for i in range(abs(sy-ty)):
    ans.append("U")
for i in range(abs(sx-tx)):
    ans.append("L")
for i in range(abs(sy-ty)):
    ans.append("D")
ans.append("D")
for i in range(tx-sx+1):
    ans.append("R")
for i in range(ty-sy+1):
    ans.append("U")
ans.append("L")
ans.append("U")
for i in range(tx-sx+1):
    ans.append("L")
for i in range(ty-sy+1):
    ans.append("D")
ans.append("R")
print("".join(ans))


Measured memory_bytes: 3188
n,k = map(int, input().split())
p = list(map(int, input().split()))
b = p[:k]
#print(b)
for i in range(k):
    b[i] = (b[i]+1)/2
a = sum(b)
a_max = sum(b)
#print(a)
for i in range(n-k):
    a -= (p[i]+1)/2
    a += (p[i+k]+1)/2
    if (a > a_max):
        a_max = a
print(a_max)


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

int gcd(int a, int b) {
    int v0 = a, v1 = b, v2 = a % b;
    while (v2 != 0) {
        v0 = v1;
        v1 = v2;
        v2 = v0 % v1;
    };
    return v1;
}

int main() {
    int k, a, b, c, s;
    long sum = 0;
    cin >> k;
    for(a=1; a<=k; a++){
        for(b=1; b<=k; b++){
            for(c=1; c<=k; c++){
                s = gcd(a, b);
                sum += gcd(s, c);
            }
        }
    }
    cout << sum;
}

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

int main(){
    
    int A = 0;
    int B = 0;
    string s;
    cin >> s;

    for(int i=0;i<3;++i){
        if(s[i] == 'A'){
            A++;
        }else{
            B++;
        }
    }

    if((A == 0) || (B == 0)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;  
}

Measured memory_bytes: 256
h, w, k = map(int, input().split())
c = [list(input()) for i in range(h)]

ans = 0
for i in range(1 << h):
    for j in range(1 << w):
        black = 0
        for x in range(h):
            for y in range(w):
                if (i >> x) & 1:
                    continue
                    
                if (j >> y) & 1:
                    continue
                    
                if c[x][y] == '#':
                    black += 1
        if black == k:
            ans += 1
print(ans)


Measured memory_bytes: 9140
N = int(input())
A = []
B = [0 for i in range(N)]
j = 0
A = list(map(int,input().split()))
list.sort(A)
T = A[0]
for i in range(N-1):
    if A[i] != T and i != N-2:
        B[T-1] = i - j
        T = A[i]
        j = i
    elif i == N-2:
        if A[i] == T:
            B[T-1] = i - j + 1
        else:
            B[T-1] = i - j
            B[A[i]-1] = 1
for i in range(N):
    print(B[i])

Measured memory_bytes: 33928
#include <iostream>
#include <cmath>
#include <cfenv>
using namespace std;
#define ll long long

int main () {
  ll n, a, b;
  cin >> n >> a >> b;
  ll h[n], sub[n];
  ll max = 0;
  for (ll i = 0; i < n; i++) {
    cin >> h[i];
    max += h[i] / b + 1;  
    sub[i] = h[i];
  }  
  ll left = 0;
  ll right = 1000000000;
  while (left < right - 1) {
    ll mid = (left + right) / 2;
    for (ll i = 0; i < n; i++) {
      sub[i] = h[i] - b * mid;  
    }  
    ll num = 0;
    for (ll i = 0; i < n; i++) {
      if (sub[i] > 0) {
        num += ceil((double) sub[i] / (a - b));    
      }  
    }
    if (mid >= num) {
      right = mid;  
    }
    else {
      left = mid;  
    }
  }
  cout << right << endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.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;
}

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

    if (N == 0) {
        cout << 0 << endl;
        return 0;
    }

    vector<int> bits;

    while (N != 0) {
        if ((N & 0x1) != 0) {
            bits.push_back(1);
            N -= 1;
        } else {
            bits.push_back(0);
        }
        N /= -2;
    }

    reverse(bits.begin(), bits.end());

    for (auto b : bits) {
        cout << b;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3568
#include <iostream>

using namespace std;

int main() {
  int64_t A, B, K;
  cin >> A >> B >> K;
  if (K <= A)
  {
    cout << (A - K) << ' ' << B << endl;
  } else if (K <= A + B) {
    cout << 0 << ' ' << (A + B - K) << endl;
  } else {
    cout << 0 << ' ' << 0 << endl;
  }
  return 0;
}


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

int main()
{
	string a,b;
	cin>>a>>b;
	int c=0,i;
	a=a+b;
	for(i=0;i<=a.length()-1;i++) c=c*10+a[i]-48;
	if (int(sqrt(c))==sqrt(c)) cout<<"Yes"; else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import sys
#input = sys.stdin.buffer.readline

def main():
    N = int(input())
    s = input()
    a,i,j = 0,0,1
    
    while j < N:
        if s[i:j] in s[j:]:
            a = max(a,j-i)
            j += 1
        else:
            i += 1
        if i == j:
            j += 1
            
    print(a)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#D問題
import copy

N = int(input())
A = [list(map(int,input().split())) for i in range(N)]
G = copy.deepcopy(A)
whole = 0
for i in range(N):
    for j in range(N):
        whole+=A[i][j]


#print(A,G)
#warshall_floyd法
def warshall_floyd(dist):
    global N
    #dist[i][j]: iからjへの最短距離
    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j])

warshall_floyd(G)
#print(A,G)

flag = 0
ans = 0
for i in range(N):
    for j in range(N):
        if A[i][j] != G[i][j]:
            flag = 1
        else:
            for k in range(N):
                if k != i and k != j:
                    #print(G[i][j],G[i][k]+G[k][j])
                    if G[i][j] == G[i][k] + G[k][j]:
                        ans+=A[i][j]
                        #print(A[i][j])
                        break
                
            
if flag == 1:
    print(-1)
else:
    print((whole-ans)//2)

Measured memory_bytes: 57564
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    string S;
    
    cin >> S;

    int num[26] = {0};

    for(int i = 0; i < S.size(); i++)
    {
        num[S[i] - 'a']++;
    }

    for(int i = 0; i < sizeof(num) / sizeof(int); i++)
    {
        if(num[i] == 0)
        {
            cout << char('a' + i) << endl;
            break;
        }

        if(i == 25)
        {
            cout << "None" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <cassert>
using namespace std;

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v; ll w; };

ll _MOD = 1000000009;
double EPS = 1e-10;
int INF = INT_MAX / 2;

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (-v[x] < -v[y]) swap(x, y);
		v[x] += v[y]; v[y] = x;
	}
	bool root(int x) { return v[x] < 0; }
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

vector<int> f(int N, int M, vector<int> dx) {
	vector<vector<int> > nxt(N + 1, vector<int>(M));
	rep(j, M) nxt[N][j] = nxt[N - 1][j] = N;
	for (int i = N - 2; i >= 0; i--) {
		nxt[i] = nxt[i + 1];
		for (int j = dx[i]; j < M; j++) nxt[i][j] = i + 1;
	}
	vector<int> dp(1<<M);
	rep(S, 1<<M)
		rep(j, M) if (!(S>>j & 1)) {
			int _S = S | 1<<j;
			dp[_S] = max(dp[_S], nxt[dp[S]][j]);
		}
	return dp;
}

vector<int> solve() {
	int N, V; cin >> N >> V;
	vector<int> x(N);
	rep(i, N) scanf("%d", &x[i]);
	vector<int> dx(N - 1);
	rep(i, N - 1) dx[i] = x[i + 1] - x[i];
	bool ok2 = true;
	rep(i, N - 1) if (dx[i] > V) ok2 = false;
	if (ok2) return vector<int>(N, true);
	vector<int> v;
	for (int _V = V; _V; _V /= 2) v.pb(_V);
	v.pb(0);
	int M = v.size();
	rep(i, N - 1) {
		int k;
		for (k = 0; dx[i] <= v[k]; k++);
		dx[i] = k;
	}
	union_find uf(N);
	rep(i, N - 1) if (dx[i]) uf.unite(i, i + 1);
	vector<int> dp1 = f(N, M, dx);
	reverse(dx.begin(), dx.end());
	vector<int> dp2 = f(N, M, dx);
	vector<bool> ok(N);
	rep(S, 1<<(M - 1)) {
		int S1 = S<<1, S2 = (((1<<(M - 1)) - 1) - S)<<1;
		int i = min(dp1[S1], N - 1), j = max(0, N - 1 - dp2[S2]);
		if (i > j || uf.same(i, j)) ok[uf.find(i)] = true;
	}
	vector<int> ans(N);
	rep(i, N) ans[i] = ok[uf.find(i)];
	return ans;
}

int main() {
	vector<int> ans = solve();
	for (int z: ans) if (z) printf("Possible\n"); else printf("Impossible\n");
}


Measured memory_bytes: 30880
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

int main() {
	int N, K, Q;
	vector<int> A;
	vector<int> dp;
	cin >> N >> K >> Q;
	A.resize(Q);
	in(A);
	dp.resize(N,K - Q);
	for (auto itr = A.begin(); itr != A.end();itr++) {
		dp[--(*itr)]++;
	}
	for (int n = 0; n < N; n++) {
		if (dp[n] > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define R register int
#define AC 400100
#define ac 1601000//error!!!数据范围是2 00000, 不是1开头！！！

int n, m, ans = -INT_MAX, w;
int Head[AC], Next[ac], date[ac], tot;
int tree[ac], lazy[ac], l[ac], r[ac], l_[AC], r_[AC];

inline int read()
{
	int x = 0;char c = getchar();
	while(c > '9' || c < '0') c = getchar();
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x;
}

inline void add(int f, int w)
{
	date[++tot] = w, Next[tot] = Head[f], Head[f] = tot;
}

inline void upmax(int &a, int b)
{
	if(b > a) a = b;
}

void pre()
{
	n = read(), m = read();
	for(R i = 1; i <= n; i ++) 
		l_[i] = read(), r_[i] = read(), add(r_[i], i);
}

inline void pushdown(int x)
{
	if(lazy[x])
	{
		int ll = x * 2, rr = ll + 1;
		lazy[ll] += lazy[x], lazy[rr] += lazy[x];
		tree[ll] += lazy[x], tree[rr] += lazy[x];//这里因为是+=，所以必须用lazy[x]，不然会将lazy[ll]中的一些东西重复统计
		lazy[x] = 0;//最后才清空！！！！！！！！！！
	}//error!!!是区间加，不是赋值，不能直接覆盖，要+=
}

inline void update(int x)
{
	tree[x] = max(tree[x * 2], tree[x * 2 + 1]); 
}

void build(int x, int ll, int rr)
{
	l[x] = ll, r[x] = rr;
	if(ll == rr) 
	{
		tree[x] = -ll + 1;
		return ;
	}
	int mid = (ll + rr) >> 1;
	build(x * 2, ll, mid);
	build(x * 2 + 1, mid + 1, rr);
	update(x);
}

void change(int x, int ll, int rr)
{
	pushdown(x);
	if(l[x] == ll && r[x] == rr)
	{
		lazy[x] += w, tree[x] += w;
		return ;
	}
	int mid = (l[x] + r[x]) >> 1;
	if(rr <= mid) change(x * 2, ll, rr);
	else if(ll > mid) change(x * 2 + 1, ll, rr);
	else
	{
		change(x * 2, ll, mid);
		change(x * 2 + 1, mid + 1, rr);
	}
	update(x);
}
	
void find(int x, int ll, int rr)
{
	pushdown(x);
	if(l[x] == ll && r[x] == rr) 
	{
		upmax(ans, tree[x]);
		return ;	
	}
	int mid = (l[x] + r[x]) >> 1;
	if(rr <= mid) find(x * 2, ll, rr);
	else if(ll > mid) find(x * 2 + 1, ll, rr);
	else find(x * 2, ll, mid), find(x * 2 + 1, mid + 1, rr);//这是取max啊，，，，
}

void work()
{
	int now;
	ans = n - m;//r = 0的情况
	for(R i = Head[m + 1]; i; i = Next[i])
	{
		now = date[i], w = 1;
		change(1, l_[now] + 1, m + 1);
		//find(1, 4, 4);
	}
	//find(1, 4, 4);
	upmax(ans, tree[1]);
	for(R i = m; i; -- i)
	{
		w = -1;
		change(1, 1, i + 1);
		for(R j = Head[i]; j; j = Next[j])
		{
			now = date[j], w = 1;
			change(1, l_[now] + 1, i + 1);
		}
		find(1, 1, i + 1);//左端点在后面就不合法了
	}
	printf("%d\n", ans);
}

int main()
{
	pre();
	build(1, 1, m + 1);//要多出一位来代表左端点取0的情况
	work();//ri最大居然可以到m+1...
	return 0;
}

Measured memory_bytes: 32768
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

typedef long long ll;

const ll h = 3e6+10;
//GO DOWN!!!!!!!!!!!!!
//DO NOT OPEN SECRET GO OFF
int a,b,c,d,e,mx;

int main(){
   cin>>a>>b;
   c=a-b;
   d=a+b;
   e=a*b;
   mx = max(c,d);
   mx =max(mx, e);
   cout<<mx;
}

/*
 Check for :
  - Overflow
*/


Measured memory_bytes: 256