akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

struct edge{
  int to;
  long long cap;
  int rev;
};

vector<vector<edge> > G;
bool used[109];

void add_edge(int from,int to,long long cap){
  G[from].push_back({to,cap,(int)G[to].size()});
  G[to].push_back({from,0,(int)G[from].size()-1});
}

long long dfs(int v,int t,long long f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      long long d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

long long max_flow(int s,int t){
  long long flow=0;
  for(;;){
    fill(begin(used),end(used),false);
    long long f=dfs(s,t,1LL<<62);
    if(f==0)return flow;
    flow+=f;
  }
}

int main(){
  for(long long N,W;cin>>N>>W,N;){
    G=vector<vector<edge> >(109);
    for(int i=0;i<7;i++){
      add_edge(107,100+i,W);
    }
    long long tsum=0;
    for(int i=0;i<N;i++){
      long long t,c;
      cin>>t>>c;
      tsum+=t;
      while(c--){
	char dow[99];
	cin>>dow;
	add_edge(100+(
		 (dow[0]=='S')?(dow[1]=='u')?0:1:
		 (dow[0]=='M')?2:
		 (dow[0]=='T')?(dow[1]=='u')?3:4:
		 (dow[0]=='W')?5:6),i,1LL<<62);
      }
      add_edge(i,108,t);
    }
    cout<<((max_flow(107,108)==tsum)?"Yes":"No")<<endl;
  }
}

Measured memory_bytes: 1252
S = [int(x) for x in list(input())]
ans = 0

for i in range(2**(len(S)-1)):
    dig = 0
    for j in range(len(S)-1):
        if int(i/(2**j)) % 2 == 0:
            dig += 1
        else:
            dig = 0
        ans += S[-j-2] * (10**dig)

ans += S[-1]*(2**(len(S)-1))
print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

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

//Tはアーベル群
template<class T> class WeightedUnionFind{
    std::vector<int> par;
    std::vector<int> rank;
    std::vector<T> diff_weight;

public:
    WeightedUnionFind(){}
    WeightedUnionFind(int n, T UNITY = 0): par(n), rank(n), diff_weight(n){
        for(int i(0); i < n; ++i){
            par[i] = i;
            rank[i] = 0;
            diff_weight[i] = UNITY;
        }
    }

    void  resize(int n, T UNITY = 0){
        int m(par.size());
        par.resize(n);
        rank.resize(n, 0);
        diff_weight.resize(n, UNITY);
        for(int i(m); i < n; ++i) par[i] = i;
    }

    int find(int x){
        if(x == par[x]) return x;
        int r(find(par[x]));
        diff_weight[x] += diff_weight[par[x]];
        return par[x] = r;
    }

    T weight(int x){
        find(x);
        return diff_weight[x];
    }

    //weight(y) = weight(x) + w
    bool unit(int x, int y, T w){
        w += weight(x); w -= weight(y);
        x = find(x); y = find(y);
        if(x == y) return false;

        if(rank[x] < rank[y]){
            par[x] = y;
            diff_weight[x] = -w;
        }else{
            par[y] = x;
            if(rank[x] == rank[y]) ++rank[x];
            diff_weight[y] = w;
        }
        return true;
    }

    bool same(int x, int y){
        return find(x) == find(y);
    }
};





int main(){
    int n; std::cin >> n;
    WeightedUnionFind<int> wuf(n);
    {
        int q, op, x, y, z; std::cin >> q;
        for(int QQ(0); QQ < q; ++QQ){
            std::cin >> op >> x >> y;
            if(!op){
                std::cin >> z;
                wuf.unit(x, y, z);
            }else{
                if(wuf.same(x, y)){
                    std::cout << wuf.weight(y) - wuf.weight(x) << "\n";
                }else{
                    std::cout << "?\n";
                }
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N=pow(10,9)+7;

int main(){
    ll n,k;
    cin >> n >> k;
    vector<pair<ll,ll>> a(n);
    bool all_minus=true;
    for(int i=0; i<n; i++){
        ll x,y;
        cin >> x;
        if(x>=0) all_minus=false;
        y=abs(x);
        pair<ll, ll> p=make_pair(y,x);
        a.at(i)=p;
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ll ans=1;
    for(int i=0; i<k; i++){
        ans = (ans * a.at(i).second) % N;
    }
    if(k==n||ans>=0){
        if(ans<0) ans=N+ans;
        cout << ans << endl;
        return 0;
    }
    if(k%2==1&&all_minus){
        ll ans2=1;
        for(int i=1; i<=k; i++){
            ans2 = (ans2*a.at(n-i).first)%N;
        }
        cout << N-ans2 << endl;
        return 0;
    }
    ll plus_in=-1,plus_out=-1,minus_in=1,minus_out=1;
    ll p,q;
    for(int i=1; i<=k; i++){
        if(a.at(k-i).second>=0&&plus_out<0) plus_out=a.at(k-i).second;
        if(a.at(k-i).second<0&&minus_out>0) minus_out=a.at(k-i).second;
    }
    for(int i=k; i<n; i++){
        if(a.at(i).second>=0&&plus_in<0) plus_in=a.at(i).second;
        if(a.at(i).second<0&&minus_in>0) minus_in=a.at(i).second;
    }
    if(plus_out<0||minus_in>0){
        p=minus_out;q=plus_in;
    }
    else if(minus_out>0||plus_in<0){
        p=plus_out;q=minus_in;
    }
    else{
        if(abs(minus_in*minus_out) <= abs(plus_in*plus_out)){
            p=minus_out;q=plus_in;
        }
        else{
            p=plus_out;q=minus_in;
        }
    }
    //cout << p << " " << q << endl;
    ans=1;
    bool first_time=true;
    for(int i=0; i<k;i++){
        if(a.at(i).second==p&&first_time==true){
            first_time=false;
            continue;
        }
        ans = (ans * a.at(i).second) % N;
    }
    ans = (ans*q)%N;
    cout << ans << endl;
}

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

//Common
using namespace std;using f64 = double;using i64=long long;using u64=unsigned long long;
template<typename T> using Arr=vector<T>;template<typename T> using Func=function<T>;template<typename T> using Str=basic_string<T>;
#define hfor(v, s, e) for(int v=(s);(s)<=v&&v<(e);++v)//half-opened range
#define hfori(v, s, e) for(int v=(e)-1;(s)<=v&&v<(e);--v)//inversion
#define hforo(v, s, e) int v=(s);for(;(s)<=v&&v<(e);++v)//out declaration
#define hforoi(v, s, e) int v=(e)-1; for(;(s)<=v&&v<(e);--v)
#define cfor(v, s, e) hfor(v,(s),(e)+1)//closed range
#define cfori(v, s, e) hfori(v,(s),(e)+1)
#define cforo(v, s, e) hforo(v,(s),(e)+1)
#define cforoi(v, s, e) hforoi(v,(s),(e)+1)
#define rep(v,x) hfor(v,0,(x))
#define repi(v,x) hfori(v,0,(x))
#define repo(v,x) hforo(v,0,(x))
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define empl emplace
#define emplb emplace_back
#define emplf emplace_front
#define fi first
#define se second
#define cxp constexpr
#define PQ std::priority_queue

//Math
template<typename T> cxp T inf() { return numeric_limits<T>::max() / 2; }
template<typename T> inline T sq(T x){return x*x;}
int rd(int lb, int ub){static mt19937 rng(time(0)^i64(new int)); return uniform_int_distribution<int>(lb, ub-1)(rng);}
int rd(int ub=inf<int>()){return rd(0,ub);}
const f64 pi=acosl(-1), eps=1e-10;

//IO
template<typename T>ostream& operator<<(ostream& s, const Arr<T>& a) {for(auto i:a) cout<<i<<' '; return s;}
int getint(){int x;cin>>x;return x;}
char getchr(){char x;cin>>x;return x;}
#ifndef DEBUG
	//#pragma GCC optimize ("Ofast") //somtimes it become more slower
	auto __PRE_RUN__=(ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),(cout<<fixed<<setprecision(11)), 0);
#endif

//Functional
template<typename U> auto mapf(const auto& a, auto f){Arr<U> r; for(const auto& x:a)r.pushb(f(x)); return r;}
template<typename T> auto reduce(const auto& a, T acc){ return accumulate(all(a),acc); }
template<typename T> auto reduce(const auto& a, T acc, auto f){ return accumulate(all(a),acc,f); }
template<typename T> T rev(const T& a){return {a.rbegin(),a.rend()};}
Arr<int> range(int n){ Arr<int> ret(n); rep(i,n)ret[i]=i; return ret; }
struct defer{ defer(auto f):f(f){} ~defer(){f();} function<void()> f; };
#define defer(x) auto _##__COUNTER__ = defer([&](){x});
#define lam(expr, ...) [&](__VA_ARGS__){return expr;}
auto split(auto s, auto p){
	Arr<decltype(s)> ret;
	auto it1=s.begin();
	for(auto it2=it1; (it2 = find(it1,s.end(),p)) != s.end(); it1=it2+1)
		ret.pushb({it1, it2});
	ret.pushb({it1,s.end()});
	return ret;
}

#define endl '\n'//not interactive?
#define int i64//MLE?
using pint = pair<int,int>;
using tint = tuple<int,int,int>;

signed main(){
	int a,b,c,k; cin>>a>>b>>c>>k;
	int ans=0;
	ans+=min(a,k), k-=min(a,k);
	k-=min(b,k);
	ans-=min(c,k);
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3656
var
    n,d,d0,x,i,sum: Integer;
    a:array[1..100] of Integer;
begin
    readln(n);
    readln(d,x);
    d0:=d-1;
    for i := 1 to n do
    begin
        readln(a[i]);
    end;
    sum:=x;
    for i := 1 to n do
    begin
        inc(sum,1+d0 div a[i]);
    end;
    writeln(sum);
end.

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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int x3, y3, x4, y4;
    int x = x2 - x1;
    int y = y2 - y1;
    x3 = x2 - y;
    y3 = y2 + x;
    x4 = x3 - x;
    y4 = y3 - y;
    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll dp[3010][3010][4];

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

    map<pii, int> mp;
    int r, c, v;
    for (int i = 0; i < K; ++i) {
        cin >> r >> c >> v;
        mp[pii(r, c)] = v;
    }

    for (int i = 0; i <= R; ++i) {
        for (int j = 0; j <= C; ++j) {
            for (int k = 0; k < 4; ++k) {
                dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
                dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
            }
            if (mp.count(pii(i+1, j))) {
                for (int k = 0; k < 4; ++k) {
                    dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][k] + mp[pii(i + 1, j)]);
                }
            }
            if (mp.count(pii(i, j+1))){
                for (int k = 0; k < 3; ++k) {
                    dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + mp[pii(i, j+1)]);
                }
            }
        }
    }

    ll res = 0;
    for (int i = 0; i < 4; ++i) {
        res = max(res, dp[R][C][i]);
    }
    cout << res << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<char> S(N);
  for (int i=0; i<N; i++) {
    cin >> S[i];
  }
  
  //'.'の個数の累積和
  vector<int> sum(N);
  if (S[0] == '.') sum[0] = 1;
  else sum[0] = 0;
  for (int i=1; i<N; i++) {
    if (S[i] == '.')
      sum[i] = sum[i-1] + 1;
    else
      sum[i] = sum[i-1];
  }
  
  int count = 1000000;
  for (int i=1; i<N; i++) {
    count = min(count, (i - sum[i-1]) + (sum[N-1] - sum[i-1]));
  }
  
  int count_0 = 0, count_N;
  for (int i=0; i<N; i++) {
    if (S[i] == '.') count_0++;
  }
  count_N = N - count_0;

  cout << min(count, min(count_0, count_N)) << endl;
    
  
}



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

int top,S[1000];

void push(int x){
  top++;
  S[top]=x;
}
int pop(){
  top--;
  return S[top+1];
}
int main(){
  int a,b;
  top=0;
  char s[100];
  while((scanf("%s",s))!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }
    else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
    }
    else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }
    else{
      push(atoi(s));
      //  printf("%d",atoi(s));
    }
    }
  printf("%d\n",pop());
  
  return 0;
}

