akhauriyash/Code-Regression huggingface dataset:
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

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

LL a[1001];
int K;
vector<bool> ok;
vector<LL> l;
LL f(int i){
	if(i<0){
		return 0;
	}
	int c=0;
	for(int j=0;j<l.size();j++){
		//cerr << (l[j]&(1LL<<i)) << endl;
		if(ok[j]&&(l[j]&(1LL<<i))){
			c++;
		}
	}
	//cerr << i << ": " << c << endl;
	LL ret=0;
	if(c>=K){
		for(int j=0;j<l.size();j++){
			ok[j]=(ok[j]&&(l[j]&(1LL<<i)));
		}
		ret=1LL<<i;
	}
	ret|=f(i-1);
	return ret;
}
int main() {
	int N;
	scanf("%d%d",&N,&K); 
	for(int i=1;i<=N;i++){
		scanf("%lld",a+i);
		a[i]+=a[i-1];
		for(int j=0;j<i;j++){
			l.push_back(a[i]-a[j]);
			ok.push_back(true);
			//cerr << l.back() << ", " << ok.back() << ".. ";
		}
		//cerr << endl;
	}
	cout << f(40) << endl;

	return 0;
}



Measured memory_bytes: 6512
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int N, D, x[10][10];
	cin >> N >> D;
	rep(i, N)rep(j, D) cin >> x[i][j];

	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int dist = 0;
			for (int d = 0; d < D; d++) {
				dist += (x[i][d] - x[j][d]) * (x[i][d] - x[j][d]);
			}
			int d = sqrt(dist)+0.5;
			if (d * d == dist) {
				ans++;
			}

		}
	}
	cout << ans << endl;

	return 0;
}


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

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

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int a, b, c, d, e, f, g, h, i;
  cin >> a >> b >> c >> d >> e >> f >> g >> h >> i;
  int ans = 0;
  rep(k, 1, 10) {
    int ka = k;
    if(a != -1) ka = a;
    rep(l, 1, 10) {
      int kb = l;
      if(b != -1) kb = b;
      if(kb == ka) continue;
      rep(o, 1, 10) {
        int kc = o;
        if(c != -1) kc = c;
        if(kc == ka || kc == kb) continue;
        rep(p, 1, 10) {
          int kd = p;
          if(d != -1) kd = d;
          if(kd == ka || kd == kb || kd == kc) continue;
          rep(q, 1, 10) {
            int ke = q;
            if(e != -1) ke = e;
            if(ke == ka || ke == kb || ke == kc || ke == kd) continue;
            rep(r, 1, 10) {
              int kf = r;
              if(f != -1) kf = f;
              if(kf == ka || kf == kb || kf == kc || kf == kd || kf == ke) continue;
              int mi = (ka + kc + kf) % 10;
              if(i != -1) if(mi != i) continue;
              if(mi == ka || mi == kb || mi == kc || mi == kd || mi == ke || mi == kf || mi == 0) continue;
              int ma = (kb + ke + (ka + kc + kf) / 10) % 10;
              if(h != -1) if(ma != h) continue;
              if(ma == ka || ma == kb || ma == kc || ma == kd || ma == ke || ma == kf || ma == mi || ma == 0) continue;
              int hi = (kd + (kb + ke + (ka + kc + kf) / 10) / 10);
              if(g != -1) if(hi != g) continue;
              if(hi == ka || hi == kb || hi == kc || hi == kd || hi == ke || hi == kf || hi == mi || hi == ma || hi == 0 || hi >= 10) continue;
              ans++;
              if(f != -1) break;
            }
            if(e != -1) break;
          }
          if(d != -1) break;
        }
        if(c != -1) break;
      }
      if(b != -1) break;
    }
    if(a != -1) break;
  }
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;



