akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//FUNCTION

//SOLVE
void solve(void)
{
  int N;
  cin>>N;
  vector<int> vec(N+1,0);
  for (int i = 1; i <= N; i++)
  {
    cin>>vec[i];
    vec[i] += vec[i-1];
  }
  int ANS = INF;
  // DEBUG(vec);
  for (int i = 1; i < N; i++)
  {
    int X = vec[i];
    int Y =vec[N] - vec[i];
    chmin(ANS,abs(X-Y));
  }
  cout<<ANS<<endl;
  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 1792
N, X = map(int, input().split())
A = list(map(lambda a: abs(int(a) - X), input().split()))
def gcd(a, b):
    while b != 0:
        r = a % b
        a = b
        b = r
    return a
g = A[0]
for a in A[1:]:
    g = gcd(g, a)
print(g)


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

#define ll long long
#define ld long double
#define ff first
#define ss second
#define eps 1e-9
#define pi acos(-1.0)
#define all(v) v.begin(),v.end()

#define MAX 500005

vector<ll> p;
bool vis[MAX];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    ll k;
    cin >> k;

    ll sum = 0;
    for(int i=0;i<1000000;i++)
    {
        sum*=10;
        sum+=7;
        sum%=k;

        if(sum == 0)
        {
            cout << i+1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define N 1009
#define ll long long
#define M 1000000007

ll dp[N][N];
string s[N];

int main()
{
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n ; i++)
        cin >> s[i];
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            if(i == 1 && j == 1)
            {
                dp[i][j] = 1LL;
                continue;
            }
            if(s[i - 1][j - 1] != '#')
            {
                if(i > 1) dp[i][j] += dp[i - 1][j];
                if(j > 1) dp[i][j] += dp[i][j - 1];
            }
            dp[i][j] = dp[i][j] % M;
        }
    }
    cout << dp[n][m] << endl;
}







Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()
#define pb push_back

typedef long long ll;
const int inf = 1e9+7;
const ll infll = 1 << 60LL;
const ll mod = 1e9 + 7;
// 0~3までは左右前後 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

// 型による変数のオーバーフローに気をつけろ！！
// 悩んだら図やグラフを書け！！悩む前から書け！！

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

	int n, m;
	cin >> n >> m;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];

	// 累積和で余裕やん
	vector<ll> sum(n);
	sum[0] = a[0];

	Rep(i, 1, n) {
		sum[i] = sum[i - 1] + a[i];
		sum[i];
	}

	// まって　前に同じようなの見たぞ 累積和だ！！！
	// mの余りであるだけでほぼ全く同じ問題じゃん！！！！！！！
	map<ll, ll> mp;

	mp[0] = 1;
	ll cnt = 0;

	rep(i, n) {
		if (sum[i] != 0) {
			cnt += mp[sum[i] % m];
			mp[sum[i] % m]++;
		}
	}

	cout << cnt << endl;

	return 0;
}

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

vector<int> vc;

int main(void)
{
    int a,b,k,g;
    cin >> a >> b >> k;
    g = __gcd(a, b);
    int i;
    for(i=1;i*i<g;i++){
        if(g%i==0){
            vc.push_back(i);
            vc.push_back(g/i);
        }
    }
    if(i*i==g) vc.push_back(i);
    sort(vc.begin(), vc.end());

    cout << vc[vc.size()-k];

}


Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)

demands = m.times.map do
  gets.chomp.split.map(&:to_i)
end.sort_by{|d| [d[0],d[1]]}

cnt = 0

min, max = demands[0]
(demands.size - 1).times do |i|
  if max <= demands[i + 1][0]
    cnt += 1
    max = Float::INFINITY
  end

  min = demands[i + 1][0]
  max = [max, demands[i + 1][1]].min
end

puts(cnt + 1)

Measured memory_bytes: 26356
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
const long long oo = 1000000000000000;
int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long long n, W;
	cin >> n >> W;

	vector<long long> w(n), v(n);
	for(long long i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
	}

	long long mx = *max_element(v.begin(), v.end());
	mx *= n;
	vector<long long> dp(mx + 1, oo);
	dp[0] = 0;
	for(long long i = 0; i < n; i++) {
		for(long long j = mx; j - v[i] >= 0; j--) {
			dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
		}
	}

	long long res = oo;
	for(long long j = 0; j <= mx; j++) {
		if(dp[j] <= W) res = j;
	}

	cout << res << '\n';

}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; 
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define F0Rd(i,a) for (int i = a - 1; i >=0 ; i--)
#define FORd(i,a,b) for (int i = b - 1; i >= a; i--)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'
 
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define print(x) cout << x << newl;
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 
 
