akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;
int n, H, W, OH, OW, P[70][70], D[70][70], vis[70][70], head, tail;
struct point {
	int x, y;
	bool operator < (const point &p)const {
		return x < p.x;
	}
}w[32], Q[5010];
long long res, Mod = 1000000007, CC[70][70];
int XX[70], YY[70];
void Com2(int bx, int ex, int &X, int &Y, int ck) {
	if (!ck) XX[bx] = ex - bx + 1;
	else YY[bx] = ex - bx + 1;
	int i, c1 = 0, c2 = 0;
	for (i = 1; i <= n; i++) {
		if (w[i].x <= bx)c1++;
		else c2++;
	}
	long long ll = 0, rr = 1ll * (X - 1 - ex) * Y - c2;
	for (i = 0; i < bx; i++) {
		if (!ck)ll += XX[i];
		else ll += YY[i];
	}
	ll *= Y;
	ll -= c1;
	for (i = 1; i <= ex - bx; i++) {
		long long t1 = (ll + 1ll*i*Y)%Mod;
		long long t2 = (rr + 1ll * (ex - bx + 1 - i)*Y) % Mod;
		res = (res + t1*t2) % Mod;
	}
	for (i = 1; i <= n; i++) {
		if (w[i].x >= ex)w[i].x -= (ex - bx);
	}
	X -= (ex - bx);
}
bool XCom() {
	int i;
	sort(w + 1, w + n + 1);
	if (w[1].x > 1) {
		Com2(0, w[1].x - 1, H, OW, 0);
		return true;
	}
	for (i = 1; i < n; i++) {
		if (w[i + 1].x - w[i].x > 2) {
			Com2(w[i].x + 1, w[i + 1].x - 1, H, OW, 0);
			return true;
		}
	}
	if (w[n].x < H - 2) {
		Com2(w[n].x + 1, H - 1, H, OW, 0);
		return true;
	}
	return false;
}
bool YCom() {
	int i;
	sort(w + 1, w + n + 1);
	if (w[1].x > 1) {
		Com2(0, w[1].x - 1, W, OH, 1);
		return true;
	}
	for (i = 1; i < n; i++) {
		if (w[i + 1].x - w[i].x > 2) {
			Com2(w[i].x + 1, w[i + 1].x - 1, W, OH, 1);
			return true;
		}
	}
	if (w[n].x < W - 2) {
		Com2(w[n].x + 1, W - 1, W, OH, 1);
		return true;
	}
	return false;
}
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
void Put(int x, int y, int d) {
	if (x>=0&&x<H&&y>=0&&y<W&&!P[x][y]&&!vis[x][y]) {
		vis[x][y] = 1;
		Q[++tail] = { x,y };
		D[x][y] = d;
	}
}
void BFS(int x, int y) {
	int i, j;
	for (i = 0; i < H; i++)for (j = 0; j < W; j++)vis[i][j] = 0;
	D[x][y] = 0;
	vis[x][y] = 1;
	head = tail = 0;
	Q[++tail] = { x,y };
	while (head < tail) {
		point t = Q[++head];
		if(t.x>x || (t.x==x&&t.y>y))res = (res + CC[x][y] * CC[t.x][t.y] % Mod * D[t.x][t.y])%Mod;
		for (j = 0; j < 4; j++) {
			Put(t.x + dx[j], t.y + dy[j], D[t.x][t.y] + 1);
		}
	}
}
int main() {
	int i, j;
	scanf("%d%d", &H, &W);
	OH = H, OW = W;
	for (i = 0; i < 70; i++)XX[i] = 1;
	for (i = 0; i < 70; i++)YY[i] = 1;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &w[i].x, &w[i].y);
	}
	while (XCom());
	for (i = 1; i <= n; i++)swap(w[i].x, w[i].y);
	while (YCom());
	for (i = 1; i <= n; i++)swap(w[i].x, w[i].y);
	for (i = 1; i <= n; i++) {
		P[w[i].x][w[i].y] = 1;
	}
	for (i = 0; i < H; i++)for (j = 0; j < W; j++)CC[i][j] = 1ll * XX[i] * YY[j] % Mod;
	for (i = 0; i < H; i++) for (j = 0; j < W; j++) if(!P[i][j])BFS(i, j);
	printf("%lld\n", res);
	return 0;

}

Measured memory_bytes: 256
L, R = map(int, input().split())

x = 2020

for i in range(R + 1)[L:]:
    if x == 0:
        break
    for j in range(R + 1)[i + 1:]:
        mod = i * j % 2019

        x = min(mod, x)
        if x == 0:
            break
print(x)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long 
#define m 1000000007
using namespace std;
ll umax(ll a ,ll b)
{
	if(a<b)return b;return a;
}
ll dp[1001][1001];
int main()
{
	ll h,w;
	cin >> h >> w;
	char a[h][w];
	for(ll i=0;i<h;i++)
		for(ll j=0;j<w;j++)
			cin >> a[i][j];
	for(ll i=0;i<h;i++)
	{
		//int t=i%2;
		for(int j=0;j<w;j++)
		{
			if(a[i][j]=='#')
			{
				dp[i][j]=0;continue;
			}
			if(i==0 and j==0)
			{
				dp[i][j]=1;
			}
			else if(i==0)
			{
				dp[i][j]=(dp[i][j-1])%m;
			}
			else if(j==0)
				dp[i][j]=dp[i-1][j]%m;
			else
				dp[i][j]=(dp[i][j-1]%m+dp[i-1][j]%m)%m;
		}
	}
  /*for(int i=0;i<h;i++)
  {
    for(int j=0;j<w;j++)
      cout << dp[i][j] << " ";
	cout << endl;
  }*/
  cout << dp[h-1][w-1]%m;
	return 0;
}

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

