akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int dist[300][300][300];

const vector<tuple<int,int,int>> moves = {
    tuple<int,int,int> {1,1,0},
    tuple<int,int,int> {1,0,1},
    tuple<int,int,int> {0,1,1},
    tuple<int,int,int> {2,0,0},
    tuple<int,int,int> {0,2,0},
    tuple<int,int,int> {0,0,2}
};

int main() {
    int a, b, c;
    while (cin >> a >> b >> c && a >= 0) {
        queue<tuple<int, int, int>> q;
        memset(dist, -1, sizeof dist);
        dist[a][b][c] = 0;
        q.emplace(a, b, c);

        int same = -1;
        while (q.size()) {
            int ta, tb, tc;
            tie(ta, tb, tc) = q.front();

            q.pop();
            if (ta == tb && tb == tc) {
                same = ta;
                break;
            }

            for (auto m : moves) {
                int da, db, dc;
                tie(da, db, dc) = m;
                int na = ta + da;
                int nb = tb + db;
                int nc = tc + dc;
                if (max({na, nb, nc}) >= 300) continue;
                if (dist[na][nb][nc] == -1) {
                    dist[na][nb][nc] = dist[ta][tb][tc] + 1;
                    q.emplace(na, nb, nc);
                }
            }
        }

        cout << dist[same][same][same] << endl;
    }
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

const int MAX = 10000000;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/****** define constant end ********/

/****** define variable start ******/
ll x;
/******* define variable end *******/
int solve() {
	cin >> x;
	if(x) cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


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

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

using namespace std;

int main() {
  int N,Q;
  cin >> N >> Q;
  vector<int> year(N+1);
  vector<string> name(N+1);
  year[0] = 0, name[0] = "kogakubu10gokan";
  rep(i,N) cin >> year[i+1] >> name[i+1];
  int ptr = upper_bound(year.begin(),year.end(),Q) - year.begin() - 1;
  cout << name[ptr] << endl;
  return 0;
}

Measured memory_bytes: 3220
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <string>
#include <cstring>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
#include <tuple>

using namespace std;
mt19937_64 rng(58);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int m, n;
    cin >> n >> m;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(), a.end());
    cout << ((a[n - m] * 4 * m >= sum) ? "Yes" : "No") << endl;

}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int H = in.nextInt();
            int A = in.nextInt();
            out.println(H / A + (H % A > 0 ? 1 : 0));
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21332
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N = sc.nextInt()
    val Inf = Int.MinValue / 10
    val A, B, C = Array.fill(N)(Inf)
    (0 until N) foreach { i =>
      val a, b, c = sc.nextInt()
      A(i) = a
      B(i) = b
      C(i) = c
    }

    val dp = Array.fill(N+1, 3)(Inf)
    dp(0)(0) = 0
    dp(0)(1) = 0
    dp(0)(2) = 0
    var i = 0
    while (i < N) {
      dp(i+1)(0) = (dp(i)(1) + A(i)) max (dp(i)(2) + A(i))
      dp(i+1)(1) = (dp(i)(0) + B(i)) max (dp(i)(2) + B(i))
      dp(i+1)(2) = (dp(i)(0) + C(i)) max (dp(i)(1) + C(i))
      i += 1
    }
    println(dp(N).max)
  }

}

Measured memory_bytes: 107380
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;

void solve(){

    ll k;
    cin >> k;
    string s;
    cin >> s;
    if(s.size()<=k){
        cout << s << endl;
        return;
    }
    rep(i,k){
        cout << s[i];
    }
    cout << "..." << endl;

}

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


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define EPS (1e-14)
#define _PA(x,N) rep(i,N){cout<<x[i]<<" ";}cout<<endl;
#define _PA2(x,H,W) rep(i,(H)){rep(j,(W)){cout<<x[i][j]<<" ";}cout<<endl;}

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef complex<double> Complex;
typedef vector< vector<int> > Mat;

const ll INF = 1e+18 + 9;

int n;
int a[100005];
ll sum[100005]; // +,-,+,-
ll sum2[100005]; // -,+,-,+
ll ans1 = 0, ans2 = 0;

