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

using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;

    vector<int> hist_s(26, 0), hist_t(26, 0);

    for (auto ch : s)
    {
        hist_s[ch - 'a']++;
    }

    for (auto ch : t)
    {
        hist_t[ch - 'a']++;
    }

    sort(hist_s.begin(), hist_s.end());
    sort(hist_t.begin(), hist_t.end());

    bool success = true;
    for (int i = 0; i < 26; i++)
    {
        if (hist_s[i] != hist_t[i])
        {
            success = false;
        }
    }
    cout << (success ? "Yes" : "No") << endl;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
#define long long long
using namespace std;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n,x;cin>>n>>x;int gcd=0;
  for(int i=1;i<=n;i++)
  {
    int z;cin>>z;z=abs(z-x);
    gcd=__gcd(gcd,z);
  }
  cout<<gcd<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> s;
	if(s[0] == 'S'){
		print("Cloudy")	
	}
	if(s[0] == 'C'){
		print("Rainy")	
	}
	if(s[0] == 'R'){
		print("Sunny")	
	}
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
a = 0
while sum(h) > 0:
    lst = [i for i, x in enumerate(h) if x > 0]
    mx = min(lst)
    for i in range(len(lst) -1):
        if lst[i] + 1 == lst[i+1]:
            mx += 1
        else:
            break
    h = [x - 1 if i >= min(lst) and i <= mx else x for i, x in enumerate(h)]
    a += 1
print(a)

Measured memory_bytes: 3188
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc =new Scanner(System.in);
        int num_a=0,num_b=0,num_c=0;
        String S;
        S = sc.next();
        for(int a=0;a<S.length();a++){
            if(S.charAt(a)=='a') num_a++;
            else if(S.charAt(a)=='b') num_b++;
            else num_c++;
        }
        if(num_a==1&&num_b==1&&num_c==1) System.out.println("Yes");
        else System.out.println("No");
    }
}


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

using namespace std;

int main() 
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	long long int a,b;
	vector <pair<long long int,long long int>> v;
	long long int res = 0;
	long long int sum = 0;
	
	cin >> n;
	
	for(int i=0;i<n;i++)
	{
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}
	
	for(int i=n-1;i>=0;i--)
	{
		long long int val = (v[i].first + sum)%v[i].second;
		if(val==0)
		{
			continue;
		}
		res += (v[i].second - val);
		sum += (v[i].second - val);
	}
	
	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
using vc = vector<char>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

struct Edge{
  int from;
  int to;
  long cost;
};

long k;

void dfs(vector<vector<Edge>> &Graph, vector<long> &num, int v, int pv){
  long cnt = k - 2 + (pv == -1);
  for(Edge ed : Graph.at(v)){
    int nv = ed.to;
    if(pv == nv) continue;
    //cout << nv << endl;
    num.at(nv) = cnt;
    cnt--;
    dfs(Graph,num,nv,v);
  }
}