int main(){
  int n,m;	cin >> n >> m;
  map<long long,long long>	A;
  priority_queue<long long, vector<long long>, greater<long long>> p;
  rep(i,n){
    long long a;	cin >> a;
    A[a]++;
    p.push(a);
  }
  
  vector<pair<long long,int>>	cb(m);
  rep(i,m)	cin >> cb[i].second >> cb[i].first;
  sort(cb.rbegin(),cb.rend());
  
  rep(i,m){
    long long b=cb[i].second;
    long long c=cb[i].first;
    while(b>0){
      long long now=p.top();
      if(now>=c)	break;
      long long x=min(A[now],b);
      A[now]-=x;
      A[c]+=x;
      b-=x;
      p.push(c);
      if(A[now]==0){
        A.erase(now);
        p.pop();
      }
    }
  }
  
  long long ans=0;
  for(auto q:A){
    ans+=q.first*q.second;
  }
  cout << ans;
}

Measured memory_bytes: 11824
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;



int main(){
    
    int N,M,x[100010],d[100010];
    ll cnt=0;
    cin>>N>>M;
    if(N>=M){
        cout<<0<<endl;
        return 0;
    }
    rep(i,0,M)cin>>x[i];
    sort(x,x+M);
    rep(i,0,M-1){
        d[i]=x[i+1]-x[i];
    }
    sort(d,d+(M-1));
    rep(i,0,M-1-N+1){
        cnt+=d[i];
    }
    cout<<cnt<<endl;
}






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

int main()
{
	int sum = 0;
	string s;
	cin >> s; 
	int len = s.size();
	for(int i = 0;i < len/2;++i){
		if(s[i] != s[len-i-1]) sum++;
	}
	printf("%d\n",sum);
	return 0;
} 

Measured memory_bytes: 256
#define ll long long
#define lld long double
#define cn(n)  ll n;cin >> n;
#define tes(t) ll t;cin>>t;while(t--) 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define al(v) v.begin(), v.end()
#define oset(X) tree<X, null_type, less<X>, rb_tree_tag, tree_order_statistics_node_update>
#define roset(X) tree<X, null_type, greater<X>, rb_tree_tag, tree_order_statistics_node_update>
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll INF = 1ll * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7;
const ll MOD2 = 998244353;
const long double PI = 3.141592653589793;
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
ll power(ll x, ll y, ll p){ll res = 1;x %= p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}
ll po(ll base, ll powerRaised){if (powerRaised != 0)return (base * po(base, powerRaised - 1));else return 1;}
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
ll lcm(ll a, ll b){return (a * b) / gcd(a, b);}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
// #ifndef ONLINE_JUDGE
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
// #endif //*
  // tes(t)
  // {
  // }
  int h,w,m;
  cin>>h>>w>>m;
  vector<int>row(h);
  vector<int>col(w);
  map<pii,int>mpp;
  rep(i,0,m-1)
  {
    int x,y;
    cin>>x>>y;
    x--;y--;
    mpp[mp(x,y)]++;
    row[x]++;
    col[y]++;
  }
  int r=*max_element(al(row));
  int c=*max_element(al(col));
  vector<int>v1,v2;
  rep(i,0,h-1)
  {
    if(row[i]==r)
    v1.pb(i);
  }
  rep(i,0,w-1)
  {
    if(col[i]==c)
    v2.pb(i);
  }
  for(int i:v1)
  {
    for(int j:v2)
    {
      if(mpp[mp(i,j)]==0)
      {
        cout<<r+c;
        exit(0);
      }
    }

  }
  cout<<r+c-1;


}



Measured memory_bytes: 28488
#include<iostream>
#include<algorithm>
using namespace std;
int main (void)
{
  string s;
  cin>>s;
  if((s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[3])||(s[0]==s[2]&&s[1]==s[3]&&s[0]!=s[3])||(s[0]==s[3]&&s[2]==s[1]&&s[1]!=s[3]))
  {
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
  
}
 

Measured memory_bytes: 3616
k, x = list(map(int, input().split()))

a = []

for i in range(k):
  a.append(x - i)

for i in range(1, k):
  a.append(x + i)

s_a = sorted(a)
#print(s_a)
for s in s_a:
  print(s, end =" ")


Measured memory_bytes: 3060
import java.util.Arrays;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] d = new int[N];
        for (int i = 0; i < d.length; ++i) {
            d[i] = sc.nextInt();
        }

        System.out.println(solve(d));

        sc.close();
    }

    static int solve(int[] d) {
        d = Arrays.stream(d).boxed().sorted().mapToInt(x -> x).toArray();

        return d[d.length / 2] - d[d.length / 2 - 1];
    }
}

Measured memory_bytes: 59532
//AT2523 Digits in Multiplication
# include <iostream>
# include <cmath>
using namespace std;
int F(int);
int main() {
    long long n; cin>>n;
    for (int i=sqrt(n); i>=1; i--) 
        if (n%i==0) {
            cout<<F(n/i);
            return 0;
        }
}
int F(int a) {
    int k=0;
    while (a) {
        a/=10;
        k++;
    }
    return k;
}

Measured memory_bytes: 256
import sys

a, b = input().split()

num = int(a + b)


def prime_factorize(N: int) -> list:
    res = []
    pn = 2
    while N != 1:
        exp = 0
        while N % pn == 0:
            N /= pn
            exp += 1
        if exp:
            res.append((pn, exp))
        pn += 1
    return res


value = prime_factorize(num)

if len(value) > 1:
    for i in value:
        if i[1] % 2:
            print('No')
            sys.exit()
    print('Yes')
else:
    if value[0][1] % 2:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