Measured memory_bytes: 548
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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 N,ans,dp[61][300100],kake[61];

int main(){
    cin>>N;
    ll A[N];
    rep(i,61)dp[i][0]=0;
    kake[0]=1;
    repi(i,1,61)kake[i]=(kake[i-1]*2)%1000000007;
    rep(i,N){
        cin>>A[i];
        rep(j,61)dp[j][i+1]=dp[j][i]+(A[i]>>j)%2;
    }
    rep(i,N){
        rep(j,61){
            if((A[i]>>j)%2){
                ll tmp=i-dp[j][i];
                rep(k,j){
                    if(j-1-k>10){
                        tmp=(tmp*1024)%1000000007;
                        k+=9;
                    }
                    else tmp=(tmp*2)%1000000007;
                }
                // rep(k,j)tmp=(tmp*2)%1000000007;
                ans=(ans+tmp)%1000000007;
            }
            else{
                ll tmp=dp[j][i];
                rep(k,j){
                    if(j-1-k>10){
                        tmp=(tmp*1024)%1000000007;
                        k+=9;
                    }
                    else tmp=(tmp*2)%1000000007;
                }
                // rep(k,j)tmp=(tmp*2)%1000000007;
                ans=(ans+tmp)%1000000007;
            }
        }
    }
    out(ans);


    

}


