akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_vars(...) do { cerr << "DEBUG: line "<< __LINE__ << ": " << __PRETTY_FUNCTION__ << ":  "; \
                            pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;
using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;
#define X first
#define Y second
#define pb push_back

istream &operator>> (istream &fin, mp &p) { fin >> p.first >> p.second; return fin; }
ostream &operator<< (ostream &fout, const mp &p)
{ fout << "{" << p.first << ", " << p.second << "} "; return fout; }

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cerr << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cerr << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr ll INF = numeric_limits<ll>::max();
constexpr ll MOD = 1e9 + 7;


constexpr ll MAX = 1e5 + 5;

int main()
{
    ll res = 0;
    string s; cin >> s;
    for (auto c: s) {
        if (c == '+') res++;
        else res--;
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    vector<int> v(3);
    int x;
    for (int i = 0; i < 3; i++) {
        cin >> x;
        v[i] = x;
    }
    int sum = 0;
    sort(v.begin(), v.end());
    sum = abs(v[2] - v[1]) + abs(v[1] - v[0]);
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
#include <functional>
#include <cassert>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define MOD (long long int)(1e9+7)
#define INF (int)(1e9)
#define LINF (long long int)(1e18)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  if(n <= 1e7){
    ret *= kaijo(n); ret %= MOD;
    ret *= gyaku_kaijo(r); ret %= MOD;
    ret *= gyaku_kaijo(n-r); ret %= MOD;
  }else{
    rep(i,r){
      ret *= n-i; ret %= MOD;
      ret *= mpow(r-i, MOD-2); ret %= MOD;
    }
  }
  return ret;
}

/*
std::mt19937 mt{ std::random_device{}() };

std::uniform_int_distribution<int> dist(1, 6);
dist(mt);

while(1){
	val;
	cout << val << endl;
	sol1 = solver1();
	sol2 = solver2();
	if(sol1==sol2){
	cout << "OK" << endl;
	}else{
	cout << "NG" << endl;
	cout << sol1 << endl;
	cout << sol2 << endl;
	break;
	}
}
*/

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);
  int n;
  cin >> n;
  ll ans = 0;
  ll p = 1;
  rep(i,n){
	  p = p*10%MOD;
  }
  ans = (ans + p)%MOD;
  p = 1;
  rep(i,n){
	  p = p*8%MOD;
  }
  ans = (ans + p)%MOD;
  p = 1;
  rep(i,n){
  	  p = p*9%MOD;
  }
  ans = (ans - 2*p)%MOD;
  if(ans < 0){
	  ans += MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3648
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int k,a,b;
    cin>>k;
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0){
            cout<<"OK\n";
            return 0;
        }
    }
    cout<<"NG\n";
    return 0;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1,s2;
	int n,m;
	cin>>s1>>s2;

	n=s1.length();
	m=s2.length();
	
	
	int dp[n+1][m+1];
	for(int i=0;i<=n;i++)
	{
		
		for(int j=0;j<=m;j++)
		{
			if(i==0||j==0)
			{
				dp[i][j]=0;
			}
			else if(s1[i-1]==s2[j-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	int index=dp[n][m];
	char lcs[index+1];
	lcs[index]='\0';
	int i=n,j=m;
	while(i>0 && j>0)
	{
		if(s1[i-1]==s2[j-1])
		{
			lcs[index-1]=s1[i-1];
			i--;
			j--;
			index--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
		{
			i--;
		}
		else
		{
			j--;
		}
	}
	cout<<lcs<<"\n";
	
	}

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

typedef unsigned long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  ll A;
  string B;
  cin >> A >> B;

  ll b1 = B[0] - '0';
  ll b2 = B[2] - '0';
  ll b3 = B[3] - '0';

  b1 *= 100 * A;
  b2 *= 10 * A;
  b3 *= 1 * A;

  cout << (b1 + b2 + b3)/100 << endl;

}


Measured memory_bytes: 3620
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

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


def solve():
    n, m = rl()
    A = rl()
    print (max(n - sum(A), -1))






mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()


Measured memory_bytes: 69848
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
#include <ctype.h>
using namespace std;

#define PI acos(-1.0)
#define EPS 1e-8
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
    return os << "(" << P.fi << "," << P.se << ")";
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
    os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}

struct Matrix {
    vvi data;
    int r, c;
    Matrix(int row, int col, bool identity = false) : r(row), c(col) {
        data.assign(row, vector<int>(col, 0));
        if (identity) {
            for (int i = 0; i < r; ++i) {
                data[i][i] = 1;
            }
        }
    }
    Matrix operator * (Matrix& other) {
        int m = r, n = c, p = other.c;
        Matrix res(m, p);
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < p; ++j) {
                for (int k = 0; k < n; ++k) {
                    res.data[i][j] += data[i][k] * other.data[k][j];
                }
            }
        }
        return res;
    }
};

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 矩阵快速幂
Matrix matrix_power(Matrix base, ll exp) {
    int n = base.r;
    Matrix res(n, n, true);
    while (exp) {
        if (exp & 1) {
            res = res * base;
        }
        base = base * base;
        exp >>= 1;
    }
    return res;
}