#define mod 1000000007
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x
#define IO if(fopen("input.txt", "r")){freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);} std::ios::sync_with_stdio(false);
using namespace std;

signed main()
{

    IO
    const int N = 1000000;
    vector<vector<int>> divisors(N + 1);
    for (int i = 1; i <= N; i++) {
        for (int j = i; j <= N; j += i) {
            divisors[j].push_back(i);
        }
    }

    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        cnt += divisors[n - i].size();
    }
    cout << cnt;


    return 0;
}

Measured memory_bytes: 184036
import java.io.*;
import java.util.*;
//import java.util.stream.*;
//import java.math.*;

public class Main {

    public static int gcd(int a, int b) {
        return (b == 0) ? a : gcd(b, a % b);
    }

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        System.out.println(c % gcd(a, b) == 0 ? "YES" : "NO");
        bw.flush();
    }
}


Measured memory_bytes: 23124
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<queue>
#include<ctime>
#include<cassert>
#include<complex>
#include<string>
#include<cstring>
#include<chrono>
#include<random>
#include<bitset>
#include<iomanip>

#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define sz(v) (int) v.size()

using namespace std;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int MAX_N = 1e5 + 5;

int n, a[MAX_N];
int pref[MAX_N], fenw[MAX_N * 2];

void update(int pos, int delta) {
	for (int i = pos; i <= 2 * n; i |= (i + 1)) {
		fenw[i] += delta;
	}
}

int get(int r) {
	int res = 0;
	for (int i = r; i >= 0; i = (i & (i + 1)) - 1) {
		res += fenw[i];
	}
	return res;
}

bool check(int m) {
	fill(fenw, fenw + 2 * n + 1, 0);
	for (int i = 1; i <= n; ++i) {
		pref[i] = pref[i - 1] + (a[i] >= m) - (a[i] < m);
	}
	update(n, 1);
	ll cnt = 0;
	for (int i = 1; i <= n; ++i) {
		cnt += get(pref[i] + n);
		update(pref[i] + n, 1);
	}
	return cnt >= (1ll * n * (n + 1) / 2 + 1) / 2;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	vector<int> diff;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
		diff.eb(a[i]);
	}
	sort(all(diff));
	diff.resize(unique(all(diff)) - diff.begin());
	int lef = 0, rig = sz(diff);
	while (lef + 1 < rig) {
		int mid = (lef + rig) / 2;
		if (check(diff[mid])) {
			lef = mid;
		} else {
			rig = mid;
		}
	}
	cout << diff[lef] << "\n";
	return 0;
}

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

using namespace std;
using ll = long long;

template <typename T> T gcd(T a, T b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll A, B;
  cin >> A >> B;
  ll gcdn = gcd(A, B);
  ll gcdm = gcdn;
  ll res = 1;
  for (ll i = 2; i * i <= gcdn; i++) {
    if (gcdm % i != 0) continue;
    res++;
    while (gcdm % i == 0) {
      gcdm /= i;
    }
  }
  if (gcdm > 1) res++;
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
aaa = [0,1,1,2,2,2,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
l = factorization(N) 

ans = 0

for arr in l:
  if arr[0] != 1:
    a = arr[1]
    b = aaa[a]
    ans += b
  
print(ans)

Measured memory_bytes: 9528
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int M = sc.nextInt();
        sc.nextLine();
        String[] A = new String[N];
        String[] B = new String[M];
        for (int i = 0; i < N; ++i) {
            A[i] = sc.nextLine();
        }
        for (int i = 0; i < M; ++i) {
            B[i] = sc.nextLine();
        }

        for (int i = 0; i < N - M + 1; ++i) {
            for (int j = 0; j < N - M + 1; ++j) {
                boolean ok = true;
                for (int k = 0; k < M; ++k) {
                    if (A[i + k].indexOf(B[k], j) != j) {
                        ok = false;
                        break;
                    }
                }
                if (ok) {
                    _out.println("Yes");
                    return;
                }
            }
        }
        _out.println("No");
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

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

typedef long long ll;
unordered_map<int, int> m;
int n;


int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		m[t]++;
	}
	unordered_map<int, int>::iterator iter = m.begin();
	vector<int> num;
	while (iter != m.end()) {
		if (iter->second >= 2) {
			num.push_back(iter->first);
			if (iter->second >= 4) num.push_back(iter->first);
		}
		iter++;
	}
	sort(num.begin(), num.end());
	ll ans = 0;
	if (num.size() >= 2) {
		ll w = num[num.size() - 1]; ll h = num[num.size() - 2];
		ans = 1ll * w * h;
	}
	cout << ans << endl;
}

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

#define ll long long
#define nl '\n'
#define deb(x) cerr<<#x" = "<<x<<nl
#define in() ( { int a ; scanf("%d", &a); a; } )

const int N = 3e5 + 9;
const int mod = 1e9 + 7;