Measured memory_bytes: 145664
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans;
  FOR(i, 1, b+1)
  {
    ans = ((i * a) % b == c) ? "YES" : "NO";
    if (ans == "YES")
      break;
  }

  cout << ans << "\n";

  return(0);
}


Measured memory_bytes: 256
n,m = map(int,input().split())
A = []
B = []
for i in range(n):
	tmp = list(map(int,input().split()))
	A.append(tmp)
	tmp=[]
for i in range(m):
	num = int(input())
	B.append(num)
for i in range(n):
	c = 0
	for j in range(m):
		c += A[i][j]*B[j]
	print(c)


Measured memory_bytes: 6016
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int[] ar = new int[n];
		
		for(int i = 0; i < n; i++){
			ar[i] = sc.nextInt();
		}
		
		int key,i,j,k;
		for(i = 1; i < n; i++){
			
			for (j = 0; j < n - 1; j++){
				System.out.print(ar[j] + " ");
			}
			System.out.println(ar[n - 1]);
			
			key = ar[i];
			k = i - 1;
			while(k >= 0 && ar[k] > key){
				ar[k+1] = ar[k];
				k--;
			}
			ar[k+1] = key;
		}
		
		for (i = 0; i < n - 1; i++){
			System.out.print(ar[i] + " ");
		}
		System.out.println(ar[n - 1]);
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