// 带模快速幂
template <typename T>
T power_mod(T base, int exp, int mod = MOD) {
    T res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
template <typename T>
T power(T base, int exp) {
    T res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, MOD - 2);
}

/******************************** template ********************************/
#define N 2010
const int M = (int)4e6 + 10;
int n;
int a[N];
bitset<M> mask;

int main() {
    cin >> n;
    int sum = 0;
    mask.set(0);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
        sum += a[i];
        mask |= (mask << a[i]);
    }
    int tar = (sum + 1) / 2;
    for (int i = tar; i <= M; ++i) {
        if (mask[i]) {
            cout << i;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
using namespace std;
int main(void)
{
    int N,A,B,C,X;
    int Y[101];
    while(cin>>N>>A>>B>>C>>X){
        if(!(N||A||B||C||X)) break;
        for(int i=0; i<N; i++){
            cin >> Y[i];
        }
        int flame=0;
        int rel=0;
        while(flame<10001){
            if(X==Y[rel]) rel++;
            if(rel==N) break;
            flame++;
            X = (A*X+B)%C;
        }
        if(flame<10001){
            cout<<flame<<endl;
        }else{
            cout<<"-1"<<endl;
        }
    }
             
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#define MAX 11
using namespace std;

int main(){
  int N;
  cin >> N;
  int maxid = 0;
  int total = 0;
  int p[MAX];
  for(int i = 0;i < N;i++){
    cin >> p[i];
    if(p[maxid] < p[i]) maxid = i;
  }

 for(int i = 0;i < N;i++){
   if(i == maxid) p[i]/=2;
   total += p[i];
 }
 cout << total << endl;

 return 0;
}


Measured memory_bytes: 256
#include <unistd.h>
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define istream ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define uint unsigned int
#define mod 1000000007
#define vec vector<int>
#define twod vector<vector<int>>
#define mp make_pair
#define pbc push_back
#define all(a) a.begin(),a.end()
#define debug1(x)                cout<<#x<<"="<<x<<endl;
#define debug2(x,y)              cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define debug3(x,y,z)            cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl;
#define debug4(x,y,z,w)          cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<" "<<#w <<"="<<w<<endl;
#define debugarray(arr,j,n)      for(int i=j;i<n;i++) {cout<<"i="<<i<<" arr[i]="<<arr[i]<<"\n";};

int32_t main()
{
     int n,w;
     scanf("%lld%lld",&n,&w);
     vec wts;
     vec vals;
     for(int i=0;i<n;i++){
          int t1,t2;
          scanf("%lld%lld",&t1,&t2);
          wts.pbc(t1);
          vals.pbc(t2);
     }
     twod knapsack(w+1, vec (n+1, 0));
     for(int i=1;i<=n;i++){
          int wt = wts[i-1];
          for(int j=1;j<=w;j++){
               if(j<wt)
                    knapsack[j][i] = knapsack[j][i-1];
               else
                    knapsack[j][i] = max(knapsack[j][i-1],knapsack[j-wt][i-1]+vals[i-1]);
          }
     }
     cout<<knapsack[w][n];
     return 0;
}


Measured memory_bytes: 85128
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fs first
#define se second
#define M 1000000007
ll exp(ll a,ll p)
{
	if(p==1)
		return a;
	if(p==0)
		return 1;
	ll st=exp(a,p/2);
	st=(st*st)%M;
	if(p%2 != 0)
		st=(st*a)%M;
	return st;
} 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b;
	cin>>a>>b;
	ll gcd=__gcd(a,b);
	ll lcm=(a*b)/gcd;
	cout<<lcm<<endl;
}


Measured memory_bytes: 256
list_x=[]
list_y=[]
while True:
   x,y=map(int,input().split())
   if x==0 and y==0:
      break
   else:
      list_x.append(x)
      list_y.append(y)

for i in range(len(list_x)):
   list_x[i],list_y[i]=sorted([list_x[i],list_y[i]])
   print(list_x[i],list_y[i])






Measured memory_bytes: 6120
#include<bits/stdc++.h>
#define MAXN 200000+5
using namespace std;
typedef long long LL;
struct node
{
	LL x,y;
}P[MAXN];
LL n,minans=LLONG_MAX;
LL Rmax,Rmin,Lmax,Lmin;
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&P[i].x,&P[i].y);
	}
	for(int k=1;k<=100;k++)
	{
		srand(time(0));
		random_shuffle(P+1,P+n+1);
		Rmax=Rmin=P[1].x,Lmax=Lmin=P[1].y;
		for(int i=2;i<=n;i++)
		{
			LL rmax=Rmax,rmin=Rmin,lmax=Lmax,lmin=Lmin,ans=0;
			rmax=max(rmax,P[i].x),rmin=min(rmin,P[i].x);
			lmax=max(lmax,P[i].y),lmin=min(lmin,P[i].y);
			ans=(rmax-rmin)*(lmax-lmin);
			rmax=Rmax,rmin=Rmin,lmax=Lmax,lmin=Lmin;
			swap(P[i].x,P[i].y);
			rmax=max(rmax,P[i].x),rmin=min(rmin,P[i].x);
			lmax=max(lmax,P[i].y),lmin=min(lmin,P[i].y);
			if(ans>(rmax-rmin)*(lmax-lmin))
			{
				Rmax=max(Rmax,P[i].x),Rmin=min(Rmin,P[i].x);
				Lmax=max(Lmax,P[i].y),Lmin=min(Lmin,P[i].y);
			}
			else
			{
				Rmax=max(Rmax,P[i].y),Rmin=min(Rmin,P[i].y);
				Lmax=max(Lmax,P[i].x),Lmin=min(Lmin,P[i].x);
			}
		}
		minans=min(minans,(Rmax-Rmin)*(Lmax-Lmin));
	}
	printf("%lld ",minans);
	return 0;
}