int a[3][3];
set<int> se;
int32_t main()
{
    for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cin >> a[i][j];
    int n ; cin >> n;
    while(n--){
        int k ; cin >> k; se.insert(k);
    }
    for(int i = 0; i < 3; i++){
        int ok = 1;
        for(int j = 0; j < 3; j++) ok &= se.find(a[i][j]) != se.end();
        if(ok) return cout << "Yes\n", 0;
    }
    for(int i = 0; i < 3; i++){
        int ok = 1;
        for(int j = 0; j < 3; j++) ok &= se.find(a[j][i]) != se.end();
        if(ok) return cout << "Yes\n", 0;
    }
    if(se.find(a[1][1]) != se.end() && se.find(a[2][2]) != se.end() && se.find(a[0][0]) != se.end()) return cout << "Yes\n", 0;
    if(se.find(a[2][0]) != se.end() && se.find(a[1][1]) != se.end() && se.find(a[0][2]) != se.end()) return cout << "Yes\n", 0;
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int i, j, n, minj, cnt = 0, tmp;
  int a[100];

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &a[i]);

  for(i = 0; i < n; i++){
    minj = i;
    for(j = i; j < n; j++){
      if(a[j] < a[minj])
        minj = j;
    }
    if(i != minj){
      tmp = a[i];
      a[i] = a[minj];
      a[minj] = tmp;
      cnt++;
    }
  }

  for(i = 0; i < n-1; i++)
    printf("%d ", a[i]);
  printf("%d\n", a[i]);
  printf("%d\n", cnt);
  
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  string s;
  cin >> s;
  if(s[0] == s[1] && s[1] == s[2]){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
  
}
      
    

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
#define MAXN 1000
char s[MAXN+5];int f[5];
int main()
{
	scanf("%s",s+1);
	int lens=strlen(s+1);
	for(int i=1;i<=lens;i++)
	{
		if(s[i]=='S') f[1]=1;
		if(s[i]=='N') f[2]=-1;
		if(s[i]=='E') f[3]=1;
		if(s[i]=='W') f[4]=-1;
	}
	if((f[1]+f[2]==0)&&((f[3]+f[4]==0))) printf("Yes\n");
	else printf("No\n");
}//

Measured memory_bytes: 128
N = int(input())
S = input()
a,b = '',''
r = S.count('R')
g = S.count('G')
b = len(S)-r-g
rgb = r*g*b
expt = 0
for i in range(N):
  a = S[i]
  for j in range(i,(N+i-1)//2+1):
    if S[j] != a:
      b = S[j]
      k = 2*j-i
      if S[k]!=b and S[k]!=a:
        expt += 1
print(rgb-expt)

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

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	string X;
	vector<pair<string, int>> in;
	
	cin>>N;
	
	in.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>in[i].first>>in[i].second;
	}
	
	cin>>X;
	
	bool flag = false;
	int ans = 0;
	
	for(int i = 0; i < N; i++){
		if(flag) ans += in[i].second;
		if(in[i].first == X) flag  = true;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main () {
   int N,K,i,x=0;
   cin>>N>>K;
   int h[N];
   for(i=0;i<N;i++){
       cin>>h[i];
   if(K<=h[i])
       x++;
   }
   cout<<x;
   return 0;}


Measured memory_bytes: 640
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    int s = 0;
    rep(i, 9) {
      int x;
      cin >> x;
      s += x;
    }
    cout << n - s << endl;
  }
}

Measured memory_bytes: 3020
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <iomanip>
#include <climits>
#include <cmath>
#include <queue>
#define ll long long int
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false)  ;cin.tie()  ; cout.tie() ;
#define MAX 100001
using namespace std;
ll q  ,  h , s , d   ;
ll n   ;



 int main(){
   IOS  ;

   cin>>q>>h>>s>>d ;
   ll a = q*4  ,b = h*2  ,c = s  ;
   cin>>n  ;

   q *= 8  ;
   h *= 4 ;
   s *= 2 ;

   ll p =  min( min(q,h)  , min(s,d) ) ;

   if(n % 2 ==0 )
   cout<<n/2 * p;
    else
   {
     ll ans = 0  ;

         ans = (n-1)/2 *  p ;


       ll m = min(min(a,b) , c )  ;

         ans += m ;
         cout<<ans  ;


   }









    return 0;
}


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

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

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

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

using namespace std;

using int64 = int64_t;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, n;
  cin >> h >> n;
  int mx = h + 10010;
  const int INF = (int)1e9;
  vector<int> dpOld(mx, INF), dpNew(mx, INF);
  dpOld[0] = 0;
  while (n--) {
    int a, b;
    cin >> a >> b;
    rep(i, mx) {
      if (i - a >= 0) {
        dpNew[i] = min(dpOld[i], dpNew[i - a] + b);
      } else {
        dpNew[i] = dpOld[i];
      }
      dpOld[i] = dpNew[i];
    }
  }
  int ans = INF;
  for (int i = h; i < mx; i++) {
    ans = min(ans, dpNew[i]);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3776
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int[] i = new int [3];
for(int j=0;j<3;j++){i[j]=sc.nextInt();}
Arrays.sort(i);
System.out.println(i[0] + " " + i[1] + " " + i[2]);}}

Measured memory_bytes: 26080
import Control.Monad
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as C
import Data.List

main = sol <$> readLn <*> get >>= print

get = unfoldr (C.readInt . C.dropWhile (==' ')) <$> C.getLine

sol n as = if check n ar then pow2 (n `div` 2) else 0
  where
  ar = accumArray (+) 0 (0,n-1) $ zip as (repeat 1) :: UArray Int Int

check n ar = if odd n
    then ar!0==1 && all ((==2) . (ar!)) [2,4..n-1]
    else all ((==2) . (ar!)) [1,3..n-1]

p = 10^9+7 :: Int

pow2 n
  | n == 0    = 1
  | odd n     = 2*r `mod` p
  | otherwise = r
  where
  q = pow2 (n `div` 2)
  r = q*q `mod` p

Measured memory_bytes: 3964
import collections

n,k = map(int,input().split())
a = [int(i) for i in input().split()]
b = collections.Counter(a)
c = sorted(b.items(), key=lambda x:x[1])
ans = 0
d = len(c)
i = 0
while d > k:
    d -= 1
    ans += c[i][1]
    i +=1
print(ans)

Measured memory_bytes: 44388
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> d0{0,0,1,1,2,2};
const vector<ll> d1{1,2,0,2,0,1};
const vector<ll> d2{2,1,2,0,1,0};