int main(){
  int N;
  string S;
  cin >> N >> S;
  
  if(S.size()%2!=0){
    cout << "No" << endl;
    return 0;
  }
  
  int cnt = 0;
  int l = (S.size()/2);
  for(int i=0; i<l; i++){
    if(S[i]==S[i+l]) cnt++;
  }
  
  if(cnt==l) cout << "Yes" << endl;
  else cout << "No" << endl;
    
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long int ll;
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int a,b; cin >> a >> b;
		if(a==0&&b==0)break;
		int g=__gcd(a,b);
		a/=g; b/=g;
		vector<int> seen(b,-1);
		seen[a]=0;
		for(int c=1;;c++){
			a=(10*a)%b;
			if(a==0){
				cout << c << " " << 0 << endl;
				break;
			}
			else if(seen[a]!=-1){
				cout << seen[a] << " " << c-seen[a] << endl;
				break;
			}
			else{
				seen[a]=c;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 6976
#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define inf 1e18
#define fo(i,y,n,inc)	for(int i=y;i<n+y;i+=inc)
#define cin(t) int t;cin>>t
#define w(t) while(t--)
#define nl cout<<endl;
#define pb push_back
#define ft(i) (i&(-1*i))
#define arrIn(arr,size)		for(int i=0;i<size;i++){cin>>arr[i];}
#define arrOut(arr,size,seperater)	for(int i=0;i<size;i++){cout<<arr[i]<<seperater;}
using namespace std;

int max(int a, int b) {
	if (a > b)
		return a;
	return b;
}

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

void fastIO() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}

int n, k;
int arr[100005];
int dp[100005];

int solve(int rem) {

	if (rem == 0)	return 0;

	if (dp[rem] != -1)	return dp[rem];

	int ans = 0;

	fo(i, 0, n, 1) {

		if ((rem - arr[i]) >= 0) {

			if (solve(rem - arr[i]) == 0) {
				ans = 1; break;
			}

		}
	}

	dp[rem] = ans;

	return ans;
}

int32_t main() {
  
	memset(dp, -1, sizeof(dp));

	cin >> n >> k;
	fo(i, 0, n, 1)	cin >> arr[i];

	if (solve(k))	cout << "First";
	else	cout << "Second";

	nl;

	return 0;
}

// cout << "Case #" << i << ": " << answer << endl;

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

typedef long long ll;

int max(int a, int b){
  if(a > b) return a;
  else return b;
}
int min(int a, int b){
  if(a < b) return a;
  else return b;
}

  int seen[51] = {0};
  int n,m;
  int graph[51][51] = {0};
  int flag = 0;
  int count = 0;

void dfs(int x, int y){
  if(seen[y] == 1) return;

  seen[y] = 1;

  for(int i = 1; i <= n; ++i){
    if(seen[i] == 0 && graph[y][i] == 1){
      dfs(y,i);
    }
  }
}

int main(){


  scanf("%d %d",&n,&m);

  int a,b;
  for(int i = 0; i < m; ++i){
    scanf("%d %d",&a,&b);
    graph[a][b] = 1;
    graph[b][a] = 1;
  }

  int flag2 = 0;
  int x,y;
  for(int i = 1; i <= n; ++i){
    for(int j = i+1; j <= n; ++j){
      if(graph[i][j] == 1 || graph[j][i] == 1){
        if(flag2 == 0){
          x = i;
          y = j;
          flag2 = 1;
        }
        graph[i][j] = 0;
        graph[j][i] = 0;
          dfs(x,y);
          for(int k = 1; k <= n; ++k){
            if(seen[k] == 0) flag = 1;
            seen[k] = 0;
          }
          if(flag == 1) count ++;
        graph[i][j] = 1;
        graph[j][i] = 1;
        flag = 0;
      }
    }
  }

  printf("%d",count);

  return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

int main() { cin.tie(0); ios::sync_with_stdio(false);
    int N = in, K = in; K = min( K, N-1 );
    vector<int> H(N); rep( i, N ) H[i] = in;

    vector<int> dp(N,INT_MAX); dp[0] = 0;
    for( int i=1; i<N; i++ ) {
        for( int j= max(0, i-K); j<i; j++ ) {
            dp[i] = min( dp[i], dp[j] + abs(H[i] - H[j]) );
        }
    }

    cout << dp[N-1] << "\n";
}


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

Measured memory_bytes: 256
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

H,N = two_int()
A=many_int()

sumA=sum(A)

if sumA >= H:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 13964
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
  int n,i;
  int c[101]={0};
  int ans=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      int tmp;
      scanf("%d",&tmp);
      if(c[tmp]==0)
	{
	  c[tmp]++;
	  ans++;
	}
    }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c <= 21) PRINT("win");
    else PRINT("bust");
    return 0;
}

Measured memory_bytes: 3592
//#pragma GCC optimize("03")
//#pragma GCC target("avx2")
 
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iomanip>
#include <utility>
#include <unordered_map>
#include <unordered_set>
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sqr(a) (a)*(a)
#define um unordered_map 
#define us unordered_set
using namespace std;
 
hash<string> hfn;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef double dbl;
typedef unsigned int ui;
const int inf = 2e9;
const ll mod = 1e9 + 7;
const ld eps = 1e-7;
const ll biginf = 1e18;
const ld pi = acosl(-1);

void solve()
{
  int n, k;
  cin >> n >> k;
  vector<int> v(n), dp(n, inf);
  for(auto& i : v)
    cin >> i;
  dp[0] = 0;
  dp[1] = abs(v[1] - v[0]);
  for(int i = 2; i < n; i++)
  {
    for(int j = 1; j <= k; j++)
    {
      if(i - j < 0)
        continue;
      dp[i] = min(dp[i], dp[i-j] + abs(v[i-j] - v[i]));
    }
  }
  cout << dp.back();
}
 
