akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,c; cin >> a >> b >> c;
    out(a+b+c+max({a,b,c})*9);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n; cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        string s = to_string(i);
        if((int)s.size() % 2)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

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

long mod(long x, long p) {
    long res = x % p;
    if (res < 0) {
	return res + p;
    } else {
	return res;
    }
}


int main() {
    long k = LONG_MIN;
    cin >> k;
    int i = 1;
    long x = 7;
    while (i < 10'000'000) {
	if (mod(x, k) == 0) {
	    cout << i << "\n";
	    return 0;
	}
	x = mod(10*x + 7, k);
	++i;
    }
    cout << -1 << "\n";
    return 0;
}


Measured memory_bytes: 3548
#
# abc138 d
#
import sys
from io import StringIO
import unittest
from collections import deque


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3
1 2
2 3
2 4
2 10
1 100
3 1"""
        output = """100 110 111 110"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """6 2
1 2
1 3
2 4
3 6
2 5
1 10
1 10"""
        output = """20 20 20 20 20 20"""
        self.assertIO(input, output)


def resolve():
    N, Q = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N-1)]
    PX = [list(map(int, input().split())) for _ in range(Q)]

    G = [[i+1, 0] for i in range(N)]
    for ab in AB:
        a, b = ab
        G[a-1][1] += 1
        G[b-1][1] += 1
        G[a-1].append(b)
        G[b-1].append(a)

    ans = [0] * N
    for px in PX:
        p, x = px
        ans[p-1] += x

    S = deque()

    F = [False] * N
    S.append(1)
    F[0] = True

    while S:
        p = S.pop()
        if G[p-1][1] == 0:
            continue

        for np in G[p-1][2:]:
            if F[np-1]:
                continue
            S.append(np)
            F[np-1] = True
            ans[np-1] += ans[p-1]

    print(*ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 131648
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,avx2,fma,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0)
typedef long long ll;


ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

//#######################################


int main(){
  boost;
  int n;
  cin>>n;
  string s;
  // int ac=0,wa=0,tle=0,re=0;
  map<string,int>m;
  for(int i=0;i<n;i++){
    cin>>s;
    m[s]++;
  }
  cout<<"AC x "<<m["AC"]<<"\n";
    cout<<"WA x "<<m["WA"]<<"\n";
  cout<<"TLE x "<<m["TLE"]<<"\n";
  cout<<"RE x "<<m["RE"]<<"\n";

}



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

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int N;
  cin >> N;
  int w;
  w = findSumOfDigits(N);
  if(N%w == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int N;
vector<vector<vector<double>>> dp;
vector<vector<vector<bool>>> reached;

double dfs(int a, int b, int c) {
  if (a < 0 || b < 0 || c < 0 || a + b + c == 0) return 0;
  if (reached.at(a).at(b).at(c)) return dp.at(a).at(b).at(c);
  reached.at(a).at(b).at(c) = true;
  int s = a + b + c;
  return dp.at(a).at(b).at(c) = (double)N / s + dfs(a - 1, b, c) * ((double)a / s) + dfs(a + 1, b - 1, c) * ((double)b / s) + dfs(a, b + 1, c - 1) * ((double)c / s);
}

int main() {
  cin >> N;

  int x1 = 0;
  int x2 = 0;
  int x3 = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a == 1) x1++;
    if (a == 2) x2++;
    if (a == 3) x3++;
  }

  dp.resize(N + 1, vector<vector<double>>(N + 1, vector<double>(N + 1, 0.0)));
  reached.resize(N + 1, vector<vector<bool>>(N + 1, vector<bool>(N + 1, false)));

  cout << fixed << setprecision(10) << dfs(x1, x2, x3) << endl;
  return 0;
}

Measured memory_bytes: 224000
#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>;

# define chmax(x, y) x = max(x, y)

int a[3005][3005];
ll dp[3005][3005][4];

int main() {
  int R, C, n;
  cin >> R >> C >> n;
  rep(i, n) {
    int r, c, v;
    cin >> r >> c >> v;
    a[r - 1][c - 1] = v;
  }

  rep(i, R) rep(j, C) {
    for (int k = 2; k >= 0; k--) {
      chmax(dp[i][j][k + 1], dp[i][j][k] + a[i][j]);
    }
    rep(k, 4) {
      chmax(dp[i + 1][j][0], dp[i][j][k]);
      chmax(dp[i][j + 1][k], dp[i][j][k]);
    }
  }

  ll ans = 0;
  rep(k, 4) chmax(ans, dp[R - 1][C - 1][k]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 320584
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int score = 0;
    int state = 1;
    rep(i, S.length()) { 
        if (S[i] == 'p' && state == 1) score--;
        else if (S[i] == 'g' && state == 0) score++;
        state = 1 - state;
    }
    cout << score << endl;

    return 0;
}


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

int main(){
	int K, A, B;
  	cin>>K>>A>>B;
  
  for(int i=A;i<=B;i++){
  	if(i%K==0){
    	cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;
}


Measured memory_bytes: 3588
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if (a*500 + b*100 + c*50) == X:
                count += 1
print(count)


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES 
#include <iomanip> 
#include <cmath>  
#include<iostream>
#include <fstream>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl

struct XY {
	int x, y;
};

char MAP[100][100];
int d[100][100];
bool flag[100][100];
queue<XY> q;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int counter;

int main() {
	int H, W;
	cin >> H >> W;

	repi(i, 0, W + 2) { 
		MAP[0][i] = '#';
		MAP[H + 1][i] = '#';
		MAP[i][0] = '#';
		MAP[i][W + 1] = '#';
	}
	repi(i, 1, H + 1) {
		repi(j, 1, W + 1) {
			cin >> MAP[i][j];
			if (MAP[i][j] == '#') counter++;
		}
	}

	d[1][1] = 1;
	flag[1][1] = true;

	XY first;
	first.x = 1, first.y = 1;
	q.push(first);

	while (q.size()) {
		XY p = q.front();
		q.pop();
		if (p.x == H&&p.y == W) break;
		repi(i, 0, 4) {
			int nx = p.x + dx[i], ny = p.y + dy[i];
			if (flag[nx][ny] == false && MAP[nx][ny] != '#') {
				XY np;
				np.x = nx, np.y = ny;
				q.push(np);
				d[nx][ny] = d[p.x][p.y] + 1;
				flag[nx][ny] = true;
			}
		}
	}

	if (flag[H][W]) wrln(H*W - counter - d[H][W]);
	else wrln(-1);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<functional>
#include<stack>
#include<queue>
#include<cmath>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
# define MOD 1000000000+7
# define INF 1000000000
typedef long long ll;
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }


int main() {
	ll r, d, x;
	cin >> r >> d >> x;
	cout << r * x - d << endl;
	int memo = r * x - d;
	for (int i = 1; i < 10; i++) {
		cout << r * memo - d << endl;
		memo = r * memo - d;
	}
	return 0;
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {
	private static List<Long> primes = new ArrayList<Long>();

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		long n = Long.parseLong(str);
		PrimeFactorize(n);
		long phi = n;
		for (long prime : primes) {
			phi = phi * (prime - 1) / prime;
		}
		System.out.println(phi);

	}

	private static void PrimeFactorize(long a) {
		long div = a;
		Boolean isBig = true;
		for (long i = 2; isBig; i++) {
			if (div % i == 0) {
				div = div / i;
				if (primes.size() == 0) {
					primes.add(i);
				} else if (i != primes.get(primes.size() - 1)) {
					primes.add(i);
				}
				i--;
			}
			isBig = i < Math.pow(div, 0.5);
		}
		if (div != 1) {
			if (primes.size() == 0) {
				primes.add(div);
			} else if (div != primes.get(primes.size() - 1)) {
				primes.add(div);
			}
		}
	}
}

Measured memory_bytes: 24224
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int p, q, r;
  cin >> p >> q >> r;
  int ans = p + q + r - max(p, max(q, r));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(){
    getline(cin,s);
    getline(cin,t);
    int Len=s.size(),Cnt=0;
    for(int i=0;i<Len;i++)
        Cnt+=(s[i]!=t[i]);
    cout<<Cnt;
    return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define F(i,n) for (int i = 0; i < n; ++i)
#define F1(i,n) for (int i = 1; i <= n; ++i)
#define dbg(x) cerr << #x << " = " << x << endl
#define dbgg(x) cerr << #x << " = " << x << ' '
#define T(x) x[pool]
#define mineq(x,y) { if ((x) > (y)) (x) = (y); }
#define maxeq(x,y) { if ((x) < (y)) (x) = (y); }
#define MEOW cout << "meowwwww" << '\n'; system("pause");
#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c)
{
	s << "[ "; for (auto it : c) s << it << " "; s << "\b]\n";
	return s;
}

template<typename T>
ostream& operator <<(ostream &s, const pair<int, T> &c)
{
	s << "[ "; cout << c.fi << " , " << c.se << " ] ";
	return s;
}

const int maxn = 123;
int n;
int a[maxn][2], b[maxn][2];

void input()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	F1 (i, n) cin >> a[i][0];
	F1 (i, n) cin >> a[i][1];
}

void solve()
{
	F1 (i, n) b[i][0] = b[i - 1][0] + a[i][0];
	F1 (i, n) b[i][1] = b[i - 1][1] + a[i][1];
	int ans = 0;
	F1 (i, n) ans = max(ans, b[i][0] + b[n][1] - b[i - 1][1]);
	cout << ans << '\n';
}

main()
{
	input();
	solve();
}


Measured memory_bytes: 256
function main(input) {
    const args = input.split('\n');
    const N = args[0],
          nums = args.slice(1, args.length - 1);

    console.log(nums.filter((n, i) => nums.indexOf(n) === i).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

int n;
ll a[200000], sum[200010], x[200010];

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

    cin >> n;
    REP(i, n) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
        x[i + 1] = x[i] ^ a[i];
    }

    ll ans = 0;
	REP(i, n) {
		int l = i + 1, r = n + 1;
		while(r - l > 1) {
			int m = (l + r) / 2;
			if (sum[m] - sum[i] == (x[m] ^ x[i])) l = m;
			else r = m;
			//cout << l << r << endl;
		}
		ans += l - i;
	}
	cout << ans << endl;

    return 0;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    vector<int> B(M);

    for (int i = 0; i < M; i++)
    {
        cin >> A.at(i) >> B.at(i);
    }

    for (int i = 1; i <= N; i++)
    {
        cout << count(A.begin(), A.end(), i) + count(B.begin(), B.end(), i) << endl;
    }

}

Measured memory_bytes: 3568
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(X);
    FORI(A,0,1001)
    {
        ll b=A*A*A*A*A-X;
        FORI(j,0,1001)
        {
            if((j*j*j*j*j)==abs(b))
            {
                if(b>=0)
                {
                    cout<<A<<" "<<j<<endl;
                }
                else
                {
                    cout<<A<<" "<<-1*j<<endl;
                }
                
                return 0;
            }
        }
    }

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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3664
row = int(input())
number = list(map(int,input().split()))

count = 0
flg = 0

while flg == 0:
  for i in range(row):
    if number[i] % 2 == 1:
    	flg = 1
    	break
    else:
      number[i] = number[i] / 2
  count += 1

print(count-1)


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

const int N = 100;

void selectionSort(int [], int);

void print(int [], int, int);

int main(){
	int n, a[N];
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	selectionSort(a, n);
	return 0;
}

void selectionSort(int a[], int n){
	int minJ, num = 0;
	for(int i = 0; i < n; i++){
		minJ = i;
		for(int j = i+1; j < n; j++){
			if(a[j] < a[minJ])
				minJ = j;
		}
		if(minJ != i){
			swap(a[i], a[minJ]);
			num++;
		}
	}
	print(a, n, num);
}

void print(int a[], int n, int num){
	cout << a[0];
	for(int i = 1; i < n; i++)
		cout << ' ' << a[i];
	cout << endl << num << endl;
}


Measured memory_bytes: 3108
from itertools import product
S = input().strip()
N = len(S)
cnt = 0
for x in product((0,1),repeat=N-1):
    y = ""
    for i in range(N-1):
        y += S[i]
        if x[i]==1:
            y += "+"
    y += S[N-1]
    cnt += eval(y)
print(cnt)

Measured memory_bytes: 73804
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;



int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    int a, b; cin >> a >> b;
    int ans = (b >= a) ? a : a-1;
    cout << ans << '\n';


    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        boolean[] bool = new boolean[n+1];
        for (int i=0;i<=n;i++){
            bool[i]=true;
        }
        for (int i=0;i<m;i++){
            bool[scanner.nextInt()]=false;
        }
        int[] b = new int[n+1];
        b[0] = 1;
        b[1] = 1;
        int mod = 1000000007;
        for (int i=2;i<=n;i++){
            b[i] = 0;
            if (bool[i-2])b[i]+=b[i-2];
            if (bool[i-1])b[i]+=b[i-1];
            b[i] %= mod;

        }
        System.out.println(b[n]);
    }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(int i = f; i < (int)l; ++i)
#define repit(it, t) for(__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++)

#define endl "\n"

#ifdef ONLINE_JUDGE
#define DEBUG false
#else
#define DEBUG true
#endif

#define pb emplace_back
#define lb lower_bound
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second

#define ALL(c) (c).begin(),(c).end()

#define DBG0(x){if(DEBUG){ cout << #x << ": " << x << "\t"; }}
#define DBG(x) {if(DEBUG){DBG0(x); cout << endl;}}
#define DBG2(x, y) {if(DEBUG){DBG0(x); DBG(y);}}
#define DBG3(x, y, z) {if(DEBUG){DBG0(x); DBG2(y, z);}}
#define DBG4(w, x, y, z) {if(DEBUG){DBG0(w); DBG3(x, y, z);}}

template <class T>
ostream& operator<<(ostream& os, vector<T> xs){ for(T x: xs) os << x << ' '; return os; }
template <class S, class T>
ostream& operator<<(ostream& os, pair<S,T> st){ os << "(" << st.first << "," << st.second <<")"; return os; }

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

int main(void){
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n){
        if(n == 0) break;
        vector<string> vs(n);
        rep(i, n) cin >> vs[i];
        vector<vint> fld(n, vint(n, 0));

        rep(i, n){
            for(int j = n; 0 <= --j; ){
                if(j == n - 1){
                    if(vs[i][j] == '.') fld[i][j] = 1;
                    else fld[i][j] = 0;
                    continue;
                }
                if(vs[i][j] == '*') fld[i][j] = 0;
                else fld[i][j] = fld[i][j + 1] + 1;
            }
        }
        int mx = 0;

//      rep(i, n) DBG(fld[i]);
        rep(i, n) rep(j, n){
            if(fld[i][j] <= mx) continue;
            int m = fld[i][j];
            bool flg = true;
            rep(k, m){
                m = min(m, fld[i+k][j]);
                if(k + i == n - 1) break;
            }
            flg &= (n - i >= m);
            if(flg){
//              DBG4(i,j,m, mx);
                mx = max(m, mx);
            }
        }
        cout << mx << endl;
    }
    return 0;
}

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

	#define mainspring cout<<"mainspring\n";
	#define barrel cout<<"barrel\n";
	#define escapement cout<<"escapement\n";

	#define pb push_back
	#define eb emplace_back
	#define all(v) (v).begin(), (v).end() 
	#define sz(v) (int)((v).size())
	#define fs first
	#define sd second
	#define tik(i,a,b) for(int i = a; i < b; i++)
	#define tok(i,a,b) for(int i = a; i >= b; i--)
	#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

	typedef long long ll;
	typedef unsigned long long ull;

	#define int ll 

	typedef pair < int, int > pi;
	typedef pair < pi, int > ppi;

	typedef vector < int > vi;
	typedef vector < vector < int > > vvi;
	typedef vector < pi > vpi;
	typedef vector < vpi > vvpi;
	typedef vector < ppi > vppi;

	void fast() {
	    ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
	}

	void err(istream_iterator<string> it) {cout << endl;}
	template<typename T, typename... Args>
	void err(istream_iterator<string> it, T a, Args... args) {
	    cerr << *it << " = " << a << " ";
	    err(++it, args...);
	}

	ll pow(ll x, ll y) {
		if(y == 0)
		return 1;
		ll temp = pow(x, y/2);
		temp = (temp*temp);
		if(y%2 == 1)
			temp *= x;
		return temp;
	}
	const int MAX = 2E3 + 100;
	int cnt[MAX];

	int32_t main() {
		int n, x, y;
		cin >> n >> x >> y;
		for(int i = 1; i <= n; i++) {
				for(int j = 1; j <= n; j++) {
					int dist = min({abs(i - j), abs(i - x) + 1 + abs(j - y), abs(i - y) + 1 + abs(j - x)});
					cnt[dist]++;
				}
		}
		for(int i = 1; i < n; i++)
			cout << cnt[i]/2 << '\n';	
	}


Measured memory_bytes: 256
import bisect
import sys

verbose = False


def main():
    rv = 0
    input = sys.stdin
    args = input.readline()
    argv = args.split()
    iargv = [int(arg) for arg in argv]
    ans = min(iargv[1] * iargv[0], iargv[2])
    print(ans)


if __name__ == '__main__':
    main()
    # mock()

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

using namespace std;

int main()
{
    int n;
    vector<int> card(100);
    int alice=0,bob=0;
    
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>card.at(i);
    }
    for(int i=0;i<n;i++)
    {
        for(int j=n-1;j>i;j--)
        {
            if(card.at(j) > card.at(j-1))
            {
                int small = card.at(j-1);
                card.at(j-1) = card.at(j);
                card.at(j) = small;
            }
        }
    }
    int count = n%2 == 0 ? n/2 : n/2+1;
    for(int i=0;i<count;i++)
    {
        if(i == count-1 && n%2 == 1)
        {
            alice += card.at(2*i);
        }else{
            alice += card.at(2*i);
            bob += card.at(2*i+1);
        }
    }
    cout<<alice-bob<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

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

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

int main()
{
    int a,b;
    cin >> a >> b;
    cout << lcm(a,b) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  while(n){
    n/=k; ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
#include <bits/stdc++.h>
using namespace std;
 
long long int calcPow(long long int a, long long int n) {
	if (n == 0){
		return 1;
	}
    if (n == 1){
        return a;
    }

    if (n % 2 == 1){
        return (a * calcPow(a, n - 1));
    }

    long long int t = calcPow(a, n / 2);
    return (t * t);
}

int main(){
    long long int N, tmp=0;
	vector<int> S;
	string res = "";

	cin >> N;

	int d=0;
	while(1){
		tmp += calcPow(26, d);
		if(tmp > N){
			break;
		}
		d++;
	}

	tmp=0;
	rep(i, d){
		tmp+=calcPow(26, i);
	}
	N = N-tmp;

	while(d!=0){
		if(d == 1){
			S.push_back(N);
			d--;
		}else{
			rep(i, d){
				tmp+=calcPow(26, i);
			}
			long long int w = calcPow(26, d-1);
			S.push_back(N/w);
			N = N%w;
			d--;
		}
	}

	rep(i, S.size()){
		res += ('a' + S[i]);
	}

	cout << res;

 
	return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;main(){int n,m,p,q,r,x,y;vector<int>::iterator u,v,z;for(;cin>>n>>m>>p>>q>>r;cout<<x<<endl){vector<int>s,t;s.push_back(0);for(s.push_back(r);m--;t.clear()){cin>>x>>y;u=upper_bound(s.begin(),s.end(),x);v=upper_bound(s.begin(),s.end(),y);if(v-s.begin()+1&1)t.push_back(0);t.push_back(0);for(z=v;z!=s.end();++z)t.push_back(*z-y);if(s.end()-u&1)t.push_back(n-y);for(z=u;z!=v;++z)t.push_back(*z-x+n-y);z=s.begin();if(v-s.begin()&1)++z;if(!z[1])z+=2;if(*z+n-x==t.back()){++z;t.pop_back();}for(;z!=u;++z)t.push_back(*z+n-x);s.swap(t);}s.insert(upper_bound(s.begin(),s.end(),p-1),2,p-1);s.insert(lower_bound(s.begin(),s.end(),q),q);s.push_back(n);z=upper_bound(s.begin(),s.end(),p-1);if(z-s.begin()&1)--z;for(x=0;*z<q;++z)m=*z++,x+=*z-m;}}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define int long long
struct Event
{
	int debut , fin;
	bool operator < (const Event & autre) const
	{
		return fin < autre.fin || (debut == autre.debut && debut < autre.debut);
	}
};
int32_t main()
{
	int N;
	cin >> N;
	Event events[N];
	for (int i = 0 ; i < N ; i++)
	{
		int a,b;
		cin>>a>>b;
		events[i] = {a-b , a+ b};
	}
	sort(events , events + N);
	int nbGardes = 0;
	int Xder = -1e15;
	for (int i = 0 ; i < N ; i++)
	{
		if (Xder <= events[i].debut)
		{
			Xder = events[i].fin;
			nbGardes++;
		}
	}
	cout<<nbGardes<<endl;
}

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

using namespace std;
int cnt;
vector<int> G;

void insertionSort(int A[], int n, int g){
    
    int v=0;
    int j;

    for(int i=g; i<n; i++){
       v = A[i];
       j = i - g;
       while(j >= 0 && A[j] > v){
           A[j+g] = A[j];
           j -= g;
           cnt++;
       }
       A[j+g] = v;
    }
}

void shellSort(int A[], int n){

    for(int h=1;;){
        if(h > n) break;
        G.push_back(h);
        h = 3*h+1;
    }
    
    cnt=0;
    int m = G.size();

    for(int i=m-1; i>=0; --i) insertionSort(A, n, G[i]);

    cout << m << endl;
    for(int i=m-1; i >= 0; i--){
        if(i != 0){
            cout << G[i] << " ";
        }else{
            cout << G[i] << endl;
        }
    }
    cout << cnt << endl;
    for(int i=0; i<n; i++){
        cout << A[i] << endl;
    }

    
}

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

    int A[n];
    for(int i=0; i<n; i++)  cin >> A[i]; 
    
    shellSort(A, n);

    return 0;
}

Measured memory_bytes: 7004
#include <iostream>

using namespace std;

int abs(int a) {
    return a >= 0 ? a : -a;
}

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

    bool res = true;
    int pt = 0, px = 0, py = 0;
    for (int i = 0; i < n; i++) {
        int t, x, y;
        cin >> t >> x >> y;

        if ((t - pt) < abs(x - px) + abs(y - py)
                || (t - pt) % 2 != (abs(x - px) + abs(y - py)) % 2) {
            res = false;
        }

        pt = t; px = x; py = y;
    }

    cout << (res ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
N = int(input())

s_min = 200
sum = 0
for _ in range(N):
    s_i = int(input())
    sum += s_i
    if s_i % 10 != 0:
        if s_min > s_i:
            s_min = s_i


if sum % 10 != 0:
    print(sum)
else:
    if s_min == 200:
        print(0)
    else:
        print(sum - s_min)


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

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

vector<ll> a;

bool solve(ll m){
  ll num = 0;
  ll N = a.size();
  for(auto &&x : a){
    ll nokori = x+m-(N-1);
    num += max((ll)0, (nokori+N)  / (N+1));
  }
  return num <= m;
}

int main(){
  ll N;
  cin >> N;
  a.resize(N);
  bool ok = true;
  ll sum = 0;
  for(int i=0;i<N;i++){
    cin >> a[i];
    sum+=a[i];
    if(a[i]>=N)
      ok=false;
  }
  ll zatu = max((ll)0, sum -N*N);
  ll rest = zatu;
  ll ans = 0;
  for(int i=0;i<a.size();i++){
    ll nokori = a[i]+zatu-(N-1);
    ll num = min(rest, max((ll)0, (nokori+N)  / (N+1)));
    rest -= num;
    a[i] = a[i] + zatu - (N+1) * num;
    ans += num;
  }
  for(ll plus = 0;true;plus++){
    if(solve(plus)){
      ans += plus;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;

int main(){
	int x;cin >> x;
	cout << 1-x << endl;

}
 
 

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

int main(){
    string s2,s;
    cin>>s2;
    s=s2;
    for(int i=0;i<s2.size();i++){
        s[s2.size()-(i+1)]=s2[i];
    }
    //cout<<s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='m' && i+4<s.size() && s[i+1]=='a' && s[i+2]=='e' && s[i+3]=='r' && s[i+4]=='d'){
            i+=4;
        }
        else if(s[i]=='e' && i+4<s.size() &&  s[i+1]=='s' && s[i+2]=='a' && s[i+3]=='r' && s[i+4]=='e'){
            i+=4;
        }
        else if(s[i]=='r' &&  i+5<s.size() && s[i+1]=='e'){
            //cout<<"?";
            if(s[i+2]=='s' && s[i+3]=='a' &&  s[i+4]=='r' &&  s[i+5]=='e'){
                //cout<<"*";
                i+=5;
            }
            else if(s[i+2]=='m' && i+6<s.size() && s[i+3]=='a' &&  s[i+4]=='e' &&  s[i+5]=='r' && s[i+6]=='d'){
                //cout<<"*";
                i+=6;
            }
            //cout<<s[i+3];
            //else{
            //    return cout<<"NO",0;
            //}
        }
        else{
            return cout<<"NO",0;
        }
    }
    return cout<<"YES",0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string s;
  cin>>s;
  int n=s.size();
  int ans=0;
  map<char,char> r;
  r['[']=']';
  r[']']='[';
  r['(']=')';
  r[')']='(';
  r['{']='}';
  r['}']='{';
  r['i']='i';
  r['w']='w';
  for(int b=0;b<(1<<n);b++){
    string t;
    for(int i=0;i<n;i++) if((b>>i)&1) t+=s[i];
    if(t.find("iwi")==string::npos) continue;
    int k=t.size();
    if(k%2==0) continue;
    if(t[k/2-1]!='i'||t[k/2]!='w'||t[k/2+1]!='i') continue;
    bool f=1;
    for(int i=0;i<k/2;i++) f&=t[i]==r[t[k-1-i]];
    if(f) ans=max(ans,k);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main(){
  int m, f, r;

  while(1){
    cin >> m >> f >> r;
    if( m == -1 && f == -1 && r == -1){
      break;
    }
    if( m == -1 || f == -1){
      cout << "F";
    } else if ( m + f >= 80){
      cout << "A";
    } else if ( m + f >= 65 && m + f < 80){
      cout << "B";
    } else if ( m + f >= 50 && m + f < 65){
      cout << "C";
    } else if ( m + f >= 30 && m + f < 50){
      if( r >= 50 ){
        cout << "C";
      } else {
        cout << "D";
      }
    } else {
      cout << "F";
    }
    cout << endl;
  }
  return 0;
}


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

static const int MAX = 100;
const int MOD = 1e+9 + 7;
int n;
map<string, ll> memo[MAX];

bool ok(string last4){
    for(int i = 0; i < 4; i++){
        string t = last4;
        if(i >= 1){
            swap(t[i-1], t[i]);
        }
        if(t.find("AGC") != string::npos){
            return false;
        }
    }
    return true;
}

ll dfs(int i, string last3){
    if(memo[i].count(last3))
        return memo[i][last3];
    if(i == n)
        return 1;
    ll ret = 0;
    for (char c : {'A', 'C', 'G', 'T'}) {
        string last4 = last3 + c;
        if(ok(last4)){
            ret = (ret + dfs(i+1, last4.substr(1, 3))) % MOD;
        }
    }
    memo[i][last3] = ret;
    return ret;
}

int main(){
    cin >> n;
    cout << dfs(0, "TTT") << endl;
    return 0;
}

Measured memory_bytes: 4020
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{   
	ll n,k;cin>>n>>k;
	ll h[n],dp[n];
	for(int i=0;i<n;++i)
	{
		cin>>h[i];
		dp[i]=1e16+1;
	}
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;++i)
	{
		for(int j=1;j<=k;++j)
		{
			if(i-j>=0)
			{
				dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
			}
		}
	}
	cout<<dp[n-1]<<"\n";

	return 0;
}

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

int main(){
    int aa[33]={0,1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
    int x;
    cin>>x;
    cout<<aa[x];
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] p = new int[n];
    int counter = 0;
    boolean ans = true;
    for(int i = 0;i < n;i++){
      p[i] = sc.nextInt();
      if(p[i] != i + 1){
        counter++;
        if(counter == 3){
          ans = false;
          break;
        }
      } 
    }
    if(ans){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}


Measured memory_bytes: 22868
A, B = map(int,input().split())
if A == 1:
    if B == 1:
        ans = "Draw"
    else:
        ans = "Alice"
elif B == 1:
    ans = "Bob"
elif A > B:
    ans = "Alice"
elif B > A:
    ans = "Bob"
else:
    ans = "Draw"
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
	int n, m;
	cin >> n >> m;
	vector<P> a(m);
	REP(i,m) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end());
	VI l(n), r(n);
	REP(i,n) l[i] = r[i] = i;
	REP(i,m){
		int y = a[i].second - 1;
		l[y] = min(l[y], l[y+1]);
		l[y+1] = l[y];
		r[y] = max(r[y], r[y+1]);
		r[y+1] = r[y];
	}
	REP(i,n){
		cout << r[i] - l[i] + 1;
		if (i < n-1) cout << " ";
	}
	cout << endl;
    return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    string s;
    cin >> s;
    
	// 処理
    int ans = 0;
    rep(i, 4) {
        if (s[i] == '+') ans++;
        if (s[i] == '-') ans--;
    }
    // 出力
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll n, k, a, b;
    cin >> n >> k;
    a = n / k;
    b = (n + k / 2) / k;
    if (k % 2) cout << a * a * a;
    else cout << a * a * a + b * b * b;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<string.h>
#include<vector>
#include<deque>
using namespace std;
const int MAX=1e5+10; 
vector<int>v[MAX];
deque<int>q;
int d[MAX];
int vis[MAX];
void bfs()
{
	while(q.size())
	{
		
		int x=q.front();
		q.pop_front();
		for(int i=0;i<v[x].size();i++)
		{
			int y=v[x][i];
			if(!vis[y])
			{
				if(d[y]==999999999)
				d[y]=x;
				q.push_back(y);
				vis[y]=1;
			}
		}
	}
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int hhn,hn;
		scanf("%d%d",&hhn,&hn);
		v[hhn].push_back(hn);
		v[hn].push_back(hhn);
	} 
	d[1]=0;
	vis[1]=1;
	for(int i=2;i<=n;i++)
	{
		d[i]=999999999;vis[i]=0;
	}
	q.push_back(1);
	bfs();
	int flag=1;
	for(int i=2;i<=n;i++)
	{
		if(d[i]==999999999)
		{
			flag=0;break;
		}
	}
	if(flag)
	{
		cout<<"Yes"<<endl;
		for(int i=2;i<=n;i++)
		cout<<d[i]<<endl;
	}else
	cout<<"No"<<endl;
return 0;
 } 

Measured memory_bytes: 10944
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
x = int(input())
for i in range(x):
  if is_prime(x+i) == True:
    print(x+i)
    break

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <memory>
#include <vector>

int main()
{
    int n, m;
    int a[30+1]={0,};

    std::cin >> n >> m;
    for(int i=0; i<n; i++)
    {
        int mm;
        std::cin >> mm;
        for(int j=0; j<mm; j++)
        {
            int x;
            std::cin >> x;
            a[x] += 1;
        }
    }

    int c=0;
    for(int i=1; i<=m; i++)
    {
        if(a[i]==n) c++;
    }
    std::cout << c << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string mp[101];
int h,w;
bool used[101][101];
 
void saiki(int x,int y,char ch){
  int dx[]={0,0,-1,1},dy[]={1,-1,0,0};
  if(used[y][x]) return;
  used[y][x]=1;
  for(int i=0;i<4;i++){
    int nx=x+dx[i],ny=y+dy[i];
    if(nx<0||ny<0||nx>=w||ny>=h||mp[ny][nx]!=ch)continue;
    saiki(nx,ny,ch);
  }
}
 
 
int main(){
  while(1){
 
  cin>>h>>w;
  if(!h&&!w)break;
  for(int i=0;i<h;i++)cin>>mp[i];
 
  memset(used,0,sizeof(used));
  int ans=0;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(!used[i][j]) ans++,saiki(j,i,mp[i][j]);
  cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2492
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
using namespace std;
const int INF = 0x3f3f3f3f;

struct Task
{
	char str[15];
	int time;
}task[100005];

int main()
{
	queue<Task> q;
	int n, p, ans = 0;
	cin >> n >> p;
	for(int i = 0; i < n; i++)
	{
		scanf("%s%d", task[i].str, &task[i].time);
		q.push(task[i]);
	}
	while(!q.empty())
	{
		if(q.front().time <= p)
		{
			ans += q.front().time;
			printf("%s %d\n", q.front().str, ans);
			q.pop();
		}
		else
		{
			ans += p;
			Task temp = q.front();
			temp.time -= p;
			q.pop();
			q.push(temp);
		}
	}
	return 0;
}

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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; }

int main() {
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n; i++) cout << 'x';
    cout << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int A,B;
    cin >> A >> B;
    if(A+B >= 10) cout << "error" << endl;
    else cout << A+B << endl;
    return 0;
}


Measured memory_bytes: 256