int main() {
    ll N,C;
    cin >>N>>C;

    vector<vector<ll>>D(C,vector<ll>(C));
    vector<vector<ll>>c(N,vector<ll>(N));
    vector<vector<ll>>D2(C,vector<ll>(3,INF));
    vector<vector<ll>>E(3,vector<ll>(C));
    rep(i,C){
        rep(j,C){
            cin>>D[i][j];
        }
    }

    rep(i,N){
        rep(j,N){
            cin>>c[i][j];
            c[i][j]--;
            E[(i+j)%3][c[i][j]]++;
        }
    }
    /*rep(i,C){
        rep(j,C){
            chmin(D2[i][j%3],D[i][j]);
        }
    }*/
    ll ans = INF;
    rep(c0,C)rep(c1,C)rep(c2,C){
        if(c0==c1 || c0==c2 || c1==c2)continue;
        ll now=0;
        rep(i,C){
            now+=E[0][i]*D[i][c0]+E[1][i]*D[i][c1]+E[2][i]*D[i][c2];
        }

        
        
        chmin(ans,now);
    }


    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 5560
def main():
    N = int(input())
    S = []
    for i in range(N):
        s, t = input().split()
        S.append([s,int(t)])
    X = input()
    ans = 0
    flag = False
    for i in range(N):
        if S[i][0] == X:
            flag = True
            continue
        if flag:
            ans += S[i][1]

    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int h,w;
    cin >> h >> w;
    vector<vector<char>>a(h,vector<char>(w));
    rep(i,h){rep(j,w)cin >> a[i][j];}
    vector<bool>print(h);
    rep(i,h)print[i]=false;
    rep(i,h){
        rep(j,w)if(a[i][j]=='#')print[i]=true;
    }
    vector<bool>print2(w);
    rep(i,w)print2[i]=false;
    rep(i,w){
        rep(j,h)if(a[j][i]=='#')print2[i]=true;
    }
    rep(i,h){
        if(print[i]){
            rep(j,w){
                if(print2[j])cout << a[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}

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

public class Hello
{
    public static void Main()
    {
        var ans = new List<int> { 1, 2, 3 };
        for (int i = 0; i < 2; i++)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            ans.Remove(n);
        }
        Console.WriteLine(ans[0]);
    }
}


Measured memory_bytes: 13148
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N;
    cin >> N;
    ll ans = 0;
    vector<int> A(N+1);
    vector<int> B(N);
    rep(i,N+1) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N){
        // i 番目の勇者について、
        // 街iにいるモンスターを倒す
        int t = min(A[i],B[i]);
        ans += t;
        A[i] -= t;
        B[i] -= t;
        t = min(A[i+1],B[i]);
        ans += t;
        A[i+1] -= t;
        B[i]  -= t;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    if (__builtin_popcount(N) != 1) {
        cout << "Yes\n";
        for (int i = 2; i+1 <= N; i += 2) {
            cout << i << ' ' << i+1 << '\n';
            cout << i+1 << ' ' << 1 << '\n';
            cout << 1 << ' ' << N+i << '\n';
            cout << N+i << ' ' << N+i+1 << '\n';
            if (i == 2) cout << N+i+1 << ' ' << N+1 << '\n';
        }
        if (N % 2 == 0) {
            cout << N << ' ' << N+N-2 << '\n';
            cout << (N^(N-2)^1) << ' ' << N+N << '\n';
        }
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 2304
#include <stdio.h>
#include <stdlib.h>

#define DEBUG 1
#define NINF -1
#define PINF 1E9+1

int n;
double *p;
double *dp; // x:throw coins y:surface

int pos(int x,int y)
{
	return n*y+x;
}

int main(void)
{
	int i,j;
	double ans;
	scanf("%d",&n);
	p = (double *)malloc(sizeof(double) * n);
	for (i=0;i<n;i++) scanf("%lf",&p[i]);

	dp = (double *)malloc(sizeof(double) * n*(n+1));
	if (dp==NULL) {
		perror("malloc");
		exit(1);
	}
	for (j=0;j<n+1;j++) {
		for (i=0;i<n;i++) {
			dp[pos(i,j)] = 0;
		}
	}
	dp[pos(0,1)] = p[0];
	dp[pos(0,0)] = 1.0 - p[0];

	for (j=0;j<n+1;j++) {
		for (i=1;i<n;i++) {
			dp[pos(i,j)] += dp[pos(i-1,j)] * (1.0-p[i]);
			if (j==0) continue;
			dp[pos(i,j)] += dp[pos(i-1,j-1)] * p[i];
		}
	}

	ans = 0.0;
	for (j=(n+1)/2;j<n+1;j++) {
		ans += dp[pos(n-1,j)];
	}
	printf("%.10f\n",ans);

	free(p);
	free(dp);
	return 0;
}


Measured memory_bytes: 70528
import sys

H,W = list(map(int, input().split()))
S = [[]]*H

for h in range(H):
    S[h] = input()

T = [None]*W

for w in range(W):
    t = [S[h][w] for h in range(H)]
    T[w] = ''.join(t)

#print(S)
#print(T)


def calc_lights_map(MAP, H, W):
    LIGHTS_MAP = [None]*H
    for h in range(H):
        lights_map_row = calc_lights_map_row(MAP[h], W)
        LIGHTS_MAP[h] = lights_map_row
    return LIGHTS_MAP


def calc_lights_map_row(ROW, W):
    lights_map_row = []
    lights = 0
    for here, masu in enumerate(ROW):
        if masu == '#':
            lights_map_row.append(0)
            lights = 0
            continue
        if lights > 0:
            lights_map_row.append(lights)
            continue
        try:
            wall_id = ROW.index('#', here)
        except:
            wall_id = len(ROW)
        lights = wall_id - here
        lights_map_row.append(lights)
        continue
    return lights_map_row

S_lights_map = calc_lights_map(S, H, W)

#print(S)
#print(S_lights_map)

T_lights_map = calc_lights_map(T, W, H)

#print(T)
#print(T_lights_map)


max_lights = 0
for h in range(H):
    for w in range(W):
        lights = S_lights_map[h][w] + T_lights_map[w][h] - 1
        max_lights = max(max_lights, lights)


print(max_lights)


Measured memory_bytes: 140164
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val s = sc.next
  val alphabets = "abcdefghijklmnopqrstuvwxyz"

  val res = alphabets.map(loop(_, s).max).min
  println(res)

  def loop(ch: Char, str: String, vec: Vector[Int] = Vector.empty): Vector[Int] = {
    val (tr, fa) = str.span(_ != ch)
    if(fa.isEmpty) vec :+ tr.length
    else loop(ch, fa.tail, vec :+ tr.length)
  }
}


Measured memory_bytes: 27192
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(s,e) for(int x = s; x <= e; x++)
#define BR printf("\n")
#define INF 2000000000
#define INTM_1 2147483647

int SEG[400000];//18 stages

void upd(int i){
    if(i == 0) return;
    if(i%2 == 1){//left
        int p = (i-1)/2;
        SEG[p] = min(SEG[i],SEG[i+1]);
        upd(p);
    }else{
        int p = (i-2)/2;
        SEG[p] = min(SEG[i-1],SEG[i]);
        upd(p);
    }
}

void Updade(int i,int x){
    SEG[i+131071] = x;//i + 2^17-1
    upd(i+131071);
}

int Rmq(int a, int b, int k, int l, int r){
    if (b <= l || r <= a) return INTM_1;
    if (a <= l && r <= b) return SEG[k];
    else{
        int lm = Rmq(a,b,2*k+1,l,(l+r)/2);
        int rm = Rmq(a,b,2*k+2,(l+r)/2,r);
        return min(lm,rm);
    }
}

int main(){
    REP1(i,400000) SEG[i] = INTM_1;
    INT(n);INT(q);
    
    REP1(i,q){
        INT(com);INT(x);INT(y);
        if (com == 0) {
            Updade(x,y);
        }else{
            printf("%d\n",Rmq(x,y+1,0,0,131072));//0 -> 2^17
        }
    }
    return 0;
}

Measured memory_bytes: 2748
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int a = sc.nextInt();
			int b = sc.nextInt();
			int [] data = new int[n];
			for(int i = 0; i < n; i++){
				data[i] = sc.nextInt();
			}
			
			int [] count = new int[3];
			for(int i =0; i < n; i++){
				if(data[i] <= a){
					count[0]++;
				}
				else if(data[i] <= b){
					count[1]++;
				}
				else{
					count[2]++;
				}
			}
			System.out.println(Math.min(count[0], Math.min(count[1], count[2])));
		}
	}


	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 21844
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(s)-1,i##_len=(int)(n);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int a, b, k;
	scanf("%d%d%d", &a, &b, &k);
	int cnt = 0;
	RREPS(i, 100) {
		if (a%i == 0 && b%i == 0) {
			cnt++;
			if (cnt == k) {
				PRINTD(i);
				return 0;
			}
		}
	}
}

Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>