void multisolve()
{
  int t;
  cin >> t;
  while(t--)
    solve();
}
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  //freopen("hull.in", "r", stdin);
  //freopen("hull.out", "w", stdout);
  solve();
  //multisolve();
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;

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

  for(int i = 0; i < S.size(); i++) {
    S = S[S.size() - 1] + S.substr(0, S.size() - 1);
    if(S == T) { cout << "Yes"; return 0; }
  }

  cout << "No";
 return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  int diff=a-b;
  if(c<=diff){
    printf("0\n");
  }else{
    printf("%d\n",c-diff); 
  }
  return 0;
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CSubarraySum {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n, k, s; cin >> n >> k >> s;
      int ma = 1e+9;
      vector<int> ans;
      if (s != ma) {
        rep(i, k) {
          ans.push_back(s);
        }
        rep(i, n-k) {
          ans.push_back(ma);
        }
      } else {
        rep(i, k) {
          ans.push_back(s);
        }
        rep(i, n-k) {
          ans.push_back(1);
        }
      }

      for(auto e: ans) {
        cout << e << ' ';
      }
      cout << endl;
    }
};

signed main() {
  CSubarraySum solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 1912
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll M = 1000000000;

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

  	ll X[3], Y[3];
  	X[0] = 0;
  	Y[0] = 0;


  	Y[2] = 1;
  	if(S%M==0){
  		X[1] = 0;
  	}else{
  		X[1] = M - S%M;
  	}
  	S += X[1];

  	X[2] = S/M;
  	Y[1] = M;

  	for(int i=0;i<3;i++){
  		cout << X[i] << " " << Y[i] << " ";
  	}
  	cout <<endl;
  	
    
  	return 0;
}

Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
// ここから編集しろ
int p[210][210];
int dp[410][210][210];

int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		scanf("%d",&p[i][j]);
	}
	dp[0][0][0]=p[0][0];
	for(int i=0;i<a+b;i++){
		for(int j=0;j<max(a,b);j++){
			int X1=j;
			int Y1=i-j;
			if(X1>=a||Y1<0||Y1>=b)continue;
			for(int k=0;k<max(a,b);k++){
				int X2=k;
				int Y2=i-k;
				if(X2>=a||Y2<0||Y2>=b)continue;

				if(X1+1<a&&X2+1<a){
					int to=dp[i][j][k]+p[X1+1][Y1];
					if(X1!=X2)to+=p[X2+1][Y2];
					dp[i+1][X1+1][X2+1]=max(dp[i+1][X1+1][X2+1],to);
				}
				if(X1+1<a&&Y2+1<b){
					int to=dp[i][j][k]+p[X1+1][Y1];
					if(X1+1!=X2)to+=p[X2][Y2+1];
					dp[i+1][X1+1][X2]=max(dp[i+1][X1+1][X2],to);
				}
				if(Y1+1<b&&X2+1<a){
					int to=dp[i][j][k]+p[X1][Y1+1];
					if(X1!=X2+1)to+=p[X2+1][Y2];
					dp[i+1][X1][X2+1]=max(dp[i+1][X1][X2+1],to);
				}
				if(Y1+1<b&&Y2+1<b){
					int to=dp[i][j][k]+p[X1][Y1+1];
					if(X1!=X2)to+=p[X2][Y2+1];
					dp[i+1][X1][X2]=max(dp[i+1][X1][X2],to);
				}
				
			}
		}
	}
	printf("%d\n",dp[a+b-2][a-1][a-1]);
}


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

#define ll long long
#define ull unsigned long long
#define test int t;cin>>t;while(t--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
const ll mod = 1000000007;

ll dp[100002][3], a[100002][3];

ll happy(ll n, ll j) {
    
    if (j >= 0 && dp[n][j] > 0) return dp[n][j];
    
    if (n == 0)
        return 0;
    else if (j == -1)
        dp[n][(j+3)%3] = max(happy(n-1, 0)+a[n][0], max(happy(n-1, 1)+a[n][1], happy(n-1, 2)+a[n][2]));
    else
        dp[n][j] = max(happy(n-1, (j+2)%3)+a[n][(j+2)%3], happy(n-1, (j+1)%3)+a[n][(j+1)%3]);
    
    return dp[n][(j+3)%3];
}

int main()
{
    jaldi;
    
    ll n;
    cin >> n;
    for (ll i = 1; i <= n; i++)
        for (ll j = 0; j < 3; j++)
            cin >> a[i][j];
    for (ll i = 0; i <= n; i++)
        for (ll j = 0; j < 3; j++)
            dp[i][j] = 0;
    cout << happy(n, -1) << endl;
    
    return 0;
}


