akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    vector<int> A(3);
    vector<int> D(3);
    rep(i,3) cin >> A[i];
    D[0] = abs(A[0] - A[1]);
    D[1] = abs(A[0] - A[2]);
    D[2] = abs(A[1] - A[2]);
    sort(D.begin(), D.end());
    cout << D[0] + D[1] << endl;
}


Measured memory_bytes: 256
//
//Created by just_sort 2016/10/1 14:00
//Copyright (c) 2016 just_sort.All Rights Reserved
//

#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10;
char s[maxn];
int k;
int main()
{
    cin>>s;
    cin>>k;
    int len = strlen(s);
    for(int i = 0; s[i]; i++){
        if(i == len-1 && k>0){
            s[i] = 'a' + (s[i] -'a' + k)%26;
            k = 0;
        }
        else{
            if(s[i] == 'a') continue;
            if('z'-s[i]+1 <= k){
                k = k - ('z'-s[i]+1);
                s[i] = 'a';
            }
            else continue;
        }
    }
    printf("%s\n",s);
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(a<b) swap(a,b);
  if(a%b==0) return b;
  else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  a/=g;
  b/=g;
  return a*b*g;
}
int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> vec;
  ll all_g=1;
  bool f=true;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    a/=2;
    if(f) all_g=lcm(all_g,a);
    if(all_g>m) f=false;
    vec.push_back(a);
  }
  for(int i=0;i<n;i++){
    ll k=all_g/vec[i];
    if(k%2==0||!f){
      cout<<0<<endl;
      return 0;
    }
  }
  ll v=m/all_g;
  v++;
  cout<<v/2<<endl;
}


Measured memory_bytes: 1400
a=[list(map(int,input().split()))for _ in range(3)]
for i in range(int(input())):
  b=int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k]==b:a[j][k]=0
ans="No"
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==0:ans="Yes"
  if a[0][i]==a[1][i]==a[2][i]==0:ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:ans="Yes"
if a[2][0]==a[1][1]==a[0][2]==0:ans="Yes"
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define maxs 30005
using namespace std;

struct data {
  long long w, s, v;
};
bool operator<(const data &l, const data &r) {
  return l.s + l.w < r.s + r.w;
}

long long n;
vector<data> v;
long long dp[1005][31000] = {0};

long long solve();

int main() {
  cin >> n;
  v.resize(n);
  for(int i = 0; i < n; ++i)
    cin >> v[i].w >> v[i].s >> v[i].v;
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  sort(v.begin(), v.end());
  for(int i = 0; i < n; ++i)
    for(int j = 0; j < maxs; ++j) {
      dp[i + 1][j] = dp[i][j];
      if(j >= v[i].w && j - v[i].w <= v[i].s)
        dp[i + 1][j] =
            max(dp[i + 1][j], dp[i][j - v[i].w] + v[i].v);
      ans = max(ans, dp[i + 1][j]);
    }
  return ans;
}

Measured memory_bytes: 242432
#include <bits/stdc++.h>
using namespace std;
//NOT TO SUBMIT IN WRONG PLACE OR BY WRONG COMPILER
//ABC 136, task c, 2020/08/14
//ms,
/*
*/

int main(void){
  int N;
  vector<int64_t> h;
  string ans="Yes";

  cin >>N;
  for(int i=0;i<N;i++){
    int tmp;
    cin >>tmp;
    h.push_back(tmp);
  }

  for(int i=h.size()-1;i>0;i--){

    if(h[i] == h[i-1]-1) h[i-1]--;
    else if(h[i] >= h[i-1]) ;//do nothing
    else {
      ans = "No";
      break;
    }
  }

  cout <<ans;

  return 0;
}
/*
わからんけど後ろからやったら勝つんじゃない？？
だめだ、オーダーがNでは勝てない。
*/


Measured memory_bytes: 4312
from typing import Set


if __name__ == "__main__":
    int_set: Set[int] = set()
    num_query = int(input())

    for _ in range(num_query):
        op, v = map(lambda x: int(x), input().split())
        if (0 == op):
            int_set.add(v)
            print(len(int_set))
        elif (1 == op):
            if (v in int_set):
                print(1)
            else:
                print(0)
        else:
            if (v in int_set):
                int_set.remove(v)



Measured memory_bytes: 24884
N=int(input())
F=[int(input().replace(' ',''),2) for i in range(N)]
P=[list(map(int,input().split())) for i in range(N)]
print(max(sum([p[bin(f&i).count('1')] for f,p in zip(F,P)]) for i in range(1,2**10)))

Measured memory_bytes: 41068
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Int N; cin >> N;
    Int ans = LLONG_MAX;
    for (Int i = 1; i * i <= N; i++) {
        if (N % i != 0) continue;
        Int x = i, y = N / i;
        ans = min(ans, (Int)x + y - 2);
    }
    cout << ans << endl;
    return 0;
}

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