const int MXN = 2e5 + 5;
//const int MXN = 1e6 + 5;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
 

const ll mod1 = 1e9 + 7;

struct matrix {
    vector<vector<ll>> cells;
    matrix(vector<vector<ll>> input) : cells(input) {}
    matrix(ll n, ll m, ll val) {
        cells.resize(n);
        vector<ll> row(m);
        fill(row.begin(), row.end(), val);
        fill(cells.begin(), cells.end(), row);
    }
    
    matrix(ll n) : matrix(n, n, 0) {
        for (ll i = 0; i < n; i++) {
            cells[i][i] = 1;
        }
    }
    
    matrix operator*(matrix b) {
        assert(cells[0].size() == b.cells.size());
        ll n = cells.size(), m = b.cells[0].size();
        matrix result(n, m, 0);
        for (ll i = 0; i < n; i++) {
            for (ll j = 0; j < m; j++) {
                for (ll k = 0; k < (ll) b.cells.size(); k++){
                    result.cells[i][j] += ((cells[i][k] * b.cells[k][j] + mod1) % mod1 + mod1);
                    result.cells[i][j] %= mod1;
                }
            }
        }
        return result;
    }
};

matrix matPow(matrix base, ll exp) {
    if (exp == 0)
        return matrix(base.cells.size());
    return matPow(base * base, exp / 2) * (exp % 2 == 1 ? base : matrix(base.cells.size()));
}


ll N, K;

int main(){ FAST
    //ifstream cin("/Users/konwoo/input.txt");
    //ofstream cout("/Users/konwoo/output.txt");

    cin >> N >> K;
    matrix M(N,N,0);
    F0R(i,N){
        F0R(j,N){
            cin >> M.cells[i][j];
        }
    }
    ll ans = 0;
    M = matPow(M,K);
    F0R(i,N) F0R(j,N) ans = (ans + M.cells[i][j]) % mod1;
    finish(ans);




    



 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int a[200010];
int main() {
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans ^= a[i];
    }
    for (int i = 0; i < n; i++) {
        cout << (ans^a[i]) << " \n"[i == n - 1];
    }
    return 0;
}

Measured memory_bytes: 4408
//#pragma GCC optimize(2)


#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/priority_queue.hpp>
#include<ext/rope>*/
//using namespace __gnu_cxx;
//using namespace __gnu_pbds;
//void err(istream_iterator<string> it){cerr<<endl;}
//template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args){cerr << *it << " = " << a << " , ";err(++it, args...);}
//#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mem(a,b) memset((a),b,sizeof((a)))
#define fpre(x) cout<<fixed<<setprecision(x)
#define clr(v) (v).clear()
#define pii pair<int,int>
#define pdd pair<double,double>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp make_pair
#define eb emplace_back
#define pb emplace_back
#define ll long long
#define ld long double
#define ull unsigned long long
#define uint unsigned int
#define ushort unsigned short
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define lowbit(i) (i&(-i))
#define lson rt<<1
#define rson lson|1
#define fi first
#define se second
const double eps=1e-7;
const double pi=acos(-1);
inline int dcmp(double x)
{
    if(x<-eps)
        return -1;
    if(x>eps)
        return 1;
    return 0;
}
//-----------------------------------------------head

bool v[10];
bool ok(int n)
{
    while(n)
    {
        if(v[n%10])
            return 0;
        n/=10;
    }
    return 1;
}

int main()
{
    int n,k;
    while(~scanf("%d%d",&n,&k))
    {
        mem(v,0);
        for(int i=0,t;i<k;++i)
            scanf("%d",&t),v[t]=1;
        for(int i=n;i<1e5;++i)
            if(ok(i))
            {
                printf("%d\n",i);
                break;
            }
    }
}

/*
6
0 0 -1 3
-2 -1
2 3
3 -1
-1 2
-3 2
-4 0
6
3 10 3 2
2 1
4 1
0 3
6 3
4 4
2 4
6
3 2 3 10
2 1
4 1
0 3
6 3
4 4
2 4
*/