using namespace std;

void swap(int S[],int x[],int y[],int n,int m){
	int tmp1, tmp2, tmp3;
	tmp1 = S[m];
	tmp2 = y[m];
	tmp3 = x[m];
	S[m] = S[n];
	y[m] = y[n];
	x[m] = x[n];
	S[n] = tmp1;
	y[n] = tmp2;
	x[n] = tmp3;
}

int main(void){
	int n, w, d, p, s, S[102], x[102], y[102], num, i, j, tmp[2];
	while(1){
		scanf("%d%d%d",&n,&w,&d);
		if(n == 0 && w == 0 && d == 0)
			break;
		S[0] = w * d;
		x[0] = w, y[0] = d;
		num = 1;
		for(i = 0;i < n;i++){
			scanf("%d%d",&p,&s);
			tmp[0] = x[p - 1];
			tmp[1] = y[p - 1];
			s %= tmp[0] + tmp[1];
			for(j = 0;tmp[j] < s;j++)
				s -= tmp[j];
			if(j == 0){
				x[num] = x[p - 1] - s;
				x[num + 1] = s;
				y[num + 1] = y[num] = y[p - 1];
			}else{
				y[num] = y[p - 1] - s;
				y[num + 1] = s;
				x[num + 1] = x[num] = x[p - 1];
			}
			S[num] = x[num] * y[num];
			S[num + 1] = x[num + 1] * y[num + 1];
			if(S[num] > S[num + 1])
				swap(S,x,y,num + 1,num);
			for(j = p - 1;j < num + 1;j++){
				y[j] = y[j + 1];
				x[j] = x[j + 1];
				S[j] = S[j + 1];
			}
			num++;
		}
		sort(S,S + num);
		for(i = 0;i < num - 1;i++)
			printf("%d ",S[i]);
		printf("%d\n",S[i]);
	}
	return 0;
}

Measured memory_bytes: 1044
#!/usr/bin/perl
use strict;