Measured memory_bytes: 11136
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int l,r;
    int s=1,e=n;
    for (int i=0;i<m;i++){
        cin>>l>>r;
        if (s<l) s=l;
        if (e>r) e=r;
    }
    int ans = max(e-s+1,0);
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
using namespace std;

int main() {
  int N,D;
  cin>>N>>D;
  
  int ans=0;
  
  if(N%(2*D+1)==0)
    ans=N/(2*D+1);
  else
    ans=N/(2*D+1)+1;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<vector>
#include<cmath>
#define maxn 1000007
using namespace std;
int n,m;
inline int read()
{
    int x = 0;
    int flag = 1;
    char ch;
    ch = getchar();
    while(!isdigit(ch)) 
    {
        if(ch == '-') flag = -1;
    ch = getchar();
    } 
    while(isdigit(ch))
    {
        x = (x<<1) + (x<<3) + ch - 48;
        ch = getchar();
    }
    return x * flag;
}


int main()
{
	n = read();
	m = read();
	if(n <  m) swap(n,m);
	for(register int i = 1;i <= n;i++)
	{
		printf("%d",m);
	}
}

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

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

    bool ans = true;
    if(a == b && b != c) ans = false;
    if(b == c && c != a) ans = false;
    if(c == a && a != b) ans = false;

    if(ans) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

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

int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    if (a > 0)
        printf("Positive\n");
    else if (b < 0){
        if ((b-a)%2 == 0)
            printf("Negative\n");
        else
            printf("Positive\n");
    }
    else
        printf("Zero\n");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main(){
  int N;
 
  std::cin >> N;
  
  if (N == 1){
    std::cout << "Hello World" << std::endl;
    return 0;
  } else if (N == 2){
    int a, b;
    std::cin >> a;
    std::cin >> b;
    std::cout << a+b << std::endl;
    return 0;
  }
}

Measured memory_bytes: 256
n, m = map(int, input().split())
l_sc = [list(map(int, input().split())) for _ in range(m)]

if n == 1:
    for i in range(10):
        i = str(i)
        for sc in l_sc:
            if i[sc[0] - 1] != str(sc[1]):
                break
        else:
            print(i)
            exit()

for i in range(10**(n-1), 10**n):
    i = str(i)
    for sc in l_sc:
        if i[sc[0]-1] != str(sc[1]):
            break
    else:
        print(i)
        exit()

print(-1)

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }

const int N=1e5+5;
bool prime[N];
int ans[N];

void init() {
    // compute prime
    for ( int i=2; i<N; i++ ) {
        prime[i]=1;
    }
    for ( int i=2; i<N; i++ ) {
        if ( prime[i] ) {
            for ( int j=i+i; j<N; j+=i ) {
                prime[j]=0;
            }
        }
    }
    for ( int i=1; i<N; i+=2 ) {
        if ( prime[i] && prime[(i+1)/2] ) {
            ans[i]=1;
        }
    }
    for ( int i=0; i<N-1; i++ ) {
        ans[i+1]+=ans[i];
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();
    int qq;
    cin >> qq;
    while ( qq-- ) {
        int l,r;
        cin >> l >> r;
        cout << ans[r]-ans[l-1] << '\n';
    } 
    return 0;   
}






Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	if (n<1000) cout<<"ABC";
	else cout<<"ABD"<<endl;
	return 0;
}


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

int n, w;

vector<int> W;
vector<long long> V;