Measured memory_bytes: 3328
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).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 chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int h, w;
  cin>>h>>w;
  vector<string> s(h+2, string(w+2, '#'));
  rep(i, h){
    cin>>s[i+1];
    s[i+1] = "#"+s[i+1]+"#";
  }
  rep(i, h+2) cout<<s[i]<<endl;
	return 0;
}


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

int main() {
  string S, T;
  cin >> S >> T;
  
  string ans = "Yes";
  
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) ans = "No";
  }
  
  cout << ans << endl;

}

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

string s;
int n;
long long ans;
map<string,int> m;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		cin>>s;
		sort(s.begin(),s.end());
		ans+=m[s];
		m[s]++;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;
int counter(int x){
    if(x == 0) return 0;
    else return counter(x>>1) + (x&1);
}

int main()
{
    fast;
    int n;
    int a[20];
    int x[20][20];
    int y[20][20];
    cin>>n;
    for(int i = 1; i <= n ; i++){
        cin>>a[i];
        for(int j = 1; j <= a[i]; j++){
            cin>>x[i][j]>>y[i][j];
        }
    }
    int ans = 0;
    for(int bits = 1; bits < (1<<n); bits++){
        bool ok = 1;
        for(int i = 1; i <= n; i++){
            if(!(bits&(1<<(i-1)))) continue;
            for(int j = 1; j <= a[i]; j++){
                if(((bits>>(x[i][j] - 1))&1)^y[i][j]) ok = false;
            }
        }
        if(ok) ans = max(ans, counter(bits));
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  
  long long sum=0,ans=1000000000;
  for(long long i=0;i<=max(y,x);i++){
      if(x-i<0) sum=2*c*i+b*(y-i);
      else if(y-i<0) sum=2*c*i+a*(x-i);
      else sum=2*c*i+a*(x-i)+b*(y-i);
      ans=min(sum,ans);
  }

  cout<<ans<<endl;
 
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#define F first
#define S second
#define vec vector
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define pnn pair<Node*, Node*>
#define all(m) m.begin(), m.end()
#define uid uniform_int_distribution
#define init(m, x) memset(m, x, sizeof(m));
#define FILE ifstream in("input.txt");ofstream out("output.txt");
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    fast;
    int a,b,k; cin>>a>>b>>k;
    pii m[k];
    int rw[a], cl[b];
    uset<int> srw[a];
    init(rw, 0); init(cl, 0);
    for(int q=0; q<k; q++){
        int x,y; cin>>x>>y; x--, y--;
        m[q] = {x, y};
        rw[x]++;
        srw[x].insert(y);
        cl[y]++;
    }
    int mxr = *max_element(rw, rw+a);
    int mxc = *max_element(cl, cl+b);
    int o = mxr+mxc-1;
    vec<int> big;
    for(int q=0; q<b; q++){
        if(cl[q]==mxc) big.pb(q);
    }
    for(int q=0; q<a; q++){
        if(rw[q]!=mxr) continue;
        for(int i : big){
            if(!srw[q].count(i)){
                cout<<o+1;
                return 0;
            }
        }
    }
    cout<<o;
}

Measured memory_bytes: 45176
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0;i<=(n);i++)

