akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <queue>
#include <array>
#include <stack>

const int LARGE = 1<<30;
bool checked[1000*1000+1];
std::vector<int> depth_list(1000*1000+1, -1);

int dfs(int node, const std::vector<std::set<int> > &adj){
  if(checked[node]) return LARGE; //loop detection
  if(depth_list[node] != -1) return depth_list[node];
  checked[node] = true;
  int depth = -1;
  for(const auto& elem: adj[node]){
    int temp = dfs(elem, adj);
    if(depth < temp) depth = temp;
  }
  checked[node] = false;
  depth_list[node] = depth==LARGE ? LARGE : depth+1;
  return depth_list[node];
}

int main(void){
  int n;
  std::cin >> n;
  std::vector<std::set<int> > adjacent_list(n*n+1);
  
  for(int i=0; i<n; i++){
    int prev = -1;
    int now = -1;
    for(int j=1; j<n; j++){
      std::cin >> now;
      now--; // 0-origin;
      if(prev != -1){
	if(i<prev && i<now) adjacent_list[i*n + prev].insert(i*n + now);
	else if(i<prev && i>=now) adjacent_list[i*n + prev].insert(now*n + i);
	else if(i>=prev && i<now) adjacent_list[prev*n+i].insert(i*n + now);
	else                      adjacent_list[prev*n+i].insert(now*n + i);
      }else{
	if(i<now) adjacent_list[n*n].insert(i*n+now);
	else      adjacent_list[n*n].insert(now*n+i);
      }
      prev = now;
    }
  }

  int result = dfs(n*n, adjacent_list);
  
  std::cout << (result>=LARGE?-1:result) << std::endl;

  return 0;
}


Measured memory_bytes: 99072
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	string s1;
	cin>>s1;

	int n=0,w=0,s=0,e=0;
	rep(i,s1.size()){
		if(s1[i]=='N')n=1;
		if(s1[i]=='W')w=1;
		if(s1[i]=='S')s=1;
		if(s1[i]=='E')e=1;
	}
	if((n+s)%2==1)cout<<"No"<<endl;
	else if((w+e)%2==1)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;

}


Measured memory_bytes: 256
A, B, C, D = map(int, input().split())
if(B<=C or D<=A):
    print("0")
elif(A<=C):
    if(B<=D):
        print(B-C)
    else:
        print(D-C)
elif(C<A):
    if(B<=D):
        print(B-A)
    else:
        print(D-A)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}



int main(){
    string k;cin >> k;ll d;cin >> d;
    ll dp[k.size()+1][d][2];
    rep(i,k.size()+1)rep(j,d)rep(x,2)dp[i][j][x]=0;
    dp[0][0][0]=1;
    rep(i,k.size()){
        ll p=k[i]-'0';
        rep(j,d){
            dp[i+1][(j+p)%d][0]+=dp[i][j][0];
            dp[i+1][(j+p)%d][0]%=MOD;
            rep(x,p){
                dp[i+1][(j+x)%d][1]+=dp[i][j][0];
                dp[i+1][(j+x)%d][1]%=MOD;
            }
            rep(x,10){
                dp[i+1][(j+x)%d][1]+=dp[i][j][1];
                dp[i+1][(j+x)%d][1]%=MOD;
            }
        }
    }
    cout << (dp[k.size()][0][0]+dp[k.size()][0][1]+MOD-1)%MOD <<endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h;
  for (int i = 0; i < N; ++i) {
    int tmp;
    cin >> tmp;
    h.push_back(tmp);
  }
  sort(h.begin(), h.end());
  int diff = 1000000000;
  for (int i = 0; i + K - 1 < N; ++i) {
    diff = min(abs(h[i] - h[i + K - 1]), diff);
  }
  cout << diff << endl;
  return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    string n;
    cin>>n;
    ll nLL=stoll(n);
    queue<string> strq;
    strq.push("7");
    strq.push("5");
    strq.push("3");
    vector<string> pre;
    while(!strq.empty()){
        string tempstr=strq.front();strq.pop();
        ll tempLL=stoll(tempstr);
        if(tempLL<=nLL){
            pre.push_back(tempstr);
            strq.push(tempstr+'7');
            strq.push(tempstr+'5');
            strq.push(tempstr+'3');
        }        
    }
    vector<string> ans;
    for(int i=0;i<pre.size();i++){
        bool find3=(pre[i].end()!=find(pre[i].begin(),pre[i].end(),'3'));
        bool find5=(pre[i].end()!=find(pre[i].begin(),pre[i].end(),'5'));
        bool find7=(pre[i].end()!=find(pre[i].begin(),pre[i].end(),'7'));
        if(find3&find5&find7){
            ans.push_back(pre[i]);
        }
    }
    cout<<ans.size()<<endl;
    return 0;
}

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