long long int n,i,x,a[200010];

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	for (i=1;i<n+1;i++) a[i]=0;
	for (i=1;i<n;i++) cin>>x,a[x]++;
	for (i=1;i<n+1;i++) cout<<a[i]<<"\n";
}


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

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

    char x[26];
    for (int i = 0; i < 26; i++) {
        x[i] = char('A' + i);
    }

    map<char, char> m;
    for (int i = 0; i < 26; i++) {
        m[char('A' + i)] = char((i + n) % 26 + 'A');
    }

    for (int i = 0; i < s.size(); i++) {
        cout << m[char(s[i])];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <cmath>
#include <cstring>
#include <climits>
using namespace std;

#define FORN(i, j, k) for(int i=j;i<k;i++)
#define FORR(i, j, k) for(int i=j;i>=k;i--)
#define REP(i, n) FORN(i, 0, n)
#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'

const int MODO = 1e+9 + 7;

void solve(string s, string t){
	int n=s.length(), m = t.length();
	int dp[n+1][m+1];
	REP(i, n+1){
		REP(j, m+1){
			if(i==0 || j==0){
				dp[i][j] = 0;
			}
			else{
				if(s[i-1] == t[j-1]){
					dp[i][j] = dp[i-1][j-1] + 1;
				}
				else{
					dp[i][j] = max({dp[i][j-1], dp[i-1][j], dp[i-1][j-1]});
				}
			}
		}
	}
	string res;
	int i=n, j=m;
	while(i>0 && j>0){
		if(s[i-1] == t[j-1]){
			res.pb(s[i-1]);
			i--;
			j--;
		}
		else{
			if(dp[i-1][j] > dp[i][j-1]){
				i--;
			}
			else{
				j--;
			}
		}
	}
	reverse(res.begin(), res.end());
	cout << res << endl;
	return;
}

int32_t main(){
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
		string s, t;
		cin >> s >> t;
		solve(s, t);
		return 0;
}

Measured memory_bytes: 73992
#include <stdio.h>
#include <string.h>

int main(void)
{
        int i,j,s,l,min=754,a[11];
        char t[10];
        scanf("%s",t);

        l=strlen(t);
        for(i=0;i<l;i++)
                a[i]=t[i]-'0';

        for(i=0;i<l-2;i++){
                s=a[i]*100+a[i+1]*10+a[i+2]-753;
                if(s<0) s=-s;
                if(min>s) min=s;
        }
        printf("%d\n",min);
        return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int a[N],n;
map<int,int>m;
inline int check(int mid)
{
	if(mid==1)
	{
		for(int i=1;i<n;i++)
			if(a[i]>=a[i+1])
				return 0;
		return 1;
	}
	m.clear();
	for(int i=2;i<=n;i++)
	{
		if(a[i]<=a[i-1])
		{
			m.erase(m.upper_bound(a[i]),m.end());
			int k=a[i];
			m[k]++;
			for(;k&&m[k]==mid;)
			{
				m.erase(k);
				k--;
				m[k]++;
			}
			if(!k)
				return 0;
		}
	}
	return 1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	int l=1,r=n,mid;
	while(l<r)
	{
		mid=l+r>>1;
		if(check(mid))
			r=mid;
		else
			l=mid+1;
	}
	printf("%d\n",l);
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

class Main {
    static final long mod = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[] = new int[m];
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt();
        }
        sc.close();

        for (int i = 1; i < m; i++) {
            if (a[i] - a[i - 1] == 1) {
                System.out.println(0);
                return;
            }
        }
        long dp[] = new long[n + 2];
        dp[1] = 1;
        dp[2] = 1;
        for (int i = 3; i < n + 2; i++) {
            dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
        }
        if (m == 0) {
            System.out.println(dp[n + 1]);
            return;
        }
        long ans = 1;
        ans *= dp[a[0]];
        for (int i = 1; i < m; i++) {
            ans *= dp[a[i] - a[i - 1] - 1];
            ans %= mod;
        }
        ans *= dp[n - a[m - 1]];
        ans %= mod;
        System.out.println(ans);
    }
}


Measured memory_bytes: 51168
#include <algorithm>
#include <cstdio>
#include <vector>

#define int long long
#define dotimes(i, n) for (int i : range(n))

using namespace std;

class range {
  class iterator {
    int i, s;
  public:
    iterator(int i, int s): i(i), s(s) {}
    int& operator*() {
      return i;
    }
    void operator++() {
      i += s;
    }
    bool operator!=(iterator const& that) {
      return i < that.i;
    }
  };
  iterator b, e;
public:
  range(int e): b({0, 1}), e({e, 1}) {}
  range(int b, int e): b({b, 1}), e({e, 1}) {}
  range(int b, int e, int s): b({b, s}), e({e, s}) {}
  iterator begin() {
    return b;
  }
  iterator end() {
    return e;
  }
};

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

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

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

signed main() {
  for (;;) {
    const int n = rint();
    const int w = rint();
    const int d = rint();
    if (!n && !w && !d)
      break;
    vector<pair<int, int>> pieces;
    pieces.reserve(n+1);
    pieces.emplace_back(w, d);
    dotimes(i, n) {
      int p = rint() - 1;
      int x = pieces[p].first, y = pieces[p].second;
      int s = rint() % (2 * (x + y));
      int a, b, c, d;
      if (s < x)
        a = s, b = y, c = x - s, d = y;
      else if (s - x < y)
        a = x, b = s - x, c = x, d = y - (s - x);
      else if (s - x - y < x)
        a = s - x - y, b = y, c = x - (s - x - y), d = y;
      else
        a = x, b = s - x - y - x, c = x, d = y - (s - x - y - x);
      if (a * b > c * d)
        swap(a, c), swap(b, d);
      pieces.erase(pieces.begin() + p);
      pieces.emplace_back(a, b);
      pieces.emplace_back(c, d);
    }
    vector<int> areas(n+1);
    dotimes(i, n+1)
      areas[i] = pieces[i].first * pieces[i].second;
    sort(areas.begin(), areas.end());
    dotimes(i, n+1)
      if (i)
        printf(" %lld", areas[i]);
      else
        printf("%lld", areas[i]);
    puts("");
  }
  return 0;
}



Measured memory_bytes: 2772
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];

	const int INF = 1e18;
	int mincount = INF;
	rep(x,3) {
		int sum = a[0];
		int count = 0;
		if(x==1) {
			if(sum>0) {
				count+=sum+1;
				sum = -1;
			}
			else if(sum<=0) {
				count+=1-sum;
				sum = 1;
			}
		}
		if(x==2) {
			if(sum>=0) {
				count+=sum+1;
				sum = -1;
			}
			else if(sum<0) {
				count+=1-sum;
				sum = 1;
			}
		}
		if(sum==0) continue;
		for(int i=1;i<n;i++) {
			if((sum+a[i])*sum>=0) {
				if(sum>0) {
					count+=a[i]+sum+1;
					sum = -1;
				}
				else if(sum<0) {
					count+=1-a[i]-sum;
					sum = 1;
				}
			}
			else sum+=a[i];
		}
		mincount = std::min(count,mincount);
	}
	print(mincount);
	
	return 0;
}