int main(){
  long n;
  cin >> n >> k;
  vector<vector<Edge>> Graph(n);
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--;b--;
    //cout << a << " " << b << endl;
    Graph.at(a).push_back(Edge{a,b,1});
    Graph.at(b).push_back(Edge{b,a,1});
  }
  vector<long> num(n);
  num.at(0) = k;
  dfs(Graph, num, 0, -1);
  long ans = 1;
  rep(i,n){
    //cout << num[i] << endl;
    ans *= num[i];
    ans %= MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 14464
#include <iostream>
#include <algorithm>
using namespace std;
int main( void )
{
	int x, y;
	while ( cin >> x >> y )
	{
		if ( x > y )
			swap( x, y );

		while ( x != 0 && y != 0 )
		{
			y = y % x;
			if ( x > y )
				swap( x, y );
		}

		cout << y << endl;

	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    bool maki=false;
    int mi=0,ma=1e4,mid=(mi+ma)/2;
    while(mi!=mid){
        if(mid*(mid+1)/2==n){
            maki=true;
            break;
        }
        else if(mid*(mid+1)/2<n){
            mi=mid;
        }
        else{
            ma=mid;
        }
        mid=(ma+mi)/2;
    }
    if(maki){
        for(int i=1;i<=mid;i++){
            cout << i<<endl;
        }
    }else{
        int x=ma*(ma+1)/2-n;
        for(int i=1;i<=ma;i++){
            if(x!=i){
                cout << i<<endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <iomanip>
#include <functional>
#include <array>
#include <climits>
#include <cmath>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;
const ll LL_MAX = 0x7fffffffffffffff;

int main()
{
    int x[3], k;
    vector<ll> a[3];
    cin >> x[0] >> x[1] >> x[2] >> k;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < x[i]; j++)
        {
            ll aa;
            cin >> aa;
            a[i].push_back(aa);
        }
        sort(a[i].begin(), a[i].end(), greater<ll>());
    }

    vector<ll> r;
    for (int i = 0; i < x[0]; i++)
    {
        for (int j = 0; j < x[1]; j++)
        {
            for (int n = 0; n < x[2]; n++)
            {
                if ((i + 1) * (j + 1) * (n + 1) <= k)
                {
                    r.push_back(a[0][i] + a[1][j] + a[2][n]);
                }
            }
        }
    }
    sort(r.begin(), r.end(), greater<ll>());
    for (int i = 0; i < k; i++)
    {
        cout << r[i] << endl;
    }
    return 0;
}




Measured memory_bytes: 1412
#include <set>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <limits>
#include <map>
#include <numeric>

#define ll long long
using namespace std;
static ll imin = std::numeric_limits<ll>::min();
static ll imax = std::numeric_limits<ll>::max();
#define rep(i, n) for(int i = 0; (i)<(n); ++(i))
#define rep1(i, n) for(int i = 1; (i)<(n); ++(i))
#define rev_rep(i, n) for(int i = (n) - 1; (i) >= 0; --(i))
#define range(a, i, b) for(int i = (a); (i) < (b); ++(i))
#define dump(x) cout << #x << ":" << x << "\n";
#define all(v) v.begin(), v.end()
#define readl(N) ll N; cin >> N
#define readlv(N, vec) vector<ll> vec(N); rep(i, N){cin >> vec[i];}
#define greater_than [](ll l, ll r){return l > r;}
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair);
template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec);
template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::pair<T1, T2>& pair){
  os << '(' << pair.first << ',' << pair.second << ')';
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::vector<T>& vec){
  std::size_t n = vec.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(int i = 0; i<n - 1; ++i){
    os << vec[i] << " ";
  }
  os << vec[n - 1];
  os << std::endl;
  return os;
}

template<class T1, class T2>
std::ostream& operator << (std::ostream& os, std::map<T1, T2>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

template<class T>
std::ostream& operator << (std::ostream& os, std::set<T>& mp){
  std::size_t n = mp.size();
  if(n == 0){
    return os;
  }
  os << " ";
  for(auto && x:mp){
    os << x << " ";
  }
  os << std::endl;
  return os;
}

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

#ifndef BOOST_TEST_MAIN
int main(int const argc, char const** argv){
  const ll mod = 1000000007;
  readl(H);
  readl(W);
  readl(K);

  vector<vector<ll>> dp(H + 1, vector<ll>(W, 0));
  dp[0][0] = 1;

  rep(h, H){
    rep(w, W){
      rep(x, 1 << (W - 1)){ // mask
        bool ok = true;
        rep(l, W - 2){
          if((x & (1 << l)) && (x & (1 << (l + 1)))){
            ok = false;
          }
        }

        if(ok){
          if(w >= 1 && x & (1 << (w - 1))){ // left
            dp[h + 1][w - 1] += dp[h][w];
            dp[h + 1][w - 1] %= mod;
          }else if(w <= W - 2 && x & (1 << w)){//right
            dp[h + 1][w + 1] += dp[h][w];
            dp[h + 1][w + 1] %= mod;
          }else { // strait
            dp[h + 1][w] += dp[h][w];
            dp[h + 1][w] %= mod;
          }
        }
        
      }
    }
  }
  cout << dp[H][K - 1];
  
}
#endif


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

int main() {
	int K,N;
  	cin>> K >> N;
  	vector<int> a(N);
  	int sum=0;
  
  	for(int i=0;i<N;i++){
     	 cin>>a.at(i);
      	 sum+=a.at(i);
    }
  	if(K>sum){
      	cout<<"No"<<endl;
    }  	
  	else{
     	cout<<"Yes"<<endl; 
    }
}

Measured memory_bytes: 640
/* All men have limits. They learn what they are and learn
   not to exceed them, I ignore mine. -Batman           */
#include <bits/stdc++.h>
//#include <iostream>
//#include <vector>
//#include <Windows.h>
using namespace std;

int main(){
int a,b,c,d;
cin>>a;
while(a--){
	cin>>b>>c>>d;
	if(b*b+c*c==d*d||b*b+d*d==c*c||d*d+c*c==b*b)
	cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

return 0;
}

Measured memory_bytes: 3000
#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;
typedef pair<ll, ll> pii;
#define fi first
#define se second
#define show(x) cout << #x << " is " << x << "\n";
const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ld pi = 3.141592653589793238462643383279502884;

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

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];
	}
	sort(a, a+n, greater<ll>());
	ll ans=0;
	int j=0;
	if(n==2) cout<<a[0];
	else if(n==3) cout<<a[0]+a[1];
	else{
		ans=a[0]+a[1];
		j=1;
		for(int i=3;i<n;i++){
			if(i%2==0) j++;
			ans+=a[j];
		}
		cout<<ans;
	}
	

    return 0;
}