# 各桁の数字の和を返す関数
def sum_digits(num):
    sum = 0
    while num > 0:
        sum += num % 10
        num = num // 10
    return sum

if N % sum_digits(N) == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

ll dp[110][6][2]={};

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  string s;cin>>s;
  int K,n=siz(s);cin>>K;
  dp[0][0][1]=1;

  rep(i,0,n){
    rep(j,0,4){
      rep(k,0,10){
        if(k!=0){
          if(k>s[i]-'0'){
            dp[i+1][j+1][0]+=dp[i][j][0];
          }else if(k==s[i]-'0'){
            dp[i+1][j+1][0]+=dp[i][j][0];
            dp[i+1][j+1][1]+=dp[i][j][1];
          }else{
            dp[i+1][j+1][0]+=dp[i][j][0];
            dp[i+1][j+1][0]+=dp[i][j][1];
          }
        }else{
          if(k>s[i]-'0'){
            dp[i+1][j][0]+=dp[i][j][0];
          }else if(k==s[i]-'0'){
            dp[i+1][j][0]+=dp[i][j][0];
            dp[i+1][j][1]+=dp[i][j][1];
          }else{
            dp[i+1][j][0]+=dp[i][j][0];
            dp[i+1][j][0]+=dp[i][j][1];
          }
        }
        
      }
    }
  }

  cout<<dp[n][K][0]+dp[n][K][1]<<ENDL;

}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n,ans=0;
int a[100005],b[100005],c[100005],p[100005][205];
signed main(){
	cin>>n; n++;
	for(int i=1;i<=n;i++)
	    cin>>a[i];
	b[1]=1,c[n]=a[n];
	for (int i=2;i<=n;i++)
	    b[i]=(b[i-1]-a[i-1])*2;
	for (int i=n-1;i>=1;i--)
	    c[i]=c[i+1]+a[i];
	for (int i=1;i<=n;i++)
	    ans+=min(b[i],c[i]);
	for (int i=1;i<=n;i++){
		if(a[i]>b[i])
		    return cout<<"-1"<<endl,0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5980
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"6
aabbca"# => r#"2"#,

r#"10
aaaaaaaaaa"# => r#"1"#,

r#"45
tgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir"# => r#"9"#,
}


fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        s: chars,
    }
    let mut ans = 0;

    for i in 1..n {
        let mut max = 0;
        let mut h = s[0..i].iter().collect::<Vec<&char>>();
        let mut t = s[i..].iter().collect::<Vec<&char>>();
        h.sort();
        h.dedup();
        t.sort();
        t.dedup();
        for i in 0..h.len() {
            for j in 0..t.len() {
                if h[i] == t[j] {
                    max += 1;
                }
            }
        }
        ans = std::cmp::max(ans, max);
    }

    ans.to_string()
}

Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;

const int N   = 200;
const ll inf =(1LL<<58);

ll land[N][N];
ll sea[N][N];

void wf(int n,ll mat[N][N]){
  rep(k,n)rep(i,n)rep(j,n)mat[i][j]=min(mat[i][j],mat[i][k]+mat[k][j]);
}


ll dp[1000][N];
ll solve(int n,vector<int> &in,int s){
  wf(n,land);
  wf(n,sea);
  rep(i,in.size())rep(j,n)dp[i][j]=inf;

  dp[0][s]=0;

  REP(i,1,in.size()){
    rep(j,n){
      rep(k,n){
	dp[i][k]=min(dp[i][k],
		     dp[i-1][j]+land[in[i-1]][j]+sea[j][k]+land[k][in[i]]);
      }
      dp[i][j]=min(dp[i][j],dp[i-1][j]+land[in[i-1]][in[i]]);
    }
  }

  ll ret = inf;
  rep(i,n)ret=min(ret,dp[in.size()-1][i]);
  return ret;
}

