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

const int MOD = 1e9 + 7;

const int N = 5000001;
long long fact[N];
long long invfact[N];
long long inv[N];
void init() {
        fact[0] = fact[1] = 1;
        for (int i = 2; i < N; i ++) fact[i] = fact[i - 1] * i % MOD;
        inv[1] = 1;
        for (int i = 2; i < N; i ++) inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
        invfact[0] = invfact[1] = 1;
        for (int i = 2; i < N; i ++) invfact[i] = invfact[i - 1] * inv[i] % MOD;
}
long long C(long long n, long long r) {
        if (n < 0 || r < 0 || n < r) return 0;
        return fact[n] * invfact[n - r] % MOD * invfact[r] % MOD;
}

long long ModPow(long long x, long long n, long long m = MOD) {
        long long res = 1;
        while (n > 0) {
                if (n & 1) res = res * x % m;
                x = x * x % m;
                n >>= 1;
        }
        return res;

}

int main() {
        init();
        int k;
        cin >> k;
        string s;
        cin >> s;
        int n = s.size();
        long long ans = 0;
        for (int i = n - 1; i < n + k; i ++) {
                long long r = ModPow(26, n + k - i - 1);
                (r *= ModPow(25, i - n + 1)) %= MOD;
                (r *= C(i, n - 1)) %= MOD;
                (ans += r) %= MOD;
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 122468
pub struct ProconReader<R: std::io::Read> {
    reader: R,
}

impl<R: std::io::Read> ProconReader<R> {
    pub fn new(reader: R) -> Self {
        Self { reader }
    }
    pub fn get<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .reader
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&byte| byte == b' ' || byte == b'\n' || byte == b'\r')
            .take_while(|&byte| byte != b' ' && byte != b'\n' && byte != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf)
            .unwrap()
            .parse()
            .ok()
            .expect("Parse Error.")
    }
}

fn main() {
    let stdin = std::io::stdin();
    let mut rd = ProconReader::new(stdin.lock());

    let x: usize = rd.get();
    println!("{}", if x == 0 { 1 } else { 0 });
}

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

ll pow( ll n ){
  return n*n;
}

ll func( ll n ){
  if( n == 0 ) return 1;
  if( n == 1 ) return 5;
  if( n%2 == 0 ) return pow(func(n/2));
  else return pow(func(n/2))*5;
}

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

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

  ll ans = 0;

  ll cnt = 1;
  while( n >= func(cnt) ){
    ans += n/func(cnt)/2;
    ++cnt;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612
import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


int N, A, B;
int[] ans;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      A = readInt();
      B = readInt();
      if (popcnt(A ^ B) % 2 != 0) {
        int[] ans;
        int p = (1 << N) - 1;
        for (int a = A; a != B; ) {
          debug {
            writeln("ans = ", ans);
          }
          int im = -1;
          foreach (i; 0 .. N) {
            if ((p >> i) & 1) {
              if (((a ^ B) >> i) & 1) {
                im = i;
              }
            }
          }
          assert(im != -1);
          p ^= 1 << im;
          int[] js;
          foreach (j; 0 .. N) {
            if ((p >> j) & 1) {
              js ~= j;
            }
          }
          const len = cast(int)(js.length);
          ans ~= a;
          foreach (k; 1 .. 1 << len) {
            a ^= 1 << js[bsf(k)];
            ans ~= a;
          }
          a ^= 1 << im;
        }
        ans ~= B;
        assert(ans.length == 1 << N);
        foreach (k; 1 .. 1 << N) {
          assert(popcnt(ans[k - 1] ^ ans[k]) == 1);
        }
        writeln("YES");
        writeln(ans.to!string.replaceAll(regex(`[\[\],]`), ""));
      } else {
        writeln("NO");
      }
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
#define pi 2*asin(1.0)


//template functions
/////////////////////////
long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}
long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}
/////////////////////////



//Answer


int main() {

long A,B;
cin>>A>>B;
cout<<6-A-B<<endl;

}





Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]=='a'&&a[1]=='b'&&a[2]=='c')puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <utility>

typedef long long ll;
typedef unsigned long long ull;

#define vi std::vector<int>
#define vl std::vector<ll>
#define floop(n) for(int i = 0; i < n; ++i)
#define print(x) std::cout << x << std::endl;

const ll INF = 1e18;
const ll MOD = 1e9+7;