Measured memory_bytes: 5212
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	unsigned long long n, a[100001];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a + n);

	if (a[0] == 0) {
		cout << 0;
		return 0;
	}

	constexpr unsigned long long max = 1e18;
	unsigned long long ans = 1;
	for (int i = 0; i < n; i++) {
		if (ans <= max / a[i])
			ans *= a[i];
		else {
			cout << -1;
			return 0;
		}


	}

	cout << ans;

	return 0;
}


Measured memory_bytes: 4400
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <limits>
#include <numeric>
#include <functional>
#define FOR(i, a, n) for (int i = (a); i < (n); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using namespace std;

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

	int N,M,X,Y;
	int temp;
	vector<int> Xn;
	vector<int> Ym;
	int land[200];

	cin >> N >> M >> X >> Y;

	REP(i, 200)land[i] = 1;
	REP(i, X + 101)land[i] = 0;
	for (int i = Y + 101; i < 200; i++)land[i] = 0;

	REP(i, N)
	{
		cin >> temp;
		Xn.push_back(temp);
	}

	REP(i, M)
	{
		cin >> temp;
		Ym.push_back(temp);
	}

	sort(Xn.begin(), Xn.end(), greater<int>());
	sort(Ym.begin(), Ym.end());

	REP(i, Xn[0]+101)land[i] = 0;
	FOR(i, Ym[0] + 101, 200)land[i] = 0;

	REP(i, 200)
	{
		if (land[i] == 1)
		{
			temp = 1;
			break;
		}
		else
		{
			temp = 0;
		}
	}

	if (temp == 1)
	{
		cout << "No War" << endl;
	}
	else
	{
		cout << "War" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
double v;
MinHeap<double> h;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> v;
        h.push(v);
    }

    while (h.size() > 1) {
        double a = h.top(); h.pop();
        double b = h.top(); h.pop();

        h.push((a + b) / 2);
    }

    printf("%.*lf\n", DBL_DIG, h.top());
    
    return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.strip.split.map(&:to_i)
b = gets.strip.split.map(&:to_i)
c = gets.strip.split.map(&:to_i)
sum = 0
for i in 0..n-2
  sum += b[a[i]-1]
  if a[i+1] == a[i]+1
    sum += c[a[i]-1]
  end
end
puts sum + b[a[n-1]-1]

Measured memory_bytes: 14320
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 50;
int n, m, q, ans, X[10];
int A[N], B[N], C[N], D[N];
void f(int a, int d){
  if(d==n){
    int s = 0;
    FOR(i, 0, q) if(X[B[i]]-X[A[i]]==C[i]) s += D[i];
    maxs(ans, s);
  }else FOR(i, a, m){
    X[d] = i;
    f(i, d+1);
  }
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  FOR(i, 0, q){
    cin >> A[i] >> B[i] >> C[i] >> D[i];
    A[i]--;
    B[i]--;
  }
  f(0, 0);
  cout << ans << endl;
}