my $N = <>;
my $sum = 0;
for (my $i = 1; $i <= $N; $i++) {
  if (($i % 3 == 0) && ($i % 5 == 0) ) {
  } elsif ($i % 3 == 0) {
  } elsif ($i % 5 == 0) {
  } else {
	$sum += $i;
  }
}
print $sum;

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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

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

    int pre_t=0;
    int pre_x=0;
    int pre_y=0;
    bool flg=true;
    for(int i=0;i<n;i++){
        int t,x,y;cin >> t >> x >> y;
        if(t-pre_t<abs(x-pre_x)+abs(y-pre_y)
           || ((t-pre_t)-abs(x-pre_x)-abs(y-pre_y))%2!=0){
            flg=false;
        }
        pre_t=t;pre_x=x;pre_y=y;
    }
    Yes(flg)
} 

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

signed main(){
  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  rep(i,N)cin>>A[i];
  sort(rbegin(A),rend(A));
  int mx=0;
  rep(i,K)mx+=A[i];
  cout<<mx<<endl;
  return 0;
}

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
int main(){

	int a, b, c, d, e, f;
	cin >> a >> b >> c;

	if (a > b){
		d = b, b = a, a = d;
	}
	if (b > c){
		e = b, b = c, c = e;
	}
	if (a > b){
		f = a, a = b, b = f;
	}

	cout << a << " " << b << " " << c << endl;

	return 0;
}


Measured memory_bytes: 3092
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

ll DP1[10005][100], DP2[10005][100];

int main(){
  string S; cin >> S;
  int D; scanf("%d", &D);

  DP1[0][0] = 0;
  DP2[0][0] = 1;

  for (int i = 1; i <= S.length(); i++){
    int now = S[i - 1] - '0';

    for (int j = 0; j < D; j++){
      for (int k = 0; k < 10; k++){
        DP1[i][(j + k) % D] += DP1[i - 1][j];
      }
    }

    for (int j = 0; j < D; j++){
      for (int k = 0; k < now; k++){
        DP1[i][(j + k) % D] += DP2[i - 1][j];
      }
    }
    
    for (int j = 0; j < D; j++){
      DP2[i][(j + now) % D] += DP2[i - 1][j];
    }

    for (int j = 0; j < D; j++){
      DP1[i][j] %= nmax;
      DP2[i][j] %= nmax;
    }
  }

  ll ans = DP1[S.length()][0] + DP2[S.length()][0] + nmax - 1;
  printf("%lld\n", ans % nmax);
  return 0;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,c; cin >> a >> b >> c;
    if(a < b) swap(a,b);
    if(b < c) swap(b,c);
    if(a < b) swap(a,b);
    cout << a -c << endl;
}

Measured memory_bytes: 3608
s=input()
t=input()
dp=[[0 for i in range(len(t)+1)] for j in range(len(s)+1)]

for i in range(len(s)):
    for j in range(len(t)):
        dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j],dp[i][j]+(s[i]==t[j]))
        
st=[]
x=len(s)
y=len(t)
while x>0 and y>0:
    if dp[x][y] == dp[x-1][y]:
        x-=1
    elif dp[x][y] ==dp[x][y-1]:
        y-=1
    else:
        x-=1
        y-=1
        st += s[x]
print(''.join(reversed(st)))

Measured memory_bytes: 120412
/* ex3_4 
　　　　　sachiyan*/

#include <stdio.h>
int main(void){
    int NUM; //入力Nの定義
    int rp1,rp2; //while内変数の定義
    scanf("%d", &NUM); //Nの読み取り
    rp1 = 1;
    while(rp1 <= 9){ //二重のループを０－９までで回して九九の解をすべてしらべる
        rp2 = 1;
        while(rp2 <= 9){
            if(rp1*rp2 == NUM){ //九九を総当たりで探し、Nと等しければ
                printf("Yes"); //Yesを出力しendの行まで飛ぶ
                goto end; //endの行まで飛ぶ
            }
            rp2++;
        }
        rp1++;
    }
    if(rp1 == 10 && rp2 == 10){ //九九全てに当てはまらないとき
        printf("No"); //Noを出力
    }
    end:
        printf("\n"); //改行を出力
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

typedef long long int ll;
typedef vector<ll> V;
typedef vector<V> VV;

int main() {
  // Happy hacking!
  ll h, w;
  cin >> h >> w;
  VV f(w, V(h, 0));
  VV sx(w, V(h, 0));

  for(ll y=0; y<h; y++) {
    string s;
    cin >> s;
    for(ll x=0; x<w; x++) {
      if(s[x] == '#') {
        f[x][y] = -1;
        sx[x][y] = -1;
      }
    }
  }

  for(ll x=0; x<w; x++) {
    ll cnt_w = 0;
    ll y_cnt_max = 0;
    for(ll y=0; y<h; y++) {
      if(f[x][y] != -1) {
        cnt_w++;
        f[x][y] = cnt_w;
      } else {
        cnt_w = 0;
      }
    }
    for(ll y=h-1; y>=0; y--) {
      if(f[x][y] != -1) {
        if(f[x][y] > y_cnt_max) y_cnt_max = f[x][y];
        f[x][y] = y_cnt_max;
      } else {
        y_cnt_max = -1;
      }
    }
  }
  for(ll y=0; y<h; y++) {
    ll cnt_w = 0;
    ll x_cnt_max = 0;
    for(ll x=0; x<w; x++) {
      if(sx[x][y] != -1) {
        cnt_w++;
        sx[x][y] = cnt_w;
      } else {
        cnt_w = 0;
      }
    }
    for(ll x=w-1; x>=0; x--) {
      if(sx[x][y] != -1) {
        if(sx[x][y] > x_cnt_max) x_cnt_max = sx[x][y];
        sx[x][y] = x_cnt_max;
      } else {
        x_cnt_max = -1;
      }
    }
  }

  /*
  for(ll y=0; y<h; y++) {
    for(ll x=0; x<w; x++) {
      cout << f[x][y] << ", ";
    }
    cout << endl;
  }
  for(ll y=0; y<h; y++) {
    for(ll x=0; x<w; x++) {
      cout << sx[x][y] << ", ";
    }
    cout << endl;
  }
  */

  ll res = 0;
  for(ll y=0; y<h; y++) {
    for(ll x=0; x<w; x++) {
      if(f[x][y] != -1 && sx[x][y] != -1) {
        ll tres = f[x][y] + sx[x][y];
        if(res < tres)
          res = tres;
      }
    }
  }

  cout << res-1 << endl;

  return 0;
}


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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define dbg(x) std::cerr<<#x<<" = " << (x) << std::endl
#define pnl(x) std::cout << x << "\n"

typedef	std::vector<int>	vi;
typedef std::pair<int,int>	ii;
typedef std::vector<std::string>	vs;
typedef std::vector<ii>	vii;
typedef std::vector<long long>	vl;
typedef	long long ll;


const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};