long long solve()
{
    vector<vector<long long> > dp(n+1, vector<long long> (w+1));
    for(int i=0; i<=n; i++){
        for(int j=0; j<=w; j++){
            if(i == 0 || j == 0){
                dp[i][j] = 0;
                continue;
            }
            if(j >= W[i-1]){
                dp[i][j] = max(dp[i-1][j-W[i-1]]+V[i-1], dp[i-1][j]);
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    return dp[n][w];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> w;

    for (int i = 0; i < n; i++)
    {
        int x,y;
        cin>>x>>y;
        W.push_back(x);
        V.push_back(y);
    }

    long long ans = solve();
    cout << ans << "\n";

    return 0;
}

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

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


void solve(long long N, long long X, std::vector<long long> L){
    ll a=1,d=0;
    rep(i,N){
        d=d+L[i];
        (d<=X)?a++:1;
    }
    cout<<a<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, X, std::move(L));
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <limits.h>

int main(){
  long long int l,r;
  scanf("%lld %lld",&l,&r);
  long long int min = LONG_MAX;
  long long int a;
  if(r > l + 2019){
    a = l + 2019;
  }else{
    a = r;
  }

  for(long long int i = l; i < a; i++){
    for(long long int j = i + 1; j <= a; j++){
      if(min > i * j % 2019){
	min = i *j % 2019;
      }
    }
  }

  printf("%lld\n",min);
}


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


int main() {
    ll D, N;
    cin >> D >> N;
    ll ans = 1;
    rep(i,D) ans *= 100LL;
    if (N == 100) ++N;
    ans *= N;
    cout << ans << endl;
}


Measured memory_bytes: 3636
using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;

namespace AtcoderExpress
{


    class Program
    {

        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            var N = NK[0];
            var K = NK[1];
            var points = new List<Tuple<long, long>>();
            for (int i = 0; i < N; i++)
            {
                var XY = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
                var X = XY[0];
                var Y = XY[1];
                points.Add(new Tuple<long, long>(X, Y));
            }

            //X座標でのソート
            points = points.OrderBy(tuple => tuple.Item1).ToList();
            var ans = long.MaxValue;
            //左端を1番目からN-1番目まで動かす
            for (int i = 0; i < N; i++)
            {
                //右端の範囲を設定
                for (int j = i; j < N; j++)
                {
                    var left = points[i];
                    var right = points[j];

                    long xmin = Min(left.Item1, right.Item1);
                    long xmax = Max(left.Item1, right.Item1);

                    //y座標の高さの決定
                    for (int m = i; m <= j; m++)
                    {
                        for (int n = m; n <= j; n++)
                        {
                            long ymin = Min(points[n].Item2, points[m].Item2);
                            long ymax = Max(points[n].Item2, points[m].Item2);
                            long rec = (xmax - xmin) * (ymax - ymin);
                            //y座標の範囲にK個以上座標があるかどうかの検索
                            var CumPoint = 0L;
                            for (int k = i; k <= j; k++)
                            {
                                if (points[k].Item2 <= ymax && points[k].Item2 >= ymin)
                                {
                                    CumPoint++;
                                }
                            }

                            if (CumPoint >= K && rec < ans)
                            {
                                ans = rec;
                            }
                        }
                    }

                }
            }
            Console.WriteLine(ans);
        }


    }
}


Measured memory_bytes: 13524
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;
//-----------------------------------------------//

int main() {
	string S;
	cin >> S;
	cout << 700 + count(ALL(S), 'o') * 100 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int mi[3000]; int ma[3000];
ll dp[3001][3002] = {};
int main() {
	int n, m; string s; cin >> n >> m >> s;
	string t1 = s; string t2 = s;
	int cnt = 0;
	rep(i, m) {
		int l; int r;
		cin >> l >> r; l--; r--;
		int cnt1 = 0; int cnt2 = 0;
		Rep1(j, l, r) {
			if (t1[j] == '1')cnt1++;
			if (t2[j] == '0')cnt2++;
		}
		Rep1(j, l, r) {
			if (j < l + cnt1) {
				t1[j] = '1';
			}
			else {
				t1[j] = '0';
			}
			if (j < l + cnt2) {
				t2[j] = '0';
			}
			else {
				t2[j] = '1';
			}
		}
	}
	int cnt1 = 0; int cnt2 = 0;
	rep(i, n) {
		if (s[i] == '1')cnt++;
		if (t1[i] == '1')cnt1++;
		if (t2[i] == '1')cnt2++;
		mi[i] = cnt2; ma[i] = cnt1;
	}
	rep(i, n) {
		if (i == 0) {
			if (mi[i] == 0)dp[0][0] = 1;
			if (ma[i] == 1)dp[0][1] = 1;
		}
		else {
			rep(j, 3001) {
				if (mi[i - 1] <= j && j <= ma[i - 1] && mi[i] <= j && j <= ma[i]) {
					(dp[i][j] += dp[i - 1][j]) %= MOD;
				}
				if (mi[i - 1] <= j - 1 && j - 1 <= ma[i - 1] && mi[i] <= j && j <= ma[i]) {
					(dp[i][j] += dp[i - 1][j - 1]) %= MOD;
				}
			}
		}
	}
	cout << dp[n-1][cnt] << endl;
	return 0;
}

Measured memory_bytes: 68480
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    int n; cin >> n;
    vector<int> vec(n);
    map<int, pair<int, ll>> mp;
    ll total = 0;
    rep(i, n) {
        int x; cin >> x;
        total -= mp[x].second;
        vec[i] = x;
        int num = mp[x].first+1;
        mp[x] = make_pair(num, num*(num-1LL)/2LL);
        total += mp[x].second;
    }
    rep(i, n) {
        int num = vec[i];
        ll ans = total;
        ans -= mp[num].second;
        ans += (mp[num].first-1LL)*(mp[num].first-2LL)/2LL;
        cout << ans << endl;
    }
}


Measured memory_bytes: 10368
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int num=scan.nextInt();
    long[] tall=new long[num];
    int x=0, Ans=0;
    for(int a=0; a<num; a++){
      tall[a]=scan.nextInt();
    }
    for(int a=0; a<num-1; a++){
      if(tall[a]>=tall[a+1]){
        x++;
      }else{
        if(Ans<x){
          Ans=x;
        }
        x=0;
      }
    }
    if(Ans<x){
      Ans=x;
    }
    System.out.println(Ans);
  }
}