main(){
  int n,m;
  while(cin>>n>>m && n){
    rep(i,n){
      rep(j,n)sea[i][j]=land[i][j]=inf;
      sea[i][i]=0;land[i][i]=0;
    }
    rep(i,m){
      int f,t;ll c;char tmp;
      cin>>f>>t>>c>>tmp;
      f--;t--;
      if (tmp == 'L')land[f][t]=land[t][f]=min(land[t][f],c);
      if (tmp == 'S')sea[f][t] =sea[t][f] =min( sea[t][f],c);
    }

    int q;
    cin>>q;
    vector<int> in(q);
    rep(i,q)cin>>in[i],in[i]--;
    cout << solve(n,in,in[0]) << endl;
  }
  return false;
}

Measured memory_bytes: 3100
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/19/20 20:59:58
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  string s; cin>>s;
  if (s.back() == 's') {
    s.push_back('e');
    s.push_back('s');
  } else {
    s.push_back('s');
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;

const int mx=200010;
const ll mod=1e9+7;

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

int main(){
  cin >> a >> b >> c >> d;
  a--;
  b = b - (b/c + b/d - b/(c*d/gcd(c,d)));
  a = a - (a/c + a/d - a/(c*d/gcd(c,d)));
  cout << b-a << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
#include <stdio.h>

int main(void){
  long long n,d,x,y,s=0;
  std::cin >> n >> d;
  for(int i=0;i<n;i++){
    std::cin >> x;
    std::cin >> y;
    if(x*x+y*y<=d*d){
      s++;
    }
  }
  std::cout << s;
  return 0;
}

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

int n;
double p[3000];
double memo[3000][3000];

double dp(int h,int t){
	if(memo[h][t]!=-1)return memo[h][t];
	if(h==0)return memo[h][t]=(1-p[h+t-1])*dp(h,t-1);
	else if(t==0)return memo[h][t]=p[h+t-1]*dp(h-1,t);
	return memo[h][t]=p[h+t-1]*dp(h-1,t)+(1-p[h+t-1])*dp(h,t-1);
}

int main() {
    scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%lf",&p[i]);
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++)memo[i][j]=-1;
	}
	memo[0][0]=1;
	double ans=0;
	for(int i=0;2*i<n;i++){
		ans+=dp(n-i,i);
	}
	printf("%.10lf",ans);
}


Measured memory_bytes: 70784
import numpy as np

N, K = map(int, input().split())
S = [int(x) for x in input()]

cur = 1 # 最初は1が0人立っている
blocks = np.zeros(10**5+1, dtype = np.int64)
seq = 0
p = 0
for s in S:
    if s == cur:
        blocks[p] += 1
    else:
        p += 1
        blocks[p] += 1        
        cur = 1 - cur
W = min(2*K, 10**5)
answer = sum = blocks[:W+1].sum()
for i in range(W+1, 10**5, 2):
    if i+1 > 10 ** 5:
        break
    sum = sum + blocks[i] + blocks[i+1] - blocks[i-W-1] - blocks[i-W]
    if sum > answer:
        answer = sum
print(answer)

Measured memory_bytes: 14136
function main(input) {
  var n = input[0];
  console.log(
    [7,6,5,4,3,2,1][(["SUN","MON","TUE","WED","THU","FRI","SAT"].indexOf(n))]
  );
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))


Measured memory_bytes: 7372
#include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const int INF=1<<30;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;typedef vector<ll> vll;typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;
#ifdef ONLINE_JUDGE
#define assert(...) /* nothing */
#endif
#define DEBUG_CAT
#ifdef DEBUG_CAT
#define dbg(...)   printf( __VA_ARGS__ )
#else 
#define dbg(...)   /****nothing****/
#endif
void solve(int R, int G, int B, int n){
	int ans=0;
	int rlim=n/R;
	for (int r=0;r<=rlim;r++) {
		int nleft=n-r*R;
		int glim=(nleft/G)*G;
		for (int g=0;g<=glim;g+=G) {
			if ((nleft-g)%B==0) ans++;
		}
	}
	printf("%d\n",ans);
}