Measured memory_bytes: 256
#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    for(intl i = 0; 4 * i <= n; i++){
        for(intl j = 0; 7 * j <= n; j++){
            if(4 * i + 7 * j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
 // #ifndef ONLINE_JUDGE
// 	freopen("input.txt" , "r" , stdin);
// 	freopen("output.txt" , "w" , stdout);
// #endif
long long int t;
cin>>t;
int a=t%10;
if(a==2||a==4||a==5||a==7||a==9)
    cout<<"hon";
else if(a==3)
    cout<<"bon";
else
    cout<<"pon";
return 0;}


Measured memory_bytes: 3608
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
using namespace std;
const int mod = 1000000007;

int main() {
 
  int64_t N,K;
  cin>>N>>K;
  vector<int64_t> A(N+1);
  vector<bool> B(N+1,false),C(N+1,false);
  for(int i=1; i<=N; i++){cin>>A[i];}
  int now=A[1],count=0,ans,loop=-1,tmp;
  while(true){
    count++;
    if(count>K)goto end;
    if(B[now])break;
    B[now]=true;
    now=A[now];
  }
  ans=now;tmp=now;
  while(true){
    loop++;
    if(C[tmp])break;
    C[tmp]=true;
tmp=A[tmp];

  }
  for(int i=0; i<(K-count)%loop; i++){
   ans=A[ans];
  }
  cout << ans << endl;
  return 0;
  end : 
  ans=A[1];
  for(int i=1; i<K; i++){
   ans=A[ans];
  }
  cout << ans << endl;
}

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


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


    if( n%2 )
    {
        stack<ll> odd ;
        queue<ll> even;
        for(int i=1 ;i<=n;i++)
        {
            ll temp;
            cin>>temp;
            if( i%2  ==0 )
            {
                even.push( temp);
            }
            else odd.push( temp);
        }
        while( !odd.empty())
        {
            cout<<odd.top()<<" ";
            odd.pop();
        }
        while (!even.empty() )
        {
            cout<<even.front()<<" ";
            even.pop();
        }
    } else
    {
        stack<ll> even;
        queue<ll> odd;
        for(int i=1 ;i<=n;i++)
        {
            ll temp;
            cin>>temp;
            if( i%2  ==0 )
            {
                even.push( temp);
            }
            else odd.push( temp);
        }
        while (!even.empty() )
        {
            cout<<even.top()<<" ";
            even.pop();
        }
        while( !odd.empty())
        {
            cout<<odd.front()<<" ";
            odd.pop();
        }
    }
}


Measured memory_bytes: 5236
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
ll inf = 1e10;

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int c[9];
  rep(i, 9) cin >> c[i];
  
  for(int i = 0; i < 2; i++){
    if(c[i]-c[i+1] == c[i+3]-c[i+4] && c[i+3]-c[i+4] == c[i+6]-c[i+7]) continue;
    else{
      cout << "No" << "\n";
      return 0;
    }
  }
  for(int i = 0; i < 4; i+=3){
    if(c[i]-c[i+3] == c[i+1]-c[i+4] && c[i+1]-c[i+4] == c[i+2]-c[i+5]) continue;
    else{
      cout << "No" << "\n";
      return 0;
    }
  }
  cout << "Yes" << "\n";
  
}  

Measured memory_bytes: 256
# p (0..6).to_a.map{|j| [6 ** j, 9 ** j] }.flatten.uniq.sort
a = [1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049, 531441]
 
m, dp = gets.to_s.to_i, [0]
(1..m).each {|i|
  t = 987654321
  a.take_while{|j| i - j >= 0 }.map{|j| i - j }.each{|c| t = dp[c] if t > dp[c] }
  dp.push(t + 1)
}
puts dp[-1]

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define LEN 100000
priority_queue<int> Q;
int N,p,ans=0;;
int main(){
  cin >> N;
  for(int i=0;i<N;++i){
    cin >> p;
    Q.push(p);
  }
  ans=Q.top()/2;
  Q.pop();
  while(! Q.empty()){
    ans+=Q.top();
    Q.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

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

void test() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    if (a > k) {
        ans += k;
        k = 0;
    } else {
        k -= a;
        ans += a;
    }
    if (b > k) {
        k = 0;
    } else {
        k -= b;
    }
    if (c > k) {
        ans -= k;
        k = 0;
    } else {
        k -= c;
        ans -= c;
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifdef HOME
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i) {
        test();
    }
    return 0;
}


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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
    
    
    int h,w,m;
    cin>>h>>w>>m;
    pvec memo(m);
    pvec u(h);
    pvec v(w);
    map<P,int> mp;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        u[a].first++;
        v[b].first++;
        memo[i]=P(a,b);
        mp[P(a,b)]++;
    }
    rep(i,h) u[i].sc=i;
    rep(j,w) v[j].sc=j;

    int ans=0;
    rep(i,m){
        int a,b;
        tie(a,b)=memo[i];
        chmax(ans,u[a].fs+v[b].fs-1);
    }


    sort(rall(u));
    sort(rall(v));

    rep(i,h){
        chmax(ans,u[i].fs+v[0].fs-mp[P(u[i].sc,v[0].sc)]);
    }
    rep(i,w){
        chmax(ans,u[0].fs+v[i].fs-mp[P(u[0].sc,v[i].sc)]);
    }
    
    cout<<ans<<endl;
    
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