ll gcd(ll a, ll b) { return a == 0 ? b : gcd(b%a, a); }
ll mod(ll a) { return a % MOD < 0 ? (a % MOD) + MOD : a % MOD; }
ll mod_add(ll a, ll b) { return (a%MOD + b%MOD) % MOD; }
ll mod_sub(ll a, ll b) { return mod((a%MOD - b%MOD) % MOD); }
ll mod_mul(ll a, ll b) { return (a%MOD * b%MOD) % MOD; }
ll mod_pow(ll a, ll b) 
{
    if(b == 0) return 1;
    ll p = mod_pow(a, b/2) % MOD;
    p = mod_mul(p, p);
    return (b%2 == 0) ? p : mod_mul(a, p);
}
ll mod_inv(ll a) { return mod_pow(a, MOD-2); }
ll mod_div(ll a, ll b) { return a%MOD * mod_inv(b) % MOD; }


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

    int len = S.length();
    if(S[len-1] == 's')
    {
        print(S+"es");
    }
    else
    {
        print(S+"s");
    }
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
using namespace std;

int main(void){
	long long int n, d;
  	cin>>n>>d;
  
  	long long int x[n];
  	long long int y[n];
  	
  	int num=0;
  	for(int i=0;i<n;i++){
    	cin>>x[i]>>y[i];
      
      	if(d*d>=x[i]*x[i]+y[i]*y[i]) num++;
    }
  
  	cout<<num<<endl;
}

Measured memory_bytes: 6756
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    int num[n];
    rep(i,n) cin >> num[i];
    sort(num,num+n);
    int k = n / 2;
    cout << num[k] - num[k-1] << endl;
}

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

int main() {
  string o, e;
  cin >> o >> e;
  int n = e.size();
  for(int i=0; i<n; i++) {
    cout << o.at(i) << e.at(i);
  }
  if(o.size() > n) {
    cout << o.at(n) << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll money = 1000;
    ll stock = 0;
    REP(i, 0, N - 1) {
        if (A[i] < A[i + 1]) {
            ll st = money / A[i];
            money -= st * A[i];
            stock += st;
        } else {
            money += stock * A[i];
            stock = 0;
        }
    }
    money += stock * A[N - 1];
    cout << money << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int32 i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int32 i = (b) - 1; i >= (a); --i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define ALL(x) (x).begin(),(x).end()
#define C(x) cout << #x << " : " << x << endl
#define scanf scanf_s

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;



int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int32 n, x, t = 0;
	cin >> n;
	x = n;
	while (n) {
		t += n % 10;
		n /= 10;
	}
	if (x%t == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}
 
int main() {
  int N; 
  cin >> N;
  
  vector<int> A;
  int sum=0;
  rep(i,N){
    int a; cin >> a;
    if(a%10 != 0) A.push_back(a);
    sum+=a;
  }
  
  sort(A.begin(),A.end());
  
  if(A.size() == 0) cout << 0 << endl;
  else{
    if(sum%10 != 0) cout << sum << endl;
    else cout<< sum - A[0] << endl;
  }
}
  



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
int i,s;
char x[1001];
while(scanf("%s\n",&x),x[0]!='0'){
    s=0;
    for(i=0;x[i]!='\0';i++){
        s+=x[i]-'0';
    }
    printf("%d\n",s);
}
return 0; 
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    int A,B,C;
    cin >> A >> B >> C;
    bool poor=false;
    if(A==B&&A!=C){
        poor=true;
    }
    if(A==C&&A!=B) {
        poor=true;
    }
    if(B==C&&B!=A) {
        poor=true;
    }
    
    if(poor==true) {
        cout << "Yes" << endl;
    }
    else{
        cout <<"No" << endl;
    }
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)   for(signed i=0; i<n; i++)
#define FOR(i, k, n)    for(signed i=k; i<n; i++)
#define yn(b)   cout << ((b)?"Yes":"No") << endl
#define YN(b)   cout << ((b)?"YES":"No") << endl
#define pr(r)   cout << r << endl
#define min(x,y)    (x<y)?x:y
#define max(x,y)    (x>y)?x:y
#define ll  long long
int main(void){
    ll n;
    cin >> n;
    int k=0, i=0;
    while(n/(int)(pow(10,i))>0){
        k+=n/(int)(pow(10,i))%10;
        i++;
    }
    yn(n%k==0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    int a = (int)sqrt(n);
    ll ans = 0;
    for (int i=1; i<n; i++) {
        ans += n/i;
        if (n%i==0) ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

unsigned ll ggd(unsigned ll number1,unsigned ll number2){
    unsigned ll m = number1;
    unsigned ll n = number2;

    if(number2 > number1){
        m = number2;
        n = number1;
    }

    while(m != n){
        unsigned ll temp = n;
        n = m - n;
        m = temp;
    }

    return m;
}

unsigned ll lcm(unsigned ll number1,unsigned ll number2){
    return number1 * number2 / ggd(number1,number2);
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    unsigned long long a, b, c, d, num, min_c, min_d, max_c, max_d;
    cin >> a >> b >> c >> d;


    //unsigned ll xx = lcm(c, d);
    unsigned long long xx =  c / __gcd(c, d);
    xx *= d;
    //while(xx % d != 0) xx += c;
    //cout << xx << endl;



    num = b - a + 1;
    unsigned long long min_cc = a / c;
    if(a % c != 0) {
        min_c = (min_cc + 1) * c;
        min_cc ++;
    }
    else min_c = min_cc * c;
    unsigned long long  min_dd = a / d;
    if(a % d != 0) {
        min_d = (min_dd + 1) * d;
        min_dd ++;
    }
    else min_d = (min_dd) * d;
    unsigned long long max_cc = b / c;
    //max_c = max_cc * c;
    unsigned long long max_dd = b / d;
    //max_d = max_dd * d;
    unsigned long long min_cd = a / xx;
    if(a % xx != 0) min_cd ++;
    unsigned long long max_cd = b / xx;
    unsigned long long cc = max_cc - min_cc + 1;
    unsigned long long dd = max_dd - min_dd + 1;
    unsigned long long ee = max_cd - min_cd + 1;

    if(max_cc != 0 && max_dd != 0 && max_cd != 0)cout << num - ((max_cc - min_cc + 1) + (max_dd - min_dd + 1) - (max_cd - min_cd + 1)) << endl;
    else{
        if(max_cc == 0) cc =0;
        if(max_dd == 0) dd = 0;
        if(max_cd == 0) ee = 0;
        cout << num - (cc + dd + ee)<< endl;
    }
}

Measured memory_bytes: 256
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair<int, pair<int, int> >

const int maxn = 1000* 100 + 5;
pll a[maxn];

int32_t main(){
    ios_base::sync_with_stdio;
    ll n, sum_b = 0, sum_a = 0;
    cin >>n;
    for(int i = 0; i < n; i ++){
        int x, y;
        cin >>x >>y;
        a[i].F = x + y;
        a[i].S = x;
        sum_a += x;
        sum_b += y;
    }
    sort(a, a + n);
    ll cn_a = 0, cn_b = 0;
    for(int i = n - 1; i >= 0; i -= 2){
        cn_a += a[i].S;
        cn_b += a[i].F - a[i].S;
    }
    cout <<cn_a - (sum_b - cn_b) <<endl;
    return false;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
    int H, W;
    cin >> H >> W;
    vector< vector<char> > grid(H+2, vector<char>(W+2, '.'));
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            cin >> grid[i][j];
        }
    }

    vector< vector<int> > ans(H+2, vector<int>(W+2));
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            if(grid[i][j] == '.') {
                if(grid[i-1][j-1] == '#') ans[i][j]++;
                if(grid[i-1][j] == '#') ans[i][j]++;
                if(grid[i-1][j+1] == '#') ans[i][j]++;
                if(grid[i][j-1] == '#') ans[i][j]++;
                if(grid[i][j+1] == '#') ans[i][j]++;
                if(grid[i+1][j-1] == '#') ans[i][j]++;
                if(grid[i+1][j] == '#') ans[i][j]++;
                if(grid[i+1][j+1] == '#') ans[i][j]++;
            }
        }
    }

    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            if(grid[i][j] == '#') {
                cout << '#';
            } else {
                cout << ans[i][j];
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))