int main(){	
	long long B;
	long long G;
	long long R;
	long long N;
	scanf("%lld",&R);
	scanf("%lld",&G);
	scanf("%lld",&B);
	scanf("%lld",&N);
	solve(R, G, B, N);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define debug(x) cerr << #x << ": " << x << '\n';

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, cnt = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a >= k) {
      cnt++;
    }
  }
  cout << cnt << '\n';
}


Measured memory_bytes: 256
multipleOf3 x = (mod x 3) == 0
contain3 0 = False
contain3 x =
    if (mod x 10) == 3 
        then True
        else contain3 $ div x 10

f ::Int -> IO()
f x = putStrLn $ " " ++  (unwords .  map show $ [ a | a <- [1..x] , multipleOf3 a || contain3 a])

main = getLine >>= f . read


Measured memory_bytes: 4112
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <deque>
#include <map>
using namespace std;

#define ii pair <int, int>
#define lli long long
#define pb push_back
#define X first
#define Y second

const int Mod = 1E9 + 7;
const int Inf = 1E9 + 7;
const int N = 5E5 + 10;

int n;
lli a[N], Bit[65];

void Input()
{
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
}

void Solve()
{
    lli res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= 60; j++) if (a[i] & (1ll << j)) {
            res = (res + (lli) (1ll << j) % Mod * (i - 1 - Bit[j]) % Mod ) % Mod;
            Bit[j]++;
        }
        else res = (res + (1ll << j) % Mod * Bit[j] % Mod) % Mod;
    }
    cout << res;
}

#define task "test"
int main()
{
    if (fopen(task ".inp", "r")) {
        freopen(task ".inp", "r", stdin);
        freopen(task ".out", "w", stdout);
    }
    int testcase = 1;
    /// cin >> testcase;
    while (testcase--) {
        Input();
        Solve();
    }
}




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