void go(_Bool* bridge, _Bool* via, int now, int N, int* path){
//	printf("now%d\n", now);           //現在の居場所
	int i;
	_Bool t = 0;
	_Bool via_Copy[N];
	for(i = 0; i < N; i ++){
		via_Copy[i] = via[i];
	}
	via_Copy[now] = 1;

	for(i = 0; i < N; i ++){
		
//		printf("%d", via[i]);
		
		if(via_Copy[i] == 0){
			t = 1;
//			printf("t = 1, %d\n", i);
			break;
		}
	}
//	printf("\n");
	
	if(t == 0){
		*path = *path + 1;
//		printf("Yes\n");
	}else{
				
		for(i = 0; i < N; i ++){
			if(bridge[now * N + i] == 1 && via[i] != 1){  // bridge[now][i]
				go(bridge, via_Copy, i, N, path);
			}
		}
	}
	
}

int main(){
	int N, M, a, b;
	int sc, i, j, k;
	int path = 0;
//	*path = 0;
	sc = scanf("%d %d", &N, &M);
	_Bool bridge[N][N];  // bridge[a][b] aからbに橋があれば１
	_Bool via[N];        // via[a]　通った島は1
	for(i = 0; i < N; i ++){
		for(j = 0; j < N; j ++){
			bridge[i][j] = 0;
		}
		via[i] = 0;
	}
	
	for(i = 0; i < M; i ++){
		sc = scanf("%d %d", &a, &b);
		bridge[a - 1][b - 1] = 1;
		bridge[b - 1][a - 1] = 1;
	}
	
	for(i = 0; i < N; i ++){
		for(j = 0; j < N; j ++){
//			printf("%d", bridge[i][j]);
		}
//		printf("\n");
	}
	
	go(&bridge[0][0], via, 0, N, &path);
	
	printf("%d\n", path);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <stdlib.h>
#include <vector>
#include <climits>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <iomanip>
#include <stdio.h>
using namespace std; 
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<a*b;
} 