Measured memory_bytes: 1024
N = int(input())
H = list(map(int,input().split()))
split = 0
counter = 0
i = 0
while i+1<=N-1:
    if (H[i] >= H[i+1]):
        counter += 1
    else: #counter reset, save to split.
        split = max(counter,split)
        counter = 0
    i += 1
if counter != 0:
    print(max(counter,split))
else:
    print(split)

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


int main(){
    string a, b, ab = "";
    cin >> a >> b;
    ab = a + b;
    int res = stoi(ab);
    for(int i = 1; i <= sqrt(res); i++){
        if(i*i == res){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <numeric>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using namespace std;
const ll mod = 1e9 + 7;
const int N = 2e5 + 5;



void solve()
{
    int n, m; cin >> n >> m;
    string res(n, '$');
    FOR(i, 0, m)
    {
        int s, c; cin >> s >> c;
        if (res[s - 1] != '$' && res[s - 1] != (c + '0'))
        {
            cout << "-1\n";
            return;
        }
        res[s - 1] = (c + '0');
    }
    if (res[0] == '0' && n != 1)
    {
        cout << "-1\n";
        return;
    }
    FOR(i, 0, n)
    {
        if (res[i] == '$')
        {
            if (i == 0 && n != 1) res[0] = '1';
            else res[i] = '0';
        }
    }
    cout << res;
}


int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); //cout.tie(NULL);
    /*int tc; cin >> tc;
    while (tc--)*/
        solve();

    return 0;
}

Measured memory_bytes: 3104
import sys

def factorize(n):
    if n == 2:
        return [2]
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        break
    return fct


input = sys.stdin.readline

n = int(input())
a_list = list(map(int, input().split()))

count_2 = 0
for a in a_list:
    count_2 += len(factorize(a))

print(count_2)
    

Measured memory_bytes: 9936
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * SoundHound Inc. Programming Contest 2018 -Masters Tournament- C "Ordinary Beauty"
 *   https://soundhound2018-summer-qual.contest.atcoder.jp/tasks/soundhound2018_summer_qual_c/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		double n = in.nextDouble();
		double m = in.nextDouble();
		double d = in.nextDouble();

		double prob = 0.0;
		if (d == 0.0) {
			prob = n / (n * n);
		} else {
			prob = 2.0 * (n - d) / (n * n);
		}
		
		double ans = 1.0 * prob * (m - 1.0);

		out.println(ans);

		in.close();
		out.close();
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public int nextInt() {
			return scanner.nextInt();
		}

		public long nextLong() {
			return scanner.nextLong();
		}

		public double nextDouble() {
			return scanner.nextDouble();
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

}


Measured memory_bytes: 24660
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
using namespace std;
int main() {
  int n;
  cin >> n;
  queue<int> que;
  for(int i=0; i<pow(2,n); i++) {
    int a;
    cin >> a;
    que.push(a);
  }
  while(que.size()>1) {
    int x=que.front();
    que.pop();
    int y=que.front();
    que.pop();
    que.push(x==y?x:abs(x-y));
  }
  cout << que.front() << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 9e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
	if(y<=0) return 1;
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//------------------------------------------------------------------------------------------

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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


	ll n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
//	vi lis(n+1, 0);
//	vi st (n+1, -1);
	deque<int> v;
	for(int i=0;i<n;i++){
		int k = lower_bound(all(v), a[i]) - v.begin() - 1;
        if (k == -1)
            v.push_front(a[i]);
        else
            v[k] = a[i];
	}
//	ll ans=0;
//	for(int i=0;i<n;i++){
//		if(lis[i]) ans++;
//	}
	cout<<v.size();
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char b;
  cin >>b;
  if(b=='A'){
   cout<<"T"<<endl;
  }
  else if(b=='T'){
    cout<<"A"<<endl;
  }
  else if(b=='G'){
    cout<<"C"<<endl;
  }
  else if(b=='C'){
    cout<<"G"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll dp[1005][10005];
    int main() {
        // your code goes here
        ll h,n,i,j,k,a[1005],b[1005];
        cin >> h >> n;
        for(i=1;i<=n;i++){
            cin >> a[i] >> b[i];
        }
        for(i=0;i<=n;i++){
            for(j=0;j<=h;j++) dp[i][j]=1e12;
        }
        dp[0][0]=0;
        for(i=1;i<=n;i++){
            for(j=0;j<=h;j++){
                dp[i][j]=min(dp[i-1][j],dp[i][max((ll)0,j-a[i])]+b[i]);
            }
        }
        cout << dp[n][h] <<"\n";
        return 0;
    }

Measured memory_bytes: 78464
#include<cstdio>
#include<cstring>
#include<cstdlib>
int main(void){
	int a[3][3];
	int s;
	scanf("%d", &a[0][0]);
	scanf("%d", &a[0][1]);
	scanf("%d", &a[1][1]);
	s = 3 * a[1][1];
	a[0][2] = s - a[0][0] - a[0][1];
	a[2][2] = s - a[0][0] - a[1][1];
	a[1][2] = s - a[0][2] - a[2][2];
	a[1][0] = s - a[1][1] - a[1][2];
	a[2][1] = s - a[0][1] - a[1][1];
	a[2][0] = s - a[2][1] - a[2][2];
	for (int i = 0; i < 3; i++){
		printf("%d %d %d\n", a[i][0], a[i][1], a[i][2]);
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int k = stdin.nextInt();
		int memo=0;
		int val=10000000;
		int ans=10000000;
		int x[] = new int[n];
		for(int i=0;i<n;i++) {
			x[i]=stdin.nextInt();
			if(x[i]==1)memo=i;
		}
		if(memo+1<=k||memo+1>=n-k) { //はじっこ
			ans=(n-2)/(k-1)+1;
		}else {
			for(int j=0;j<k-1;j++) {
				val=(memo-j+k-2)/(k-1)+(n-memo-k+j+k-2)/(k-1)+1;
				if(val<ans) {
					ans=val;
				}
			}
		}
		System.out.println(ans);


	}

}


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

using namespace std;

long long inf=1000000007;

int main(){
	long long d;
	cin>>d;
	map<long long,long long> c,last;
	for(long long i=1;i<=26;i++){
		long long hoge;
		cin>>hoge;
		c[i]=hoge;
		last[i]=0;
	}

	vector<vector<long long>> vec(d,vector<long long>(27,0));
	for(long long i=0;i<d;i++){
		for(long long j=1;j<=26;j++){
			cin>>vec.at(i).at(j);
		}
	}

	long long ans=0;

	for(long long i=0;i<d;i++){
		long long t;
		cin>>t;
		last.at(t)=i+1;
		ans+=vec.at(i).at(t);

		for(long long j=1;j<=26;j++){
			ans-=c.at(j)*(i+1-last.at(j));
		}

		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 3684
n, k = map(int, input().split())
sunuke_set = set(i for i in range(1, n + 1))

for i in range(k):
    d = int(input())
    sunuke_list = list(map(int, input().split()))
    for sunuke in sunuke_list:
        sunuke_set.discard(sunuke)

print(len(sunuke_set))


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


int main()
{
  int r, d, x;
  cin >> r >> d >> x;
  rep(i, 10)
  {
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mo 1000000007
#define N 310
using namespace std;
template <typename T> void read(T &x){
	x=0;char c=getchar();int fh=1;
	while (!isdigit(c)){if (c=='-')fh=-1;c=getchar();}
	while (isdigit(c))x=x*10+c-'0',c=getchar();
	x*=fh;
}
int n,a[N*2],f[N*2],dp[N*2][N][N],sum;
int main(){
	read(n);
	for (int i=1;i<=n*2;i++)read(a[i]);
	for (int i=1;i<=n*2;i++)f[i]=0;
	for (int i=1;i<=n;i++){
		if (a[i*2]!=-1&&a[i*2-1]!=-1){f[a[i*2]]=1;f[a[i*2-1]]=1;}
		else{if(a[i*2]!=-1)f[a[i*2]]=2;if(a[i*2-1]!=-1)f[a[i*2-1]]=2;}
		if (a[i*2]==-1&&a[i*2-1]==-1) sum++;
	}
	dp[n*2+1][0][0]=1;
	for (int i=n*2;i>=1;i--){
		if (f[i]==0){
			for (int j=0;j<=n;j++)
				for(int k=0;k<=n;k++){
					dp[i][j][k]=(dp[i+1][j+1][k]+1ll*dp[i+1][j][k+1]*(k+1))%mo;
					if (j){dp[i][j][k]=(dp[i][j][k]+dp[i+1][j-1][k])%mo;}
				}
		}
		if (f[i]==2){
			for (int j=0;j<=n;j++)
				for(int k=0;k<=n;k++){
					dp[i][j][k]=1ll*dp[i+1][j+1][k]%mo;
					if (k){dp[i][j][k]=(dp[i][j][k]+dp[i+1][j][k-1])%mo;}
				}
		}
		if (f[i]==1){for (int j=0;j<=n;j++)for (int k=0;k<=n;k++)dp[i][j][k]=dp[i+1][j][k];}
	}
	for (int i=1;i<=sum;i++) dp[1][0][0]=1ll*dp[1][0][0]*i%mo;
	cout<<dp[1][0][0]<<endl;
	return 0;
}
/*
3
-1 -1 -1 3 -1 6
*/

Measured memory_bytes: 227200
# abc142_b.py
# https://atcoder.jp/contests/abc142/tasks/abc142_b

# B - Roller Coaster /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 高橋君の仲間たちは N人で遊園地に遊びにいきました。
# 遊園地の一番人気のジェットコースターに乗るためには、身長が Kcm以上必要です。
# 高橋君の i番目の仲間の身長は hicm です。
# 高橋君の仲間たちのうち、一番人気のジェットコースターに乗ることができる人の数を求めてください。

# 制約
#     1≤N≤105
#     1≤K≤500
#     1≤hi≤500
#     入力はすべて整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N K
# h1 h2 … hN

# 出力
# 高橋君の仲間たちのうち、一番人気のジェットコースターに乗ることのできる人の数を出力してください。

# 入力例 1
# 4 150
# 150 140 100 200

# 出力例 1
# 2

# 一番人気のジェットコースターに乗ることができるのは、1番目の仲間と 4 番目の仲間の 2人です。

# 入力例 2
# 1 500
# 499

# 出力例 2
# 0

# 入力例 3
# 5 1
# 100 200 300 400 500

# 出力例 3
# 5


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, K = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    cnt = 0

    for value in values:
        if value >= K:
            cnt += 1

    return [cnt]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4 150', '150 140 100 200']
        lines_export = [2]
    if pattern == 2:
        lines_input = ['1 500', '499']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['5 1', '100 200 300 400 500']
        lines_export = [5]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

using namespace std;



long int N,M;


int main(){
    
    cin >> N >> M;
    
    if (N == 1 && M == 1) {
        cout << 1 << endl;
    }else if(N == 2 || M == 2){
        cout << 0 << endl;
    }else if(N == 1 && M > 2){
        cout << M-2 << endl;
    }else if(M == 1 && N > 2){
        cout << N-2 << endl;
    }else{
        cout << (M-2)*(N-2) << endl;
    
        
    }
    
    
}




Measured memory_bytes: 384
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>

using namespace std;


int main(){
    string s;
    cin >> s;
    string output;
    int len;
    len = s.length();
    for (int i = 0; i < len; i++){
        if (s[i] == char('0') ){
            output.push_back(char('0'));
        }
        else if (s[i] == char('1')){
            output.push_back(char('1'));
        }
        else {
            if (output.length() > 0){
                output.pop_back();
            }
        }
    }
    cout << output << endl;


    return 0;
}

Measured memory_bytes: 256
from math import cos, sin, pi, radians
from cmath import exp

a, b, h, m = map(int, input().split())

# 時針は一時間あたり360/12 = 30度
# 時針は一分あたり30/60 = 0.5度
# 分針は一分あたり360/60 = 6度
hdeg = radians(h * 30 + m * 0.5)
mdeg = radians(m * 6)

# オイラーの公式
hz = a * exp(complex(0, hdeg))
mz = b * exp(complex(0, mdeg))

# 複素数平面における二点間の距離
dist = abs(hz - mz)

print(dist)

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

// clang-format off
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
#define FOR(i, x, y) for(int i = x; i < y; i++)
// clang-format on

int main()
{
  IOS;

  int N;
  cin >> N;
  int a, b, c;
  cin >> a >> b >> c;

  int A = a, B = b, C = c;
  int x, y, z;
  FOR(i, 1, N)
  {
    cin >> a >> b >> c;
    x = A, y = B, z = C;
    A = a + max(y, z);
    B = b + max(x, z);
    C = c + max(x, y);
  }

  cout << max(A, max(B, C)) << endl;

  return 0;
}


Measured memory_bytes: 3632
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, M = getNM()
que = [getList() for i in range(N)]
que.sort(reverse = True)

left = M
ans = 0
while left > 0:
    a, b = que.pop()
    buy = min(left, b)
    left -= buy
    ans += buy * a
print(ans)

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


#define vt vector
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define ll long long
#define ld long double
#define ar array
#define inf() ifstream cin("d.txt")
#define onf() ofstream cout("test.txt")
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define in(a) cin>>a
#define inn(a,b) cin>>a>>b
#define innn(a,b,c) cin>>a>>b>>c 
#define rep(i,st,end) for(int i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST ll tc;cin>>tc;while(tc--)
#define EACH(x, a) for (auto& x: a)

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {
    cin >> x;
}
void read(double& d) {
    string t;
    read(t);
    d=stod(t);
}
void read(long double& d) {
    string t;
    read(t);
    d=stold(t);
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
template<class A> void read(vt<A>& x) {
    EACH(a, x)
        read(a);
}
template<class A, size_t S> void read(array<A, S>& x) {
    EACH(a, x)
        read(a);
}

void solve()
{
  ll d,s,t;
  read(d,t,s);
  ll di = s*t;
  if(di>=d)
    cout<<"Yes";
  else
    cout<<"No";

}

 int main()
 {
    fio;
    ll k = 1;
    ll tc;
    tc = 1;
    // cin>>tc;
    while(tc--){
       // cout<<"Case #"<<k<<": ";k++;
        solve();
        endl;
    }
    
 }




Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <cmath>

typedef long long int ll;

int main( void )
{
	int n;
	std::cin >> n;

	const int nmax = std::pow( 10, 5 ) * 2;
	ll b[ nmax ];

	for( int i = 0; i < n; i++ ) {
		std::cin >> b[ i ];
		b[ i ] = b[ i ] - ( i + 1 );
	}

	std::sort( b, b + n );

	ll med = b[ n / 2 ];
	ll sum = 0;
	for( int i = 0; i < n; i++ ) {
		sum = sum + std::abs( b[ i ] - med );
	}

	std::cout << sum << std::endl;
	return 0;
}



Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }






        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var n = Read();
            var a = Reads();
            var b = new long[(long)Math.Pow(10,7)];

            long left = (long)Math.Pow(10, 6) * 5;
            long right = (long)Math.Pow(10, 6) * 5+1;

           
            for (int i = 0; i <n; i++)
            {
                if (n % 2 == (i+1) % 2)
                {
                    b[left] = a[i];
                    left--;
                }
                else
                {
                    b[right] = a[i];
                    right++;
                }
               
            }
            
            
                for (long i =left+1; i<right; i++)
                {
                    Console.Write("{0} ", b[i]);
                }
            
            Console.WriteLine();
         
            Console.Out.Flush();
        }
    }
}




Measured memory_bytes: 35520
import re
a, b = map(int, input().split())
s = input().rstrip()
result = 'Yes'

if len(s[:a]) != a or len(s[a+1:]) != b:
    result = 'No'
if re.fullmatch(r'\d+', s[:a]) is None or\
        re.fullmatch(r'\d+', s[a+1:]) is None:
    result = 'No'
if s[a:a+1] != '-':
    result = 'No'

print(result)

Measured memory_bytes: 3188
using System;
using System.Linq;
class A
{
    static void Main()
    {
        while (true)
        {
            long n = long.Parse(Console.ReadLine());
            if (n == 0) break;
            long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Array.Sort(a);
            long min = long.MaxValue;
            for (long i = 0; i < a.Length - 1; i++)
            {
                min = Math.Min(min, Math.Abs(a[i] - a[i + 1]));
            }
            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 9980
#include<bits/stdc++.h>
using namespace std;
typedef long long D;
const int maxn=2003,maxm=4000003,mod=1000000007;
int Plus(int x,int y){return (x+=y)>=mod?x-mod:x;}
void Pluseq(int &x,int y){if((x+=y)>=mod)x-=mod;}
int Minus(int x,int y){return Plus(x,mod-y);}
void Minuseq(int &x,int y){Pluseq(x,mod-y);}
int mul(D x,int y){return x*y%mod;}
void muleq(int &x,int y){x=mul(x,y);}
int qpow(int x,int y){
    int ans=1;
    while(y){
        if(y&1)muleq(ans,x);
        muleq(x,x);
        y>>=1;
    }
    return ans;
}
int fac[maxm],facinv[maxm],dp[maxn][maxn],n,k;
int C(int n,int m){return mul(mul(fac[n],facinv[m]),facinv[n-m]);}
int main(){
    fac[0]=1;
    for(int i=1;i<maxm;i++)fac[i]=mul(fac[i-1],i);
    facinv[maxm-1]=qpow(fac[maxm-1],mod-2);
    for(int i=maxm-2;i>=0;i--)facinv[i]=mul(facinv[i+1],i+1);
    scanf("%d%d",&n,&k);
    if(k==1){puts("1");return 0;}
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            dp[i][j]=Plus(dp[i-1][j],!j?0:mul(dp[i][j-1],mul(C(n*k-i-(j-1)*(k-1)-1,k-2),n-j+1)));
        }
    }
    printf("%d\n",dp[n][n]);
    return 0;
}

Measured memory_bytes: 48656
a, b, k = map(int, input().split())
c = []
if b - 2*k < a:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(k):
        c.append(a+i)
        c.append(b-i)
    c.sort()
    for i in c:
        print(i)

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

int main(){
    int n,c=0,m=0;
    string s;
    cin>>n>>s;
    vector<int> x(26,0),y(26,0);
    for(int i=0;i<n;i++) x[s[i]-'a']++;
    for(int i=0;i<n-1;i++){
        x[s[i]-'a']--;
        y[s[i]-'a']++;
        for(int j=0;j<26;j++) if(x[j]>0 && y[j]>0) c++;
        m=max(m,c);
        c=0;
    }
    cout<<m<<endl;
    return 0;
}

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

int main(){
    ll H;
    cin >> H;
    
    int cnt = 1;
    ll hp = H;
    while(hp>1){
        hp = hp/2;
        cnt += 1;
    }
    if(cnt == 1) cout << "1" << endl;
    else cout << ll(pow(2,cnt)-1) << endl;
}

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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long int
#define mod (long long)(1e9+7)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi (acos(-1))
#define F first
#define S second

ll fp(ll n , ll p )
{
    if(p==0)
        return 1;
    if(p==1)
        return n ;
    ll res = fp(n,p/2)%mod ;
    res=((res)*(res))%mod ;
    if(p%2)
        res=(res*n)%mod ;
    return res ;
}


ll n , arr[200005] , brr[200005] ;
int main()
{
    ENGZ;
    cin>>n ;
    for(int i=1 ; i<=n ; i++)cin>>arr[i] ;
    set<ll> st ;
    for(int i=n ; i>=1 ; i--)
    {
        int cnt = 0 , idx = 2*i ;
        while(idx <= n)
        {
            cnt+= brr[idx];
            idx += i;
        }
        if(cnt%2 != arr[i])
        {
            st.insert(i);
            brr[i]++;
        }

    }
    cout<<sz(st) <<endl ;
    for(auto i:st)cout<<i <<" ";
    cout<<endl ;

    return 0;
}


Measured memory_bytes: 12116
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    auto a = vector<int>(m,0);
    auto b = vector<int>(m,0);
    auto c = vector<vector<int> >(n,vector<int>(n,0));
    for(int i=0;i<m;i++){
        cin >> a[i] >> b[i];
        c[--a[i]][--b[i]] = 1;
        c[b[i]][a[i]] = 1;
    }
    
    stack<pair<int,int> > s;
    s.push(make_pair(0,0));
    int ans = 0;
    while(!s.empty()){
        auto u=s.top();
        bool t = false;
        s.pop();
        u.second |= 1<<u.first;
        //cout << u.first << " "<<bitset<8>(u.second) << endl;
        for(int i=0;i<n;i++){
            if(u.second & 1<<i) continue;
            if(c[u.first][i]==0) continue;
            s.push(make_pair(i,u.second));
            t=true;
        }
        if(!t&&u.second==(int)pow(2,n)-1){
            ans++;
        }
    }
    
    cout << ans;
    
}

Measured memory_bytes: 256
#include<iostream>
    #include<cmath>
    using namespace std;
    #define MOD 1000000007
    long long f[1000005];
    long long g[100005];
    long long inv[1000005];
     
    long long q_pow(long long n,long long m)
    {
    	int res=1;
    	while(m)
    	{
    		if(m&1)
    		{
    			res=(res*n)%MOD;
    		}
    		n=(n*n)%MOD;
    		m=m>>1;
    	}
    	return res;
    } 
     
    void fac()
    {
    	f[0]=1;
    	inv[0]=1;
    	for(long long i=1;i<=1000000;i++)	
    	{
    		f[i]=(f[i-1]*i)%MOD;
    	}
    	inv[1000000]=q_pow(f[1000000],MOD-2);
    	for(long long i=1000000-1;i>0;i--)
    	{
    		inv[i]=(inv[i+1]*(i+1))%MOD;
    	}
    }
    long long c(long long n,long long m)
    {
    	long long res=((f[n]*inv[n-m])%MOD*inv[m])%MOD;
    	//cout<<f[n]<<' '<<inv[n-m]<<' '<<inv[m]<<endl;
    	//cout<<n<<' '<<m<<endl;
    	return res;
    }
    int main()
    {
    	fac();
    	long long n,m;
    	cin>>n>>m;
    	long long p=0;
            long long lim=sqrt(m);
    	for(int i=2;i<=lim;i++)
    	{
    		if(m%i==0)
    		{
    			g[p]=0;
    			while(m%i==0)
    			{
    				g[p]++;
    				m=m/i;
    			}
    			p++;
    		}
    	}	
    	long long ans=1;
    	for(int i=0;i<p;i++)
    	{
    		ans=(c(g[i]+n-1,n-1)*ans)%MOD;//,cout<<g[i]<<endl;
    	}
    	if(m!=1) ans=(ans*n)%MOD;
    	cout<<ans<<endl;
    } 


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

int main(void){
   string s;
   cin >> s;
   long long int q;
   cin >> q;

   for(long long int i = 0;i < q; i++){
       string in;
       cin >> in;
       if(in == "print"){
           long long int a,b;
           cin >> a >> b;
           cout << s.substr(a,b - a+1) << endl;
       }
       else if(in == "reverse"){
           long long int a,b;
           cin >> a >> b;
           string k = s;
           for(long long int j = a;j <= b; j++){
               s[j] = k[a + b - j];
           }
       }
       else if (in == "replace"){
           long long int a,b;
           cin >> a >> b;
           for(long long int j = a;j <= b; j++){
               char c;
               cin >> c;
               s[j] = c;
           }
       }
   }
}


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

main(){
  string s;
  int x = 0;
  cin >> s;
  for(int i = 0; i < 4 ;i++){
    if(s[i] == '+'){
      x += 1;
    }
    else{
      x-=1;
    }
  }
  cout << x<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

vector<ll> seg, lazy;

void eval(ll k) {
	if (k >= seg.size())return;
	if (lazy[k] == 0)return;
	seg[k] += lazy[k];
	if (k < seg.size() / 2) {
		lazy[2 * k] += lazy[k];
		lazy[2 * k + 1] += lazy[k];
	}
	lazy[k] = 0;
}

void add(ll a, ll b, ll k = 1, ll l = 0, ll r = seg.size() / 2 - 1) {
	eval(k);
	if (r < a || b < l)return;
	if (a <= l && r <= b) {
		lazy[k] += 1;
		eval(k);
	}
	else {
		add(a, b, 2 * k, l, (l + r) / 2);
		add(a, b, 2 * k + 1, (l + r) / 2 + 1, r);
		seg[k] = seg[2 * k] + seg[2 * k + 1];
	}
}

ll get(ll a, ll b, ll k = 1, ll l = 0, ll r = seg.size() / 2 - 1) {
	if (r < a || b < l)return 0;
	eval(k);
	if (a <= l && r <= b)return seg[k];
	else return get(a, b, 2 * k, l, (l + r) / 2) + get(a, b, 2 * k + 1, (l + r) / 2 + 1, r);
}

ll N, K;
vector<ll> A;
vector<ll> S;
map<ll, ll> order;

int main() {
	cin >> N >> K;
	A.resize(N + 1,K);
	for (ll n = 1; n <= N; n++)cin >> A[n];
	S.resize(N + 1,0);
	for (ll n = 1; n <= N; n++) {
		S[n] = S[n - 1] + (A[n] - K);
	}
	{
		set<ll> s;
		for (ll n = 0; n <= N; n++)s.insert(S[n]);
		vector<ll> V;
		for (auto n : s)V.push_back(n);
		for (ll n = 0; n < V.size(); n++) {
			order.insert(pll(V[n], n));
		}
	}
	ll ans = 0;
	ll RN = 1;
	while (RN < N)RN *= 2;
	RN *= 2;
	seg.resize(RN);
	lazy.resize(RN);
	for (ll n = 1; n <= N; n++) {
		ll ord = order.find(S[n])->second;
		ans += ::get(ord, ord);
		if (S[n] >= 0)ans++;
		::add(ord, RN - 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 26868
#include<iostream>
#include<vector>
#include<list>
using namespace std;
int main() {
    int n, q, a, b, c;
    cin >> n >> q;
    vector<list<int>> v(n);
    for (int i = 0; i < q; i++) {
        cin >> a;
        if (a == 0) {
            cin >> b >> c;
            v[b].push_back(c);
        }
        else if (a == 1) {
            cin >> b;
            list<int>::iterator it = v[b].begin();
            if (it != v[b].end())    cout << *it;
            while (++it != v[b].end()) {
                cout << " " << *it;
            }
            cout << endl;
        }
        else if (a == 2) {
            cin >> b >> c;
            v[c].splice(v[c].end(), v[b]);
        }
    }
}


Measured memory_bytes: 18636
#include <iostream>

using namespace std;

int main()
{
    int W, H, x, y;

    cin >> W >> H >> x >> y;

    cout << (double)W * (double)H / 2.0 << " ";

    if ( x*2 == W && y*2 == H ) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int A,B,T;
  cin >> A >> B >> T;
  int cnt = 0;
  int t = 0;
  t += A;
  while(t < T+0.5){
    t += A;
    cnt += B;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
# from bisect import *
# from collections import *
# from heapq import *
# import functools
# import itertools
# import math
INF = 500000
MOD = 10**9+7

a = int(input())
b = int(input())
for i in range(1, 4):
    if i not in [a, b]:
        print(i)
        exit()


Measured memory_bytes: 38704
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int R, C, K;
  cin >> R >> C >> K;

  int goods[R][C];
  memset(goods, 0, sizeof(goods));
  // map<int, map<int, ll>> goods;

  int r, c, v;
  for (int i = 0; i < K; ++i) {
    cin >> r >> c >> v;

    goods[r - 1][c - 1] = v;
  }

  ll dp[2][C][4];
  memset(dp, 0, sizeof(dp));

  for (int y = 0; y < R; ++y) {
    int cy = y % 2;
    int by = (y + 1) % 2;

    for (int x = 0; x < C; ++x) {
      ll mv = LLONG_MIN;

      for (int c = 0; c <= 3; ++c) {
        mv = max(mv, dp[by][x][c]);
      }

      dp[cy][x][0] = mv;

      if (goods[y][x] > 0) {
        dp[cy][x][1] = mv + goods[y][x];
      }
    }

    for (int x = 1; x < C; ++x) {
      for (int c = 0; c <= 3; ++c) {
        dp[cy][x][c] = max(dp[cy][x][c], dp[cy][x - 1][c]);

        if (c < 3 && goods[y][x] > 0) {
          dp[cy][x][c + 1] = max(dp[cy][x][c + 1], dp[cy][x - 1][c] + goods[y][x]);
        }
      }
    }
  }

  ll ans = LLONG_MIN;

  for (int c = 0; c <= 3; ++c) {
    ans = max(ans, dp[(R - 1) % 2][C - 1][c]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 38912
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
int main(){
    int cnt=0;
    string a,b;
  	cin>>a>>b;
  	int k =a.size();
    fo(i,k){
        if(a[i]!=b[i]){++cnt;}
    }
    cout << cnt;return 0;
}

Measured memory_bytes: 3848