Measured memory_bytes: 59888
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (1LL<<59)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	ll x;
	cin>>x;
	ll jk = 100;
	int ct = 0;
	while(jk < x)
	{
		ll ad = jk / 100;
		jk += ad;
		ct++;
	}
	cout<<ct<<"\n";
	return;
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
const ll llMAX=9223372036854775807LL; 
const ll llMIN=-9223372036854775808LL;

void myprint1D(vi &data)
{
  REP(i,data.size())
    cout<<data[i]<<" ";
  cout<<endl;
}

//配列を[y][x]で表示
void myprint2D_T(vvi &data)
{
  REP(i,data.size())
    myprint1D(data[i]);
}

//配列を[x][y]で表示
void myprint2D(vvi &data)
{
  ll l1=data.size();
  ll l2=data[0].size();
  REP(j,l2){
    REP(i,l1)
      cout<<data[i][j]<<" ";
    cout<<endl;
  }
}

//print(a,b...)って使い方
void print1(ll a){cout<<a<<endl;}
void print2(ll a,ll b){cout<<a<<" "<<b<<endl;}
void print3(ll a,ll b,ll c){cout<<a<<" "<<b<<" "<<c<<endl;}
void print4(ll a,ll b,ll c,ll d){cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;}
void print5(ll a,ll b,ll c,ll d,ll e){cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;}


ll n,k,x,y;


//moddivとnCk
//c剰余下でaをbで割った値
ll moddiv(ll a,ll b,ll c){
	ll x0=c,x1=b,x2,n0=0LL,n1=1LL,n2,t=a%b,m,ans;
	if (t==0LL) return a/b;
		for(int i=0;i<900;i++){
      m=x0/x1;
      x2=x0-x1*m;
      n2=(n0-m*n1)%c;
      if (x2==1LL){
        ans=(n2+c)%c;
        break;
      }
      x0=x1;x1=x2;
      n0=n1;n1=n2;
    }
	return (a+((t*ans)%c)*b-t)/b;
}
//剰余の割ざん

//aのn乗 mod c
ll expmod(ll a,ll n,ll c){
  ll ans=1LL,aa=a,beki=n;
  for(int i=0;i<64;i++){
    if (beki%2==1LL) ans=ans*aa%c;
    aa=aa*aa%c;
    beki/=2LL;
    if (beki==0LL)break;
  }
  return ans;
}

//nCk
vi mulmod(500001);//0!,1!,2!,3!,4!,,,,
void first_nCk(){
  mulmod[0]=1LL;
  for(ll i=1;i<500001;i++){
    mulmod[i]=mulmod[i-1]*i%MOD;
  }
}
ll nCk(ll nn,ll kk){
  return moddiv(mulmod[nn],mulmod[kk]*mulmod[nn-kk]%MOD,MOD);
}

ll modinv(ll a,ll b){
  return moddiv(1,a,b);
}

ll garner(ll a,ll b,ll ar,ll br){
  return ar+(br-ar+b)%b*modinv(a,b)%b*a;
}
ll garner2(ll a,ll b,ll ar,ll br){
  ar%=a;
  br%=b;
  ll ret=(ar+  ( (br-ar)%b*(moddiv(1,a,b)%b) +b )%b *a+a*b)%(a*b);
  return ret;
}

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0LL){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}