Measured memory_bytes: 3672
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    
    if op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    elif op == "*":
        print(a*b)
    elif op == "/":
        print(a//b)
    else:
        break




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

int dp[100007];
bool f(int k, int arr[], int n){
    //cout<<k<<endl;
    //if(k<=0) return false;
    if(dp[k]!=-1) return dp[k];
    for(int i=0;i<n;i++){
        if(arr[i]<=k){
            bool temp = f(k-arr[i],arr,n);
            if(temp==false){
                dp[k] = 1;
                return true;
            }
        }
    }
    dp[k]=0;
    return false;
}


int main() {
    memset(dp,-1,sizeof(dp));
	int n, k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	if(f(k,arr,n)) cout<<"First";
	else cout<<"Second";
	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t N =0;
  int64_t m = 0;
  int64_t n = 0;
  cin >> N;
  int64_t sum = N+1;
  for(int i = 1; i <= floor(sqrt(N)); i++){
    if(N%i==0){
      if(N/i+i<=sum){
        m = N/i;
        n = i;
        sum = N/i+i;
      }
    }
  }
  cout << m+n-2;
}

Measured memory_bytes: 256
# B
count = 0
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab = 0
    for j in range(m):
        ab += a[j] * b[j] 
    if -c < ab:
        count += 1
print(count)

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

int main(){
   long long int a, b, c;
   cin >> a >> b >> c;
   if(a+b>c) cout << "No" << endl;
   else if( 4*a*b < (c-a-b)*(c-a-b) ) cout << "Yes" << endl;
   else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int a;
cin>>a;
int k;
cin>>k;
int y[a];
int min=1000000;
int g=0;
for(int i=0;i<a;i++){
cin>>y[i];
g+=y[i];
if(y[i]<min){
min=y[i];
}
}
cout<<(a+((k-g)/min));
 return 0;
}

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

using namespace std;

int main()
{
    string a,b;
    cin>>a>>b;
    int dp[a.size()+1][b.size()+1];
    for(int i=0;i<=a.size();i++)
    {
        for(int j=0;j<=b.size();j++)
        {
            dp[i][j]=0;
        }
    }
    for(int i=1;i<=a.size();i++)
    {
        for(int j=1;j<=b.size();j++)
        {
            if(a[i-1]==b[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
   /* for(int i=0;i<=a.size();i++)
    {
        for(int j=0;j<=b.size();j++)
        {
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
  if(dp[a.size()][b.size()]!=0)
   {
      int i=a.size()-1,j=b.size()-1;
      string em="";
      while(1)
      {
          if(i==0 || j==0)
          break;
          if(a[i]==b[j])
          {
              em+=a[i];
              i--,j--;
          }
          else if(i==0 && j==0)
          break;
          else
          {
              if(dp[i+1][j+1]==dp[i][j+1])
              {
                  i--;
              }
              else
              {
                  j--;
              }
          }
      }
      if(i==0)
      {
          for(int k=j;k>=0;k--)
          {
              if(a[0]==b[k])
              {
                  em.push_back(a[0]);
                  break;
              }
          }
      }
      else if(j==0)
      {
          for(int k=i;k>=0;k--)
          {
              if(a[k]==b[0])
              {
                  em.push_back(b[0]);
                  break;
              }
          }
      }
      reverse(em.begin(),em.end());
      cout<<em<<endl;

}
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
const int MAXN=1e2+7;
char s[MAXN],t[MAXN];
bool cmp(char x,char y){
	return x>y;
}
int main(void){
	gets(s);
	gets(t);
	int lens=strlen(s);
	int lent=strlen(t);
	std::sort(s,s+lens);
	std::sort(t,t+lent,cmp);
	//std::cout<<s<<std::endl<<t;
	for(int i=0;i<std::max(lens,lent);i++){
		if(s[i]<t[i]){
			std::cout<<"Yes"<<std::endl;
			return 0;
		}
		else if(s[i]>t[i]){
			std::cout<<"No"<<std::endl;
			return 0;
		}
	}
	std::cout<<"No"<<std::endl;
	return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

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

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

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

    int n,x;
    cin>>n>>x;
    vector<int> a(n,0);
    vector<int> b(n,0);
    vector<int> v(n,0);

    REP(i,n) cin>>a[i];
        REP(i, n) b[i] = abs(x - a[i]);
        v[0]=b[0];
        for (int i = 0; i < n - 1; i++)
        {
            v[i+1]=gcd(b[i+1],v[i]);
        }
    cout<<v[n-1]<<endl;
}

Measured memory_bytes: 1408
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	K = 1000;
	M = 0;
	vector<int>v(N);
	for (auto &i : v)cin >> i;
	for (int i = 0; i < N; i++) {
		K += M * v[i];
		M = 0;
		if (i + 1 < N&&v[i] < v[i + 1]) {
			M = K / v[i];
			K %= v[i];
		}
	}
	cout << K << endl;
}

Measured memory_bytes: 3656
#include<iostream>
int main(){
	int x, n;
	int a = 0;
	while (true){
		std::cin >> n >> x;
		if (n == 0 && x == 0){
			break;
		}
		else{
			int i, j, k;
			for (i = 1; i <= n; i++){
				
				for (j = 1; j <= n; j++){
					if (i == j){
						break;
					}
					else{
						for (k = 1; k <= n; k++){
							if (k == i || k == j || j == i){
								break;
							}
							else if (i + j + k == x){
								++a;
							}
						}

					}
				}
			}
		}
		std::cout << a << "\n";
		a = 0;
	}
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	char op;
	scanf("%d%*c%c%*c%d",&a,&op,&b);
	if(op == '+'){
		printf("%d",a+b);
	}else if(op == '-'){
		printf("%d",a-b);
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>

int main(){
    int n;
    std::cin >> n;
    while(n--){
        int a;
        std::cin >> a;
        if(a%2==0){
            if(a%3&&a%5){
                std::cout << "DENIED";
                return 0;
            }
        }
    }
    std::cout << "APPROVED";
}

Measured memory_bytes: 256
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5+5;
//const int MOD=1e9+7;

int main(){
	int N;
	cin>>N;
	int a[100];
	int sum=0;
	rep(i,N){
		cin>>a[i];
		sum+=a[i];
		a[i]*=N;
	}
	if(N==1)cout<<0;
	else{
		int ans=0;
		int df=abs(a[0]-sum);
		rep1(i,N-1){
			if(abs(a[i]-sum)<df){
				df=abs(a[i]-sum);
				ans=i;
			}
		}
		cout<<ans;
	}
}

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

int Har(long long n) {
  long long dig;
  long long sum=0;
  while(n){
    dig = n%10;
    sum+=dig;
    n/=10;
  }
  return sum;
}

int main() {
  long long n;
  cin>>n;
  if(n%Har(n)==0) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 384
n, m = [ int(v) for v in input().split() ]
shortest_distance = [ [ 10**8 for i in range(n) ] for j in range(n) ]
distance_path = [ [ [] for i in range(n) ] for j in range(n) ]

for i in range(m):
    a, b, c = [ int(v) for v in input().split() ]
    shortest_distance[a-1][b-1] = c
    shortest_distance[b-1][a-1] = c
    distance_path[a-1][b-1].append(i)
    distance_path[b-1][a-1].append(i)


for k in range(n):
    for i in range(n):
        for j in range(n):
            if i != j:
                if shortest_distance[i][j] > shortest_distance[i][k] + shortest_distance[k][j]:
                    shortest_distance[i][j] = shortest_distance[i][k] + shortest_distance[k][j]
                    distance_path[i][j] = distance_path[i][k] + distance_path[k][j]


path_used = [ False for i in range(m) ]
for i in distance_path:
    for j in i:
        for k in j:
            path_used[k] = True
print(path_used.count(False))


Measured memory_bytes: 46172
// Garg's Code
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i,x,n) for(ll i = x; i >= x; i--) 
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const ll MAX = LLONG_MAX, MOD = 1000000007, MODA = 1e9 - 1;
const ll MIN = LLONG_MIN;
const long double PI = 3.1415926535;

int main()
{
  fast();
  
  
  ll n,m ;
  cin >> n >> m;
  if(n == m)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<"LBWNB    "<<x<<"---\n"
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define p() puts("")
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")

using namespace std;
typedef long long ll;
const int mod=998244353;
const int inf=1e9+7;
const int maxn=1e5+10;
int a[maxn],b[maxn],c[maxn];
int n,m,x,y,z;
int main(){
    scanf("%d%d%d%d%d",&n,&m,&x,&y,&z);
    rep(i,1,x) scanf("%d",&a[i]);
    rep(i,1,y) scanf("%d",&b[i]);
    rep(i,1,z) scanf("%d",&c[i]);
    sort(a+1,a+x+1);
    sort(b+1,b+y+1);
    sort(c+1,c+z+1);
    int s1=x-n+1,s2=y-m+1,s3=z;
    ll s=0;
    rep(i,s1,x) s+=a[i];
    rep(i,s2,y) s+=b[i];
    while(s3>=1){
        while(s3>=1&&(s1>x||a[s1]>=c[s3])&&(s2>y||b[s2]>=c[s3])) s3--;
        if(s3<1) break;
        if(s1<=x&&s2<=y){
            if(a[s1]<b[s2]) s+=0ll+c[s3--]-a[s1++];
            else  s+=0ll+c[s3--]-b[s2++];
        }
        if(s1>x){
            if(b[s2]<c[s3]) s+=0ll+c[s3--]-b[s2++];
            else break;
        }
        if(s2>y){
            if(a[s1]<c[s3]) s+=0ll+c[s3--]-a[s1++];
            else break;
        }
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    int a,b,x;
    cin >> a >> b >> x;
    x *= 2;
    x = x/1000 + (x%1000 != 0);
    a = min(a,b*2);
    int ans = a*(x/2);
    if(x%2)ans += min(a,b);
    cout << ans << endl;
}



Measured memory_bytes: 3096
import java.util.*;

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

        int[] diffs = new int[n];
        for (int i = 0; i < n; i++) {
            diffs[i]= Math.abs(x - in.nextInt());
        }

        int gcd = diffs[0];
        for (int i = 1; i < diffs.length; i++) {
            gcd = gcd(gcd, diffs[i]);
        }

        System.out.println(gcd);

    }

    private static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
}


Measured memory_bytes: 52456
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,l] <- getIntList
    as <- getIntList
    let s = filter ((>= l) . snd) . zip [1..] $ zipWith (+) as (tail as)
    let r | null s = 0
          | otherwise = fst $ head s
    if r == 0 then
        putStrLn "Impossible"
    else do
        putStrLn "Possible"
        forM_ [1..r-1] $ \i -> print i
        forM_ [n-1,n-2..r] $ \i -> print i

Measured memory_bytes: 7336
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <climits>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int n;
vector<int>a;
int dp[201010];
int lis(){
    rep(i,201010)dp[i] = INT_MAX;
    rep(i,n){
        *lower_bound(dp,dp+201010,a[i]) = a[i];
    }
    return (int)(lower_bound(dp,dp+201010,INT_MAX)-dp);
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if(x1 > x2){
        swap(x1,x2);
        swap(y1,y2);
    }
    cin >> n;
    vector<pii>p(n);
    rep(i,n){
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(),p.end());
    rep(i,n){
        if(p[i].first >= x1 && p[i].first <=x2 && p[i].second >= min(y1,y2) && p[i].second <= max(y1,y2)){
            if(y1 <= y2){
                a.push_back(p[i].second);
            }else{
                a.push_back(-p[i].second);
            }
            
        }
    }
    n = (int)a.size();
    int k = lis();
    //cout << k << endl;
    int x = abs(x2-x1);
    int y = abs(y2-y1);
    long double hoge = 20.0-5.0*M_PI;
    long double fuga = 10.0*M_PI - 20.0;
    cout<<setprecision(100);
    if(k == min(x,y)+1){
        cout << 100.0*(x+y) - hoge*(k-1) + fuga << endl;
    }else cout << 100.0*(x+y)- hoge*k << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ld r;
	cin >> r;
	cout << 2 * pival * r << endl;    
	return 0;
}

Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <set>
using namespace std;

string s;
set<string > a;
int k;

int main() {
    cin >> s >> k;
    for(int i = 0; i < (int)s.length(); ++i) {
        int tot = min(k, (int)s.length() - i);
        for(int j = 1; j <= tot; ++j)
            a.insert(s.substr(i, j));
    }
    int pos = 0;
    for(auto i : a) {
        ++pos;
        if(pos == k) {
            cout << i;
            return 0;
        }
    }
}

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

int main(){
	int n;
	string s;
	cin>>n>>s;
	s.erase(unique(s.begin(),s.end()),s.end());
	cout<<s.size()<<endl;
	return 0;		
}

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

int main() {
  int n, x, me, s = 0;
  vector<int> m;
  cin >> n >> x;
  REP(i, n) {
    cin >> me;
    s += me;
    m.push_back(me);
  }
  sort(m.begin(), m.end());

  cout << n + (x - s) / m[0] << endl;

  return 0;
}

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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll f[26] = { };
	REP(i, s.size()) f[s[i]-'a']++;
	ll ans = 1;
	REP(i, 26) (ans *= (f[i]+1)) %= INF;
	cout << (ans+INF-1)%INF << endl;
	return 0;
} 


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int n, m;
	while(cin >> n >> m) {
		if(n == 0 && m == 0) break;

		vector<int> v(n+m);
		rep(i,n) cin >> v[i];
		rep(i,m) cin >> v[n+i];

		sort(v.begin(), v.end());
		v.insert(v.begin(), 0);

		int ans = 0;
		REP(i,1,v.size()) {
			ans = max(ans, v[i] - v[i-1]);
		}

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1316
n=int(input())
array = []
for i in range(1, int(n**0.5)+1):
  if n % i == 0:
    array.append(i)
    if i != n // i:
      array.append(n//i)
array.sort()
      
if len(array)%2==1:
  a=array[int(len(array)/2)]
  print(2*a-2)
else:
  a=array[int(len(array)/2)-1]
  b=array[int(len(array)/2)]
  print(a-1+b-1)
  

Measured memory_bytes: 3268
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int N, len;
string s;

int solve(int l, int r) {
    l++;
    // printf("l = %lld, r = %lld, ", l, r);
    // cout << s.substr(l, r-l) << endl;
    int cnt = 0;
    if(s[l] == '[') {
        vector<int> ns;
        int nl = -1, nr = -1;
        rep(i,l,r) {
            if(s[i] == '[') {
                cnt++;
                if(cnt == 1) nl = i;
            }
            else if(s[i] == ']') {
                cnt--;
                if(cnt == 0) {
                    nr = i;
                    int val = solve(nl, nr);
                    ns.push_back(val);
                }
            }
        }
        sort(ns.begin(), ns.end());
        int ret = 0, sz = ((int)ns.size() - 1) / 2 + 1;
        rep(i,0,sz) ret += ns[i];
        return ret;
    }
    else {
        int ret = 0;
        rep(i,l,r) ret = ret * 10 + (s[i] - '0');
        return (ret - 1) / 2 + 1;
    }
}

signed main() {
    cin >> N;
    while(N--) {
        cin >> s;
        len = s.length();
        cout << solve(0, len-1) << endl;
    }
    return 0;
}

Measured memory_bytes: 3224
import java.util.*;
 
import java.io.*;
 
public class Main{
 
    public static long Combination(long n, long r){
        long A = 1;
        long B = 1;
        for(long i = 0; i < r; i++){
            A = A*(n-i);
            B = B*(r-i);
        }
        if(A == 0) return 0;
        return A/B;
    }
 
    public static long solve(int i, int j, boolean check, int N, String S){
        if(i == N){
            if(j == 0){
                return 1;
            }else{
                return 0;
            }
        }
 
        if(j == 0) return 1;
 
        if(check){
            return Combination(N-i, j)*(long)Math.pow(9, j);
        }else{
            if(S.charAt(i) == '0') return solve(i+1, j, false, N, S);
            long Z = solve(i+1, j, true, N, S);
            long A = solve(i+1, j-1, true, N, S)*(S.charAt(i)-'1');
            long P = solve(i+1, j-1, false, N, S);
            return Z+A+P;
        }
 
 
    }
    
    public static long Dflag(long a){
        if(a == 1) return 1;
        long h = Dflag(a/2);
        return h + h + 1;
    }
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        String S = s.next();
        String T = s.next();
        boolean c = false;

        for(int i = 0; i < S.length(); i++){
            if(S.charAt(i) == T.charAt(i)){

            }else{
                c = true;
            }
        }
        
        if(c){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
	}
} 

Measured memory_bytes: 35700
/* Author: Mrigank
Science is what we understand well enough to explain to a computer, 
    Art is everything else we do - Donald E. Knuth */

#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <string> 
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair < ll , ll > PLL;
typedef pair<int, int> PII;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < pair < ll , ll > > vpl;
typedef vector < pair < ll , bool > > vpb;
typedef vector < vector < int > > vvi;
typedef vector < vector < ll > > vvl;


#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x , val) memset(x , val , sizeof(x))
#define deb(x) cout<<#x<<" :: "<<x<<"\n"
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define all(x) x.begin() , x.end()
#define alls(x , y) x.begin() , x.end() , y
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl "\n"

const ll mxsize = 3e5 + 10;
const ll linf = 1e9;
const ld inf = 10000000000.0;
const ll mod = 1e9 + 7;
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 

int main()
{
    fastIO;
    unordered_set < string > s;
    ll n;
    cin >> n;
    ll i;
    fo(i , n)
    {
        string s1;
        cin >> s1;
        s.insert(s1);
    }
    cout << (ll)s.size() << endl;
}

Measured memory_bytes: 17624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0587?year=2006>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll n,m; cin >> n >> m;
    res = m;
    
    for(int i = 0; i < n;i++){
        ll u,v; cin >> u >> v;
        m += u - v;
        res = max(res,m);
        if(m < 0) return 0;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}



Measured memory_bytes: 3180
#include<iostream>
using namespace std;
int main(){
int n,i,j;
  cin >> n;
  for(i=1;i<=9;i++){
    for(j=1;j<=9;j++){
      if(i*j==n){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
#define deb debug("line %d\n",__LINE__)
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("-1");exit(0);}

	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int MM=1e6+10;
	ll fac[MM],facinv[MM],Inv[MM];ll Comb(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,MM-1) fac[i]=fac[i-1]*i%MOD;
		facinv[MM-1]=invm(fac[MM-1]);fd(i,MM-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,MM-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	int dis[N];deque<pii> q;
	void main()
	{
		int K=qread();fo(i,0,K-1) dis[i]=INF;dis[1]=1;q.PB({1,1});
		while(sz(q))
		{
			int x=q.front().FR,d=q.front().SE;q.pop_front();if(dis[x]!=d) continue;
			if(dis[(x*10)%K]>d) dis[(x*10)%K]=d,q.push_front({(x*10)%K,d});
			if(dis[(x+1)%K]>d+1) dis[(x+1)%K]=d+1,q.push_back({(x+1)%K,d+1});
		}write(dis[0]);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();
	mine::main();
	debug("\n------------------------------------------\nTime: %.2lf s\n",1.0*clock()/CLOCKS_PER_SEC);
}

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

int main(){
    char str[100009], vazio[500003];
    int tam = 0, casa = 0;
    scanf("%s", str);
    
    tam = strlen(str);
    
    for (int i = 0; i < tam; ++i){
        if (i % 2 == 0){
            vazio[casa] = str[i];
            casa += 1;
        }
    }
    printf("%s\n", vazio);
    
    
    return 0;
}

Measured memory_bytes: 384