cnt = 0
mx = 0
s = [_ for _ in input()]
for si in s:
  if si == 'R':
    cnt +=1
    mx = max(mx, cnt)
  else:
    mx = max(mx, cnt)
    cnt =0

print(mx)

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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)

int main() {
  int n,d;
  int ans=0;
  cin >> n >> d;
  while (n > 0){
    n-=2*d+1;
    ans++;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    char s[6];
    int len;
    int i;
    int ans;

    scanf("%s",s);
    len=strlen(s);

    ans = 1;
    for(i=0;i<len/2;i++){
        if(s[i]!=s[len-1-i]){
            ans = 0;
            break;
        }
    }

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

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);
		int n = sc.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		int count = 0;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				for(int k=j+1;k<n;k++){
					Solve obj = new Solve(a[i], a[j], a[k]);
					if(obj.solve())
						count++;
				}
			}
		}
		out.println(count);
	}
}

class Solve{
	int a, b, c;

	public Solve(int x, int y, int z){
		this.a=x;
		this.b=y;
		this.c=z;
	}

	public boolean solve(){
		if(this.a > this.b){
			int temp = this.a;
			this.a = this.b;
			this.b = temp;
		}

		if(this.a > this.c){
			int temp = this.a;
			this.a = this.c;
			this.c = temp;
		}

		if(this.b > this.c){
			int temp = this.b;
			this.b = this.c;
			this.c = temp;
		}

		return this.a != this.b && this.b != this.c && this.a + this.b > this.c;
	}
}