int main(){
    int n, d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int norm = 0;
            for(int k = 0; k < d; k++){
                int diff = abs(x[i][k] - x[j][k]);
                norm += diff * diff;
            }
            bool flag = false;
            for(int k = 0; k <= norm; k++){
                if(k*k == norm){
                    flag = true;
                }
            }
            if(flag) ++ans; 
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    cout << min(b/a, c) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(vecto) vecto.begin(),vecto.end()
typedef long long ll;

int main(){
    int a,b,x;
    cin >> a >> b >> x;
    if(b-(x-a)>=0&&x>=a){
        cout << "YES" << endl;
    }
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#define NUM 10000000
#define NIL -2000000001
using namespace std;

void print(int* heap, int H){
    for(int i = 0; i < H; i++){
        printf(" %d", heap[i + 1]);
    }
    printf("\n");
}

int left(int i){
    return i * 2;
}

int right(int i){
    return i * 2 + 1;
}

int largest_(int* heap, int a, int b, int c){
    if(heap[a] < heap[b]){
        if(heap[b] < heap[c]){
            return c;
        }else{
            return b;
        }
    }else{
        if(heap[a] < heap[c]){
            return c;
        }else{
            return a;
        }
    }
}


void maxHeapify(int* heap, int i){
    int l = left(i);
    int r = right(i);
    int largest = largest_(heap, l, r, i);

    if(largest != i){
        swap(heap[i], heap[largest]);
        maxHeapify(heap, largest);
    }
}

void buildMaxHeap(int* heap, int H){
    for(int i = H / 2; i >= 1; i--){
        maxHeapify(heap, i);
    }
}

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

    int heap[NUM];
    for(int i = 0; i < NUM; i++){
        heap[i] = NIL;
    }

    for(int i = 1; i <= H; i++){
        scanf("%d", &heap[i]);
    }

    buildMaxHeap(heap, H);

    print(heap, H);

    return 0;
}





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

using namespace std;

int main(){
	int n;
	long long h;
	cin >> n >> h;
	vector<long long> a(n), b(n);
	for(int i = 0; i < n; i++)cin >> a[i] >> b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	int ans = 0;
	vector<long long>::iterator boarder = upper_bound(b.begin(), b.end(), a[n-1]);
	long long d = accumulate(boarder, b.end(), 0);
	if(d >= h){
		long long tmp = 0;
		for(vector<long long>::iterator i = b.end() -1; i >= boarder; i--){
			tmp += *i;
			ans++;
			if(tmp >= h)break;
		}
	}
	else{
		h -= d;
		ans = distance(boarder, b.end()) + ((h + a[n-1] - 1)/ a[n-1]);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1792
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408

#include <iostream>
using namespace std;
#define MAX 250

int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }

int main() {
	int H, A[MAX + 1]; // 1-origin array

	cin >> H;
	for (int i = 1; i <= H; i++) cin >> A[i];

	for (int i = 1; i <= H; i++) {
		cout << "node " << i << ": key = " << A[i] << ", ";
		if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
		if(left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
		if(right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
		cout << endl;
	}

	return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    string s, t;
    cin >> s;
    cin >> t;
    for(ll i = 0; i < s.length(); i++) {
        if(s[i] != t[i]) {
            cout << "No" << endl;
            exit(0);
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int N, A;
  cin >> N;
  cin >> A;

  
  if (N % 500 - A <= 0){
    cout << "Yes" <<endl;
  }else{ 
    cout << "No" <<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
while True:
    H, W = map(int, input().split())
    
    if H==0 and W==0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if i%2 == j%2:
                    print("#", end = "")
                else:
                    print(".", end = "")
            print("")
        print("")


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

int main(){
    int N; cin >> N;
    int a[N]; for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < N; i++) {
        if (a[i]%2 == 0) {
            if (a[i]%3 != 0 && a[i]%5 != 0) {
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    cin >> a >> b >> c;

    if(a+b==c || b+c==a || c+a==b) {
    	cout << "Yes" << endl;
    } else {
    	cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  static const std::unordered_map<std::string, std::string> next_weather({
    {"Sunny", "Cloudy"},
    {"Cloudy", "Rainy"},
    {"Rainy", "Sunny"}
  });

  std::string S;
  std::cin >> S;
  std::cout << next_weather.at(S) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(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
using namespace std;
 
int main(){
  int n,sum = 0,f = 1;
  cin >> n;
  vector<int> s(n);
  REP(i,n) {
    cin >> s[i];
    sum += s[i];
    if (s[i] % 10 != 0) {
      f = 0;
    }
  }
  sort(s.begin(), s.end());
  if (f == 1) {
    cout << 0;
  } else if (sum % 10 != 0) {
    cout << sum;
  } else {
    for (int i = 0;i < n;i++) {
      if (s[i] % 10 == 0) {
        continue;
      } else {
        sum -= s[i];
        cout << sum;
        break;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define mii map<int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define Loop(s, e, itr) for (int itr = s; itr < e; itr++)
#define loop(n) for(int i = 0; i < n; i++)
#define vin vector<int>
#define w(t) int tc; cin >> tc; for(int t = 1; t <= tc; t++)
#define vec vector
#define mod 1000000007
#define all(x) x.begin(), x.end()

string str;
int base;
vin limits(10005);
int len;

int dp[10005][110][2];

int fun(int ind, int crr_sum, bool unlimited){

    if(dp[ind][crr_sum][unlimited] == -1){
        int limit = unlimited ? 10 : limits[ind];
        int ans = 0;
        if(ind == len-1){
            loop(limit)     
                if((crr_sum + i)%base == 0){
                    ans = ans + 1;
                    if(ans > mod) ans -= mod;
                }
            if(!unlimited and ((crr_sum+limit)%base == 0)){
                ans++;
                if(ans > mod) ans -= mod;
            }
        }
        else{
            loop(limit) ans = (ans + fun(ind+1, (crr_sum + i)%base, true))%mod;
            if(!unlimited) ans = (ans + fun(ind+1, (crr_sum+limit)%base, false))%mod;
        }
        dp[ind][crr_sum][unlimited] = ans; 
    }


    return dp[ind][crr_sum][unlimited];
}

int32_t main(){
    memset(dp, -1, sizeof(dp));
    cin >> str;
    cin >> base;
    len = str.size();
    loop(len) limits[i] = str[i]-'0';
    int ans = (fun(0, 0, false) - 1);
    if(ans > mod) ans -= mod;
    if(ans < 0) ans += mod;
    cout << ans << endl;

}

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

int main(){
  
  string text;
  cin >> text;
  
  for(int i = 0; i < text.size(); i++){
    if( i % 2 == 0){ //文字列の奇数目 = 配列における偶数
    cout << text.at(i);	//そこの文字を表示
    }
  }
  
  //最後に開業を出力
  cout << endl;
  
}

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

using namespace std;

int n;
double a[101];

int main()
{
	cin >> n;
	double ans = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		if (i)
		{
			ans = ans * a[i] / (a[i] + ans);
		}
		else
		{
			ans = a[i];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import collections
n = int(input())
a = list(map(str,input().split()))
ls = [i for i in range(2*10**5)]
c = collections.Counter(a)
comon = c.most_common()
ans = 0

for i in comon:
    if i != 1:
      ls[int(i[0])] = i[1]
      ans += (i[1]*(i[1]-1)//2)

for i in a:
    co = ls[int(i)]
    print(ans-(co*(co-1)//2)+((co-1)*(co-2)//2))

      

Measured memory_bytes: 42012
#include<iostream>
#include<cmath>

using namespace std;



int main(){

unsigned long long a,b; cin >> a >> b;

if(a==b){
	cout << '0' << '\n';
}

else if(a<b){
	unsigned long long dif = b - a;
	if(dif<a)cout << dif << '\n';
	else cout << a << '\n';

	
}

else {
	unsigned long long mod = a % b;
	unsigned long long dif1 = b - mod;

	if(dif1<mod)cout << dif1 << '\n';
	else cout << mod << '\n';
}


return 0;
}

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

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		
		int[][] a = new int[n][n];
		String[] str; 
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < n; ++j){
				a[i][j] = Integer.MAX_VALUE;
			}
			str = br.readLine().split(" ");
			int u = Integer.parseInt(str[0]);
			int k = Integer.parseInt(str[1]);
			for(int j = 0; j < k; ++j) {
				int v1 = Integer.parseInt(str[2 + j * 2    ]);
				int c1 = Integer.parseInt(str[2 + j * 2 + 1]);
				a[u][v1] = c1;
			}
		}

		int[] d = new int[n];
		HashSet<Integer> t = new HashSet<Integer>(n);
		for(int i = 0; i < n; i++){
			d[i] = a[0][i];
			t.add(i);
		}
		
		int[] p = new int[n];
		int u = 0;
		p[u] = 0; // first node
		d[p[u]] = 0; // cost
		while(!t.isEmpty()){
			t.remove(p[u]);
			int min = Integer.MAX_VALUE;
			for(int node : t){
				
				if(d[p[u]] + a[p[u]][node] > 0 && d[p[u]] + a[p[u]][node] < d[node]){
					d[node] = d[p[u]] + a[p[u]][node];
				}
				if(d[node] < min){
					min = d[node];
					p[u+1] = node;
				}
			}
			u += 1;
		}
		
		StringBuffer sb = new StringBuffer();
		for(int i = 0; i < n; i++){
			sb.append(i + " " + d[i] + "\n");
		}
		System.out.print(sb);
	}

}

Measured memory_bytes: 27604
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    m: usize,
    es: [(usize1, usize1, i64); m],
  }
  let mut adj = vec![vec![1i64 << 50; n]; n];
  for &(a, b, c) in &es {
    adj[a][b] = c;
    adj[b][a] = c;
  }
  for k in 0 .. n {
    for i in 0 .. n {
      for j in 0 .. n {
        adj[i][j] = cmp::min(adj[i][j], adj[i][k] + adj[k][j]);
      }
    }
  }
  let ans = es.iter().filter(|&&(a, b, c)| adj[a][b] < c).count();

  puts!("{}\n", ans);
}


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

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


Measured memory_bytes: 256
L, R = map(int, input().split())

I = 0
J = 0
now = 0
mod = 2019

end = 0

for i in range(R-L):
    if(L+i % 2019 == 0 or end == 1):
        mod = 0
        break
    for j in range(R-L-i):
        if (L + i + j + 1 % 2019 == 0):
            mod = 0
            break
        I = L + i
        J = L + i + j + 1
        now = (I * J) % 2019
        if(now < mod):
            mod = now
        if(mod == 0):
            end += 1
            break

print(mod)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    int v = 1;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(v != a[i]) ans++;
        else v++;
    }
    cout << (v==1?-1:ans) << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

    int N;
    cin >> N;
    int a;
    vector<int> V(100001, 0);
    for(int i = 0; i < N; i++){
        cin >> a;
        V[a]++;
    }
    int ev = 0, od = 0;
    for(int i = 1; i <= 100000; i++){
        if(V[i] > 0){
            if(V[i]%2 == 0){
                ev++;
            }
            else{
                od++;
            }
        }
    }
    //cout << ev << " " << od << endl;
    if(ev%2 == 0){
        cout << ev + od << endl;
    }
    else{
        cout << ev + od - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main()
{
long long int a,i,s=0;
scanf("%lld",&a);
for(i=0;i<=a;i++)
{
if(i%3==0 || i%5==0)
continue;
else 
s+=i;
}
printf("%lld",s);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

string S[2], ans;

bool solve(){

    rep(i,2)
        reverse(S[i].begin(), S[i].end());
    // cout << ans << endl;
    // cout << S[1]+S[0] << endl;
    if(ans == S[1]+S[0])
        return true;
    else
        return false;
}

int main(){
    cin >> S[0] >> S[1];
    
    ans = S[0]+S[1];

    if(solve())
        cout << "YES" << endl;
    else 
        cout << "NO" << endl;
}


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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

#define EPS 1e-9
const double GR=(sqrt(5.0)-1.0)/2.0;

int N,K;
double X[201],Y[201];

double f(double x,double y){
  double res=0;
  vector<double> ds;
  rep(i,N){
    ds.push_back(sqrt(pow(x-X[i],2)+pow(y-Y[i],2)));
  }
  sort(all(ds)); reverse(all(ds));
  rep(i,K){
    res+=ds[i];
  }
  return -res;
}

double yargmax(double cx){
  double lb=-2000,ub=2000;
  double x=ub-GR*(ub-lb),y=lb+GR*(ub-lb);
  double vx=f(cx,x),vy=f(cx,y);
  while(ub-lb>EPS){
    if(vx<vy){
      lb=x; x=y; vx=vy; y=lb+GR*(ub-lb); vy=f(cx,y);
    }else{
      ub=y; y=x; vy=vx; x=ub-GR*(ub-lb); vx=f(cx,x);
    }
  }
  return (x+y)/2.0;
}

double xargmax(){
  double lb=-2000,ub=2000;
  double x=ub-GR*(ub-lb),y=lb+GR*(ub-lb);
  double vx=f(x,yargmax(x)),vy=f(y,yargmax(y));
  while(ub-lb>EPS){
    if(vx<vy){
      lb=x; x=y; vx=vy; y=lb+GR*(ub-lb); vy=f(y,yargmax(y));
    }else{
      ub=y; y=x; vy=vx; x=ub-GR*(ub-lb); vx=f(x,yargmax(x));
    }
  }
  return (x+y)/2.0;
}

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

  cin>>N>>K;
  rep(i,N){
    cin>>X[i]>>Y[i];
  }

  double resx=xargmax();
  double resy=yargmax(resx);

  printf("%.10f\n", -f(resx,resy));

  return 0;
}



Measured memory_bytes: 3360
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  string s; cin >> s;
  int res =0;
  rep(i,SIZE(s)/2){
    res += (s[i]!=s[SIZE(s)-1-i]);
  }
  cout << res << endl;
  return 0;

}


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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        //var n = int.Parse(Console.ReadLine());
        long[] nck = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var n = nck[0];
        var c = nck[1];
        var k = nck[2];

        long[] t = new long[n];
        for (int i = 0; i < n; i++)
        {
            t[i] = long.Parse(Console.ReadLine());
        }

        Array.Sort(t);

        long start = 0;
        long seconds = 0;
        long count = 0;
        long ans = 1;
        for (int i = 0; i < n; i++)
        {
            if (start == 0)
            {
                start = t[i];
                seconds = 0;
            }
            else
            {
                seconds = t[i] - start;
            }

            count++;

            if (seconds > k || count > c)
            {
                ans++;
                start = t[i];
                count = 1;
            }
        }

        // 出力
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 17464
def main():
    n = int(input())
    S = list(map(int, input().split()))
    q = int(input())
    T = list(map(int, input().split()))

    c = 0

    for k in T:
        if k in S:
            c += 1
    print(c)

if __name__ == "__main__":
    main()
    


Measured memory_bytes: 6548
#include<stdio.h>
#define N 101
#define W 0
#define B 1
#define INF 1000000000
int n,w[N][N],d[N];

void dijkstra(){
  int i,j,u,v,c[N];
  int mincost;
  for(u=0;u<n;u++){
    d[u]=INF;
    c[u]=W;
  }
  d[0]=0;
 
  while(1){
    mincost = INF;
    for(i=0;i<n;i++){
      if(c[i]!=B&&d[i]<mincost){
	u = i;
	mincost = d[i];
      }
    }
    if(mincost==INF) break;
    c[u]=B;
    for(v=0;v<n;v++){
      if(c[v]!=B && d[u]+w[u][v]<d[v]){
	d[v] =d[u]+w[u][v];
      }
    }
  }
}


int main(){
  int i,j;
  int u,k,v,c;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      w[i][j]=INF;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      w[u][v]=c;
    }
  }
  dijkstra();
  for(i=0;i<n;i++) printf("%d %d\n",i,d[i]);
  return 0;
}

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

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  
  vector<vector<bool>> bingo(3, vector<bool>(3, false));
  for (int i = 0; i < b.size(); i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (b.at(i) == A.at(j).at(k)) {
          bingo.at(j).at(k) = true;
        }
      }
    }
  }
  
  bool isBingo = false;
  bool num1, num2, num3;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (j == 0) num1 = bingo.at(i).at(j);
      if (j == 1) num2 = bingo.at(i).at(j);
      if (j == 2) num3 = bingo.at(i).at(j);
    }
    if (num1 && num2 && num3) isBingo = true;
  }
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (j == 0) num1 = bingo.at(j).at(i);
      if (j == 1) num2 = bingo.at(j).at(i);
      if (j == 2) num3 = bingo.at(j).at(i);
    }
    if (num1 && num2 && num3) isBingo = true;
  }
  
  if (bingo.at(0).at(0) && bingo.at(1).at(1) && bingo.at(2).at(2)) {
    isBingo = true;
  }
  
  if (bingo.at(0).at(2) && bingo.at(1).at(1) && bingo.at(2).at(0)) {
    isBingo = true;
  }
  
  if (isBingo) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    
  
  int main(){
      lint n,q;
      string s;
      cin>>n>>q;

      cout<<n*(n-1)/2+q*(q-1)/2;
  }
  
  
     
  

Measured memory_bytes: 256
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long d = long.Parse(input[1]);
		long[] numsd = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long q = long.Parse(Console.ReadLine());
    long[] numsq = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    bool[] answers = new bool[n];
    long[] rests = new long[n+1];
    rests[0] = d;
    long[] noMin = new long[n+1];
    noMin[n] = 1;

    for(long i = 0; i < n; i++)
    {
      rests[i+1] = rests[i];
      if(Math.Abs(rests[i]-numsd[i]) < rests[i]) rests[i+1] = Math.Abs(rests[i]-numsd[i]);
      
      //Console.WriteLine(i+" "+rests[i]+"r");
    }

    for(long i = 0; i < n; i++)
    {
      noMin[n-1-i] = noMin[n-i];
      if((noMin[n-1-i]-1)*2+1 >= numsd[n-1-i]) noMin[n-1-i] += numsd[n-1-i];
      //Console.WriteLine((n-1-i)+" "+noMin[n-1-i]);
    }

    for(long i = 0; i < n; i++)
    {
      if(noMin[i+1] <= rests[i]) answers[i] = true;
    }

    for(long i = 0; i < q; i++)
    {
      if(answers[numsq[i]-1]) Console.WriteLine("YES");
      else Console.WriteLine("NO");
    }
	}
}

Measured memory_bytes: 81004