akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.io.*;

public class Main {
	static int gcd (int a, int b) {
	    return b == 0 ? a : gcd (b, a % b);
	}
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		int n = in.readInt(); 
		int ans = 0; 
		for(int i = 0; i<n; i++) {
			int x = in.readInt();
			ans = gcd(x,ans); 
		}
		System.out.println(ans); 
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 24020
#include <bits/stdc++.h>
#include <set>
#include <numeric>
#define rep(i,n) for (int i=0; i < (n); ++i)
#define all(a) a.begin(), a.end()
using ll = long long;
using namespace std;
 


int solve() {
  int n; cin >> n;
  vector<int> v(n);
  vector<int> c(n);
  for (int i=0;i<n;++i) {
    cin >> v[i];
  }
  for (int i=0;i<n;++i) {
    cin >> c[i];
  }
  int ans=0;
  for (int i=0;i < n; ++i) {
    if (v[i]> c[i]){
      ans += v[i] - c[i];
    }
  }

  cout << ans << endl;

}


int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define f first
#define s second
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define fast 
#define f first
#define s second
#define endl "\n"
#define pie 3.1415926535
   
int main(){
    int n,m;
    cin >> n >> m;
    int arr[m];
    long long sum = 0;
    for(int i=0;i<m;i++){
        cin >> arr[i];
        sum+= arr[i];
    }
    if(sum>n)
        cout << -1 << endl;
    else
        cout << n-sum;
    
}


Measured memory_bytes: 3656
#include<stdio.h>
 
int main(void)
{
  int i,j,k,n,temp,temp1;
  int m1,m2;
  char in[2], chartemp;
  int a[26];
 
  while(scanf("%d",&n))
    {
      for(i=0;i<26;i++)
    {
      a[i] = 0;
    }
      if(n==0)
    break;
      else
    {
      k = 0;
      for(i=0;i<n;i++)
        {
          scanf("%s",in);
          temp = in[0];
          a[temp-65]++;
          m1 = 0;
          for(j=0;j<26;j++)
        {
          if(m1<=a[j])
            {
              m1 = a[j];
              temp1 = j;
            }
        }
          m2 = 0;
          for(j=0;j<26;j++)
        {
          if(m2<=a[j]&&j!=temp1)
            {
              m2 = a[j];
            }
        }
          if((m1-m2)>n-(i+1)&&k==0)
        k = i+1;
        }
      chartemp = temp1;
      if(k!=0) printf("%c %d\n",chartemp+65,k);
     
      else printf("TIE\n");
    }
    }
  return 0;
}


Measured memory_bytes: 2052
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>

using namespace std;

const int MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)
#define rep2(i, m, n) for(int i=m;i<n;i++)
#define rrep(i, n, m) for(int i=n;i>=m;i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

const int MAX=510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        //???
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


//n!
ll fact_mod(ll n) {
    ll ret=1; 
    for(ll i=2;i<=n;i++) ret=ret*(i%mod)%mod;
    return ret;
}
 
// 繰り返し二乗法 
ll pow_mod(ll x, ll n){
    if(n==0) return 1;
    ll ret=pow_mod((x*x) % mod, n/2);
    if(n&1) ret=(ret*x)%mod;
    return ret;
}
 
//nCr O(r) nがでかくても安心
ll combination_mod(ll n, ll r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    ll a=1;
    //a=n!/(n-r)!=n~n-r+1までの総積->O(r)
    for(ll i=0;i<r;i++) a=a*((n-i)%mod)%mod;
    //b=inv(r!)
    ll b=pow_mod(fact_mod(r), mod-2);
    return (a%mod)*(b%mod)%mod;
}
 
ll inv_mod(ll n){
    // フェルマーの小定理
    return pow_mod(n,mod-2);
}

ll dp[401][401];

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

    ll n,c;cin>>n>>c;
    vector<ll> a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];


    dp[0][0]=1;
    rep(i,n){
        vector<ll> v(c+1);
        rep(j,c+1){
            for(ll k=a[i];k<=b[i];k++){
                //サボっても...ばれへんか！
                v[j]+=pow_mod(k,j);
                v[j]%=mod;
            }
        }
        rep(j,c+1){
            for(int k=0;k<=j;k++){
                dp[i+1][j]+=dp[i][k]*v[j-k]%mod;
                dp[i+1][j]%=mod;
            }
        }
    }
    cout<<dp[n][c]<<endl;
    return 0;
}


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