Measured memory_bytes: 40544
N=input()
S=[ list(raw_input()) for i in range(N)]

A=0
ans=0
for B in range(N):
	flag=0
	for i in range(N):
		if flag==-1: break
		for j in range(N):
			x1=(N+i-A)%N
			y1=(N+j-B)%N

			x2=(N+j-A)%N
			y2=(N+i-B)%N

			if S[x1][y1]==S[x2][y2]:
				pass
			else:
				flag=-1
				break
	else:
		ans+=1*N


print ans


Measured memory_bytes: 36328
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main(){
	int n,k;
	scanf("%d %d",&n,&k);
	int a[55];
	for(int i = 1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	int sum=0;
	for(int i = n;i>n-k;i--){
		sum+=a[i];
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;

int main() {
	string s, t;
	char shoge, thoge;
	int k;
	cin >> s >> t;
	for (int i = 0; i < t.size(); i++) {
		k = i;
		for (int j = 0; j < t.size(); j++) {
			shoge = s[j];
			if (k == t.size()) k = 0;
			thoge = t[k];
			k++;
			if (shoge != thoge)break;
			if (j == t.size() - 1) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
//#define i_7 (ll)(1E9+7)
//#define i_5 (ll)(1E9+5)
/*ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}*/
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

////////////////////////////////////////
#define i_7  998244353
#define i_5  998244351
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
#define N 10004
ll kai[N];
ll kai2[N];
ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return mod(po(mod(mod(i)*mod(i)),p/2));
    else  return mod(mod(i)*mod(po(i,p-1)));
}
void calc(){
    kai[0]=1;
    kai2[0]=1;
    for(int i=1;i<N;i++){
        kai[i]=mod(kai[i-1]*i);
        kai2[i]=mod(po(kai[i],i_5));
    }
}
ll comb(ll n,ll k){
    if(n==0){
        if(k==0)return 1;
        else return 0;
    }
    else if(n<k)return 0;
    else return mod(mod(mod(kai[n])*mod(kai2[n-k]))*mod(kai2[k]));
}

int main(){
    calc();
    ll n,k;cin>>k>>n;
    ll all=mod(comb(n+k-1,n));
    rep(i,2,2*k){
        ll p;
        if(i<=k+1)p=i/2;
        else p=(2*k+2-i)/2;
        
        ll q=mod(comb(n+k-3,k-1)*p);
        if(p>=2)for(int j=2;n-2*j>=0;j++){
            q=mod(q+mod(mod((ll)pow(-1,j-1)*comb(p,j))*comb(n+k-2*j-1,k-1)));
        }
        ll ans=mod(all-mod(q));
        cout<<ans<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<math.h>
#include<string.h>
using namespace std;

int main() {

	int ose[10][10000];														//お煎餅
	int R, C;																//縦、横
	while (cin >> R >> C,R!=0&&C!=0) {															//縦、横の入力
		for (int i = 0; i < R; i++) {
			for (int j = 0; j < C; j++) {
				cin >> ose[i][j];												//お煎餅入力
			}
		}

		int ans = 0;																//答え入れるやつ				

		for (int i = 0; i < (1 << R); i++) {									//縦のお煎餅の並びの全パターン

			int table = 0;
			int sum = 0;
			for (int j = 0; j < C; j++) {										//横指定
				table = 0;
				for (int k = 0; k < R; k++) {									//縦指定

					table += (ose[k][j] != ((i >> k) & 1));

				}
				sum += max(table, R - table);
			}
			ans = max(ans, sum);
		}

		cout << ans << endl;													//回答出力
	}
	return 0;
}


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

using namespace std;

#define PB push_back
#define f first
#define s second

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

const int N = 100005;
string s[N];
vector<char> ans;
int n, arr[3];
vector<int> pos[3];

int f(string str)
{
    if(str == "AB")
    {
        return 2;
    }
    if(str == "BC")
    {
        return 0;
    }
    if(str == "AC")
    {
        return 1;
    }
}

int pos1(int x)
{
    if(x == 2)
    {
        return 1;
    }
    if(x == 0)
    {
        return 1;
    }
    if(x == 1)
    {
        return 0;
    }
}

int pos2(int x)
{
    if(x == 2)
    {
        return 0;
    }
    if(x == 0)
    {
        return 0;
    }
    if(x == 1)
    {
        return 1;
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> arr[0] >> arr[1] >> arr[2];
    for(int i=0; i<n; i++)
    {
        cin >> s[i];
        int x = f(s[i]);
        pos[x].PB(i);
    }

    for(int j=0; j<3; j++)
    {
        pos[j].PB(n);
    }
    for(int i=0; i<n; i++)
    {
        vector<int> v;
        int x = f(s[i]);
        //cout << x << "\n";
        for(int j=0; j<3; j++)
        {
            if(j != x)
            {
                v.PB(j);
            }
        }
        if(arr[v[0]] > arr[v[1]])
        {
            ans.PB(v[1] + 'A');
            arr[v[0]]--;
            arr[v[1]]++;
        }
        else if(arr[v[1]] > arr[v[0]])
        {
            ans.PB(v[0] + 'A');
            arr[v[1]]--;
            arr[v[0]]++;
        }
        else
        {
            if(arr[v[0]] == 0)
            {
                cout << "No";
                return 0;
            }
            if(arr[v[0]] == 1 && arr[x] == 0)
            {
                auto j = upper_bound(pos[x].begin(), pos[x].end(), i);
                auto k = upper_bound(pos[(x+1)%3].begin(), pos[(x+1)%3].end(), i);
                auto l = upper_bound(pos[(x+2)%3].begin(), pos[(x+2)%3].end(), i);
                if(*j < n && *j == i+1)
                {
                    arr[v[0]]--;
                    arr[v[1]]++;
                    ans.PB(v[1]+'A');
                }
                else if(*k < n && *k == i+1)
                {
                    int xx = pos1(x);
                    arr[v[xx]]++;
                    arr[v[1-xx]]--;
                    ans.PB(v[xx]+'A');
                }
                else if(*l < n && *l == i+1)
                {
                    int xx = pos2(x);
                    arr[v[xx]]++;
                    arr[v[1-xx]]--;
                    ans.PB(v[xx]+'A');
                }
                else
                {
                    arr[v[0]]--;
                    arr[v[1]]++;
                    ans.PB(v[1]+'A');
                }
            }
            else
            {
                arr[v[0]]--;
                arr[v[1]]++;
                ans.PB(v[1]+'A');
            }
        }
    }

    cout << "Yes\n";
    for(int i=0; i<ans.size(); i++)
    {
        cout << ans[i] << "\n";
    }



    return 0;
}


Measured memory_bytes: 7276
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}

ll getdigit(ll n){
	string s=to_string(n);
	return s.size();
}
	
int main(){
	init();
	vector<ll>num(27,INF);
	ll n;cin>>n;
	for(int i=0;i<n;i++){
		vector<ll>_v(27,0);
		string s;
		cin>>s;
		for(int j=0;j<s.length();j++){
			_v[(s[j]-'a')]++;
		}
		for(int j=0;j<27;j++){
			num[j]=min(_v[j],num[j]);
		}
	}
	string ans;
	for(int i=0;i<27;i++){
		for(int j=0;j<num[i];j++){
			ans+=(char)('a'+i);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
inp = []
inp.append(raw_input())
for i in xrange(10 + int(inp[0].split(" ")[0])):
    inp.append(raw_input())
Size = inp[0]

Mml = [None, 0] + [None] * 8
Cij = [[0] * 10 for i in range(10)]
for i in xrange(10):
    for j, a in enumerate(map(int,inp[i + 1].split(" "))):
        Cij[i][j] = a
        #print a,
    #print

def sloveMm(n):
    global Mml
    if(Mml[n] != None):
        return Mml[n]
    Nmm = Cij[n][1]
    rourt = [[n, 0, Nmm,n]]
    while len(rourt) > 0:
        rl = len(rourt)
        new_rourt = []
        for rn in xrange(rl):
            r = rourt[rn]
            for i in xrange(10):
                if i != r[0]:
                    nm = r[1] + Cij[r[0]][i]
                    if nm < Nmm:
                        """if Mml[i] != None:
                            Mml[n] = nm + Mml[i]
                            return nm + Mml[i]"""
                        if i == 1:
                            #print r
                            Nmm = nm
                        new_rourt.append([i, nm, nm + Cij[i][1]] + r[3:] + [i] )
        rourt = new_rourt
    Mml[n] = Nmm
    return Nmm


NumberList = [0] * 10
for Ai in inp[11:]:
    #print Ai
    for A in Ai.split(" "):
        if A != "-1" and A != "":
            NumberList[int(A)] += 1

ans = 0
for i, n in enumerate(NumberList):
    if n > 0:
        ans += sloveMm(i) * n
        #print "AA",i,":",Cij[i][1],">>",Mml[i],"*", n
#print Mml
#print NumberList
print ans



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

using namespace std;


typedef long long ll;
ll mod=1e9+0LL;
ll MOD=1e18+0LL;
#define line printf("\n")
double pi=acos(-1);
ll md=1000000007;
ll gcd(ll a,ll b){
    //if(b>a) swap(a,b);
    return b==0?abs(a):gcd(b,a%b);
}
ll poW(ll a ,ll n)
{
    if(n==0) return 1;
    if(n%2==0)
    {
        ll b=poW(a,n/2);
        return (b*b)%md;
    }
    return (poW(a,n-1)*a)%md;
}

char gap=' ';






















//vector<int>v[200100];
//bool visit[200100]={0};
//int vc[200100]={0};
//
//
//int cnt;
//void dfs(int s,int c=0)
//{
//    if(visit[s]) return;
//    cnt++;
//        visit[s]=1;
//
//        for(int i=0;i<v[s].size();i++) {
//                dfs(v[s][i]);
//        }
//
//}


int main()
{
    int cs=1;
    //scanf("%d",&cs);
    while(cs--)
    {
       int i,n,x,y,j;
       cin>>x>>y;
       i=0,j=x;
       for(;i<=x;i++,j--)
       {
           if((i*2+j*4)==y)
           {
               printf("Yes");
               return 0;
           }
       }
       printf("No");
    }
}


Measured memory_bytes: 3684
/*
“Being happy doesn't mean that everything is perfect. It means
that you decided to look beyond the imperfections.”
*/

#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include <limits>
using namespace std; 

#define int int64_t
#define pr(x) cout << x << endl;
#define vi vector<int>
#define vii vector< vector<int> >
#define mp make_pair
#define ii pair<int,int>
#define fr(i,x,n) for(i = x ; i< n ; i++)
#define f(i,n) for(i = 0 ; i< n ; i++)
#define ff first
#define ss second
#define pb push_back
#define SIZE 200001
#define mod 1000000007
#define int_max 1e12
void solve();
 
int power(int a, int b)
{
    if(b==0) return 1;
    else if(b&1) return a*power(a*a,b/2);
    else return power(a*a, b/2);
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}
int fact(int n)
{
    int i, k=1;
    fr(i, 2, n+1) k*=i;
    return k;
}

int  j=1, n, t, dot=0, i, k, a, x, y,z,c, q,toko;

void solve()
{
    // cin >> t;while(t--)
    {
       cin >> n >> k >> q;
       vi v(n,0);
       f(j,q)
       {
           cin >> i; 
           v[i-1]++;
       }

       f(i,n)
       {
           v[i] = k-(q-v[i]) ;
       }

       f(i,n)
       {
           if(v[i]>0) pr("Yes")
           else pr("No") 
       }
    }
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(i,a,b) for (int i = a; i <= (b); ++i) 
typedef long long ll;
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
*/
int n;
int noweat = 999;
int sum = 0;
int temp = 0;
cin >> n;
vector<int>a(n);
vector<int>b(n);
vector<int>c(n - 1);
rep0(i, n - 1)cin >> a[i];
rep0(j, n - 1)cin >> b[j];
rep0(k, n - 2)cin >> c[k];
rep0(m, n - 1) {
	sum += b[a[m] - 1];
}
rep0(kk, n - 2) {
	if (a[kk + 1] - a[kk] == 1) {
		sum += c[a[kk] - 1];
	}
}
cout << sum << endl;
return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}

	b := make([]int, n)
	ans := make([]int, 0, n)
	for i := len(a); i >= 1; i-- {
		x := 0
		for j := 2; j <= n; j++ {
			if i*j > n {
				break
			}
			x ^= b[i*j-1]
		}
		b[i-1] = x ^ a[i-1]
		if b[i-1] == 1 {
			ans = append(ans, i)
		}
	}

	fmt.Println(len(ans))

	wr := bufio.NewWriter(os.Stdout)
	for i, v := range ans {
		if i == len(ans)-1 {
			wr.WriteString(strconv.Itoa(v) + "\n")
			continue
		}
		wr.WriteString(strconv.Itoa(v) + " ")
	}
	wr.Flush()
}


Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>

int main()
{
	int X, N, * p, dif = 1, num = -1;
	std::cin >> X >> N;
	p = new int[N+2];
	for (int i = 0; i < N; i++)
	{
		std::cin >> p[i];
	}
	p[N] = -1000;
	p[N + 1] = 1000;
	std::sort(p,p+N+2);
	for (int i = 1; i < N+1; i++)
	{
		if (p[i] == X)num = i;
	}
	if (num == -1) {
		std::cout << X;
		exit(0);
	}
	while (true) {
		if (p[num - dif] != X - dif) {
			std::cout << X - dif;
			break;
		}
		if (p[num + dif] != X + dif) {
			std::cout << X + dif;
			break;
		}
		dif += 1;
	}
}

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

double f(int x1, int y1, int x2, int y2) {
  return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int main() {
  int n;
  cin >> n;
  vector<P> vec(n);
  rep(i, n) cin >> vec.at(i).first >> vec.at(i).second;
  int m = 1;
  for(int i = 1; i <= n; i++) m *= n;
  int l = 2 * m / n;
  double sum = 0;
  rep(i,n)for(int j = i+1; j < n; j++) sum += f(vec.at(i).first, vec.at(i).second, vec.at(j).first, vec.at(j).second);
  double S = l * sum;
  cout << fixed << setprecision(10) << S/m << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin>>N;
    int A[N];
    rep(i,N) cin>>A[i];

    int ans=0;
    rep(i,N){
        if(A[i]==0) continue;
        if(i!=0) A[i]+=A[i-1];
        ans+=A[i]/2;
        A[i]%=2;
    }
    cout << ans << endl;



}


Measured memory_bytes: 1024
A,B=map(int,input().split())
if A%2==0:
    if B%2==0:
        print(int(((B-A)/2)%2)+B)
    else:
        print(int(((B-A+1)/2)%2))
else:
    if B%2==1:
        print(A-int(((B-A)/2)%2))
    else:
        print(A^B+int(((B-A-1)/2)%2))


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

int main()
{
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  while(1){
    C = C - B;
    if(C <= 0){
      cout << "Yes" << endl;
      break;
    }
    A = A - D;
    if(A <= 0){
      cout << "No" << endl;
      break;
    }
  }
  return 0;
}


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

pair< int, int > dir(string s)
{
  if(s == "north") return(make_pair( 0, 1));
  if(s == "west" ) return(make_pair(90, 1));
  if(s[0] == 'n') {
    auto p = dir(s.substr(5));
    p.first <<= 1, p.second <<= 1;
    return(make_pair(p.first - 90, p.second));
  } else {
    auto p = dir(s.substr(4));
    p.first <<= 1, p.second <<= 1;
    return(make_pair(p.first + 90, p.second));
  }
}

int main()
{
  string s;
  while(cin >> s, s != "#") {
    auto p = dir(s);
    int g = __gcd(p.first, p.second);
    p.first /= g, p.second /= g;
    if(p.second == 1) cout << p.first << endl;
    else cout << p.first << "/" << p.second << endl;
  }
}

Measured memory_bytes: 3108
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int n;
  cin >> n;
  bool flag = true;
  rep(i, 26) {
    rep(j, 15) {
      int sum = i*4 + j*7;
      if(sum == n) {
        flag = false;
        coYes;
        break;
      }
    }
    if (flag == false) {
      break;
    }
  }
  if (flag) {
    coNo;
  }
}


Measured memory_bytes: 3632
import java.util.Scanner;

class Main{
  private static int H,W;

  public static void main(String[] args){
    
    Scanner s= new Scanner(System.in);
   
   while(true){
   H=s.nextInt();
   W=s.nextInt();
   
   if(H==0&&W==0){
       break;
   }
   for(int i = 0;i<H;i++){
       
       for(int x=0;x<W;x++){
if(i%2==0){
      if(x%2==0){
   System.out.print("#");

}else { System.out.print("."); }

}
else{if(x%2==0){
System.out.print(".");

}else{  System.out.print("#");}



}
           
        
       }
       System.out.println("");
       
   }System.out.println("");
   
  }
  }   
  
  }


Measured memory_bytes: 32832
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define PER(i,n,a) for(ll i=n;i>a;i--)
#define REP1(i,a,n) for(ll i=a;i<=n;i++)
#define forit(it,x) for(auto it=(x).begin();it!=(x).end();++it)
#define ull unsigned long long int
#define ld long double
#define prec(n) fixed<<setprecision(n)
#define test ll t; cin>>t; while(t--)
#define re return 0
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD (ll)1000000007
#define fi first
#define se second
#define eb emplace_back
#define vll vector<ll>
#define vi  vector<int>
#define mpll map<ll,ll>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)
const ll MAXI = (ll)1e9+7;
int main(){
    IOS;
/*    test{
        int n;
        cin>>n;
        int ar[n];
        REP(i,a,n){
           cin>>ar[i];
        }
    }
    */
    string str;
    cin>>str;
    if(str=="SUN"){
        cout<<"7"<<"\n";
    }else if(str=="MON"){
        cout<<"6"<<"\n";
    }else if(str=="TUE"){
        cout<<"5"<<"\n";
    }else if(str=="WED"){
        cout<<"4"<<"\n";
    }else if(str=="THU"){
        cout<<"3"<<"\n";
    }else if(str=="FRI"){
        cout<<"2"<<"\n";
    }else if(str=="SAT"){
        cout<<"1"<<"\n";
    }
re;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> L(N, 0);
    for (int i=0; i<N; i++) cin >> L[i];

    sort(L.begin(), L.end());

    int sum = 0;
    for (int i=0; i<N-1; i++) sum += L[i];
    if (sum > L[N - 1]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )
#define int long long

using namespace std;

const int N = 1e5 + 5;

int n, s, m;

int f (int n, int x)
{
    if (n == 0)
        return 0;

    return f(n / x, x) + n % x;
}

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

    if (n == s)
    {
        cout << n + 1;
        return 0;
    }
    for (int i = 2; i * i <= n; i++)
    {
        if ( f(n, i) == s )
        {
            cout << i << endl;
            return 0;
        }
    }
    if (n < s)
    {
        puts("-1");
        return 0;
    }
    m = n - s;
    for (int i = sqrt(m) + 1; i >= 1; i--)
    {
        if (m % i == 0)
        {
            int a = m / i, b = i;

            if (a < b)
                swap(a, b);
           if ( f( n, a + 1 ) == s  )
           {
               cout << a + 1 << endl;
               return 0;
           }
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 512
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        int[] num = new int[3];

        while(true){
            String[] line = br.readLine().split(" ");
            int n = Integer.parseInt(line[0]);
            int x = Integer.parseInt(line[1]);
            int cnt = 0;

            if(n == 0 && x == 0){
                break;
            }
            for(int i = 1; i <= n; i++){
                num[0] = i;
                for(int j = i+1; j <= n; j++){
                    num[1] = j;
                    for(int k = j+1; k <= n; k++){
                        num[2] = k;
                        if(num[0] + num[1] + num[2] == x){
                            cnt++;
                        }
                    }
                }
            }
            sb.append(cnt).append("\n");
        }
        System.out.print(sb.toString());
    }
}

Measured memory_bytes: 25000
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  if(S == "hi" || S == "hihi" || S == "hihihi" || S == "hihihihi" || S == "hihihihihi"){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using ld = long double;

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ld x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    ld a = abs(x1 - x2);
    ld b = abs(y1 - y2);
    ld cPow2 = pow(a, 2) + pow(b, 2);
    ld c = sqrtl(cPow2);
    cout << setprecision(10) << c << endl;
}


Measured memory_bytes: 3292
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    import math
    a,b,c,x,y=map(int, input().split())
    cmax=max(x,y)*2
    l=[]
    for i in range(cmax+1):
        amai = max(math.ceil(x - 0.5 * i),0)
        bmai = max(math.ceil(y - 0.5 * i),0)
        l.append(amai*a+bmai*b+i*c)
    print(min(l))
resolve()

Measured memory_bytes: 62304
// Template
#include <bits/stdc++.h>
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T& x, const T& y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T& x, const T& y) {if (x < y) {x = y; return 1;} return 0;}
struct IOSET {IOSET() {cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10);}} ioset;

// Main
constexpr int MAX_N = 2000, MAX_A = 2000;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    bitset<MAX_N * MAX_A + 1> bs;
    bs[0] = 1;
    rep(i, n) bs |= (bs << a[i]);
    
    int sum = 0;
    rep(i, n) sum += a[i];
    rep(i, (sum + 1) / 2, MAX_A * MAX_N + 1) {
        if (bs[i]) {
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 5112
#include<iostream>
using namespace std;
int main(){
	int a,b,c;
  cin>>a;
  cin>>b;
  cin>>c;
  int sum=a+b+c;
  if(sum>=22){
    cout<<"bust"<<endl;
  }
  else{
    cout<<"win"<<endl;
  }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 5100000
#define MOD 1000000007
#define INF 100000000000000

ll solve(ll A){
  ll ans=0;
  ll res=1;
  ll x=A%2;
  if(A%4==1||A%4==2){
    ans+=1;
  }
  A>>=1;
  res<<=1;
  while(A>0){
    if(x==0){
      ans+=res*(A%2);
    }
    A>>=1;
    res<<=1;
  }
  return ans;

}

int main(){
  ll A,B;
  cin>>A>>B;

  ll ans=0;
  if(A==0){
    ans=solve(B);
  }else{
    ans=solve(B)^solve(A-1);
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define for1(start,end) for(int i = start; i < end; i++)
#define forr(start,end) for(int j = start; j < end; ++j)
#define gap ' '

const int MAXN = 200;
ll a[MAXN], ST[MAXN * 4], LZ[MAXN*4];
int gcd(int a , int b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}

int main(){
    int k = 0;
    cin >> k;
    ll res = 0;
    for(int i = 1; i <= k; i++){
        for(int j = 1; j <= k; j++){
            for(int x = 1; x <= k; x++){
                res+=gcd(gcd(i,j),x);
            }
        }
    }
    cout << res << endl;

    return 0;  
}

Measured memory_bytes: 3192