int		summ_of_digits(int a)
{
	int		summ(0);
	std::string s = std::to_string(a);
	for (auto c : s)
		summ += c - '0';
	return summ;
}

int		main(void)
{
	std::ios_base::sync_with_stdio(false);
	int	n, a, b;
	std::cin >>n >>  a >> b;

	int		total = 0;
	for (int i(0); i <= n; ++i)
	{
		int	res = summ_of_digits(i);
		if (res >= a and res <= b)
			total += i;
	}
	pnl(total);
}



Measured memory_bytes: 256
#define errOut(s) \
  { std::cerr << __LINE__ << ":" << #s << ":" << (s) << std::endl; }

#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
//#include <boost/multi_array.hpp>
//#include <boost/optional.hpp>
//#include <boost/range/adaptors.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int64_t solve(int64_t n, int64_t x, int64_t t) { return floor(ceil(1.0 * n / x) * t); }

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int64_t n;
  std::cin >> n;
  int64_t x;
  std::cin >> x;
  int64_t t;
  std::cin >> t;
  auto const res = solve(n, x, t);
  std::cout << res << std::endl;
  return 0;
}


Measured memory_bytes: 3652
def main():
    def f(n):
        if n == 0: return 0
        return f(n % bin(n).count('1')) + 1
    n = int(input())
    X = list(input())
    c = sum(list(map(int, X)))
    m = int(''.join(X), 2)
    mp, mm = m % (c + 1), m % (c - 1) if c - 1 != 0 else 0
    jp, jm = 1, 1
    ans = [0] * n
    for i in range(n - 1, -1, -1):
        if X[i] == '0':
            mod = c + 1
            ans[i] = f((mp + jp) % mod) + 1
        else:
            ans[i] = f((mm - jm + mod) % mod) + 1 if (mod := c - 1) != 0 else 0
        jp, jm = (jp << 1) % (c + 1), (jm << 1) % (c - 1) if c - 1 != 0 else 0
    [print(a) for a in ans]
if __name__ == '__main__':
    main()


Measured memory_bytes: 13904
import sys

input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    m = set()
    for _ in range(M):
        a, b = map(int, input().split())
        if a < b:
            m.add((a,b))
        else:
            m.add((b,a))
    for i in range(2, N):
        if (1, i) in m and (i, N) in m:
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")
main()

Measured memory_bytes: 37440
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<queue>
using namespace std;

typedef long long ll;

int t[100010];
int x[100010];
int y[100010];

int main() {
  int N; cin >> N;
  for ( int i  = 1; i <= N; i++ ) {
    cin >> t[i] >> x[i] >> y[i];
  }

  t[0] = x[0] = y[0] = 0;
  
  for ( int i = 0; i < N; i++ ) {
    int dis = abs(x[i+1]-x[i]) + abs(y[i+1] - y[i]);
    int tt = t[i+1]-t[i];
    // cout << "dis " << dis << " " << "tt " << tt << endl;
    if ( tt >= dis ) {
      if ( (dis % 2 == 1 && tt % 2 == 0)
	   || ( dis % 2 == 0 && tt % 2 == 1)) {
	cout << "No" << endl;
	return 0;
      }
    } else if ( tt < dis ) {
	cout << "No" << endl;
	return 0;      
    } else if ( dis == 0 ) {
      if (tt % 2 == 1 ) {
	cout << "No" << endl;
	return 0;      	
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

#define M 100008

int f[M],sum[M],st[M],ne[M];

int root(int x)
{
    if (f[x] == x){
        return x;
    }
    else {
        return f[x] = root(f[x]);
    }
}

void unite (int x,int y)
{
    int f1 = root(f[x]);
    int f2 = root(f[y]);
    if (f1 != f2) f[f1] = f2;
    return;
}

int main()
{
    int n,m,k;
    cin >> n >> m >> k;
    for (int i = 1;i <= n;i++) f[i] = i;
    for (int i = 1;i <= m;i++){
        int a,b;
        cin >> a >> b;
        st[a]++;
        st[b]++;
        unite(a,b);
    }
    for (int i = 1;i <= n;i++){
        f[i] = root(i);
        sum[f[i]]++;
    }
    for (int i = 1;i <= k;i++){
        int a,b;
        cin >> a >> b;
        if (f[a] == f[b]){
            ne[a]++;
            ne[b]++;
        }
    }
    for (int i = 1;i <= n;i++){
        int ans = sum[f[i]]-st[i]-ne[i] - 1;
        cout << ans << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin, (x).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<double,double> pdd;
typedef pair<long long,long long> pll;
// scanf("%d %d %d %d",&w,&b,&d,&s); %lld
// printf("%d\n" ,points);
// const double PI=acos(-1);

int main() {
	fastIO;
	int n, x = 0, ans;
	cin >> n;
	
	while(1000*x < n)
		x++;
		
    ans = 1000*x - n;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628