void solve() {
	rep(i, n) {
		sum[i + 1] = sum[i] + a[i];
		sum2[i+ 1] = sum2[i] + a[i];
	}
	ll tmp1 = 0; // +,-,+,-
	ll tmp2 = 0; // -,+,-,+
	rep(i, n) {
		sum[i+1] += tmp1;
		sum2[i+1] += tmp2;
		if (i%2 == 0) {
			// +,-,+,-..
			if (sum[i+1] <= 0) {
				tmp1 += 1 - sum[i+1];
				ans1 += 1 - sum[i+1];
			}
			// -,+,-,+
			if (sum2[i+1] >= 0) {
				tmp2 += -1 - sum2[i+1];
				ans2 += -(-1 - sum2[i+1]);
			}
		} else {
			// +,-,+,-..
			if (sum[i+1] >= 0) {
				tmp1 += -1 - sum[i+1];
				ans1 += -(-1 - sum[i+1]);
			}
			// -,+,-,+
			if (sum2[i+1] <= 0) {
				tmp2 += 1 - sum2[i+1];
				ans2 += 1 - sum2[i+1];
			}

		}
		//cout << ans1 << " " << ans2 << endl;
	}
	cout << min(ans1, ans2) << endl;
}

int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	solve();
	return 0;
}




Measured memory_bytes: 2176
#include<iostream>
//#include<ctype.h>
using namespace std;
#define ll long
int main(){
	int W,H,x,y;
	cin>>W>>H>>x>>y;
	double area = double(W)*double(H)/2;
	cout<<area<<" ";
	if(x==double(W)/2 && y == double(H)/2){
		cout<<1;
	}
	else{
		cout<<0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void)
{
	int N,i,ans=1;

	string S;

	cin >> N;

	cin >> S;

	char tmp=S[0];

	for(i=1;i<N;i++)
	{
		if(tmp!=S[i])
		{
			tmp=S[i];
			ans++;
		}

	}
	
	cout << ans << endl;

}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define ll long long
#define EPS 0.000000001
#define ld long double
#define inf 5e18
#define N 1000001

 
 
 
int32_t main()
{
    IOS;

    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0;i < 10;i++)
    {
        for(int j = 0;j < 10;j++)
        {
            for(int k = 0;k < 10;k++)
            {
                string temp = "";
                temp += (char)(i + 48);
                temp += (char)(j + 48);
                temp += (char)(k + 48);
                int p = 0;
                for(int l = 0;l < s.length() and p < 3;l++)
                {
                    if(p < 3 and s[l] == temp[p])
                        p++;
                }
                // cerr << i << " " << j << " " << k << " " << p << endl;
                if(p == 3)
                    ans++;
            }
        }
    }
    cout << ans;
    return 0;
 
}