int cmpint(const void *a,const void *b){
  return *(int *)b-*(int *)a;
}
int main(){
  int a,b,c,d,e,f,ans1,ans2;
  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
  int x,y;
  double max=0;
  ans1=100*a;
  for(int i=0;i<=30;i++){
    for(int j=0;j<=30;j++){
      x=100*a*i+100*b*j;
      for(int k=0;k<=f-x;k++){
        for(int l=0;l<=f-x;l++){
          y=k*c+l*d;
          if((x+y)<=f&&y<=e*x/100){
            if(max<(double)y/(x+y)){
              max=(double)y/(x+y);
              ans1=x+y;
              ans2=y;
            }
          }
        }
      }
    }
  }
  printf("%d %d\n",ans1,ans2);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll x, y;
  cin >> x >> y;
  ll ans = 100000 * (max(4 - x, 0LL) + max(4 - y, 0LL));
  if (x == 1 && y == 1) {
    ans += 400000;
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
	int N, A;
	cin >> N >> A;
	int remainder = N - (N / 500 * 500);
	if (A >= remainder) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	char a,b,c;
	int sum=700;
	  cin>>a>>b>>c;
	  if (a=='o') sum+=100; 
        if (b=='o') sum+=100; 
          if (c=='o') sum+=100;
		  cout<<sum<<endl; 
}

Measured memory_bytes: 256
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
ll longinf=1ll<<60;
int inf=1<<29;
int dh[]={1,-1,0,0};
int dw[]={0,0,1,-1};


int main(){
      int s;
      cin>>s;
      map<ll,ll> mp;
      int i=0;
      while(1){
            i++;
            mp[s]++;
            if(mp[s]==2) break;
            if(s%2==0) s/=2;
            else s=3*s+1;
      }
      cout<<i<<endl;
      return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(N):
    ans_sub = 0
    while A[i]%2 == 0:
        A[i]/=2
        ans_sub += 1
    
    if i == 0:
        ans = ans_sub
    else:
        ans = min(ans_sub, ans)

print(ans)

Measured memory_bytes: 9056
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

//const LL mod = 1e9 + 7;



int main() {
	
	LL S, C;
	cin >> S >> C;
	LL max_ = min(S, C / 2LL);
	C -= max_ * 2;
	max_ += C / 4;
	cout << max_ << endl;
}

Measured memory_bytes: 256
import sys
import collections
import math

def main():

    input = sys.stdin.readline

    N = int(input())
    A = list(map(int,input().split()))
    Q = int(input())

    c = collections.Counter(A)

    ans = sum(A)
    ans_list = []

    for _ in range(Q):
        B,C = map(int,input().split())

        B_num = c[B]

        ans = ans - B_num * B
        ans = ans + B_num * C

        c[C] = c[C] + B_num
        c[B] = 0

        ans_list.append(ans)

    for i in ans_list:
        print(i)



if __name__ == "__main__":
    main()

Measured memory_bytes: 27296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int mod=1e9+7;
void add(int &x,int y){
	x+=y;
	if(x>=mod) x-=mod;
	if(x<0) x+=mod;
}
int dp[4001][4001];
int C[8001][4001];
int m=2000;
int N,a[200000],b[200000];
int main(){
	rep(i,8001){
		C[i][0]=1;
		if(i<=4000) C[i][i]=1;
		for(int j=1;j<min(i,4001);j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	cin>>N;
	rep(i,N){
		cin>>a[i]>>b[i];
		dp[m-a[i]][m-b[i]]++;
	}
	rep(i,4001) rep(j,4001){
		if(i!=4000) add(dp[i+1][j],dp[i][j]);
		if(j!=4000) add(dp[i][j+1],dp[i][j]);
	}
	int ans=0;
	rep(i,N) add(ans,dp[m+a[i]][m+b[i]]);
	rep(i,N) add(ans,-C[(a[i]+b[i])*2][a[i]*2]);
	if(ans%2==1) ans+=mod;
	ans/=2;
	cout<<ans<<endl;
}


Measured memory_bytes: 172032
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
#define INF 2147483647
 
using namespace std;


int S[100000];
int comp( const void *c1, const void *c2 )
{
  int tmp1 = *(int *)c1;
  int tmp2 = *(int *)c2;

  if( tmp1 < tmp2 )  return -1;
  if( tmp1 == tmp2 ) return  0;
  if( tmp1 > tmp2 )  return  1;
}

bool search(int x, int n)
{
	int *result;

	result = (int *)bsearch( &x, S, n, sizeof(int), comp );

	if(result == NULL) return (false);
	else			   return (true);
} 

int main(void)
{
	 int n, q;
	 int cnt = 0;
	 int x;

	 cin >> n;
	 for (int i = 0; i < n; i++) cin >> S[i];
	 
	 cin >> q;

	 for (int i = 0; i < q; i++) {
		 cin >> x;
		 if (search(x, n)) cnt++; 
	 }
	 cout << cnt << endl;

	 return (0);
}

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

int main(){
  string S;
  cin >> S;
  int N = (int) S.size() + 1;
  vector<long long> A(N,0);
  for(int i=0;i<N-1;i++){
    if(S[i]=='<') A[i+1] = max(A[i+1],A[i]+1);
  }
  for(int i=N-1;i>=0;i--){
    if(S[i]=='>') A[i] = max(A[i],A[i+1]+1);
  }
  long long ans=0;
  for(int i=0;i<N;i++) ans += A[i];
  cout << ans << endl;
}

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

#define inf 0x3f3f3f3f
#define INF 1000111000111000111LL
#define mod 1000000007
#define endl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define all(cc) (cc).begin(),(cc).end()
using lli = long long int ;
using pii = pair<int, int> ;
using vi = vector<int> ;
using vb = vector<bool> ;
using vvi = vector<vector<int>> ;
using vlli = vector<long long int> ;
using vpii = vector<pair<int, int>> ;

int main()
  {
    ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
    lli x, ans, l, r, m, curr ;
    bool check=true ;
    cin>> x ;
    ans=x/(11) ;
    ans*=2 ;
    x=x%11 ;
    if(x>0 & x<=6) ans++ ;
    else if(x) ans+=2 ;
    cout<< ans ;
  }


Measured memory_bytes: 256
#include <cmath>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int a,b,n;
char str[1000000];
int main()
{
    scanf("%s",str);
    n=strlen(str);
    for (int i=0;i<n;i++)
    {
    	if (i%2==0) printf("%c",str[i]);
    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  int len, cnt=0, Mcnt=0;
  cin >>a;
  len = a.size();
  for(int i=0;i<len;i++){
    if(a.at(i)=='A'||a.at(i)=='T'||a.at(i)=='G'||a.at(i)=='C'){
      cnt++;
    }else{
      cnt =0;
    }
    if(Mcnt<=cnt){
      Mcnt = cnt;
    }
  }
  cout << Mcnt <<endl;
}
       

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

using namespace std;

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

  if(a==b and b==c){
    cout<<1<<endl;
  } else if(a==b or b==c or a==c){
    cout<<2<<endl;
  } else {
    cout<<3<<endl;
  }
}


Measured memory_bytes: 3556
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

#define llset tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define en '\n'
#define S second
#define F first
#define pll pair<ll,ll>
#define PB push_back

const ll N = 1e6+7;
ll mod = 1e9+7;
#define calncr for(int i=1  ;i<=1e6;i++) fac[i] = (fac[i-1]*i)%mod;
ll fac[N] = {0};

ll gen_base(const ll before, const ll after) {
    auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
    std::mt19937 mt_rand(seed);
    int base = std::uniform_int_distribution<ll>(before+1, after)(mt_rand);
    return base % 2 == 0 ? base-1 : base;
}

ll pow(ll a,ll b)
{
    if(!b)
        return 1;
    ll p = pow(a,b/2);
    if(b%2)
        return (a*((p*p)%mod))%mod;
    else
        return (p*p)%mod;
}

ll modInv(ll a)
{
    //cout<<a<<" "<<mod<<en;
    return pow(a%mod,mod-2);
}

ll nCr(ll n,ll r)
{
    return (fac[n]*modInv((fac[r]*fac[n-r])%mod))%mod;
}

ll hashf(ll r,ll x,ll mod)
{
    return (x+r)%mod;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    fac[0] = 1;
    calncr;
    string s,t;
    cin>>s>>t;
    ll ans = LLONG_MAX;
    for(ll i=0;i<=s.size()-t.size();i++){
        ll c=0;
        for(ll j=0;j<t.size();j++){
            if(t[j]!=(s[i+j]))
                c++;
        }
        ans = min(ans,c);
    }
    cout<<ans<<en;
}


Measured memory_bytes: 11428
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
using namespace std;

int main() {
    int N;
    int S;

    cin >> N >> S;

    const int MOD = 998244353;

    vector <int> val(N);
    vector<vector <int>> dp(N+1, vector<int>(S+1));

    for (int i = 0; i < N; ++i) {
        cin >> val[i];
    }

    dp[0][0] = 1;

    int sum = 0;
    int ans = 0;

    // f(1, 3, S) = f(1, 2, S) + f(1, 2, S-val[3])
    for (int i = 0; i < N; ++i) {
        dp[i+1][0] = 1;

        for (int j = 0; j <= sum; ++j) {
            int newVal = j + val[i];

            if (newVal <= S) {
                dp[i+1][newVal] = (dp[i+1][newVal] + dp[i][j]) % MOD;
            }

            dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % MOD;
        }

        sum = min(sum+val[i], S);
        ans = (ans + dp[i+1][S]) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int N; cin >> N;
    int ans = 0;
    FOR(i,1,N+1) {
        int a; cin >> a;
        if ((i * a) % 2 ==1 ) ans++;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3648
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+:---test
3
acornistnt
peanutbomb
constraint
---+/
/+---test
2
oneplustwo
ninemodsix
---+/
/+:---test
5
abaaaaaaaa
oneplustwo
aaaaaaaaba
twoplusone
aaaabaaaaa
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;

  long ans;
  size_t[string] founds;
  foreach (i; 0..N) {
    const s = readln.chomp.array.sort!"a < b".to!string;

    if (s !in founds) founds[s] = 0;
    ans += founds[s];
    ++founds[s];
  }
  ans.writeln;
}


Measured memory_bytes: 13052
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
typedef pair<int , int > pii;
#define MOD 1000000007
#define MOD1 998244353
#define ff first
#define ss second
#define bn cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define sz(a) int((a).size())
#define o(a) cout << a
#define MAX6 1000006
#define int ll
#define all(x) x.begin(), x.end()
#define ppii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define viii vector<ppii>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define MAX5 300005
#define MAX7 10000007
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,b,a)  for (__typeof((b)) i=(b);i>=(a);i--)
#define mem(a) memset(a,0,sizeof(a))
#define memneg(a) memset(a,-1,sizeof(a))
//#define se second
#define LN 14
#define LIM 22
#define MAX_ALPHA 26
const long long INF64 = 1e18;
const ll INF = 1e9;
const double PI = acos(-1);
#define ld long double
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
inline void max_self(ll &a, ll b)
{
  a = max(a,b);
}
 
inline void min_self(ll &a,ll b)
{
  a = min(a,b);
}
 
inline void add_self(ll &a, ll b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
inline void sub_self(ll &a, ll b) {
  a -= b;
  if (a < 0) a += MOD;
}
 
inline int mul(int a, int b) {
  return (int) ((long long) a * b % MOD);
}
 
 
ll gcd(ll a,ll b)
{
  if(b == 0)
    return a;
  else 
    return gcd(b, a%b);
}
 
 
int countDigits(int x)
{
  int cnt = 0;
  while(x)
  {
    x /= 10;
    cnt++;
  }
  return cnt;
}
 
 
ll binExpo(ll a,ll b)
{
  ll res = 1;
  while(b)
  {
    if(b&1)
      res = (res * a)%MOD;
    a = (a * a)%MOD;
    b /= 2;
  }
  return res%MOD;
}
 
int sum(int a) {
    int result = 0;
    while (a > 0) {
        result += a % 10;
        a /= 10;
    }
    return result;
}

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

  string s, t;
  cin>>s>>t;
  int a = s.length();
  int b = t.length();
  int dp[a + 1][b + 1];
  mem(dp);
  dp[0][0] = 0;
  for(int i = 0;i < a;i++)
  {
    dp[i][0] = 0;
    dp[0][i] = 0;
  }
  string ans = "";
  rep(i, 1, a)
  {
    rep(j, 1, b)
    { 
      if(s[i-1] == t[j-1]){
        dp[i][j] = max(dp[i][j], dp[i-1][j-1] + 1);
      }
      else{
        dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
      }
    }
  }
  int r = a, c = b;
  while(r != 0 and c != 0)
  {
    if(s[r-1] == t[c-1]) ans.pb(t[c-1]) , r--, c--;
    else if(dp[r-1][c] > dp[r][c-1]) r--;
    else c--;
  }
  reverse(ans.begin(), ans.end());
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 70656
#!/usr/bin/python

import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        line = line.rstrip("\n")
        n = int(line)
        s = sum(map(lambda x: int(x), line))
        if n % s == 0:
            print("Yes")
        else:
            print("No")
        line = sys.stdin.readline()

if __name__ == "__main__":
    main(sys.argv)

Measured memory_bytes: 2692
#include <cstdio>
#include <vector>
using namespace std;
int N, Q, a, b, p, x, c[200001], ans[200001];
vector<vector<int>> v(200001);
void dfs(int i) {
  c[i] = 1;
  for(int k : v[i]) {
    if(c[k]) continue;
    ans[k] += ans[i];
    dfs(k);
  }
}
int main() {
  scanf("%d %d", &N, &Q);
  for(int i = 1; i < N; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for(int i = 1; i <= Q; i++) {
    scanf("%d %d", &p, &x);
    ans[p] += x;
  }
  dfs(1);
  for(int i = 1; i <= N; i++) {
    printf("%d ", ans[i]);
  }
}

Measured memory_bytes: 21120
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 15;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll dp[1000050];
ll sum[1000050];

int main() {
	ll N, i;
	scanf("%lld", &N);

	dp[0] = 1, dp[1] = N, dp[2] = N*N%MOD;
	sum[0] = 0, sum[1] = dp[1], sum[2] = sum[1] + dp[2];

	for (i = 3; i <= N; i++) {
		dp[i] = dp[i - 1];
		dp[i] = (dp[i] + (N - 1)*(N - 1)) % MOD;
		dp[i] = (dp[i] + N + 2 - i) % MOD;
		dp[i] = (dp[i] + sum[i - 3]) % MOD;
		sum[i] = sum[i - 1] + dp[i];
	}
	return !printf("%lld\n", dp[N]);
}

Measured memory_bytes: 15872
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in).useDelimiter("[\n, ]+");
		while (sc.hasNext())
		{
			double x1 = sc.nextDouble(),
					y1 = sc.nextDouble(),
					x2 = sc.nextDouble(),
					y2 = sc.nextDouble(),
					xq = sc.nextDouble(),
					yq = sc.nextDouble();
			double a, b;
			if (x1 == x2)
			{
				a = (x1 - xq) * 2 + xq;
				b = yq;
			}
			else if (y1 == y2)
			{
				a = xq;
				b = (y1 - yq) * 2 + yq;
			}
			else
			{
				a = ((x2 - x1) * (y2 - y1) * (2.0 * yq - 2.0 * y1)
					+ (x2 - x1) * (x2 - x1) * xq
					- (y2 - y1) * (y2 - y1) * (xq - 2.0 * x1))
					/ ((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));
				b = ((xq - a) * (x2 - x1)) / (y2 - y1) + yq;
			}
			System.out.printf("%f %f\n", a, b);
		}
	}
}

Measured memory_bytes: 12000
<?php
fscanf(STDIN,'%d',$N);
$N1=$N%10;
$N101=($N-$N1)%100;
$N10=$N101/10;
$N100=($N-$N10*10-$N1)/100;
if($N1==$N100){
  echo 'Yes';
}else{
  echo 'No';
}
 ?>


Measured memory_bytes: 3700
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

struct dsu
{
	vector<int> par, sz;
	int comp;
	dsu(int n)
	{
		comp = n;
		par.assign(n + 1, -1);
		iota(par.begin(), par.end(), 0);
		sz.assign(n + 1, 1);
	}
	int find(int x)
	{
		if (x != par[x])
			return (par[x] = find(par[x]));
		return par[x];
	}
	bool unite(int x, int y)
	{
		int a = find(x);
		int b = find(y);
		if (a != b)
		{
			if (sz[a] < sz[b])
			{
				par[a] = b;
				sz[b] += sz[a];
			}
			else
			{
				par[b] = a;
				sz[a] += sz[b];
			}
			comp--;
			return true;
		}
		else
			return false;
	}
	int countSet()
	{
		return comp;
	}
	int sizeOfSet(int i)
	{
		return sz[find(i)];
	}
};
void solve(int tc)
{
	ll n, m;
	cin >> n >> m;
	dsu D(n);
	vector<p32> arr(m);
	for (int i = 0; i < m; i++)
		cin >> arr[i].fi >> arr[i].se;
	v64 ans(m, 0);
	ans[m - 1] = n * (n - 1) / 2;
	ll curr = ans[m - 1];
	int idx = m - 2;
	for (int i = m - 1; i >= 1; i--)
	{
		int u = arr[i].fi, v = arr[i].se;
		ll x = D.sizeOfSet(u), y = D.sizeOfSet(v);
		db(arr[i], x, y);
		if (D.unite(u, v))
			curr -= x * y;
		ans[idx--] = curr;
	}
	for (ll x : ans)
		cout << x << ln;
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve(tc);
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int r,D,x;
	cin>>r>>D>>x;
	
	for (int i = 0; i < 10; i++) {
		x=r*x-D;
		cout<<x<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}

pair<int,int>dp[85][2];


signed main()
{
 
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   
 
#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif      

    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[0][0]={1000,0};
    int mx=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<i;j++)
        {
            int x=dp[j][0].first;
            int y=dp[j][0].second;
            int z=y*a[i];
            x+=z;
            y=0;
            if(dp[i][0].first<x)
            {
                dp[i][0].first=x;
                dp[i][0].second=y;
            }

            x=dp[j][1].first;
            y=dp[j][1].second;
            z=y*a[i];
            x+=z;
            y=0;
            if(dp[i][0].first<x)
            {
                dp[i][0].first=x;
                dp[i][0].second=y;
            }


            x=dp[j][0].first;
            y=dp[j][0].second;
            z=x/a[i];
            x%=a[i];
            y+=z;
            if(dp[i][1].second<y)
            {
                dp[i][1].first=x;
                dp[i][1].second=y;
            }
            else if(dp[i][1].second==y)
            {
                dp[i][1].first=max(dp[i][1].first,x);
            }

            x=dp[j][1].first;
            y=dp[j][1].second;
            z=x/a[i];
            x%=a[i];
            y+=z;
            if(dp[i][1].second<y)
            {
                dp[i][1].first=x;
                dp[i][1].second=y;
            }
            else if(dp[i][1].second==y)
            {
                dp[i][1].first=max(dp[i][1].first,x);
            }

        }
    }
    for(int i=0;i<=n;i++)
    {
        mx=max(mx,dp[i][0].first);
        mx=max(mx,dp[i][1].first);
    }
    cout<<mx;

}


Measured memory_bytes: 3648
n, k= map(int, input().split())
h_list = []

for i in range(n):
    h_list.append(int(input()))

h_list.sort()
result = float("inf")

for i in range(n-k+1):
    r = h_list[i+k-1] - h_list[i]
    if result >= r:
        result = r
print(result)

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


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

    bool prime = false;

    for(int i=x; i<200000; i++){
        prime = true;
        for(int j=2; j<i; j++){
            if(i%j == 0){
                prime = false;
                break;
            }
        }
        if(prime){
            cout << i;
            break;
        }
    }

    return 0;
} 

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

public class Program
{

    public void Proc()
    {
        long[] inpt = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();
        this.cityCount = (int)inpt[0];

        long startPos = inpt[1];


        long[] items = Reader.ReadLine().Split(' ').Select(a => long.Parse(a)).ToArray();

        long ans = Math.Abs(startPos - items[0]);
        foreach(long pos in items) {
            long curr = Math.Abs(startPos - pos);
            ans = GetKouyaku(curr, ans);
        }
        Console.WriteLine(ans);
    }

    private long GetKouyaku(long num1, long num2) {
        if(num1 % num2 != 0) {
            return GetKouyaku(num2, num1 % num2);
        }
        return num2;
    }



    private int cityCount;

    public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"





1 1
1000000000


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 22880