Measured memory_bytes: 78160
def main(str)
  nm, as = str.split("\n")
  n, _m = nm.split(" ").map(&:to_i)
  as = as.split(" ").map(&:to_i)
  x = n - as.sum
  (x >= 0 ? x : -1).to_s
end

unless ENV["TEST"]
  puts main($stdin.read.chomp)
  exit(0)
end


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

using namespace std;

const int maxn = 1000 + 10;
const long long mod = 1e9 + 7;
int p[maxn], m;
long long C[maxn][maxn];

void prime_table() {
    bool vis[maxn];
    int i, j;
    memset(vis, 0, sizeof(vis));
    for(i = 2; i <= 1000; i++)
        if(!vis[i]) for(j = (i<<1); j <= 1000; j += i) vis[j] = 1;
    m = 0;
    for(i = 2; i <= 1000; i++)
        if(!vis[i]) p[m++] = i;
}
long long cal(int n, int pri) {
    return (n < pri) ? 0 : (n/pri + cal(n/pri, pri));
}
int main() {
    int n;
    prime_table();
    cin >> n;
    long long sum = 1;
    for(int i = 0; i < m; i++) sum = ( sum * ( cal(n, p[i]) + 1) ) % mod;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 384
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=1e9+7;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int main(){
	int a,b;
	cin>>a>>b;
	if(a+b==15)cout<<"+"<<endl;
	else if(a*b==15)cout<<"*"<<endl;
	else cout<<"x"<<endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    int l = 0, r = N;
    while (r-l > 1) {
        int c = (l+r)/2;
        map<int, int> mp;
        for (int i = 1; i < N; i++) {
            if (A[i] >= 100000) continue;
            if (A[i-1] >= A[i]) {
                int t = A[i];
                mp[t]++;
                auto it = mp.upper_bound(t);
                mp.erase(it, mp.end());
                while (t > 0 && mp[t] == c) {
                    mp[t] = 0;
                    mp[t-1]++;
                    t--;
                }
            }
            if (mp[0] > 0) break;
        }
        if (mp[0] == 0) r = c;
        else l = c;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <math.h>
 
typedef struct{
  double x;
  double y;
}P;
 
void k( int num , P a , P b ){
  if( num == 0 ){
	return ; 
	}
 
  P c,d,e;
 
 
  c.x = ( 2.0 * a.x + 1.0 * b.x ) / 3.0;
  c.y = ( 2.0 * a.y + 1.0 * b.y ) / 3.0;
  d.x = ( 1.0 * a.x + 2.0 * b.x ) / 3.0;
  d.y = ( 1.0 * a.y + 2.0 * b.y ) / 3.0;
  e.x = ( d.x - c.x ) * cos( M_PI/3 ) - (d.y - c.y ) * sin( M_PI/3 ) + c.x;
  e.y = ( d.x - c.x ) * sin( M_PI/3 ) + (d.y - c.y ) * cos( M_PI/3 ) + c.y;
 
  k( num - 1 , a , c );
  printf("%.8f %.8f\n" , c.x , c.y );

  k( num - 1 , c , e );
  printf("%.8f %.8f\n" , e.x , e.y );

  k( num - 1 , e , d );
  printf("%.8f %.8f\n" , d.x , d.y );

  k( num - 1 , d , b );
}

int main ( void ){
 
  int n;
 
  scanf("%d" , &n );
 
  P a = {0.0, 0.0};
  P b = {100.0, 0.0};
 
  printf("%.8f %.8f\n" , a.x , a.y );
  k( n , a , b );
  printf("%.8f %.8f\n" , b.x , b.y );
 
  return 0;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
int main(){
  vector<vector<int> >vvi(555);
  int memo[555][555]={};
  for(int i=0;i<555;i++)for(int j=0;j<555;j++)memo[i][j]=-1;
  int n,m,q;cin>>n>>m>>q;
  for(int i=0;i<m;i++){
    int l,r;cin>>l>>r;
    vvi[l].pb(r);
  }
  for(int i=1;i<=500;i++){
    vvi[i].pb(INF);
    sort(ALL(vvi[i]));
  }
  for(int i=0;i<q;i++){
    ll ans=0;
    int l,r;cin>>l>>r;
    for(int j=l;j<=r;j++){
      if(memo[j][r]!=-1){ans+=memo[j][r];continue;}
      auto num=upper_bound(ALL(vvi[j]),r);
      if((*num)!=INF){ans+=num-vvi[j].begin();memo[j][r]=num-vvi[j].begin();}
      else {ans+=vvi[j].size()-1;memo[j][r]=vvi[j].size()-1;};
    }
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define inf 1000000000
#define ll long long
using namespace std;
int main()
{
    int len,locate,locate1,flag=1;
    ll k,ans=0,ans1=0,ans2=0,ans3=0;
    char a[205];
    scanf("%s%lld",a,&k);
    len=strlen(a);
    if(k==1)
    {
        for(int i=0; i<len; i++)
        {
            int tmp1=i;
            char tmp=a[i];
            while(a[i]==tmp&&i<len)
            {
                i++;
            }
            i--;
            ans+=(i-tmp1+1)/2;
        }
        printf("%lld",ans);
        return 0;
    }
    for(int i=len; i<=2*len-1; i++)
        a[i]=a[i-len];
    for(int i=0; i<2*len; i++)
    {
        int tmp1=i;
        char tmp=a[i];
        while(a[i]==tmp&&i<2*len)
        {
            i++;
        }
        i--;
        if(tmp1<=len-1&&i>=len)
        {
            locate=tmp1-1,locate1=i-len+1;
            ans1=(i-tmp1+1)/2;
            flag=0;
            break;
        }
    }
    if(!flag)
    {
        if(locate==-1&&locate1==len)
            printf("%lld",k*len/2);
        else
        {
            for(int i=0; i<=locate; i++)
            {
                int tmp1=i;
                char tmp=a[i];
                while(a[i]==tmp&&i<=locate)
                {
                    i++;
                }
                i--;
                ans+=(i-tmp1+1)/2;
            }
            for(int i=locate1; i<len; i++)
            {
                int tmp1=i;
                char tmp=a[i];
                while(a[i]==tmp&&i<len)
                {
                    i++;
                }
                i--;
                ans2+=(i-tmp1+1)/2;
            }
            for(int i=locate1; i<=locate; i++)
            {
                int tmp1=i;
                char tmp=a[i];
                while(a[i]==tmp&&i<=locate)
                {
                    i++;
                }
                i--;
                ans3+=(i-tmp1+1)/2;
            }
            printf("%lld",ans3*(k-2)+ans1*(k-1)+ans+ans2);
        }
    }
    else
    {
        for(int i=0; i<len; i++)
        {
            int tmp1=i;
            char tmp=a[i];
            while(a[i]==tmp&&i<len)
            {
                i++;
            }
            i--;
            ans+=(i-tmp1+1)/2;
        }
        printf("%lld",ans*k);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*
#define FOR(i,j,n) for(int i=j;i<n;i++)
#define LL long long
#define pii pair<int,int>
#define fir first
#define sec second
#define MEM(i,j) memset(i,j,sizeof(i))
#define ALL(i) i.begin(),i.end()
#define VI vector<int>
#define VP vector<pii>
#define pb(a) push_back(a)
*/
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
	long long X,A,B;
	cin >> X >> A >> B;
	if(X >= B)
	    cout << "delicious";
	else if(X + A >= B)
	    cout << "safe";
	else
	    cout << "dangerous";
	cout << endl;
    return 0;
}


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

const int MOD = 1000000007;
const int64_t INF = 1LL << 60;

int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> m(N);
    rep(i, N) cin >> m.at(i);

    X = X - accumulate(m.begin(), m.end(), 0);
    int min = *min_element(m.begin(), m.end());

    cout << N + X / min << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int s = scanner.nextInt();
        if (0 <= s && s < 86400) {

            int m = s / 60;
            int h = m / 60;
            int mm=m%60;
            int ss = s % 60;

            System.out.println(h + ":" + mm + ":" + ss);
        }
    }
}

Measured memory_bytes: 26064
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll


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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    vector<Pll> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a), greater<Pll>());
    vector dp(n+1, vector<ll>(n+10));
    rep(i,n){
        ll num = a[i].first, id = a[i].second;
        rep(j,i+1){
            chmax(dp[i+1][j+1], dp[i][j] + num * abs(id - j));
            chmax(dp[i+1][j], dp[i][j] + num * abs(n - i + j - 1 - id));
        }
    }

    ll ans = 0;
    rep(i,n+1)chmax(ans, dp[n][i]);
    cout << ans << endl;
}

Measured memory_bytes: 34944
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::HashSet;
use std::cmp;
use std::f64::consts;

fn main() {
    let mut n: i64 = read();
    let mut k: i64 = read();
    n-=1;
    k-=1;
    let mut ans = 0;

    if n % k == 0 {
        ans = n / k;
    } else {
        ans = n / k + 1;
    }

    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// 最大公約数
fn gcd(a: i32, b: i32) -> i32 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: i32, b: i32) -> i32 {
    a * b / gcd(a, b)
}

// 階乗
fn kaijou(n: i32)->i32 {
    if n == 1 {
        return n;
    }
    return n * kaijou(n-1);
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
const int INFTY = (1 << 21); // 2097152
// const ll INFTY = (1LL << 60);
const ll MD = 1000000007LL;
// fprintf(stderr, "%d %lld \n", x, xll);


int A, B, C, D, E, F;
int main() {

	cin >> A >> B >> C >> D >> E >> F;

	int rws = 100;
	int rs = 0;

	for(int i1 = 0; i1 <= 30; i1++)
	for(int i2 = 0; i2 <= 30; i2++)
	for(int i3 = 0; i3 <= 3000; i3++)
	{
		int w = i1 * 100 * A + i2 * 100 * B;
		if(w == 0) continue;

		int l1 = F - w;
		int l2 = w / 100 * E;
		int l = min(l1, l2) - i3 * C;
		if(l < 0) continue;
		int d = (l / D) * D;
		int s = i3 * C + d;
		int ws = w + s;

		if (s * rws >= rs * ws){
			rws = ws;
			rs = s;
		}
		// fprintf(stderr, "%d %d\n", ws, s);
	}
	cout << rws << " " << rs << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();

    if(x == 7 || x == 5 || x == 3) {
      System.out.println("YES");
    } else {
      System.out.println("NO");
    }
    
  }

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define int long long

using namespace std;

int n=0,m=0;
int a[100000];

int lcm(int a, int b)
{
	return a*b/__gcd(a,b);
}

signed main()
{
	cin >> n >> m;
	for (int i=0; i<n; i++)
	{
		cin >> a[i];
		if (a[i]%2!=0)
		{
			cout << 0;
			return 0;
		}
	}
	int l=1;
	for (int i=0; i<n; i++)
	{
		l = lcm(l, a[i]/2);
		if (l>2*m)
		{
			cout << 0;
			return 0;
		}
	}
	for (int i=0; i<n; i++)
		if (l%a[i]==0)
		{
			cout << 0;
			return 0;
		}
	int cnt = (m/l);
	cout << (cnt/2)+(cnt%2);
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <stdint.h>
#include <string>

using namespace std;

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

  string weathers[3] = {"Sunny", "Cloudy", "Rainy"};

  int ii=0;
  while(true) {
    if (S == weathers[ii++])
      break;
  }

  cout << weathers[ii%3] << endl;

  return 0;
}


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

int main(){
  int a,b;
  cin >>a >>b;
  if(a>9 || b>9) cout << -1 << endl;
  else cout << a*b << endl;
  return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    x -= 1
    y -= 1
    ans = min(ans, a[x] + b[y] - c)

print(ans)
    

Measured memory_bytes: 18684
S = input()
T = input()

d = [{},{}]

f=True

for s,t in zip(S,T):
    if t not in d[0]:
        d[0][t] = s
    else:
        if d[0][t] != s:
            f = False
            break
    if s not in d[1]:
        d[1][s] = t
    else:
        if d[1][s] != t:
            f = False
            break
if f:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	lint N, M;
	while (cin >> N >> M, !(N == 0 && M == 0)) {
		vector<lint>A(N);
		lint now = N - 1;
		lint cnt1 = 0;
		lint cnt2 = 0;
		while (1){
			
			//cout << now << ' ' << cnt1 << ' ' << cnt2 << endl;
			if (A[now] != -1) {
				cnt1++;
			}
			if (cnt1 == M) {
				A[now] = -1;
				cnt1 = 0;
				cnt2++;
			}
			if (cnt2 == N) {
				cout << now+2 << endl;
				break;
			}
			now++;
			if (now == N) {
				now = 0;
			}
			
			//cout << cnt2 << enld;
		}
	}
}


Measured memory_bytes: 3020
#include <iostream>
#include <string>
#include<algorithm>
#include <vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<numeric>
#include<regex>
using namespace std;

typedef long long ll;
#define modulo 1000000007 // 10^9 + 7
#define MAX 1000000000 // 10^9


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

	if (A + B + 1 >= C) {
		cout << B + C << endl;
	}
	else {
		cout << A + 2*B + 1 << endl;
	}

	return 0;
}

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

int main() {
  int X, N;
  cin >> X >> N;
  
  bool p[110];
  for (int i = 0;i < 110; i++) p[i] = true;
  
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    p[x] = false;
  }
  
  int ans = 1000;
  for (int i = 0; i <= 101; i++) {
    if (p[i]) {
      if (abs(i-X) < abs(X-ans)) ans = i;
    }
  }
  
  cout << ans << endl;
  
  
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define pyn(a) if(a)puts("Yes");else puts("No");
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
int n,m,x;
bool flag;
int main()
{
    sc2(n,m);
    rep(i,1,m){
        sc(x);n-=x;
    }
    if(n<=0)flag=true;
    pyn(flag);
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc =new Scanner(System.in);
		int s =sc.nextInt();//秒
		int h = s/3600;
		int m=(s%3600)/60;
		s=(s%3600)%60;
		System.out.println(h+":"+m+":"+s);
	}
		

}



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

int asc(const void* a, const void* b) {
    return *(char*)b - *(char*)a;
}
int main() {
    int n,ans=0;
    char str[100];

    scanf("%d", &n);
    scanf("%s", str);
    for (int i = 0; i < n; i++) {
        if (str[i] == 'A' && str[i+1] == 'B' && str[i+2] == 'C')
            ans++;
    }
    printf("%d", ans);
    return 0;
}




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

int main()  {
    string s; cin >> s;
    string front2 = s.substr(0, 2);
    string back2 = s.substr(2);
    //MM
    if ("01" <= front2 && front2 <= "12") {
        //MMMM
        if ("01" <= back2 && back2 <= "12") {
            cout << "AMBIGUOUS" << endl;
            return 0;
        }
        //MMYY
        else {
            cout << "MMYY" << endl;
            return 0;
        }
    }

    //YY
    //else if (front2 != "00") {
    else {
        //YYMM
        if ("01" <= back2 && back2 <= "12") {
            cout << "YYMM" << endl;
            return 0;
        }
        //YYYYつまりNA
        else {
            cout << "NA" << endl;
            return 0;
        }
    }
    
    //else cout << "NA" << endl;

    return 0;
}

Measured memory_bytes: 256
// Created by CAD on 2020/4/26.
#include <bits/stdc++.h>

#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x7fffffffffffffff
#define mst(name, value) memset(name,value,sizeof(name))
#define FOPEN freopen("C:\\Users\\14016\\Desktop\\cad.txt","r",stdin)
#define tst1(a) cout<<#a<<":"<<a<<endl
#define tst2(a, b) cout<<#a<<":"<<a<<" "<<#b<<":"<<b<<endl
#define tst3(a, b, c) cout<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<endl
#define tst4(a, b, c, d) cout<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<" "<<#d<<":"<<d<<endl
#define lson (p<<1)
#define rson (p<<1|1)
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define ll long long
#define lowbit(i) (i&-i)
using namespace std;

const int maxn=2e5+5;
ll sum[maxn];
const int mod=2019;
ll qpow(ll x,ll n){
    ll ans=1;
    while(n>0){
        if(n&1) ans=ans*x%mod;
        n>>=1,x=x*x%mod;
    }
    return ans;
}
map<ll,ll> cnt;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;cin>>s;
    int n=s.length();
    for(int i=0;i<n;++i)
        sum[i+1]=s[i]-'0';
    reverse(sum+1,sum+1+n);
    ll ans=0;
    cnt[0]++;
    for(int i=1;i<=n;++i){
        sum[i]=(sum[i-1]+sum[i]*qpow(10,i-1)%mod)%mod;
        ans+=cnt[sum[i]];
        cnt[sum[i]]++;
//        tst2(i,sum[i]);
    }
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 5320
#include<iostream>
#include<vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  for(int i=0;i<n;i++) {
    int a=0;
    int b=0;
    bool failed = false;
    for(int i=0;i<10;i++) {
      int n;
      cin >> n;
      if(failed) {
        continue;
      }

      if(b <= a && a < n) {
        // cout << "1 " << a << ":" << b << ":" << n << endl;
        a = n;
      } else if (a < b && b < n) {
        // cout << "2 " << a << ":" << b << ":" << n << endl;
        b = n;
      } else if (b <= a && b < n) {
        // cout << "3 " << a << ":" << b << ":" << n << endl;
        b = n;
      } else if (a < b && a < n) {
        // cout << "4 " << a << ":" << b << ":" << n << endl;
        a = n;
      } else {
        // cout << "x " << a << ":" << b << ":" << n << endl;
        cout<<"NO"<<endl;
        failed = true;
        continue;
      }
      if(i==9) {
        cout<<"YES"<<endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+2000;
typedef long long ll;
ll a[N],n,k,d[N];
int main()
{
	cin>>k>>n;
	for(int i=1;i<=n;i++)
    {
    	scanf("%lld",&a[i]);
	}
	for(int i=1;i<n;i++)d[i]=a[i+1]-a[i];
	d[n]=a[1]+k-a[n];
	ll ans=1e9;
	for(int i=1;i<=n;i++){
		ans=min(ans,k-d[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()


int main() {
    int N;
    string S, left_s, right_s;
    map<pair<string, string>, ll> left, right;
    cin >> N >> S;
 
    left_s = S.substr(0, N); right_s = S.substr(N); reverse(ALL(right_s));
    REP(i, 1 << N) {
        string rl, rr, bl, br;
        REP(j, N) {
            if ((i >> j) & 1) {
                rl += left_s[j];
                rr += right_s[j];
            }
            else {
                bl += left_s[j];
                br += right_s[j];
            }
        } 
        left[{rl, bl}]++;
        right[{rr, br}]++;
    }

    ll ans = 0;
    for (auto p : left) {
        if (right[p.first] > 0) {
            ans += p.second * right[p.first];
        } 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 108288
n, m, x, y = gets.split.map(&:to_i)
xs = gets.split.map(&:to_i).sort
ys = gets.split.map(&:to_i).sort

if (x+1..y).to_a.any?{ |i| i > xs[-1] && i <= ys[0] }
    puts "No War"
else
    puts "War"
end


Measured memory_bytes: 3836
#include <stdio.h>
int main(void) {
int h, w, i, j;
scanf("%d %d", &h, &w);
while( h != 0 && w != 0 ) {
for(i = 0; i < h; ++i ) {
for(j = 0; j < w; ++j ) {
if( j==0 || j==w-1 || i==0 || i==h-1 ) {
putchar('#');
} else {
putchar('.');
}
}
putchar('\n');
}
putchar('\n');
scanf("%d %d", &h, &w);
}
return 0;
}

Measured memory_bytes: 1000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		boolean[] spade = new boolean[13];
		boolean[] heart = new boolean[13];
		boolean[] club = new boolean[13];
		boolean[] diamond = new boolean[13];

		int n = scan.nextInt();		

		for (int i = 0; i < n; ++i) {
			boolean[] mark = null;
			String markChar = scan.next();
			int number = scan.nextInt();
			if ("S".equals(markChar)) {
				mark = spade;
			}
			if ("H".equals(markChar)) {
				mark = heart;
			}
			if ("C".equals(markChar)) {
				mark = club;
			}
			if ("D".equals(markChar)) {
				mark = diamond;
			}
			mark[number - 1] = true;
		}

		for (int i = 0; i < spade.length; ++i) {
			if (!spade[i]) {
				System.out.println("S " + (i + 1));
			}
		}

		for (int i = 0; i < heart.length; ++i) {
			if (!heart[i]) {
				System.out.println("H " + (i + 1));
			}
		}

		for (int i = 0; i < club.length; ++i) {
			if (!club[i]) {
				System.out.println("C " + (i + 1));
			}
		}

		for (int i = 0; i < diamond.length; ++i) {
			if (!diamond[i]) {
				System.out.println("D " + (i + 1));
			}
		}
	}
}

Measured memory_bytes: 26200
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
	cin>>n;
//	double t;
//	if (n==1||n==2)
//		cout<<"1.0000000000" <<endl;
//	else if (n%2==0)
//		printf("%.7f\n",((n-2)*1.0)/n );
//	else
//		printf("%.7f\n",(n-3)*1.0/(n-1));
	double a=0,b=0;
	for (int i=1;i<=n;i++)
		if (i%2==1)
			a++;
		else 
			b++;
	printf("%.8lf\n",a/(a+b));
    return 0;
}


Measured memory_bytes: 256