Measured memory_bytes: 3604
def main():
    # 解説AC
    N = int(input())
    AB = [[int(i) for i in input().split()] for j in range(N)]
    AB.sort(reverse=True, key=lambda p: p[0]+p[1])
    X = sum(-b for a, b in AB)
    for i in range(0, N, 2):
        X += sum(AB[i])
    print(X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64984
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,ans;
    long long x,y;
    cin>>x>>y;

    if(x*4<y) cout<<"No"<<endl;
    else if(x*2>y) cout<<"No"<<endl;
    else if(y%2!=0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}


Measured memory_bytes: 3636
//daddy's back in town, back to rolling the damn hash yoooo babeeeeees//
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = (int)1e9 + 7;
int n, m, viz[100010], ans;
vi g[100010];

void dfs(int nod){
	viz[nod]=1;
	for(int i : g[nod]){
		if(viz[i]==0) dfs(i);
	}
}

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	cin>>n>>m;
	for(int i=1; i<=m; i++){
		int x, y, z;
		cin>>x>>y>>z;
		g[x].pb(y);
		g[y].pb(x);
	}
	for(int i=1; i<=n; i++){
		if(viz[i]==0) dfs(i), ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 9600
/*  ****************************

        Author: Devanshu Chaudhari  

        Institution: Indian Institute of Technology Roorkee
    
    ********************************/  
    
    
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x,y,z;
    	cin>>y>>z>>x;
    	int num1 = max(y,z);
    	int result = (x+num1-1)/num1;
    	cout<<result<<endl;
    }

Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
from collections import Counter
cnt = Counter(A)
ans = 0
for key,val in cnt.items():
    if val>=2:
        ans += val*(val-1)//2
for a in A:
    cur = ans
    if cnt[a]>=2:
        cur -= cnt[a]-1
    print(cur)

Measured memory_bytes: 108408
#include <iostream>

using namespace std;

int main()	{
  int a, b, c;
  cin >> a >> b >> c;
  for (int i = a; i < b * a; i+=a)	{
    if ((i % b) == (c % b))	{
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

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

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const ll INF = 0x3fffffff;

int check(int a, int b, int c, int d){
	int s1 = a * (c+d);
	int s2 = b * c;
	int s3 = b * d;
	int mx = max(s1, max(s2, s3));
	int mn = min(s1, min(s2, s3));
	return mx - mn;
}

int H, W, ans=INF;
void solve(int H, int W){
		int a = H/3;
		int b = H - H/3;
		int c = W/2;
		int d = W - W/2;

		chmin( ans, check(a,b,c,d) );
		c++;
		d--;
		chmin( ans, check(a,b,c,d) );
		c--;
		d++;

		a++;
		b--;
		chmin( ans, check(a,b,c,d) );
		c++;
		d--;
		chmin( ans, check(a,b,c,d) );
		c--;
		d++;

		a++;
		b--;
		chmin( ans, check(a,b,c,d) );
		c++;
		d--;
		chmin( ans, check(a,b,c,d) );
		c--;
		d++;
}

void solve2(int H, int W){
	int a = H/3;
	int b = (H - a)/2;
	int c = H - a - b;
	int s1 = a * W;
	int s2 = b * W;
	int s3 = c * W;
	int mx = max(s1, max(s2, s3));
	int mn = min(s1, min(s2, s3));
	chmin( ans, mx - mn);
}

int main(){
	//ios_base::sync_with_stdio(0);

	cin >> H >> W;

	if( H%3 == 0 ){
		ans = 0;
	}else if( W%3 == 0 ){
		ans = 0;
	}else{
		solve(H, W);
		solve(W, H);
		solve2(H, W);
		solve2(W, H);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N=3005,Mod=1e9+7;
int dp[N][N];//dp[i][j]表示前i个位置填满了，后面有j个1可以随便填的方案数 
int r[N],a[N],sum[N];
char s[N];
inline int Max(int a,int b){
	return a>b?a:b;
}
inline int Min(int a,int b){
	return a<b?a:b;
}
inline void mo(int&x){
	x=(x<Mod?x:x-Mod);
}
int main (){
	int n,m;scanf ("%d%d",&n,&m);
	scanf ("%s",s+1);
	for (int i=1;i<=n;i++) a[i]=s[i]-'0';
	for (int i=1;i<=n+1;i++) r[i]=i,sum[i]=sum[i-1]+a[i];
	for (int i=1,x,y;i<=m;i++){
		scanf ("%d%d",&x,&y);
		r[x]=Max(r[x],y);
	}
	for (int i=1;i<=n;i++) r[i]=Max(r[i],r[i-1]);
	dp[1][sum[r[1]]]=1;
	for (int i=1;i<=n;i++)
		for (int j=0;j<=n;j++)
			if (dp[i][j]){
				int L=r[i]+1,R=r[i+1];
				if (j) mo(dp[i+1][j-1-sum[L-1]+sum[R]]+=dp[i][j]);
				if (r[i]-i-j+1) mo(dp[i+1][j-sum[L-1]+sum[R]]+=dp[i][j]);
			}
	printf ("%d",dp[n+1][0]);
	return 0;
}


Measured memory_bytes: 33920
#include <stdio.h>
int main (){
int n;
double a[1000];
double sum=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
    scanf("%lf",&a[i]);
}
for(int i=0;i<n;i++){
    sum=sum+(1/a[i]);
}
sum=1/sum;
printf("%lf",sum);
return 0;
}

Measured memory_bytes: 128
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (b - a == c - b ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef pair<string,int> Pa;
int main(){
	vector<Pa> vec;
	int T[101]={0};
	int N,P;
	string S;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>S>>P;
		T[P]=i+1;
		vec.push_back(Pa(S,-P));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<N;i++)cout<<T[-vec[i].second]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  string s; cin >> s;
  int n = s.size();
  vector<int> rl;
  for (int i = 1; i < n; i ++) {
    if (s[i - 1] == 'R' && s[i] == 'L') rl.push_back(i - 1);
  }

  vector<int> ans(n, 0);
  rep(i, n) {
    int x = lower_bound(rl.begin(), rl.end(), i) - rl.begin();
    if (s[i] == 'R') {
      if ((rl[x] - i) % 2 == 0) ans[rl[x]] ++;
      else ans[rl[x] + 1] ++;
    } else {
      x --;
      if (x < 0) x = 0;
      if ((i - rl[x] + 1) % 2 == 0) ans[rl[x] + 1] ++;
      else ans[rl[x]] ++;
    }
  }

  rep(i, n) {
    if (i) cout << " ";
    cout << ans[i];
  }
  cout << endl;
}

Measured memory_bytes: 1280
import java.util.Scanner;
class Main 
{
  public static void main(String[] args) 
  {
    Scanner input=new Scanner(System.in);
    int a=input.nextInt();
    int b=input.nextInt();
    int c=input.nextInt();
    if(b>=1 && b<=1000 && c>=1 && c<=1000 && a>=(b+c) && a<=10000)
    {
     a=a-b;
     int temp=a%c;
     System.out.println(temp);
    }
  }
}

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

int main(){
  int a = 0 , N;
  cin >> N;
  vector<int> H(N),X(N,0);
  for (int i = 0; i < N; i++){
    cin >> H.at(i);
  }
  if (N > 1) {
    for (int i = 0; i < N-1; i++){
      if ( i == 0 || (i > 0 && H.at(i) >= H.at(i+1) && H.at(i-1) < H.at(i) )) {
        int j = i;
        while ( j < N-1 && H.at(j) >= H.at(j+1) ) {
          X.at(i) ++;
          j++;
        }
      }
    }
  }
  sort( X.begin(), X.end() );
  cout << X.at(N-1) << endl;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = INT_MAX / 2;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int N; cin >> N;
	vector<ll> a(N);
	rep(i, N) cin >> a[i];
	ll m = a[0];
	rep(i, N) m = lcm(m, a[i]);
	cout << m << endl;
}


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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var s = GetStr();
            for (int i = 0; i < s.Length; i += 2){
                Console.Write(s[i]);
            }

            //Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }





        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13140
import Control.Applicative ((<$>))
import Data.Bool (bool)

main :: IO ()
main = solve <$> readLn >>= putStrLn

solve :: Int -> String
solve n = bool "No" "Yes" $ n `elem` ls
  where ls = do
          i <- [0..25]
          j <- [0..14]
          let x = 4 * i + 7 * j
          return x


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

using namespace std;

int main(){
    int n1, n2, n3, n4;
    cin >> n1 >> n2 >> n3 >> n4;
    vector<int> n(4);

    n[0] = n1;
    n[1] = n2;
    n[2] = n3;
    n[3] = n4;

    sort(n.begin(), n.end());
    if(n[0] == 1 && n[1] == 4){
        if(n[2] == 7 && n[3] == 9){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }else{
        cout << "NO" << endl;
    }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

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

int main() {
    int num; cin >> num;
    rep(k,0,num) {
        string s1,s2;
        cin >> s1 >> s2;

        int dp[1001][1001]; //s1???i??????????????§???s2???j??????????????§??§???LCS????±???????????????????
        int n = s1.length();
        int m = s2.length();
        rep(i,0,m+1) dp[0][i] = 0;

        rep(i,0,n) {
            rep(j,0,m) {
                if(s1[i]==s2[j]) dp[i+1][j+1] = dp[i][j] + 1;
                else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
            }
        }
        cout << dp[n][m] << endl;
    }
    return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

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

    double now = 100;
    int ans = 0;
    for (int n = 1; ; ++n) {
        now *= 101;
        now /= 100;
        now = (double)floor(now);
        if (now >= x) {
            ans = n;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3652
from collections import Counter
import sys

s = input()
counter = Counter(s[2:-1])

if s[0] == 'A':
    s = s.lstrip('A')
else:
    print('WA')
    sys.exit(0)

if counter['C'] == 1:
    s = s.replace('C', '')
else:
    print('WA')
    sys.exit(0)

if s.islower():
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  char op;
  cin >> A >> op >> B;
  
  int ans = 0;
  
  if(op == '+'){
    ans = A + B;
  }  
  if(op == '-'){
    ans = A - B;
  }
  
  cout << ans <<endl;
  
}

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

int bucket[60];

int main()
{
  int N, M;
  cin >> N >> M;
  
  rep(i, M)
  {
    int a, b;
    cin >> a >> b;
    
    bucket[a - 1]++;
    bucket[b - 1]++;
  }
  
  rep(i, N)
  {
    cout << bucket[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main(){
      int mod=1000000007;
      int n;
      long long int sum=0;
      cin>>n;
      int arr[n];
      for(int i=0;i<n;i++)
        cin>>arr[i];
      long long int tsum=0;
      for(int i=0;i<n;i++)
       tsum=(tsum+arr[i])%mod;
      for(int i=0;i<n;i++){
        tsum-=arr[i];
        if(tsum<0)
          tsum+=mod;
        int prod=(arr[i]*tsum)%mod;
        sum=(sum+prod)%mod;
      }
      cout<<sum;
      return 0;
    }

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

vector<int> vi;

const char o = 'o';
const char x = 'x';

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

    if (S[0] == o && S[1] == o && S[2] == o) cout << 1000 << endl;
    if (S[0] == o && S[1] == o && S[2] == x) cout << 900 << endl;
    if (S[0] == o && S[1] == x && S[2] == x) cout << 800 << endl;
    if (S[0] == x && S[1] == x && S[2] == x) cout << 700 << endl;
    if (S[0] == x && S[1] == o && S[2] == o) cout << 900 << endl;
    if (S[0] == x && S[1] == o && S[2] == x) cout << 800 << endl;
    if (S[0] == o && S[1] == x && S[2] == o) cout << 900 << endl;
    if (S[0] == x && S[1] == x && S[2] == o) cout << 800 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
string s1;
string s2;
int l1,l2;
int maxlong[3001][3001];
 
signed main()
{
	ios::sync_with_stdio(false);
	cin>>s1>>s2;
	l1 = s1.length() ; l2 = s2.length() ;
	for(int i = l1 ; i>= 0 ; i--)
	{
		for(int j = l2 ; j>= 0 ; j--)
		{
			if(i==l1 || j==l2)
			{
				maxlong[i][j]=0;
				continue;
			}
			if(s1[i]==s2[j])
			{
				maxlong[i][j] = maxlong[i+1][j+1]+1;
				continue;
			}
			maxlong[i][j] = max(maxlong[i+1][j],maxlong[i][j+1]);
		}
	}
	int i=0,j=0;
	while(i!=l1&& j!=l2)
    {
        if(i<l1 && maxlong[i+1][j]== maxlong[i][j] )
        {
            i++;
            continue;
        }
        if(j<l2 && maxlong[i][j+1]== maxlong[i][j] )
        {
            j++;
            continue;
        }
        cout<<s1[i];
        i++;
        j++;
    }
}

Measured memory_bytes: 35456
/*#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
# define ll unsigned long long
# define int long long  //comment it out when MLE
# define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define mo 998244353
//# define MOD 163577857
# define pi acos(-1)
# define fi first
# define se second
#define REP(i,n) for (int i = 1; i <= n; i++)
const ll mod = 1000000007;
const int K = 2;
//typedef vector<vector<int> > matrix;
/*
int add(int a, int b,int mod) {
    a%=mod;
    b%=mod;
	a += b;
	if (a >= mod) a -= mod;
	if(a<0)
    {
        a += mod;
        a %= mod;
    }
	return a;
}

int mul(ll a, int b,int mod) {
    a%=mod;
    b%=mod;
	a *= b;
	a += mod;
	return a % mod;
}
int po(int a,int b,int mod)
{
    if(b==0)
        return 1;
    if(b%2==0)
        return po(mul(a,a,mod),b/2,mod);
    return mul(a,po(mul(a,a,mod),(b-1)/2,mod),mod);
}


ll fact[1000003];
ll inv[1000003];

void fact0()
{
	int i,j;
	fact[0]=1;
	for(i=1;i<=200000;i++)
	{
		fact[i]=i*fact[i-1]%mod;
	}
	inv[0]=1;
	inv[1]=1;
	ll p=mod;
	for (i=2; i<=200000; i++)
		inv[i] = (p - (p/i) * inv[p%i] % p) % p;

	for(i=2;i<=200000;i++)
	{
		inv[i]*=inv[i-1];
		inv[i]%=mod;
	}
}
*/

signed main(){
   gok

   int x,n;
   cin>>x>>n;
   int a[n];
   map<int,int> mp;
   for(int i=0;i<n;i++){
    cin>>a[i];
    mp[a[i]]=1;
   }
   int ma=1e9,an;
   for(int i=0;i<=200;i++)
   {
       if(mp[i]==0)
       {
           int tt = abs(x-i);
           if(tt<ma)
           {
               ma=tt;
               an=i;
           }
       }
   }
   cout<<an;
















 return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, long long>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);

const int dpsize = 1<<26;
vector<int> dp;

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

  string s; cin >> s;
  int n=s.size();
  vector<int> a(n);
  a[0] = 1<<(s[0] - 'a');
  for(int i=1; i<n; i++) {
    a[i] = a[i-1] ^ (1<<(s[i]-'a'));
  }

  dp.resize(1<<26);
  for(int i=0; i<(1<<26); i++) {
    dp[i] = INT_MAX;
  }

  vector<int> opt(n);
  dp[0]=0;

  for(int i=0; i<n; i++) {
    int now = dp[a[i]];
    for(int j=0; j<26; j++) {
      int x = 1<<j;
      chmin(now, dp[x^a[i]]);
    }
    opt[i] = now+1;
    //debugln(opt[i]);
    chmin(dp[a[i]], opt[i]);
  }

  cout << opt[n-1] << endl;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, DP[3005][3005];
string S, T;
char ans[3005];

int main(){
  cin >> S >> T;
  N = S.length(); M = T.length();

  for (int i = 1; i <= N; i++){
    for (int j = 1; j <= M; j++){
      if (S[i-1] == T[j-1]){
        DP[i][j] = DP[i-1][j-1] + 1;
      }else{
        DP[i][j] = max(DP[i-1][j], DP[i][j-1]);
      }
    }
  }

  int I = N, J = M;
  while (I >= 0 && J >= 0 && DP[I][J] > 0){
    if (DP[I][J] == DP[I-1][J]){
      I--;
    }else if (DP[I][J] == DP[I][J-1]){
      J--;
    }else{
      ans[DP[I][J]] = S[I-1];
      I--; J--;
    }
  }

  for (int i = 1; i <= DP[N][M]; i++){
    cout << ans[i];
  }
  cout << endl;


  return 0;
}


Measured memory_bytes: 38788
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <chrono>
using namespace std;

int main(int argc, const char * argv[]) {
    
    string S;
    cin >> S;
    
    string ans;
    for (int i = 0; i < S.size(); i += 2) {
        ans.push_back(S.at(i));
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
long long int __lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
 //__gcd 最大公約数
 //__lcm 最小公倍数
 //double 少数（変数）
//sqrt ルート
//ceil 天井関数
//floor 床関数
 
int main() {
  int a;
  cin>>a;
  vector<int> b(a);
  for(int i=0;i<a;i++)
    cin>>b[i];
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  int c=b[0]/2;
  for(int i=1;i<a;i++)
    c+=b[i];
  cout<<c;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

const mod = 998244353
const facNum = 300001
const INF = 10000000007

func main() {
	sc := newScanner(os.Stdin)
	X, Y, a, b, c := sc.i(), sc.i(), sc.i(), sc.i(), sc.i()
	A := sc.is(a)
	B := sc.is(b)
	C := sc.is(c)

	sort.Slice(A, func(i, j int) bool { return A[j] < A[i] })
	sort.Slice(B, func(i, j int) bool { return B[j] < B[i] })
	sort.Slice(C, func(i, j int) bool { return C[j] < C[i] })
	x := X - 1
	y := Y - 1
	i := 0
	for i < c && ((x >= 0 && C[i] > A[x]) || (y >= 0 && C[i] > B[y])) {
		a = INF
		if x >= 0 && C[i] > A[x] {
			a = A[x]
		}
		b = INF
		if y >= 0 && C[i] > B[y] {
			b = B[y]
		}
		m := min(a, b)
		if m == a {
			A[x] = C[i]
			x--
		} else {
			B[y] = C[i]
			y--
		}
		i++
	}
	sum := 0
	for i := 0; i < X; i++ {
		sum += A[i]
	}
	for i := 0; i < Y; i++ {
		sum += B[i]
	}
	fmt.Println(sum)
}

// fmt.Println("Yes")
// fmt.Println("No")

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

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

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


Measured memory_bytes: 7076
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        if (a <= 8 && b <= 8) {
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }
        
    }
}

Measured memory_bytes: 21844
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char t = in.next().charAt(0);
            char x = in.next().charAt(0);

            if (t < x) {
                out.print("<");
            } else if (t > x) {
                out.print(">");
            } else {
                out.print("=");
            }
        }

    }
}



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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

int main(void){
    int N, K;
    scanf("%d %d",&N, &K);

    double ans=0;
    double filter=K;
    double p=1;

    int i=N;
    while(i>0){
        if(i>=filter){
            //printf("%lf\n",p);
            ans+=p;
            i--;
        }
        else{
            filter=filter/2;
            p=p/2;
        }
    }

    ans=ans/N;
    printf("%.9f\n",ans);

    return 0;
}

Measured memory_bytes: 128
class SegmentTree:
    def __init__(self, a):    
        self.n = len(a)
        self.N = 2 ** (self.n-1).bit_length()
        l = []
        for _a in a:
            l.append(1 << ord(_a)-97)
        self.data = [0]*(self.N-1) + l + [0]*(self.N-self.n)
        for i in range(2*self.N-2, 0, -2):
            self.data[(i-1)//2] = self.data[i] | self.data[i-1]
    
    def update(self, i, x):
        idx = self.N - 1 + i
        self.data[idx] = 1 << ord(x)-97
        while idx:
            idx = (idx-1) // 2
            self.data[idx] = self.data[2*idx+1] | self.data[2*idx+2]
    
    def query(self, i, j):
        # [i, j)
        if i == j:
            return bin(self.data[self.N - 1 + i]).count('1')
        else:
            idx1 = self.N - 1 + i
            idx2 = self.N - 2 + j # 閉区間にする
            b = 0
            while idx1 + 1 < idx2:
                if idx1&1 == 0: # idx1が偶数
                    b = b | self.data[idx1]
                if idx2&1 == 1: # idx2が奇数
                    b = b | self.data[idx2]
                    idx2 -= 1
                
                idx1 //= 2
                idx2 = (idx2 - 1)//2
            
            if idx1 == idx2:
                b = b | self.data[idx1]
            else: # idx1 + 1 == idx2
                b = b | self.data[idx1] | self.data[idx2]
            
            return bin(b).count('1')

N = int(input())
S = list(input())
st = SegmentTree(S)

Q = int(input())
for i in range(Q):
  t, a, b = input().split()
  if t == '1':
    a = int(a)
    if S[a-1] == b:
      continue
    st.update(a-1, b)
    S[a-1] = b
  else:
    a, b = int(a), int(b)
    print(st.query(a-1, b))

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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;
int dp[401][401];
int32_t main() {
    nitin;
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    a[0]=0;
    for(int i=1;i<=n;i++)
        a[i]=a[i]+a[i-1];
    for(int j=2;j<=n;j++)
    {
        int si=1;
        int sj=j;
        while(si<=n && sj<=n)
        {
            dp[si][sj]=inf;

            for(int p=si;p<sj;p++)
                dp[si][sj]=min(dp[si][p]+dp[p+1][sj]+a[sj]-a[si-1],dp[si][sj]);

            si++;
            sj++;
        }
    }
    cout<<dp[1][n]<<endl;
    return 0;
}

Measured memory_bytes: 4852