int main(){
  ll ans=0;
  cin >> n;

  if (n==1){
    cout<<1<<endl;
    return 0;
  }
  if (n%2==0){
    ans=2*n-1;
  }else{
    ans=n-1;
  }

  n*=2;
  for(ll i=2;i<=n+2;i++){
    if (i*i>n)break;
    if (n%i==0){
      ll val0=i;
      ll val1=n/i;
      if (val0==1)continue;
      if (val1==1)continue;
      if (gcd(val0,val1)==1){
        ll ans0=garner2(val0,val1,1,0)-1;
        ll ans1=garner2(val0,val1,0,1)-1;
        //ans0%=val0*val1;
        //ans1%=val0*val1;
        if (ans0>1)
          ans=min(ans,ans0);
        if (ans1>1)
          ans=min(ans,ans1);
      }
    }
  }


  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7056
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int N;
int A[3][3];
map<int, int> B;

int main(void) {
	for (int j = 0; j < 3; ++j) {
		for (int i = 0; i < 3; ++i)
			cin >> A[j][i];
	}
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int b;
		cin >> b;
		B[b] = 1;
	}

	bool ans = false;
	for (int j = 0; j < 3; ++j) {
		int sum = 0;
		for (int i = 0; i < 3; ++i)
			sum += B.count(A[j][i]);
		if (sum == 3) {
			ans = true;
			break;
		}
	}
	if (!ans) {
		for (int i = 0; i < 3; ++i) {
			int sum = 0;
			for (int j = 0; j < 3; ++j)
				sum += B.count(A[j][i]);
			if (sum == 3) {
				ans = true;
				break;
			}
		}
	}
	if (!ans) {
		int sum1 = B.count(A[0][0]) +  B.count(A[1][1]) +  B.count(A[2][2]);
		int sum2 = B.count(A[2][0]) +  B.count(A[1][1]) +  B.count(A[0][2]);
		if (sum1 == 3 || sum2 == 3)
			ans = true;
	}

	cout << (ans ? "Yes\n" : "No\n");
	return 0;
}


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

#define ll long long

int main(){
	ll x;
	cin>>x;
	for (ll i=-1000;i<=1000;i++)
		for (ll j=-1000;j<=1000;j++)
			if (i*i*i*i*i-j*j*j*j*j==x){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
	return 0;
}

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

using namespace std;

int A[(int)1e5];
int N;

bool isValid()
{
    for (int i = 0; i < N; i++)
    {
        if (A[i] == i + 1) return false;
    }
    return true;
}

void Generate()
{
    N = (rand() % 6) + 3;
    vector<int> v;
    for (int i = 1; i <= N; i++) v.push_back(i);
    int idx = 0;
    while (v.size() > 0)
    {
        int randind = (rand() % v.size());
        A[idx] = v[randind];
        v.erase(v.begin() + randind);
        idx++;
    }
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++) cin >> A[i];
    int swaps = 0;
    while (!isValid())
    {
        for (int i = 1; i < N; i++)
        {
            if (A[i - 1] == i)
            {
                swaps++;
                swap(A[i - 1], A[i]);
            }
        }
        if (A[N - 1] == N)
        {
            swaps++;
            swap(A[N - 1], A[N - 2]);
        }
    }
    cout << swaps << "\n";
}

Measured memory_bytes: 3996
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String x = sc.next();
		
		sc.close();
		
		int s = 0;
		int erase = 0;
		
		for(int i = 0; i < x.length(); i++) {
			if(x.charAt(i) == 'S') {
				s++;
			} else {
				if(s != 0) {
					s--;
					erase += 2;
				}
			}
		}
		
		System.out.println(x.length() - erase);
		
		return;
	}
	
}

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

using namespace std;

long long gcd(long long a,long long b){
if(b==0)return a;
a%=b;
return gcd(b,a);
}