Measured memory_bytes: 384
#include <stdio.h>
int main(){
  int a, b, c;
  while(scanf("%d%d%d", &a, &b, &c) && (a != -1 || b != -1 || c != -1)){
    if(a < 0 || b < 0) puts("F");
    else if(a + b >= 80) puts("A");
    else if(a + b >= 65) puts("B");
    else if(a + b >= 50 || c >= 50) puts("C");
    else if(a + b >= 30) puts("D");
    else puts("F");
  }
  return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;

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() {
    string S;
    cin >> S;
    int sum = 0;
    for (int i = 0; i < S.length(); i++)
    {
        int num = S[i]-'0';
        sum += num;
    }
    string ans = "No";
    if(sum%9==0){
        ans = "Yes";
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int n;
  cin >> n;
  vector<ll> vec(n);
  ll m = vec[0];
  rep(i, n) {
    cin >> vec[i];
  }
  rep(i, n-1) {
    if (vec[i+1] > vec[i]) {
      vec[i+1]--;
      m = max(m, vec[i+1]);
    }
    if (vec[i+1] < vec[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
  return 0;
}

Measured memory_bytes: 1152
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono> 
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long 
#define printa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define printv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define all(v) v.begin(),v.end()
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define ump unordered_map
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1e5;
ll mod=1e9+7;
void solve(){
    ll k,n,m;
    cin>>k>>n>>m;
    ll x=n/k,y=m/k;
    if(x*k >= n && x*k <= m || (x+1)*k >= n && (x+1)*k <= m){
        cout<<"OK"<<nl;
    }else if(y*k >= n && y*k <= m || (y+1)*k >= n && (y+1)*k <= m){
        cout<<"OK"<<nl;
    }
    else cout<<"NG"<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); ll t=1;
    //cin>>t; //comment for single test
    while(t--) solve();
}

Measured memory_bytes: 3580
N = int(input())
A_list = []

hoge = input().split()

for i in range(N):
  A_list.append(int(hoge[i]))
  
len_org = len(A_list)
len_uniq = len(list(set(A_list)))

if len_org == len_uniq:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 39092
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	string S, T, U;
	cin >> S >> T;
	int nums, numt;
	cin >> nums >> numt;
	cin >> U;
	if (S == U)cout << nums - 1 << " " << numt << endl;
	else cout << nums << " " << numt-1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
using namespace std;

int main(){
  int N,M,X;
  cin>>N>>M>>X;
  int A[M];
  for(int i=0; i<M; ++i) cin>>A[i];
  
  int ans=0;
  for(int i=0; i<M; ++i){
    if(X>A[i]) ans++;
  }
  
  cout<<min(ans,M-ans)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;


int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    vector<long long> ln(87);
    ln[0]=2;
    ln[1]=1;
    for(int i=2; i<87; i++){
        ln[i]=ln[i-1]+ln[i-2];
    }
    int n;
    cin>>n;
    cout<<ln[n];
    
    return 0;
    
}

Measured memory_bytes: 384
N = int(input())
d = [0] * N
c = 0
b = True
for i in range(N):
  d[i] = list(map(int, input().split()))
  if d[i][0] == d[i][1]:
    c += 1
    b = True
  else:
    c = 0
    b = False
  if c == 3:
    break
if c == 3:
  print("Yes")
else:
  print("No")

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

void solve() {
    string s;
    cin >> s;

    int n = 0;
    rep(0, s.size()) {
        switch (s[i]) {
            case '+':
                n++;
                break;
            case '-':
                n--;
                break;
        }
    }

    cout << n << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoder.ABC065
{
    class Program
    {
        static int[] parent;
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[n];
            int[] y = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] inputs = Console.ReadLine().Split(' ');
                x[i] = int.Parse(inputs[0]);
                y[i] = int.Parse(inputs[1]);
            }
            var sortedX = x.Select((elem, idx) => new { Value = elem, Index = idx })
                            .OrderBy(elem => elem.Value)
                            .ToArray();
            var sortedY = y.Select((elem, idx) => new { Value = elem, Index = idx })
                            .OrderBy(elem => elem.Value)
                            .ToArray();
            Edge[] edges = new Edge[2 * (n - 1)];
            int k = 0;
            for (int i = 1; i < n; i++)
            {
                edges[k++] = new Edge(sortedX[i - 1].Index, sortedX[i].Index, sortedX[i].Value - sortedX[i - 1].Value);
                edges[k++] = new Edge(sortedY[i - 1].Index, sortedY[i].Index, sortedY[i].Value - sortedY[i - 1].Value);
            }
            Array.Sort(edges);
            parent = Enumerable.Range(0, n).ToArray();
            long totalCost = 0;
            for (int i = 0; i < k; i++)
            {
                if (Root(edges[i].NodeId1) != Root(edges[i].NodeId2))
                {
                    totalCost += edges[i].Cost;
                    int theirRoot = Math.Min(Root(edges[i].NodeId1), Root(edges[i].NodeId2));
                    parent[parent[edges[i].NodeId1]] = theirRoot;
                    parent[parent[edges[i].NodeId2]] = theirRoot;
                }
            }
            Console.WriteLine(totalCost);
        }

        static int Root(int id)
        {
            return parent[id] == id ? id : parent[id] = Root(parent[id]);
        }
    }

    class Edge : IComparable<Edge>
    {
        public int NodeId1 { get; }
        public int NodeId2 { get; }
        public long Cost { get; }
        public Edge(int id1, int id2, long cost)
        {
            NodeId1 = id1;
            NodeId2 = id2;
            Cost = cost;
        }
        public int CompareTo(Edge edge2)
        {
            return this.Cost.CompareTo(edge2.Cost);
        }
    }
}

Measured memory_bytes: 39104
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int A = sc.NextInt();
        int B = sc.NextInt();
        Console.WriteLine(Math.Max(0, A - B - B));
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 3009 /// Still trying to be normal
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e9 + 15;
ll dp[maxn][maxn];
pii dp2[maxn][maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    memset(dp,0,sizeof dp);
    string s,t;
    cin>>s>>t;
    string ans="";
    rep(i,1,sz(s)+1){
        rep(j,1,sz(t)+1){
            if(s[i-1]==t[j-1])dp[i][j]=dp[i-1][j-1]+1,dp2[i][j]=make_pair(i-1,j-1);
            else{
                if(dp[i-1][j]>dp[i][j-1])dp2[i][j]=make_pair(i-1,j);
                else dp2[i][j]=make_pair(i,j-1);
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    ll posi=sz(s),posj=sz(t);
    while(posi>=1 && posj>=1){
        if(dp2[posi][posj]==make_pair(posi-1,posj-1)){
            ans+=s[posi-1];
            int ant=posi;
            posi=dp2[posi][posj].F;
            posj=dp2[ant][posj].S;
        }
        else{
            int ant=posi;
            posi=dp2[posi][posj].F;
            posj=dp2[ant][posj].S;  
        }
    }
    reverse(all(ans));
    cout<<ans<<"\n";
    return 0;   
}

Measured memory_bytes: 212480
import math

n, d, a = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
l.sort()
q = []
index = 0
ans = 0
dmg = 0
for i in range(n):
    while index < len(q) and q[index][0] < l[i][0]:
        dmg -= q[index][1]
        index += 1
    if l[i][1] > dmg:
        times = (l[i][1]-dmg)//a if (l[i][1]-dmg)%a == 0 else (l[i][1]-dmg)//a+1
        ans += times
        q.append((l[i][0]+2*d, a*times))
        dmg += a*times
print(ans)

Measured memory_bytes: 91684
x = int(input())
h_m_s_split = lambda x: [x // 3600, x % 3600 // 60, x % 3600 % 60]

h_m_s_data = h_m_s_split(x)

print(str(h_m_s_data[0]) + ':' + str(h_m_s_data[1]) + ':' + str(h_m_s_data[2]))


Measured memory_bytes: 5600
MOD=10**9+7
n,m=map(int,input().split())
a=[0]*m
dp=[1]*(n+1)
for i in range(m):
    a[i]=int(input())
    dp[a[i]]=0
for i in range(2,n+1):
    if dp[i]==0:
        continue
    else:
        dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%MOD)

Measured memory_bytes: 460020
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    double a, b, x;
    cin >> a >> b >> x;
    double pi = atan(1)*4;
    double y = x/a;
    double angle = 0;
    if (2*y >= a*b) {
        // z is remaining triangle
        double z = a*b - y;
        // z <= ab/2.
        // z = ad/2 with d <= b
        double d = 2*z/a;
        // so we have a rectangular triangle with sides a and d.
        angle = pi/2 - atan(d/a);
        
    } else {
        // y <= ab/2
        // y = cb/2 with c <= a
        // so we have a rectangular triangle with sides c and b.
        double c = 2*y/b;
        angle = atan(c/b);
    }
    cout << setprecision(20) << 90 - angle * 180 / pi << endl;
    return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int a, b; cin >> a >> b;
    int i = 1;
    int c, d;
    while(true)
    {
        c = i * (i+1) / 2;
        d = (i+1) * (i+2) / 2;
        if(d - c == b - a) break;
        i++;
    }
    cout << c - a << endl;
}

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

    solve();

    return 0;
}

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

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

  bool ok = false;
  vector<char> ans(n);
  for (int i = 0; i < 4; i++) {
    vector<char> tmp(n);
    if(i == 0) {
      tmp[0] = 'S';
      tmp[1] = 'S';
    } else if(i == 1) {
      tmp[0] = 'S';
      tmp[1] = 'W';
    } else if(i == 2) {
      tmp[0] = 'W';
      tmp[1] = 'W';
    } else if(i == 3) {
      tmp[0] = 'W';
      tmp[1] = 'S';
    }

    for (int j = 1; j < n - 1; j++) {
      if(tmp[j] == 'S') {
        if(s[j] == 'o') tmp[j + 1] = tmp[j - 1];
        else {
          if(tmp[j - 1] == 'W') tmp[j + 1] = 'S';
          else tmp[j + 1] = 'W';
        }
      } else {
        if(s[j] == 'o') {
          if(tmp[j - 1] == 'S') tmp[j + 1] = 'W';
          else tmp[j + 1] = 'S';
        } else {
          tmp[j + 1] = tmp[j - 1];
        }
      }
    }

    bool flag = true;
    for (int j = 0; j < n; j++) {
      int prev = j - 1;
      int nxt = j + 1;
      if(j == 0) prev = n - 1;
      if(j == n - 1) nxt = 0;

      if(s[j] == 'o') {
        if(tmp[j] == 'S') {
          if(tmp[prev] != tmp[nxt]) flag = false;
        } else if(tmp[j] == 'W') {
          if(tmp[prev] == tmp[nxt]) flag = false;
        }
      } else if(s[j] == 'x') {
        if(tmp[j] == 'S') {
          if(tmp[prev] == tmp[nxt]) flag = false;
        } else if(tmp[j] == 'W') {
          if(tmp[prev] != tmp[nxt]) flag = false;
        }
      }
    }
    if(flag) {
      for (int j = 0; j < n; j++) ans[j] = tmp[j];
      ok = true;
      break;
    }
  }

  if(!ok) cout << -1 << endl;
  else {
    for (auto it : ans) cout << it;
    cout << endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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

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

const ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    while(A>0 && C>0) {
        C-=B;
        A-=D;
    }
    if(C<=0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

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

  ll tmp;
  for (int i = 0; i < k; i++) {
    if (i == 0) {
      tmp = 7 % k;
    } else {
      tmp = (tmp * 10 + 7) % k;
    }

    //cout << tmp << endl;

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

  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3644
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, M, K = map(int, input().split())

def dfs(v):
    size = 1
    for w in fr[v]:
        if ~roots[w]: continue
        roots[w] = roots[v]
        size += dfs(w)
    return size

fr = defaultdict(set)
for _ in range(M):
    a, b = [int(x) -1 for x in input().split()]
    fr[a].add(b)
    fr[b].add(a)
bl = defaultdict(set)
for _ in range(K):
    a, b = [int(x) - 1 for x in input().split()]
    bl[a].add(b)
    bl[b].add(a)

roots = [-1] * N
sizes = [-1] * N

for v in range(N):
    if ~roots[v]: continue
    roots[v] = v
    sizes[v] = dfs(v)

ans = []
for v in range(N):
    w = roots[v]
    res = sizes[w] - len(fr[v]) - sum(1 for u in bl[v] if roots[u] == w) -1
    ans.append(res)

print(*ans)

Measured memory_bytes: 98180
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define INF 999999999
using namespace std;

int main(){
    int n, m; cin >> n >> m;
    cout << (n*n) - m << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int q;
    cin >> q;

    vector<pair<ll, ll>> re;

    vector<ll> v;

    bool be = false;

    ll di = 0;

    ll res = 0;

    REP(i, q)
    {
        int qu;
        cin >> qu;
        if (qu == 1)
        {
            ll a, b;
            cin >> a >> b;

            res += b;

            if (!be)
            {
                v.push_back(a);
                ll di = 0;
                be = true;
                continue;
            }

            ll prem = v[(v.size() / 2) - ((v.size() + 1) % 2)];

            int l = -1;
            int r = v.size();
            while (r - l > 1)
            {
                int mid = (r + l) / 2;
                if (v[mid] > a)
                    r = mid;
                else
                    l = mid;
            }

            v.insert(v.begin() + l + 1, a);
            ll curm = v[(v.size() / 2) - ((v.size() + 1) % 2)];

            res += abs(curm - a);

            di = curm - prem;

            //t += abs(medi - a);

            res += di * ((v.size() / 2) - (v.size() + 1) % 2);
            res -= di * (v.size() / 2);
            continue;
        }
        else
        {
            pair<ll, ll> r;

            r.first = v[((v.size() / 2) - (v.size() + 1) % 2)];
            r.second = res;

            re.push_back(r);
        }
    }

    for (auto i : re)
    {
        cout << i.first << " " << i.second << endl;
    }

    return 0;
}

Measured memory_bytes: 5488
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
using namespace std;

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

    string s;
    cin >> s;

    int count = 0;
    for (int i = 0; i <= n - 3; i++)
    {
        if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#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;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int n,m;cin>>n>>m;
    if(n*2==m){
        cout<<n<<endl;
        return 0;
    }
    if(n*2<m){
        m-=n*2;
        cout<<n+m/4<<endl;
        return 0;
    }
    if(n*2>m){
        cout<<m/2<<endl;
        return 0;
    }
}

Measured memory_bytes: 256
# Problem - 安定なソート

def bubble_sort(C, N):
    for i in range(N):
        for j in range(N-1, i, -1):
            if C[j][1]<C[j-1][1]:
                tmp = C[j]
                C[j] = C[j-1]
                C[j-1] = tmp
    return C

def selection_sort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j][1]<C[minj][1]:
                minj = j
        if not minj==i:
            tmp = C[i]
            C[i] = C[minj]
            C[minj] = tmp
    return C

def stable_check(check_dic, ans_list):
    is_ok = True
    for a in ans_list:
        v = a[0]
        k = a[1]
        if check_dic[k][0]==v:
            check_dic[k].pop(0)
        else:
            is_ok = False
    return is_ok

# input
N = int(input())
cards = input().split()
check_dic = {}
check_dic_2 = {}
cards_1 = ['']*N
cards_2 = ['']*N
for i in range(N):
    # dictionaly create
    c_list = list(cards[i])
    if not c_list[1] in check_dic:
        check_dic[c_list[1]] = [c_list[0]]
        check_dic_2[c_list[1]] = [c_list[0]]
    else:
        check_dic[c_list[1]].append(c_list[0])
        check_dic_2[c_list[1]].append(c_list[0])
    cards_1[i] = cards[i]
    cards_2[i] = cards[i]

# bubble sort
ans = bubble_sort(cards_1, N)
is_stable = stable_check(check_dic, ans)
print(" ".join(list(map(str, ans))))
if is_stable:
    print("Stable")
else:
    print("Not stable")

# selection sort
ans = selection_sort(cards_2, N)
is_stable = stable_check(check_dic_2, ans)
print(" ".join(list(map(str, ans))))
if is_stable:
    print("Stable")
else:
    print("Not stable")



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

class Program
{
    static void Main()
    {
        var seq = Input().OrderByDescending(x => x).Take(3);
        foreach (var item in seq)
        {
            Console.WriteLine(item);
        }
    }

    static IEnumerable<int> Input()
    {
        string input;
        while ((input = Console.ReadLine()) != null)
        {
            yield return int.Parse(input);
        }
    }
}

Measured memory_bytes: 10028
n=int(input())
suit=['S','H','C','D']
deck=[[],[],[],[]]
for i in range(n):
    arr=input().split()
    if arr[0]=='S':
        deck[0].append(int(arr[1]))
    elif arr[0]=='H':
        deck[1].append(int(arr[1]))
    elif arr[0]=='C':
        deck[2].append(int(arr[1]))
    else:
        deck[3].append(int(arr[1]))
for i,v in enumerate(deck):
    v.sort()
    curr=1
    for num in v:
        while num>curr:
            print(suit[i],curr)
            curr+=1
        curr+=1
    while curr<14:
        print(suit[i],curr)
        curr+=1






Measured memory_bytes: 5612
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=1000000007;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

vector<int> e[200000];
int num[200000];
int bl=0,wh=0;

void dfs(int v,int p,int t){
    if(t==1)++bl;
    else ++wh;
    num[v]=t;
    for(auto u:e[v]){
        if(u!=p){
            dfs(u,v,-t);
        }
    }
}

void print(int & a){
    cout<<a<<" ";
    a+=3;
}

int main(){
    int n;
    cin>>n;
    for(int i=0;i<n-1;i++){
        int s,t;
        cin>>s>>t;
        --s,--t;
        e[s].push_back(t);
        e[t].push_back(s);
    }
    dfs(0,-1,1);
    int a=1,b=2,c=3;
    if(bl<=n/3){
        rep(i,n){
            if(num[i]==1)print(c);
            else if(a<=n)print(a);
            else if(b<=n)print(b);
            else print(c);
        }
    }
    else if(wh<=n/3){
        rep(i,n){
            if(num[i]==-1)print(c);
            else if(a<=n)print(a);
            else if(b<=n)print(b);
            else print(c);
        }
    }
    else{
        rep(i,n){
            if(num[i]==1){
                if(a<=n)print(a);
                else print(c);
            }
            else{
                if(b<=n)print(b);
                else print(c);
            }
        }
    }
    cout<<endl;
}


Measured memory_bytes: 18432
#include<bits/stdc++.h>
#include<map>
#define ll long long int
#define ld long double
#define pb push_back
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mod 1000000007
#define MAX 200010
//#define endl '\n'
#define mp make_pair
#define INF 10000000
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ff first
#define ss second
#define ps(x,y) fixed<<setprecision(y)<<x
#define pii pair<long long int,long int>
#define mii map<long long int,long long int>
#define w(t) 	int t; cin>>t; while(t--)
#define coutyes cout<<"YES"
#define coutno cout<<"NO"
#define pi 3.141592653589793238
using namespace std;

int main() {
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	int flag=0;
	ld sec1=h*60+m;
	sec1*=60;
	ld sec2=m*60;
	ld a1=2*pi;
	a1/=12;
	a1/=3600;
	ld a2=2*pi;
	a2/=3600;
	ld angle1=a1*sec1;
	ld angle2=a2*sec2;
	ld diff=abs(angle1-angle2);
		if(diff>pi)		diff=2*pi-diff;
		ld ans2=a*a+b*b;
		ld x=2*a*b*cos(diff);
		ans2-=x;
		ld ans=sqrt(ans2);
		cout<<fixed<<setprecision(15)<<ans;
}
 
 

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

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B){
    cout<<C<<endl;
  }
  if(B==C){
    cout<<A<<endl;
  }
  if(A==C){
    cout<<B<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define MX 2010
#define EPS 0.00000000001
#define MOD 1000000007
#define PI acos(-1)
#define INF 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
using namespace std;

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

    string n;
    cin>>n;
    int ans = 0;
    loop(i,0,3) if(n[i] == '7') {ans = 1; break;}
    if(ans) cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int n;
	string b, c;
	cin >> n;
	for (int i = 0; i < n; i++){
		int a[1010][1010] = {};
		cin >> b >> c;
		for (int x = 1; x <= b.size(); x++){
			for (int y = 1; y <= c.size(); y++){
				if (b[x - 1] == c[y - 1]){
					a[x][y] = a[x - 1][y - 1] + 1;
				}
				else {
					a[x][y] = max(a[x][y - 1], a[x - 1][y]);
				}
			}
		}
		cout << a[b.size()][c.size()] << endl;
	}
	return 0;
}

Measured memory_bytes: 5196
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
		if(s[i]=='C')
			for(int j=i+1;j<s.length();j++)
				if(s[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
	cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
import sys

n = int(input())
point = [tuple(map(int, input().split())) for i in range(n)]

for p in range(101):
    for q in range(101):
        for x, y, h in point:
            if h > 0:
                H = h + abs(x-p) + abs(y-q)
                break
        
        for  x, y, h in point:
            if max(H-abs(x-p)-abs(y-q), 0) != h:
                break
        else:
            print(p, q, H)
            sys.exit(0)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
#define nl '\n'
 
#define y1 aza_ibagaliev
 
#define f first
#define s second
	
#define ed end()
#define bg begin()
#define rbg rbegin()
 
#define rv reverse
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define ppf pop_front
 
#define sz size()
#define all(x) x.bg, x.ed
 
#define pll pair < ll, ll >
#define pii pair < int, int >
 
#define sqr(x) ((x) * 1ll * (x))
#define sqrd(x) ((x) * 1.0 * (x))
 
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
 
#define rnl cout << "----------------------------------------" << nl
 
#define bit __builtin_popcount
 
inline ll bip(ll x, ll n, ll mod){ll res=1;while(n){if(n & 1){res=(res*x)%mod;}x=(x*x)%mod;n>>=1;}return res;}
  
const int ppr = 257;
const ll INF = 2e18;
const int inf = 2e9;
const int mod = 1e9 + 7;
const int N = 2e6 + 123;
const ld pi = 3.1741592653589793238462643;
 
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

int n, a[N], l[N], r[N];
string s;
vector <int> ord, g[N];
bool u[N];

void top(int v) {
	u[v] = 1;
	for(auto to : g[v]) {
		if(u[to]) continue;
		top(to);
	}
	ord.pb(v);
}

ll ans;

main() {             	
//  freopen(".in", "r", stdin);                          
//  freopen(".out", "w", stdout);
 
//	srand(time(NUll));
 
	speed;

	cin >> s;

	n = s.sz + 1;      
	s = '#' + s;

	for(int i = 2; i <= n; i++) {
		if(s[i - 1] == '<') g[i].pb(i - 1);
		else g[i - 1].pb(i);
	}

	for(int i = 1; i <= n; i++) 
		if(!u[i]) top(i);

	for(auto v : ord) {
		for(auto to : g[v])
			a[v] = max(a[to] + 1, a[v]);
		ans += a[v];
	}

	cout << ans;

    return 0;                                        
}     

Measured memory_bytes: 94636
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define MOD2 1000000009
#define sp fixed<<setprecision
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
ll fpow(ll x,ll y,ll p=MOD){x=x%p;ll sum=1;while(y){if(y&1)sum=sum*x;sum%=p;y=y>>1;x=x*x;x%=p;}return sum;}
ll inv(ll a,ll m=MOD){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
ll add(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD + b%MOD + MOD)%MOD;}
ll sub(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return (a%MOD - b%MOD + MOD)%MOD;}
ll mul(ll a, ll b) {if(a<0)a+=MOD; if(b<0)b+=MOD; return ((a%MOD)*(b%MOD) + MOD)%MOD;}
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (sz(name)) {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
int main(){
    setIO();
    ll h,w,m;
    cin>>h>>w>>m;
    map<ll,ll>cx;
    map<ll,ll>cy;
    map<pair<ll,ll>,ll >cord;
    for(int i=0;i<m;i++){
      ll x,y;
      cin>>x>>y;
      cx[x]++;
      cy[y]++;
      cord[{x,y}]++;
    }
    ll maxx=0;
    ll maxy=0;
    for(auto u:cx){
      maxx=max(maxx,u.se);
    }
    for(auto u:cy){
      maxy=max(maxy,u.se);
    }
    vector<ll>vx,vy;
    for(auto u:cx){
      if(u.se==maxx)
        vx.pb(u.f);
    }
    for(auto u:cy){
      if(u.se==maxy)
        vy.pb(u.f);
    }

    ll res=maxx+maxy-1;
    ll cnt=0;
    for(int i=0;i<vx.size();i++)
    for(int j=0;j<vy.size();j++){
      if(cnt>m)
      {
        cout<<res;
        return 0;
      }
      if(!cord[{vx[i],vy[j]}])
        res=maxx+maxy;
      cnt++;
    }
    cout<<res;
}


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

using namespace std;

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

  for(int i = 1; i < S.size(); i++) {
    if(S[i - 1] == S[i]) {
      cout << i << " " << i + 1 << endl;
      exit(0);
    }
  }

  for(int i = 2; i < S.size(); i++) {
    string t = S.substr(i - 2, 3);
    if(set< char >(begin(t), end(t)).size() <= 2) {
      cout << i - 1 << " " << i + 1 << endl;
      exit(0);
    }
  }

  cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N, M, A[100001] = {}, discount[100001] = {}, ans = 0;
set<pair<lldo,ll>> s;

int main() {
	cin >> N >> M;
	rep(i, N) {
		cin >> A[i];
		s.insert(mp(A[i],i));
	}
	rep(i, M) {
		auto it = s.end();
		it--;
		pair<lldo, ll> box = *it;
		discount[box.second]++;
		s.erase(it);
		s.insert(mp(box.first / 2, box.second));
	}
	rep(i, N)ans += A[i] / pow(2, discount[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

		BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
		String str="";

		try {
			str=bfr.readLine();
			if(str=="") {
				System.exit(0);
			}
			int input=Integer.parseInt(str);
			String ai_IS_nekama="ai1333";

			for(int i=0; i<input/100; i++) {
				ai_IS_nekama+="3";
			}
			System.out.println(ai_IS_nekama);
		} catch (IOException e) {
			System.exit(0);
		}
		catch(NumberFormatException e) {
			System.exit(0);
		}

		catch(NullPointerException e) {
			System.exit(0);
		}
	}
}



Measured memory_bytes: 24320
#include <iostream>
#include<string.h>
using namespace std;

int main()
{
    int K;
    int N;
    cin>>N;
    cin>>K;
    string bruh;
    cin>>bruh;
    for(int i=0;i<N;i++){
        if(i==K-1){
           bruh[i]+=( char)32; 
         
        }
       
    }
    cout<<bruh<<endl;
   
    return 0;
}


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

#define rep(i,e) for(int i=0;i<(e);i++)
#define rep1(i,e) for(int i=1;i<=(e);i++)
#define repx(i,x,e) for(int i=(x);i<=(e);i++)
#define pii pair<int,int>
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define mset(var,val) memset(var,val,sizeof(var))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

//#ifdef local
//    #define dbg(args...) do { cout  << #args << " -> "; err(args); cout << endl;} while (0)
//#else
//    #define dbg(...)
//#endif
//
//void err() {  }
////template<template<typename...> class T, typename t, typename... Args>
////void err(T<t> a, Args... args) { for (auto x: a) cout << x << ' '; err(args...); }
//template<typename T, typename... Args>
//void err(T a, Args... args) { cout << a << ' '; err(args...); }


typedef long long ll;
template <class T>
void test(T a) {
    cout<<a<<endl;
}
template <class T,class T2>
void test(T a,T2 b) {
    cout<<a<<" "<<b<<endl;
}
template <class T,class T2,class T3>
void test(T a,T2 b,T3 c) {
    cout<<a<<" "<<b<<" "<<c<<endl;
}
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
const int mod = 1e9+7;

const int N = 1e5+10;

set<int> s;

void work() {
    int n, m;
    scdd(n, m);
    for(int i = 1; i <= sqrt(m+1); ++i){
        if(m%i == 0){
            s.insert(m/i);
            s.insert(i);
        }
    }
    int x = *(s.lower_bound(n));
    printf("%d\n", m/x);
}


int main() {
#ifdef local
    freopen("in.txt","r",stdin);
//        freopen("out1.txt","w",stdout);
#endif // local
//    IOS;
//    init();
    int t;
//    cin >> t;
//    scd(t);
//    for(; t--;)
        work();
    return 0;
}


Measured memory_bytes: 256