using namespace std;
typedef long long int ll;

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

    int cnt = 0;
    for (int i=0; i<3; i++)
    {
        if (s[i] == t[i]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <bitset>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono>
#include <random>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define REP(i,a,b) for(int i=int(a);i<=int(b);i++)
#define MD 1000000007
#define MOD2 1000000009
#define INF 2000000000
#define DESPACITO 1000000000000000
#define E 998244353
#define pb push_back
#define mp make_pair
#define double long double
#define pdd pair<double,double>
#define ll long long

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
    IOS;
    string s;
    ll k;
    cin >> s;
    cin >> k;
    int n = s.length();
    int l = 0;
    REP(i,0,s.length()-1)
    {
        if(s[i] == s[0])
            l++;
        else
            break;
    }
    int r = 0;
    for(int i = s.length()-1;i>=0;i--)
    {
        if(s[i] == s[s.length()-1])
            r++;
        else
            break;
    }
    if(l-1>=n-r)
    {
        cout << (1LL * k *(s.length()))/2;
        return 0;
    }
    ll x = 1;
    ll ans = 0;
    ll ct = 0;
    REP(i,1,s.length()-1)
    {
        if(s[i] == s[i-1])
            x++;
        else
        {
            ct += (x/2);
            x = 1;
        }
    }
    ct += (x/2);
    if(s[s.length()-1] == s[0])
    {
        ct -= (l/2);
        ct -= (r/2);
        ll val = (l+r);
        ll an = val/2;
        an*=(k-1);
        ans += an;
        ans += (ct*k);
        ans += (l/2);
        ans += (r/2);
    }
    else
        ans = (ct*k);
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

struct LCA {
    vector<vector<int>> par;
    vector<int> d;
    int n;
    LCA(vector<vector<int>> graph, int root) {
        n = graph.size();
        par.resize(n, vector<int>(30));
        d.resize(n, 0);
        function<void(int, int, int)> dfs = [&](int c, int p, int depth) {
            d[c] = depth;
            par[c][0] = p;
            for (auto ch : graph[c]) {
                if (ch != p) dfs(ch, c, depth + 1);
            }
        };
        dfs(0, 0, 0);
        for (int j = 1; j < 30; j++) {
            REP(i, n) { par[i][j] = par[par[i][j - 1]][j - 1]; }
        }
    }
    int getdistance(int u, int v) { return (d[u] + d[v]) - 2 * (d[query(u, v)]); }
    int query(int u, int v) {
        if (d[u] > d[v]) {
            swap(u, v);
        }
        for (int i = 29; 0 <= i; i--) {
            if (d[u] <= d[par[v][i]]) {
                v = par[v][i];
            }
        }
        /* LCA */
        for (int i = 29; 0 <= i; i--) {
            if (par[v][i] != par[u][i]) {
                v = par[v][i];
                u = par[u][i];
            }
        }
        if (u == v) {
            return u;
        } else {
            return par[v][0];
        }
    }
};

struct UnionFind {
    vector<int> parent, size;
    UnionFind(int n) {
        parent.resize(n, -1);
        size.resize(n, 1);
    }
    void unite(int x, int y) {
        if (same(x, y)) {
            return;
        }
        x = root(x);
        y = root(y);
        if (size[x] <= size[y]) {
            swap(x, y);
        }
        parent[y] = x;
        size[x] += size[y];
    }
    bool same(int x, int y) { return (root(x) == root(y)); }
    int root(int x) {
        while (parent[x] != -1) {
            x = parent[x];
        }
        return x;
    }
    int getsize(int x) { return size[root(x)]; }
};
int n, m;
vector<vector<int>> graph;
void aoj(vector<int> bs) {
    REP(i, bs.size() - 1) { cout << bs[i] << " "; }
    cout << bs[bs.size() - 1] << endl;
}

signed main() {
    int n, k;
    cin >> n >> k;
    if (k <= (n + 1) / 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;


//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

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


struct Edge {
    int to, from;
    ll cost;
    Edge(int from, int to, ll cost): from(from), to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

int dp[100010][2];
int mp[200010];
int main() {
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //cout << fixed << setprecision(10);
    int N;
    string s; cin >> N >> s;

    
    for(int i=0; i<s.size(); ++i){
        
        if(i==0) mp[i] = (s[i]=='W')?0:1;
        else mp[i] = (s[i]==s[i-1])?0:1;
        //cout << mp[i];
    }
    //cout << endl;


    ll ans = 1;
    ll X = 0;
    for(int i=0; i<s.size(); ++i){
        if(mp[i] == 0){
            if(X==0){
                cout << 0 << endl;
                return 0;
            }
            ans *= X;
            X--;
            mp[i+1]^= 1;
        }else{
            X++;
        }
        ans %= MOD;
    }

    if(X != 0){
        cout << 0 << endl;
    }else{
        for(int i=1; i<=N; ++i){
            ans = (ll)ans * i;
            ans %= MOD;
        }
        cout << ans << endl;
    }
    return 0;

}

Measured memory_bytes: 1412
S = list(input())

N=len(S)
dammy1=0
dammy2=0
count=[]
#0101010101
for i in range(N):
    if i%2==0:
        if S[i] != '0':
            dammy1 += 1
    else:
        if S[i] != '1':
            dammy1 += 1
count.append(dammy1)

#1010101010
for i in range(N):
    if i%2==0:
        if S[i] != '1':
            dammy2 += 1
    else:
        if S[i] != '0':
            dammy2 += 1
count.append(dammy2)

print(min(count))

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

int main() {
    deque<ll> v;
    int n;
    cin >> n;

    rep(i, n) {
        int q;
        cin >> q;
        if (q == 0) {

            int d, x;
            cin >> d >> x;
            if (d == 0) {
                v.push_front(x);
            } else {
                v.push_back(x);
            }
        } else if (q == 1) {
            int x;
            cin >> x;
            cout << v[x] << endl;
        } else if (q == 2) {
            int d;
            cin >> d;
            if (d == 0) {
                v.pop_front();
            } else {
                v.pop_back();
            }
        } else {
            __throw_runtime_error("konai");
        }
    }

}


Measured memory_bytes: 6172
#include <stdio.h>

void leap(int start, int end);

int main(void)
{
    int start, end;
    while (1){
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0){
            break;
        } else {
            leap(start, end);
        }
    }

    return 0;
}

void leap(int start, int end)
{
    static int first_output = 1;
    if (first_output != 1){
        printf("\n");
    }
    first_output = 0;

    int cnt = 0;
    for (int year = start; year <= end; year++){
        if (year % 4 == 0 && year % 100 != 0){
            printf("%d\n", year);
            cnt++;
        }
        if (year % 400 == 0){
            printf("%d\n", year);
            cnt++;
        }
    }
    if (cnt == 0){
        printf("NA\n");
    }
}

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

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll c_count=b/c-(a-1)/c, d_count=b/d-(a-1)/d, c_d_count, x=d*c, r;
    //  c < dに統一
    if(c>d){
        swap(c, d);
    }
    r = d%c;
    while(r!=0){
        d = c;
        c = r;
        r = d%c;
    }
    x /= c;
    c_d_count = b/x-(a-1)/x;
    cout << (b-a+1) - (c_count + d_count - c_d_count) << 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 all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N, D; cin >> N >> D;

  int b = 2 * D + 1;
  int ans = (N + (b-1)) / b;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
object Main extends App {
  
  val sc = new java.util.Scanner(System.in) 
  val a, b = sc.nextInt()
  val s = sc.next()
  val pattern = s"\\d{$a}-\\d{$b}".r
  if (pattern.matches(s)) {
    println("Yes")
  } else {
    println("No")
  }
}


Measured memory_bytes: 55336
N = int(input())
X = list(map(int, input().split()))

cnt = [0] * (N + 1)
cnt[0] = 1
for i in range(N):
    cnt[i + 1] = (cnt[i] - X[i]) * 2

ans = 0
cur = 0
for i in reversed(range(N + 1)):
    cur += X[i]
    ans += min(cnt[i], cur)

if all(cnt[i] >= X[i] for i in range(N + 1)):
    print(ans)
else:
    print(-1)


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

int main() {
    //read
    int n;
    cin>>n;
    int a[n];

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    //solve
    int count = 0;
    bool flag = true;
    while(flag){
        flag = false;
        for(int i=n-1;i>0;i--){
            if(a[i-1]>a[i]){
            int tmp = a[i];
            a[i] = a[i-1];
            a[i-1]=tmp;
            count++;
            flag=true;
            }
        }
    }
    //output
    cout<<a[0];
    for(int i=1;i<n;i++){
        cout<<' '<<a[i];
    }
    cout<<endl;
    cout<<count<<endl;
}

Measured memory_bytes: 1164
#include<iostream>
using namespace std;
const int mod = 1e9+7;
typedef long long LL;
const int maxn = 23000000;
short dig[maxn+1];
inline void add(int &x, int y)
{
    x+=y;
    if(x>=mod) x-=mod;
}
int qmod(LL a, int b)
{
    LL res = 1;
    for(;b;b>>=1)
    {
        if(b&1) res=res*a%mod;
        a=a*a%mod;
    }
    return (int)res;
}
int main()
{
int t=4;
t++;
    for(int i=1; i<=maxn; ++i) dig[i] = dig[i/10]+1;
    int n, ans=0;
    scanf("%d",&n);
    for(int i=1, j=1, s=0; i<1e7; ++i)
    {
        while(s<n) s+=dig[j],++j;
        if(s==n) add(ans, 1);
        s -= dig[i];
    }
    for(int i=1; i<=n/8; ++i)
    {
        if(n%i==0) add(ans, ((qmod(10,n/i)-qmod(10,n/i-1)-i+1)%mod+mod)%mod);
        else add(ans, 1);
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
	char a;
	cin >> a;
	if(a == 'S'){
		cout << "Cloudy";
	}else if(a == 'C'){
		cout << "Rainy";
	}else if(a == 'R'){
		cout << "Sunny";
	}
	return 0;
}

Measured memory_bytes: 256
x,k,d=map(int,input().split())
if abs(x)-k*d>=0:
  print(abs(x)-k*d)
else:
  xx,kk=abs(x)-d*(abs(x)//d),k-(abs(x)//d)
  if kk%2==0:
    print(abs(xx))
  else:
    print(abs(xx-d))

Measured memory_bytes: 9180
//Created Time:2020年03月21日 星期六 20时03分11秒
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 102

using namespace std;

int n, m, ans;
int f[N][N];
char mp[N][N];

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i)
		scanf("%s", mp[i] + 1);
	memset(f, 127, sizeof f); f[1][1] = mp[1][1] == '#';
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j){
			if(mp[i][j] == '#'){
				if(mp[i - 1][j] == '#')
					f[i][j] = min(f[i - 1][j], f[i][j]);
				else f[i][j] = min(f[i - 1][j] + 1, f[i][j]);
				if(mp[i][j - 1] == '#')
					f[i][j] = min(f[i][j - 1], f[i][j]);
				else f[i][j] = min(f[i][j - 1] + 1, f[i][j]);
			} else
				f[i][j] = min(f[i][j], min(f[i - 1][j], f[i][j - 1]));
		}
	cout << f[n][m] << endl;
	return 0;
}

Measured memory_bytes: 256
x, k, d = map(int, input().split())
x = abs(x)
if x // d >= k:
    ans = x - k * d
else:
    k_ = x // d
    x %= d
    k -= k_
    if k % 2 == 0:
        ans = x
    else:
        ans = d - x

print(ans)

Measured memory_bytes: 9200
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

class BinaryIndexedTree {
    vector<int> container;

public:
    BinaryIndexedTree(size_t size)
        : container(size + 1)
    {
        fill(container.begin(), container.end(), 0);
    }
    void add(size_t i, int v)
    {
        size_t idx = i + 1;
        while (idx < container.size()) {
            container[idx] += v;
            idx += idx & -idx;
        }
    }
    int find(size_t i)
    {
        size_t idx = i;

        int result = 0;
        while (idx != 0) {
            result = container[idx] + result;
            idx -= idx & -idx;
        }
        return result;
    }
};

template <typename T>
void compress(vector<T>& v)
{
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
}

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

    vector<int> as;
    vector<int> xs;
    rep(i, n)
    {
        int a;
        cin >> a;
        as.push_back(a);
        xs.push_back(a);
    }

    compress(xs);

    BinaryIndexedTree bit(xs.size());
    int64_t result = 0;
    rep(i, n)
    {
        size_t aIdx = lower_bound(xs.begin(), xs.end(), as[i]) - xs.begin();
        result += bit.find(xs.size()) - bit.find(aIdx + 1);
        bit.add(aIdx, 1);
    }

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 5468
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  string s,t;
  cin >> s >> t;
  int l = s.size();

  int ans = 0;
  rep(i,l){
    if(s.at(i) != t.at(i))ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3852
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mInt = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000



int main(){
	
	int N,M;
	cin>>N>>M;
	
	vector<int> a(N),b(M);
	rep(i,N)scanf("%d",&a[i]);
	rep(i,M)scanf("%d",&b[i]);
	
	vector<int> c = convolution(a,b);
	
	rep(i,c.size()){
		if(i!=0)printf(" ");
		printf("%d",c[i]);
	}
	cout<<endl;
	
    return 0;
}


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

//Compiler version g++ 6.3.0

int main()
{
    long long int n,p;
    cin>>n;
    if(n<=1000){
      cout<<1000-n<<endl;
    }
    else if(n%1000 == 0){
      cout<<"0"<<endl;
    }
    else{
      p = n%1000;
      cout<<1000-p<<endl;
    }
    return 0;
}

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

int main(){
    int n; cin >> n;
    bool flag = false;
    
    for(int i=0;i<=n/4;i++){
        bool finished = false;
        for(int j=0;j<=n/7;j++){
            int sum = 4 * i + 7 * j;
                if(sum == n){
                    finished = true;
                    break;
                }
                else if(sum > n){
                    break;
                }
        }
        if(finished){
            flag = true;
        }
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;

int main()
{
	int32_t N;
	cin >> N;

	vector<int32_t> p(N);
	for (int32_t i = 0; i < N; i++)
		cin >> p[i];
	for (int32_t i = 0; i < N; i++) {
		for (int32_t j = 0; j < N; j++) {
			int32_t temp = p[i];
			p[i] = p[j];
			p[j] = temp;

			bool sorted = true;
			for (int32_t k = 1; k < N; k++) {
				if (p[k - 1] > p[k]) {
					sorted = false;
					break;
				}
			}
			if (sorted) {
				cout << "YES" << endl;
				return 0;
			}

			temp = p[j];
			p[j] = p[i];
			p[i] = temp;
		}
	}

	cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
main :: IO()
main = getContents >>= mapM_ (print . solve . read) . lines

solve :: Int -> Int
solve n | n < 100     = length $ takeWhile (<= n) primes
        | n < 1000    = (25 +)     . f $ [101, 103..n]
        | n < 10000   = (168 +)    . f $ [1001, 1003..n]
        | n < 100000  = (1229 +)   . f $ [10001,10003..n]
        | n < 200000  = (9592 +)   . f $ [100001, 100003..n]
        | n < 300000  = (17984 +)  . f $ [200001, 200003..n]
        | n < 400000  = (25997 +)  . f $ [300001, 300003..n]
        | n < 500000  = (33860 +)  . f $ [400001, 400003..n]
        | n < 600000  = (41538 +)  . f $ [500001, 500003..n]
        | n < 700000  = (49098 +)  . f $ [600001, 600003..n]
        | n < 800000  = (56543 +)  . f $ [700001, 700003..n]
        | n < 900000  = (63951 +)  . f $ [800001, 800003..n]
        | n >= 999983 && n < 1000000 = 78498
        | n < 1000000 = (71724 +)  . f $ [900001, 900003..n]
        | otherwise   = (78498 +)  . f $ [1000001, 1000003..n]
    where f = length . (filter isPrime)

primes :: [Int]
primes = (2 :) . (3 :) . (5 :) . (7 :) $ filter isPrime [11, 13..] 

isPrime :: Int -> Bool
isPrime 2 = True
isPrime n
    | n < 2            = False
    | (n `mod` 2) == 0 = False
    | otherwise        = testDiv 3 n
    where testDiv :: Int -> Int -> Bool
          testDiv i n
              | i * i > n      = True
              | n `mod` i == 0 = False
              | otherwise      = testDiv (i + 2) n


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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}

inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}


int main()
{
    ///freopen("output.txt","w",stdout);
    ///freopen("input.txt","r",stdin);

    FastIO;
    lli n,m;
    cin>>n>>m;
    lli a[n+1] ;
    map<int,int>cnt;
    cnt[0]++;
    lli now = 0 , ans = 0;
    for(int i=1; i<=n; i++){
        cin>>a[i];
        now = (now+a[i])%m;
        ans += cnt[now];
        cnt[now]++;
    }
    cout<<ans;

    return 0;

}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 3968
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Char
import Data.List
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.ByteString.Char8 as BS
import qualified Data.IntMap as IntMap
import Control.Monad

type Weight = Int

main = do
  n <- readLn
  edges <- U.replicateM (n-1) $ do
    [u,v,w] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (u, v, w)
  let tree :: IntMap.IntMap (IntMap.IntMap Weight)
      tree = U.foldl' (\m (u, v, w) -> IntMap.insertWith IntMap.union (u-1) (IntMap.singleton (v-1) w) $ IntMap.insertWith IntMap.union (v-1) (IntMap.singleton (u-1) w) m) IntMap.empty edges
  let result = U.create $ do
        vec <- UM.replicate n (-1)
        -- white: 0, black: 1
        let traverse !i !color = do
              x <- UM.read vec i
              if x == -1
                then do UM.write vec i color
                        let Just t = IntMap.lookup i tree
                        forM_ (IntMap.toList t) $ \(j,w) -> do
                          traverse j ((color + w) `rem` 2)
                else return ()
        traverse 0 0
        return vec
  U.forM_ result $ print


Measured memory_bytes: 50684
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
t = T.translate((str.maketrans({"r": "p", "s": "r", "p": "s"})))

score = 0
score_dict = {"r": R, "s": S, "p": P}
restriction_list = list("" for _ in range(K))

for i in range(N):
    prediction = t[i]
    restriction = restriction_list[i % K]
    if prediction == restriction:
        restriction_list[i % K] = ""
        continue
    else:
        score += score_dict[prediction]
        restriction_list[i % K] = prediction

print(score)


Measured memory_bytes: 4492
# coding: utf-8

s = list(input())
i = count = 0
j = -1

while True:
    if s[i] != s[j]:
        s[j]=s[i]
        count += 1
    
    i += 1
    j -= 1
    
    if i > ( len(s) / 2):
        break

print(count)

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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class CFennecVsMonster {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int n, k;
	    in >> n >> k;
	    vector<ll> h(n);
	    for(int i=0; i<n; i++){
	        in >> h[i];
	    };

        sort(h.begin(), h.end(), greater<ll>());

        ll cnt = 0;
        for(int i=k; i<n; i++){
            cnt += h[i];
        }

        out << cnt << endl;
	}
};


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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;
const ll mod=998244353;

ll fac[200010],inv[200010];
ll fpow(ll n,ll k){
	ll ret=1;
	while(k){
		if(k&1) ret=ret*n%mod;
		n=n*n%mod;
		k>>=1;
	}
	return ret;
}
void calc(){
	inv[0]=inv[1]=fac[0]=fac[1]=1;
	for(int i=2;i<=200000;i++) fac[i]=fac[i-1]*i%mod;
	for(int i=2;i<=200000;i++) inv[i]=-1*(mod/i)*inv[mod%i]%mod;
	for(int i=2;i<=200000;i++) inv[i]=inv[i-1]*((inv[i]%mod+mod))%mod;
}
ll C(int n,int r){ return fac[n]*inv[r]%mod*inv[n-r]%mod; }
ll H(int n,int r){ return C(n+r-1,r); }

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int N,M,K; cin>>N>>M>>K;
	calc();
	ll ans=0;
	for(int i=0;i<=K;i++) ans=(ans+M*fpow(M-1,N-i-1)%mod*H(i+1,N-i-1)%mod)%mod;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6780
# -*- coding: utf-8 -*-

s = raw_input()
t = ''

front = 0
rear = 7
while (s != t):
    if('dreamer' in s[front:rear]):
        if('eraser' in s[front:rear+4]):
            t += s[front:rear+4]
            front = rear + 4
            rear = front + 7
        elif('erase' in s[front:rear+3]):
            t += s[front:rear+3]
            front = rear + 3
            rear = front + 7
        else:
            t += s[front:rear]
            front = rear
            rear = front + 7
    elif('eraser' in s[front:rear]):
        t += s[front:rear-1]
        front = rear - 1
        rear = front + 7
    elif('dream' in s[front:rear]):
        t += s[front:rear-2]
        front = rear - 2
        rear = front + 7
    elif('erase' in s[front:rear]):
        t += s[front:rear-2]
        front = rear - 2
        rear = front + 7
    else:
        print('NO')
        exit()
print('YES')

Measured memory_bytes: 2820
#include <iostream>

using namespace std;

int main()
{
    int num;

    while(true)
    {
        cin >> num;
        if(num == 0) break;

        int score1 = 0;
        int score2 = 0;
        int card1;
        int card2;
        for(int i = 0; i < num; ++i)
        {
            cin >> card1 >> card2;
            if(card1 > card2)
            {
                score1 += card1 + card2;
            }
            else if(card1 < card2)
            {
                score2 += card1 + card2;
            }
            else
            {
                score1 += card1;
                score2 += card2;
            }
        }
        cout << score1 << ' ' << score2 << endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	string S;
	cin >> S;

	string result;
	for (int i = 0; i < S.size(); i++)
	{
		if (S[i] == 'B')
		{
			if (result.size() > 0)
			{
				result.pop_back();
			}
		}
		else
		{
			result.push_back(S[i]);
		}
	}

	cout << result;
	
	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[][] cards = new int[4][13];

		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {

			String k = sc.next();

			int rank = sc.nextInt();

			if (k.equals("S")) {

				cards[0][rank - 1] = 1;

			} else if (k.equals("H")) {

				cards[1][rank - 1] = 1;

			} else if (k.equals("C")) {

				cards[2][rank - 1] = 1;

			} else if (k.equals("D")) {

				cards[3][rank - 1] = 1;

			}

		}

		for (int a = 0; a < 4; ++a) {

			for (int j = 0; j < 13; j++) {

				if (cards[a][j] == 0 && a == 0) {

					System.out.println("S " + (j + 1));

				} else if (cards[a][j] == 0 && a == 1) {

					System.out.println("H " + (j + 1));

				} else if (cards[a][j] == 0 && a == 2) {

					System.out.println("C " + (j + 1));

				} else if (cards[a][j] == 0 && a == 3) {

					System.out.println("D " + (j + 1));

				}

			}

		}
	}

}

Measured memory_bytes: 26300
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
long f(long X, long K, long D)
{
    {
        long tmp = ((labs(X) / D) > K ? K : labs(X) / D);
        X -= tmp * D;
        K -= tmp;
    }
    if (K %2== 1)
    {
        X -= D;
    }

    return labs(X);
}
int main(void)
{
    long X, K, D;
    scanf("%li %li %li", &X, &K, &D);
    X = labs(X);

    printf("%li\n", f(X, K, D));
}

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

int main(void){
    int m;
    cin >> m;
    vector<int> vec(m+1);
    for(int i=1;i<=m;i++) cin >> vec[i];

    int bowl = 0;
    vector<int> ans(m+1,0);
    for(int i=m;i>=1;i--){
        int tmp = 0;
        for(int j=2*i;j<=m;){
            tmp += ans[j];
            tmp %= 2;
            j += i;
        }
        if(tmp!=vec[i]){ans[i]++; bowl++;}
    }
    
    cout << bowl << endl;
    if(bowl==0) return 0;
    for(int i=1;i<=m;i++){
        if(ans[i]) cout << i << " ";
    }
    cout << endl;
}

Measured memory_bytes: 2432
n,m,c = map(int,input().split())
b_lst = list(map(int,input().split()))
a_box = []
for i in range(n):
    array = list(map(int,input().split()))
    a_box.append(array)

ans = 0
for i in range(n):
    wa = 0
    for j in range(m):
        wa += b_lst[j] * a_box[i][j]
    if wa + c > 0:
        ans += 1
    
print(ans)

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

int main(){
    //vector<vector<int> > A(3, vector<int>(3));
    //int A[3][3];でも宣言できる
    //int T;

    int A[3][3];

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

    int b[10]; // N<=10

    for(int i=0; i<N; i++){
        cin >> b[i];
    }

    bool appear[3][3];

    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            appear[i][j] = false;
            for(int k=0; k<N; k++){
                if(A[i][j] == b[k]) appear[i][j] = true;
            }
        }
    }
    
    string Answer = "No";

    for(int i=0; i<3; i++){
        if(appear[i][0] and appear[i][1] and appear[i][2]) Answer = "Yes";
    }

    for(int i=0; i<3; i++){
        if(appear[0][i] and appear[1][i] and appear[2][i]) Answer = "Yes";
    }

    /*for(int i=0; i<3; i++){

    }*/
    if(appear[1][1] and appear[0][0] and appear[2][2]) Answer = "Yes";
    if(appear[0][2] and appear[1][1] and appear[2][0]) Answer = "Yes";

    cout << Answer << endl;


    /*for(int k=0; k<N; k++){
        int key;
        cin >> key;
        int i=1, j=1;
        while(i < 4){
            while(j < 4){
                if(key == A[i][j]){
                    A[i][j] = 0;
                    break;
                }
            }
        }
    }*/
    
    return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

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

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    string s, t; std::cin >> s >> t;
    t.pop_back();
    std::cout << (s == t ? "Yes" : "No") << "\n";
}


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

int N;
string s;

int main(){
    cin >> N; cout << (N + 1) / 2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
// UnionFind

#define MAXN 200010
ll par[MAXN]; // 親
ll deep[MAXN]; // 深さ

// in要素で初期化
ll init(ll in){
  for(int i=0;i<=in;i++){
    par[i]=i;
    deep[i]=0;
  }
}

// 木の根を求める
ll find(ll x){
  if(par[x]==x){
    return x;
  }else{
    return par[x]=find(par[x]);
  }
}

// xとyの集合を併合
void unite(ll x,ll y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(deep[x]<deep[y]){
    par[x]=y;
  }else{
    par[y]=x;
    if(deep[x]==deep[y]) deep[x]++;
  }
}

// xとyが同じ集合に属するか否か
bool same(ll x,ll y){
  return find(x)==find(y);
}
int main(){
  int n,k;cin>>n>>k;
  init(n);
  rep(i,k){
    int a,b,c;cin>>a>>b>>c;
    unite(a,b);
  }
  set<ll> s;
  reps(i,1,n+1){
    s.insert(find(i));
  }
  cout<<s.size();
}

Measured memory_bytes: 6528
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


bool doit()
{
  int N, A, b;

  std::map<int, std::pair<int, int>> map;

  for (int i = 0; i < 3; i ++)
    for (int j = 0; j < 3; j ++) {
      std::cin >> A;

      map[A] = std::make_pair(j, i);
    }

  bool f[11][11] = {0};

  std::cin >> N;

  for (int i = 0; i < N; i ++) {
    std::cin >> b;

    if (! map.count(b))
      continue;

    const auto& pair = map[b];

    int x = pair.first, y = pair.second;

    f[y][x] = true;
  }

  for (int i = 0; i < 3; i ++) {
    bool valid = true;
    
    for (int j = 0; j < 3; j ++)
      if (! f[i][j])
        valid = false;

    if (valid)
      return true;
  }

  for (int j = 0; j < 3; j ++) {
    bool valid = true;
    
    for (int i = 0; i < 3; i ++)
      if (! f[i][j])
        valid = false;

    if (valid)
      return true;
  }

  bool valid = true;
  
  for (int i = 0; i < 3; i ++)
    if (! f[i][i])
      valid = false;

  if (valid)
    return true;

  valid = true;
  
  for (int i = 0; i < 3; i ++)
    if (! f[i][2 - i])
      valid = false;

  if (valid)
    return true;

  return false;
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  std::cout << (doit() ? "Yes" : "No") << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
K = int(input())
S = input()

mod = 10**9 + 7

class Combination:
    def __init__(self, n):
        self.facts = [1 for i in range(n+1)]
        self.invs = [1 for i in range(n+1)]

        for i in range(1, n+1):
            self.facts[i] = self.facts[i-1] * i % mod
        self.invs[n] = pow(self.facts[n], mod-2, mod)
        for i in range(1, n+1):
            self.invs[n-i] = self.invs[n-i+1] * (n-i+1) % mod

    def ncr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0
        else:
            return self.facts[n] * self.invs[r] * self.invs[n-r] % mod

    def nhr(self, n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0
        else:
            return self.ncr(n+r-1, n-1)

N = K+len(S)
pow25 = [1] * (N+1)
pow26 = [1] * (N+1)
for i in range(1, N+1):
    pow25[i] = (pow25[i-1] * 25) % mod
    pow26[i] = (pow26[i-1] * 26) % mod

comb = Combination(K+len(S))

ans = 0
for i in range(K+1):
    ans = (ans + comb.ncr(N-i-1, len(S)-1) * pow25[N-i-len(S)] * pow26[i]) % mod

print(ans)

Measured memory_bytes: 220744
#include <stdio.h>

int main(void) { 
	int i, a, b, c, count=0;
	scanf("%d %d %d", &a, &b, &c);
	for (i = a; i <= b; i++) {
		if (c % i == 0)
			count++;
	}
	printf("%d\n", count);
	return 0;
}


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

int main(){
    long long a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;

    if(b-a==0) cout << "YES" << endl;
    else if(v-w>0 && abs(b-a)<=abs(t*(v-w))) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}


Measured memory_bytes: 3628