int main()
{
    long long a,b;
    cin>>a>>b;
    cout<<(a*b)/gcd(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

int main(){
    char a, b;
    cin >> a >> b;
    if (a == 'H')
        cout << b << endl;
    else {
        if (b == 'D')
            cout<<'H'<<endl;
        else
            cout << 'D' << endl;
    }
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A, B;
	cin >> A >> B;


	int g = __gcd(A, B);

	ll kotae = (ll)A * B / g;

	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 256
import sys
reverse = {
    "E":"W",
    "W":"E",
    "S":"N",
    "N":"S"
    }
        
class dice:
    def __init__(self,A):
        self.list = sorted(A)
        self.max = max(A)
        self.min = min(A)
        self.side = {
            "TOP":A[0],
            "S":A[1],
            "E":A[2],
            "W":A[3],
            "N":A[4],
            "BOT":A[5],
            }
    def get_list(self):
        return self.list
    def get_dict(self):
        return self.side
    def check(self):
        pass
    def main(self,A):
        for s in A:
            var = int(self.side[s])
            self.side[s] = self.side["TOP"]
            self.side["TOP"] = self.side[reverse[s]]
            self.side[reverse[s]] = self.side["BOT"]
            self.side["BOT"] = var
    def rot(self):
        var = self.side["N"]
        self.side["N"] = self.side["E"]
        self.side["E"] = self.side["S"]
        self.side["S"] = self.side["W"]
        self.side["W"] = var
n = int(input())
data = [list(map(int,input().split())) for _ in range(n)]


for i in range(0,n-1):
    a = dice(data[i])
    a_dict = a.get_dict()
    for j in range(i+1,n):
        b = dice(data[j])
        for do in ["N","N","N","N","E","EE"]:
            b.main(do)
            for _ in range(4):
                b.rot()
                b_dict = b.get_dict()
                if a_dict == b_dict:
                    print("No")
                    exit()

        
print("Yes")




Measured memory_bytes: 5616
N = int(input())
A = list(map(int,input().split()))
X = 0
Y = 0
for i in range(0,N):
  if A[i] % 2 == 0:
    X += 1
    if ((A[i] / 2) % 3 == 0) or ((A[i] / 2) % 5 == 0):
      Y += 1
if X == Y:
  print('APPROVED')
else:
  print('DENIED')

Measured memory_bytes: 3060
#include <bits/stdc++.h>   
using namespace std;   
typedef long long ll;
int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;

	for (int i = 0; i < dx; i++)
		cout << "R";
	for (int i = 0; i < dy; i++)
		cout << "U";
	
	for (int i = 0; i < dx; i++)
		cout << "L";
	for (int i = 0; i < dy; i++)
		cout << "D";
	
	cout << "D";
	for (int i = 0; i < dx+1; i++)
		cout << "R";
	for (int i = 0; i < dy+1; i++)
		cout << "U";
	cout << "L";

	cout << "U";
	for (int i = 0; i < dx+1; i++)
		cout << "L";
	for (int i = 0; i < dy+1; i++)
		cout << "D";
	cout << "R";
	

	
	

	return 0;   
}  


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

#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);

int main() {
    fast_io;
    string ans;
    ans = "";
    string alp="abcdefghijklmnopqrstuvwxyz";

    long long n;
    cin>>n;
    
    while(n>0) {
        n--;
        ans+=alp[(n%26)];
        n/=26;
    }

    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;

}




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

ll N;
ll A[3][105];
ll B[105];

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;

forn(i,N){
	cin>>A[0][i];
}
forn(i,N){
	cin>>A[1][i];
}

B[0]=A[0][0];
forn(i,N-1){
  B[i+1]+=B[i];
  B[i+1]+=A[0][i+1];
}

ll ans=0L;
forn(i,N){
  ll x=B[i];
  for(ll j=i; j<N; j++){
  	x+=A[1][j];
  }
  if(x>ans) ans=x;
}

cout<<ans<<endl;

}



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

int main() {
    long long n;
    cin >> n;
    
    map<long long, long long> mp;
    long long ans = 0;

    for(long long i = 0; i < n; i++) {
        long long a;
        cin >> a;
        ans += mp[i - a];
        mp[i + a]++;
    }

    // cout << mp.size() << endl;
    /*
    for(auto x : mp) {
        cout << x.first << ": " << x.second << endl;
    }
     */

    cout << ans << endl;

    return 0;
}

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

int main(){
    int S,W;

    cin >> S >> W;

    if(W >= S){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    string s;
    cin >> s;
    if(s.at(s.size()-1)=='s') cout << s << "es" << endl;
    else cout << s << 's' << endl;

    return 0;
}

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

int main(){
  string s;
  int n,k;
  
  cin >> n >> s >> k;
  
  for( int i=0; i<n; i++){
    if( s[i] != s[k-1] ) s[i]='*';
  }
  
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>

using namespace std;
typedef pair<int, int> pii;

int main(){
        int N;
        double R;
        cin >> N >> R;
        map<pii, int> mp;
        while(N--){
                double x, y;
                cin >> x >> y;
                int ix = static_cast<int>(x / R);
                if(x < 0){ --ix; }
                int iy = static_cast<int>(y / R);
                if(y < 0){ --iy; }
                ++mp[pii(iy, ix)];
        }
        set<pii> passed;
        int answer = 0;
        for(map<pii, int>::iterator it = mp.begin(); it != mp.end(); ++it){
                if(passed.find(it->first) != passed.end()){ continue; }
                ++answer;
                for(int y = -1; y <= 1; ++y){
                        for(int x = -1; x <= 1; ++x){
                                passed.insert(pii(it->first.first + y, it->first.second + x));
                        }
                }
        }
        cout << answer << endl;
        return 0;
}

Measured memory_bytes: 80220
n, k = map(int, input().split())
d = list(input().split())
num = [str(i) for i in range(10)]
for i in range(k):
    num.remove(d[i])
    
import itertools
ans = []
for i in itertools.product(num, repeat=len(str(n))):
    s = int(''.join(i))
    if s >= n:
        ans.append(s)
        
if len(ans) == 0:
    for i in itertools.product(num, repeat=len(str(n)) + 1):
        s = int(''.join(i))
        if s >= n:
            ans.append(s)
    print(min(ans))
    
else:
  print(min(ans))

Measured memory_bytes: 9204