akhauriyash/Code-Regression huggingface dataset:
// Copyright (C) 2018 Sayutin Dmitry.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.

#include <iostream>
#include <vector>
#include <stdint.h>
#include <algorithm>
#include <set>
#include <map>
#include <array>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <string>
#include <assert.h>
#include <iterator>
#include <cstdint>
#include <cinttypes>
#include <string.h>
#include <random>
#include <numeric>
#include <tuple>


using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::min;
using std::abs;
using std::max;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

#define pb push_back
#define eb emplace_back


int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    // code here.
    int n = input<int>();

    vector<string> a(n);

    for (int i = 0; i != n; ++i) {
        cin >> a[i];
        a[i] = a[i] + a[i];
    }

    for (int i = 0; i != n; ++i)
        a.push_back(a[i]);

    vector<vector<int>> dp(2 * n, vector<int>(2 * n));

    for (int i = 0; i != 2 * n; ++i)
        for (int j = 0; j != 2 * n; ++j) {
            int t = 1;

            while (i >= t and j >= t and a[i - t][j] == a[i][j - t])
                ++t;
            
            dp[i][j] = t;            
        }

    int ans = 0;
    for (int a = 0; a != n; ++a)
        for (int b = 0; b != n; ++b) {
            bool ok = true;

            for (int i = 0; i != n and ok; ++i)
                ok = (dp[a + i][b + i] >= i + 1);

            if (ok)
                ++ans;
        }

    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll w, a, b;std::cin >> w >> a >> b;
  if(a+w<b) std::cout << b-(a+w) << '\n';
  else if(a<b) std::cout << 0 << '\n';
  else if(b+w<a) std::cout << a-(b+w) << '\n';
  else std::cout << 0 << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int d, n, i;
    int x = 1;
    
    cin >> d >> n;
    
    for(i=0; i < d; i++) x = x*100;
    
    if(n == 100) n++;
    
    cout << x*n << endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
	int a,b,hz,rem;
	Scanner scan =new Scanner(System.in);
	a=scan.nextInt();
	b=scan.nextInt();
	if(b>a){
	    hz=a;
	    a=b;
	    b=hz;
	}
	rem=a%b;
        while(rem!=0){
	    a=b;
	    b=rem;
	    rem=a%b;
	}
	System.out.println(b);
    }
}



Measured memory_bytes: 26204
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}
#define P 1000000007
int a[200000];
int b[200000];
int al, bl;
int main(void){
	int n=nextint();
	int k=nextint();
	for(int i=0; i<n; i++){
		int s=nextint();
		if(s>=0){
			a[al++]=s;
		}else{
			b[bl++]=-s;
		}
	}
	rsorta_d32(a, al, 1, 0);
	rsorta_d32(b, bl, 1, 0);
	long ans=1;
	if(n==k){
		for(int i=0; i<al; i++){
			ans=ans*a[i]%P;
		}
		for(int i=0; i<bl; i++){
			ans=ans*(-b[i])%P;
		}
	}else if(k%2==1 && al==0){
		for(int i=0; i<k; i++){
			ans=ans*(-b[i])%P;
		}
	}else{
		while(k>1){
			if(al<2){
				ans=ans*(-b[--bl])%P;
				ans=ans*(-b[--bl])%P;
				k-=2;
			}else if(bl<2){
				ans=ans*a[--al]%P;
				k--;
			}else if((long)a[al-1]*a[al-2]<(long)b[bl-1]*b[bl-2]){
				ans=ans*(-b[--bl])%P;
				ans=ans*(-b[--bl])%P;
				k-=2;
			}else{
				ans=ans*a[--al]%P;
				k--;
			}
		}
		if(k==1){
			ans=ans*a[--al]%P;
		}
	}
	ans=(ans+(long)P*P)%P;
	printf("%ld\n", ans);
}


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

ll dp[51][51][2501];

int main() {
	int n,a;
	cin >> n >> a;
	vector<int> x(n);
	rep(i,n) cin >> x[i];
	int max_x = 0;
	rep(i,n) max_x = max(max_x, x[i]);

	rep(j,n+1) rep(k,n+1) rep(s,n*max_x+1) dp[j][k][s] = 0;
	dp[0][0][0] = 1;
	rep(j,n+1) rep(k,n+1) rep(s,n*max_x+1) {
		if (j>=1 && s<x[j-1]) dp[j][k][s] = dp[j-1][k][s];
		else if (j>=1 && k>=1 && s>=x[j-1]) dp[j][k][s] =  dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]];
	}
	ll ans = 0;
	for (int k=1;k<=n;k++) ans += dp[n][k][k*a];
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 51072
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

constexpr ll INF = 1ll<<60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

const std::string C = "ACGT";

std::string S;
ll ans;

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

  rep( i, S.size() ) repi( j, 1, S.size()-i+1 )
  {
    std::string T = S.substr( i, j );

    bool fl = true;

    rep( k, T.size() )
      fl &= C.find(T[k]) != std::string::npos;

    if( fl )
      chmax( ans, j );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 888
import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long[] aa=new long[n];
		int[] a=new int[n];
		long sum=0;
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt()-1;
			aa[a[i]]++;
		}
		for(int i=0; i<n; i++){
			sum+=aa[i]*(aa[i]-1)/2;
		}
		for(int i=0; i<n; i++){
			System.out.println(sum-aa[a[i]]*(aa[a[i]]-1)/2+(aa[a[i]]-1)*(aa[a[i]]-2)/2);
		}
	}
}


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

int main()
{
    int M, N;

    while ( cin >> M >> N, M != 0 && N != 0 ) {
        bool flag[1005] = {};
        int jb = 0;
        int cnt = 1;
        int d = 0;
        bool lock = false;
        while ( cnt <= N ) {
            string S;
            cin >> S;
            if ( !lock ) {
                if ( S == "FizzBuzz" ) {
                    if ( cnt % 15 != 0 ) {
                        flag[jb] = true;
                        d++;
                    }
                } else if ( S == "Fizz" ) {
                    if ( cnt % 3 != 0 || cnt % 15 == 0 ) {
                        flag[jb] = true;
                        d++;
                    }
                } else if ( S == "Buzz" ) {
                    if ( cnt % 5 != 0 || cnt % 15 == 0 ) {
                        flag[jb] = true;
                        d++;
                    }
                } else {
                    int val = atoi(S.c_str());
                    if ( val != cnt || cnt % 3 == 0 || cnt % 5 == 0 ) {
                        flag[jb] = true;
                        d++;
                    }
                }
                if ( d == M - 1 ) {
                    lock = true;
                }
                (jb += 1) %= M;
                while ( flag[jb] ) {
                    (jb += 1) %= M;
                }
            }
            cnt++;
        }
        vector < int > ans;
        for ( int i = 0; i < M; i++ ) {
            if ( !flag[i] ) {
                ans.push_back(i + 1);
            }
        }
        cout << ans[0];
        for ( int i = 1; i < ans.size(); i++ ) {
            cout << " " << ans[i];
        }
        cout << endl;
    }
    return ( 0 );
}



Measured memory_bytes: 3200
#![allow(bare_trait_objects)]
#![allow(unused_imports)]
#![allow(dead_code)]

use std::fmt::Debug;
use std::io::BufRead;
use std::io::Stdin;
use std::io::StdinLock;
use std::str::FromStr;

pub struct Scanner<'a> {
    buf_read: Box<BufRead + 'a>,
    tokens: Vec<String>,
}

impl<'a> Scanner<'a> {
    pub fn new(buf_read: StdinLock<'a>) -> Self {
        Scanner {
            buf_read: Box::new(buf_read),
            tokens: Vec::new(),
        }
    }

    // pub fn from_stdin() -> Self {
    //     let stdin = Box::leak(Box::new(std::io::stdin()));
    //     Self {
    //         buf_read: Box::new(stdin.lock()),
    //         tokens: Vec::new(),
    //     }
    // }

    pub fn next(&mut self) -> String {
        while self.tokens.is_empty() {
            let mut s = String::new();
            if self.buf_read.read_line(&mut s).is_err() {
                panic!()
            }
            self.tokens = s
                .split_whitespace()
                .filter(|s| !s.is_empty())
                .rev()
                .map(str::to_string)
                .collect();
        }
        self.tokens.pop().unwrap()
    }

    pub fn next_g<T: FromStr>(&mut self) -> T
    where
        T::Err: Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn next_vec_g<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: Debug,
    {
        (0..n).map(|_| self.next_g()).collect()
    }

    pub fn usize(&mut self) -> usize {
        self.next_g()
    }

    pub fn i64(&mut self) -> i64 {
        self.next_g()
    }

    pub fn vec_i64(&mut self, n: usize) -> Vec<i64> {
        self.next_vec_g(n)
    }

    pub fn vec_usize(&mut self, n: usize) -> Vec<usize> {
        self.next_vec_g(n)
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }
}

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

    let n = sc.usize() - 1;
    let cs: Vec<_> = sc.chars().iter().map(|c| *c as i32 - '1' as i32).collect();

    let c = if cs.iter().all(|v| *v != 1) { 2 } else { 1 };

    let mut div2 = vec![0; n + 1];
    for i in 1..div2.len() {
        div2[i] = div2[i - 1];
        let mut j = i;
        while j % 2 == 0 {
            div2[i] += 1;
            j /= 2;
        }
    }

    let mut ans = 0;
    for i in 0..n + 1 {
        let cnt2 = div2[n] - div2[n - i] - div2[i];
        if cnt2 == 0 && cs[i] == c {
            ans ^= c;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 13560
n = int(input())

print(f'{n}:', end='')
temp = n
for i in range(2, int(n**(1/2))+1):
    if temp % i == 0:
        while temp % i == 0:
            print(f' {i}', end='')
            temp //= i

if temp != 1:
    print(f' {temp}', end='')

print('')



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

int a[100005];
bool cmp(int a,int b)
{
    return a>b;
}

int main()
{
	int n;
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    sort(a+1,a+n+1,cmp);
    int min1=0,min2=2147483647;
    for(int i=2;i<=n;i++)
        if(fabs((a[1]/2)-a[i])<min2)
            min1=i,min2=fabs((a[1]/2)-a[i]);
    cout<<a[1]<<" "<<a[min1];
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int h, w;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
vector<string> vs;

int bfs(int x, int y) {
  vector<vector<int>> check(h, vector<int>(w, -1));
  check[x][y] = 0;
  int res = 0;

  queue<int> qx;
  queue<int> qy;
  qx.push(x);
  qy.push(y);
  while(!qx.empty()) {
    int tx = qx.front();
    int ty = qy.front();
    qx.pop(), qy.pop();

    for (int i = 0; i < 4; i ++) {
      int nx = tx + dx[i];
      int ny = ty + dy[i];

      if (nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
      if (check[nx][ny] != -1) continue;
      if (vs[nx][ny] == '#') continue;

      check[nx][ny] = check[tx][ty] + 1;
      res = max(res, check[nx][ny]);
      qx.push(nx);
      qy.push(ny);
    }
  }

  return res;
}

int main() {
  cin >> h >> w;
  vs.resize(h);
  rep(i, h) cin >> vs[i];

  int ans = 0;
  for (int i = 0; i < h; i ++) {
    for (int j = 0; j < w; j ++) {
      if (vs[i][j] == '#') continue;
      ans = max(ans, bfs(i, j));
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string ans="Good";
  cin>>s;
  for(int i=0;i<3;i++){
    if(s.at(i)==s.at(i+1)){
      ans="Bad";
      break;
    }
  }
  cout<<ans;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> L = {2, 1};
    rep(i, 2, n+1){
        L.push_back(L[i-2]+L[i-1]);
    }
    cout << L[n] << endl;
    return 0;
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  string S;
  cin>>S;
  map<int,int> A;
  A[0]++;
  int j=1,k=0;
  for(int i=0;i<S.size();i++){
    k=(k+j*(S[S.size()-1-i]-'0'))%2019;
    A[k]++;
    j=j*10%2019;
  }
  j=0;
  for(pair<int,int> p:A){
    j+=p.second*(p.second-1)/2;
  }
  cout<<j<<endl;
}

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

namespace ConsoleApplication1
{
    class Solution
    {
        public long Proc(string Source)
        {
            long n = Source.Length;
            long src = long.Parse(Source);
            long number = 0;

            if (n % 2 == 0)
            {
                for (long i = 1; i < n; i += 2)
                {
                    number += (long)Math.Pow(10, i) - (long)Math.Pow(10, i - 1);
                }
            }
            else
            {
                for (long i = 1; i < n; i += 2)
                {
                    number += (long)Math.Pow(10, i) - (long)Math.Pow(10, i - 1);
                }

                number += (src % (long)Math.Pow(10, n - 1)) + 1 +
                    ((src / (long)Math.Pow(10, n - 1) - 1) * (long)Math.Pow(10, n - 1));
            }

            return number;
        }

        public long Proc2(string Source)
        {
            long src = long.Parse(Source);
            long count=0;

            for (long i = 1; i <= src; i++)
            {
                if (i.ToString().Length % 2 == 1) count++;
            }

            return count;
        }
    }

    public class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var str = Console.ReadLine();
                var s = new Solution();
                var re = s.Proc(str);
                Console.WriteLine(re);

                //Random rnd = new System.Random();
                //while (true)
                //{
                //    string src = rnd.Next(1, 10000).ToString();
                //    var s = new Solution();
                //    s.Proc2("901");
                //    s.Proc("901");
                //    if (s.Proc(src) != s.Proc2(src))
                //    {
                //        throw new Exception("");
                //    }
                //    Console.WriteLine("Cp");
                //}

                //var str = Console.ReadLine();
                

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            //Console.WriteLine("終了");
            //Console.Read();
        }


    }
}

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

using namespace std;

#define debug(x,y) cout<<(#x)<<" " <<(#y)<<" is " << (x) <<" "<< (y) << endl
#define watch(x) cout<<(#x)<<" is " << (x) << endl
#define fast ios_base::sync_with_stdio(false)
#define fie(i,a,b) for(i=a;i<b;i++)
#define MOD 1000000007
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define ll long long
#define lld long long int
#define ALL(x) (x).begin(),(x).end()

typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<pair<int, int>> vpi;
typedef long long LL;

const lld INF = (1ll) << 56;
const long long OO = 2e18;
const double pi = 2 * acos(0.0);

lld dp[100001], n, m;
vector<lld> adj[100001];

//TOP_DOWN
lld longestPathGraph(lld a) {
	lld count = 0;
	if (adj[a].size() == 0) return dp[a] = 0;
	if (dp[a] != -1) return dp[a];
	for (lld i = 0; i < adj[a].size(); i++) {
		count = max(count, longestPathGraph(adj[a][i]) + 1);
	}
	return dp[a] = count;
}

int main() {
	fast;
	cin.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	lld i, j;
	cin >> n >> m;
	memset(dp, -1, sizeof(dp));
	for (j = 0; j < m; j++) {
		lld x, y;
		cin >> x >> y;
		adj[x].push_back(y);
	}
	lld ans = INT_MIN;
	for (i = 1; i <= n; i++) {
		ans = max(ans, longestPathGraph(i));
	}
	cout << ans << endl;
}

Measured memory_bytes: 8576
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int n = cin.nextInt(); // n <- データセットの数

    for(int dataSet = 1; dataSet <= n; dataSet++) {
      int y = cin.nextInt(), m = cin.nextInt(), d = cin.nextInt();
      int answer = 0;
      while(true) {
        if(y == 1000 && m == 1 && d == 1) {
          break;
        } 
        int months; // 月の日数
        if(y % 3 == 0 ||  // 3の倍数の月
           m % 2 == 1 ) { // または、奇数月
          months = 20;
        } else {
          months = 19;
        }
        if(d == months) {
          // 月の最後なら次の月へ
          m++; d = 1;
        }else {
          d++; // 次の日へ
        }
        if(m == 11) { // 年の最後なら、次の年へ
          y++; m = 1; d = 1;
        }
        answer++;
      }
      System.out.println(answer);
    }
  }
}

Measured memory_bytes: 20176
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");
	public static void main(String[] args) {
		int N=sc.nextInt();
		int M=sc.nextInt();
		int X=sc.nextInt();
		int a=0,b=0;
		int tmp;
		for(int i=0;i<M;i++) {
			tmp=sc.nextInt();
			if(tmp<X) {
				a++;
			}else if(tmp>X) {
				b++;
			}
		}
		p(Math.min(a, b));
	}
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
}
	

Measured memory_bytes: 21844
using System;
using System.IO;
using System.Collections.Generic;

namespace ConsoleApp1
{
  
    class Program
    {

        static void Main(string[] args)
        {


            string[] strs = Console.ReadLine().Split();
            int cnt = 1;

            foreach(var str in strs)
            {
                if(str == "0")
                {
                    Console.WriteLine(cnt.ToString());
                }
                cnt++;
            }

        }
    }
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007


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

ll imos[333333];
ll memo[333333];

int main()
{
	ll n,m;cin >> n >> m;
	vector<ll> v(n);
	REP(i,n)cin >> v[i];
	
	REP(i,n-1){
		if(v[i] > v[i+1]){
			DBG(cout << "!" << endl;);
			if(m + v[i+1] - v[i] < 2)continue;
			imos[v[i]+2]++;
			imos[m+v[i]+2]++;
			imos[m+v[i+1]+1]--;
			imos[2*m+v[i+1]+1]--;
			memo[v[i+1]+m+1] -= m+v[i+1]-v[i]-1;
			memo[v[i+1]+2*m+1] -= m+v[i+1]-v[i]-1;
		}
		else{
			if(v[i+1] - v[i] < 2)continue;
			imos[v[i]+2]++;
			imos[v[i]+m+2]++;
			imos[v[i+1]+1]--;
			imos[v[i+1]+m+1]--;
			memo[v[i+1]+1] -= v[i+1]-v[i]-1;
			memo[v[i+1]+m+1] -= v[i+1]-v[i]-1;
		}
	}
	
	DBG(
	cout << "memo" << endl;
	SHOW1d(memo,3*m+10);
	);
	DBG(
	cout << "imos" << endl;
	SHOW1d(imos,3*m+10);
	);

	
	REP(i,3*m+10){
		imos[i+1] += imos[i];
	}
	
	REP(i,3*m+10){
		memo[i+1] += memo[i] + imos[i+1];
	}
	
	ll ans = 0;
	REP(i,3*m+10)ans = max(ans,memo[i]);
	
	ll ret = 0;
	REP(i,n-1){
		if(v[i] > v[i+1]){
			ret += m + v[i+1] - v[i];
		}
		else{
			ret += v[i+1] - v[i];
		}
	}
	
	DBG(
	cout << "memo" << endl;
	SHOW1d(memo,3*m+10);
	);
	DBG(
	cout << "imos" << endl;
	SHOW1d(imos,3*m+10);
	);
	
	cout << ret - ans << endl;
	
	return 0;
}


Measured memory_bytes: 6016
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

bool pairCompare(const pair<int, int>& firstElem, const pair<int, int>& secondElem) {
    return firstElem.second < secondElem.second;
}

int main() {
    ll n;
    pair<ll, ll> p[300010];
    cin >> n;
    imfor(i, n) {
        ll a, b;
        cin >> a >> b;
        p[i] = make_pair(a, b);
    }
    sort(p, p + n, pairCompare);
    ll t = 0;
    bool ans = true;
    imfor(i, n) {
        t += p[i].first;
        if (t > p[i].second) {
            ans = false;
            break;
        }
    }
    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 4992
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ret = 0
for i in range(N):
  if B[i] >= A[i]:
    ret += A[i]
    B[i] -= A[i]
    A[i] = 0
  else:    
    ret += B[i]
    A[i] -= B[i]
    B[i] = 0
  if B[i] >= A[i+1]:
    ret += A[i+1]
    B[i] -= A[i+1]
    A[i+1] = 0
  else:
    ret += B[i]
    A[i+1] -= B[i]
    B[i] = 0
print(ret)

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

int main() {
  int A,B,C,X,p=0,i,j;
  cin >> A >> B >> C >> X;

  for(i=0; i<=A; i++) {
    if(X-i*500<0)
      break;
    for(j=0; j<=B; j++) {
      int r = X-i*500-j*100;
      if(r<0)
        break;
      if(r%50==0 && r/50<=C)
        p++;
    }
  }

  cout << p << endl;
}

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

int main(void){
  int num;
  int ignore = scanf("%d",&num);
  if(num % 1000 == 0){
  	printf("0"); 
  }else{
    printf("%d",1000 - num%1000);
  }
  ignore++;
 return 0; 
}

Measured memory_bytes: 1728
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]


x1,y1,x2,y2 = map(int, input().split())

dis_x = x2 - x1
dis_y = y2 - y1

x3 = x2 - dis_y
y3 = y2 + dis_x
x4 = x3 - dis_x
y4 = y3 - dis_y

print(x3,y3,x4,y4)




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

int main()
{
    long long i = 0, j = 0, k = 0, ans = 0;
	long long n;
	cin >> n;

	int num[20]={0},cnt=0;
	for (i = 0; n;i++){
		num[i] = n % 10;
		n /= 10;
		cnt++;
	}
	for (i = 0; i<cnt-1;i++){
		if(num[i]!=9){
			num[i] = 9;
			for(j=i+1;j<cnt-1;j++){
				if(num[j]==0)
					num[j] = 9;
				else
					break;
			}
			num[j] -= 1;
		}
		ans += num[i];
	}

	cout << ans+num[i] << endl;
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,t;
  cin >> n >> t;

  vll a(n);
  REP(i, n)
    cin >> a[i];

  //count, profit
  pll ans = pll(0, 0);
  ll min_a = a[0];
  REP1(i, n){
    if(min_a > a[i])
      min_a = a[i];
    else if(ans.SE == a[i] - min_a)
      ans.FI++;
    else if(ans.SE < a[i] - min_a)
      ans = pll(1, a[i] - min_a);
  }

  cout << ans.FI << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int H1 = sc.nextInt();
        int M1 = sc.nextInt();
        int H2 = sc.nextInt();
        int M2 = sc.nextInt();
        int K = sc.nextInt();
        int h = H2 - H1;
        int M = M2 - M1;
        int m=0;
        if(M<0){
            h--;
            m = 60 + M;
        }
        else
        {
            m = M;
        }
        int result = 60 * h + m;
        System.out.println(result- K);
    }
}


Measured memory_bytes: 35716
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define Repe(i,a,b) for(register int i=(a);i>=(b);--i)
#define pb push_back
#define Chkmax(a,b) a=a>b?a:b
#define Chkmin(a,b) a=a<b?a:b
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef long long ll;

using namespace std;

namespace IO
{
    const uint32 Buffsize=1<<15,Output=1<<23;
    static char Ch[Buffsize],*S=Ch,*T=Ch;
    inline char getc()
    {
        return((S==T)&&(T=(S=Ch)+fread(Ch,1,Buffsize,stdin),S==T)?0:*S++);
    }
    static char Out[Output],*nowps=Out;
    
    inline void flush(){fwrite(Out,1,nowps-Out,stdout);nowps=Out;}

    template<typename T>inline void read(T&x)
    {
        x=0;static char ch;T f=1;
        for(ch=getc();!isdigit(ch);ch=getc())if(ch=='-')f=-1;
        for(;isdigit(ch);ch=getc())x=x*10+(ch^48);
        x*=f;
    }

    template<typename T>inline void write(T x,char ch='\n')
    {
        if(!x)*nowps++='0';
        if(x<0)*nowps++='-',x=-x;
        static uint32 sta[111],tp;
        for(tp=0;x;x/=10)sta[++tp]=x%10;
        for(;tp;*nowps++=sta[tp--]^48);
        *nowps++=ch;
    }
}
using namespace IO;

inline void file()
{
#ifndef ONLINE_JUDGE
    FILE*DSA=freopen("water.in","r",stdin);
    FILE*SDU=freopen("water.out","w",stdout);
#endif
}

const int MAXN=5e5+7;

static int n;

static char s[MAXN];

inline void init()
{
	int z=scanf("%s",s+1);
	n=strlen(s+1);
}

static int fail[MAXN],fl[MAXN];

static int pr[MAXN],suf[MAXN];

inline void solve()
{
	static int ps=0;
	Rep(i,2,n)
	{
		while(ps&&s[ps+1]!=s[i])ps=fail[ps];
		if(s[ps+1]==s[i])++ps;
		fail[i]=ps;
	}
	if(n%(n-fail[n])!=0||!fail[n])return(void)printf("1\n1\n");
	else if(n-fail[n]==1)return(void)printf("%d\n1\n",n);
	puts("2");
	Rep(i,1,n)if(i%(i-fail[i])!=0||!fail[i])pr[i]=1;
	reverse(s+1,s+n+1);
	ps=0;
	Rep(i,2,n)
	{
		while(ps&&s[ps+1]!=s[i])ps=fl[ps];
		if(s[ps+1]==s[i])++ps;
		fl[i]=ps;
	}
	Rep(i,1,n)if(i%(i-fl[i])!=0||!fl[i])suf[n-i+1]=1;
	static int ans=0;
	Rep(i,1,n-1)if(pr[i]&&suf[i+1])++ans;
	printf("%d\n",ans);
}

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


Measured memory_bytes: 8576
//#define _USE_MATH_DEFINES
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }
inline int safe_mul(const int x, const int y) __attribute__ ((warn_unused_result));


int main()
{
//    freopen("in.txt","r", stdin);
//    freopen("out.txt", "w", stdout);
//    cout << fixed << setprecision(20);
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int64_t l,r;
    cin >> l >> r;
    int64_t res = 2019;

    if (r > 4030 + l)
        r = 4030 + l;

    for (auto i = l; i <= r; ++i)
        for (auto j = i + 1; j <= r; ++j)
            res = min(res, i * j % 2019);
    cout << res << endl;
}


Measured memory_bytes: 256
N, T = gets.chomp.split(" ").map(&:to_i)
F = Array.new(N).map{
  gets.chomp.split(" ").map(&:to_i)
}

dp = Array.new(T)
ans = 0
dp[0] = 0
F.sort.each{|a, b|
  (T-1).downto(0){|n|
    next if dp[n].nil?
    if n+a < T then
      if dp[n+a].nil? || dp[n+a] < dp[n] + b then
        dp[n+a] = dp[n] + b
      end
    else
      ans = dp[n] + b if ans < dp[n] + b
    end
  }
}

dp << ans
puts dp.compact.max


Measured memory_bytes: 2296
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int n,y;
    int b[110],r[110],t[110];
 
    while(true){
        cin >> n;
        cin >> y;
        if(n == 0){
            break;
        }
        for(int i = 0; i < n; i++){
            cin >> b[i] >> r[i] >> t[i];
        }
 
        double ganri[110];
        double ganri_max = 10000;
        int number;
 
        for(int i = 0; i < n; i++){
            if(t[i] == 1){
                ganri[i] = 10000*(1 + y*(double)r[i]/100);
            }
            else{
                ganri[i] = 10000*pow(1 + (double)r[i]/100, y);
            }
            if(ganri[i] > ganri_max){
                ganri_max = ganri[i];
                number = b[i];
            }
        }
        cout << number << endl;
    }
}


Measured memory_bytes: 3384
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  s <- T.getLine :: IO T.Text
  (q : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  queries <- sequence . replicate q $ T.words <$> T.getLine :: IO [[T.Text]]
  let
    queries' :: [Maybe (Bool, Char)]
    queries' = map f queries
      where
        f (t : fc) | unsafeTextToInt t == 1 = Nothing
                   | otherwise       = Just . ((,) <$> (== 1) . unsafeTextToInt . fst <*> T.head . snd) . unsafeListToTuple $ fc
    b :: Bool
    pf, sf :: String
    (b, pf, sf) = foldl step (True, "", "") $ queries'
      where
        step :: (Bool, String, String) -> Maybe (Bool, Char) -> (Bool, String, String)
        step (b', pf', sf') = g
          where
            g Nothing                   = (not b', sf', pf')
            g (Just (f, c)) | f         = (b', c : pf', sf')
                            | otherwise = (b', pf', c : sf')
    s' :: T.Text
    s' | b         = s
       | otherwise = T.reverse s
  T.putStrLn $ T.pack pf `T.append` s' `T.append` T.pack (reverse sf)

unsafeListToTuple :: [a] -> (a, a)
unsafeListToTuple (x : y : _) = (x, y)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 92796
H, W, K = [int(i) for i in input().split()]

grid = []
ans = 0
for _ in range(H):
    grid.append(list(input()))

for i in range(2**H):
    for j in range(2**W):
        now = 0
        for x in range(H):
            for y in range(W):
                if 2 ** x & i > 0  and 2**y & j > 0:
                    if grid[x][y] == "#":
                        now += 1
        if now == K:
            ans += 1
print(ans)

Measured memory_bytes: 9068
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int h,w;
int n;
set<P> sp;

ll dp[17][17];

int main(){
	while(cin >> w >> h&&w+h){
		sp.clear();
		rep(i,17)rep(j,17)dp[i][j] = 0;
		cin >> n;
		rep(i,n){
			int x,y;
			cin >> x >> y;
			x--; y--;
			sp.insert(P(y,x));
		}
		dp[0][0] = 1;
		rep(i,h){
			rep(j,w){
				if(sp.find(P(i,j)) != sp.end())continue;
				dp[i+1][j] += dp[i][j];
				dp[i][j+1] += dp[i][j];
			}
		}
		cout << dp[h-1][w-1] << endl;
	}
}


Measured memory_bytes: 3088
// Gaurav Aggarwal
 
#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 vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
 
ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

    ll a,b;
    cin>>a>>b;

    ll c = __gcd(a,b);
    ll ans = (a*b)/c;
    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 256
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <queue>

using namespace std;

int main(int argc, char *argv[]) {
	string s;
	cin >> s;
	int ans = 0;
	deque<char> q;
	for (char c : s) {
		q.push_front(c);
		while (q.size() >= 2 && q[0] != q[1]) {
			ans += 2;
			q.pop_front();
			q.pop_front();
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
using namespace std;
int main(){
	vector<int> sum;
	int n,m,x,max;
	while(cin>>n>>m,n||m){
	cin>>x;
	sum.push_back(0);
	sum.push_back(x);
	max=-1000000;
	for(int i=2;i<=n;i++){
		cin>>x;
		sum.push_back(sum[i-1]+x);
	}
	for(int i=0;i<n-m+1;i++){
		if(sum[m+i]-sum[i]>max)
		max=sum[m+i]-sum[i];
	}
	cout<<max<<endl;
		sum.clear();
	}
	return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;


	public class Main {
		

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
	        
			String S = sc.next();
			String T = sc.next();
			char[] t = T.toCharArray();
			int n = t.length;
			String S2 = S+t[n-1];
			
			if(T.equals(S2)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
			
		}
		
	}


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

void change(string s){
    int n = s.length();
    int cc = 0;
    for(int i=0;i<n/2;i++){
        if(s[i] == s[n-i-1])
            continue;
        cc+= 1;
    }
    cout<<cc<<endl;
}

int main() {
    string s;
    cin>>s;
    change((s));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long N, A[87], CurrentMoney=1000;

int main(){
    cin>>N;
    for(int i=1;i<=N;i++) cin>>A[i];
    for(int i=1;i<=N-1;i++){
        long long stock=0;
        if(A[i]<A[i+1]) stock=CurrentMoney/A[i];
        CurrentMoney+=(A[i+1]-A[i])*stock;
    }
    cout<<CurrentMoney<<endl;
}


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

int main(){
  int n,l;
  cin >> n >> l;
  int ret = 0;
  for(int i = 0;i < n;i++){
    ret += l+i;
  }
  int last = l+(n-1);
  if(l < 0 && last < 0){
    ret -= last;
  }
  if(l > 0 && last > 0){
    ret -= l;
  }
  
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cassert>
#include <string>
#include <cstring>
#include <bitset>
 
#define FOR(i, a, b) for(int i = a; i < (int) b; i++)
#define F0R(i, a) FOR (i, 0, a)
#define ROF(i, a, b) for(int i = a; i >= (int) b; i--)
#define R0F(i, a) ROF(i, a, 0)
#define GO(i, a) for (auto i : a)
 
#define rsz resize
#define eb emplace_back
#define pb push_back
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define f first
#define s second
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vpii> vvpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;

const int dr[] = {+1, -1, +0, +0, +1, -1, +1, -1};
const int dc[] = {+0, +0, +1, -1, +1, -1, -1, +1};
const int ms[] = {+31, +29, +31, 30, +31, +30, +31, +31, +30, +31, +30, +31};

const int N = 3e3 + 5;

int n, a [N];

i64 dp [N][N][2];

i64 solve (int left, int right, int who) {
  if (left > right) return 0;
  i64 &res = dp[left][right][who];
  if (~res) return res;
  if (who == 0) {
    res = -1e18;
    res = max (res, solve (left + 1, right, who ^ 1) + a[left]);
    res = max (res, solve (left, right - 1, who ^ 1) + a[right]);
  } else {
    res = 1e18;
    res = min (res, solve (left + 1, right, who ^ 1) - a[left]);
    res = min (res, solve (left, right - 1, who ^ 1) - a[right]);
  }
  return res;
}


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  F0R (i, n) cin >> a[i];
  memset (dp, -1, sizeof(dp));
  cout << solve (0, n - 1, 0) << '\n';
  return 0;
}


Measured memory_bytes: 141568
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    ll x; cin >> x;
    if (x >= 30){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define INF INT_MAX

const int MAX_SPEED=30;
const int MAX_TOWN=30;

struct P
{
    int town,speed;
    float cost;
    int ptown;
    bool operator >(const P &p) const{
        return cost>p.cost;
    }
};

struct edge
{
    int to,cost,lim;
};

float G[MAX_TOWN+1][MAX_TOWN+1][MAX_SPEED+1];

int main() {
    int town_n,way_n,s,g;
    while(cin >> town_n >> way_n, town_n|way_n){
          cin >> s >> g;

          vector<vector<edge>>E(town_n+1);

          REP(i, way_n){
              int from,to,dist,lim;
              cin >> from >> to >> dist >> lim;
              E[from].push_back({to,dist,lim});
              E[to].push_back({from,dist,lim});
          }

          fill_n((float *)G, (MAX_TOWN+1)*(MAX_TOWN+1)*(MAX_SPEED+1), INF);

          priority_queue<P, vector<P>, greater<P>>que;
          que.push({s,0,0,0});

          float res=INF;
          while(!que.empty()){
              P p=que.top();que.pop();

              if(p.town==g&&p.speed==1){
                  res=p.cost;
                  break;
              }

              for(edge e:E[p.town]){
                  if(e.to==p.ptown)continue;
                  for(int d=-1;d<=1;d++){
                      int speed=p.speed+d;
                      float cost=p.cost+e.cost/(float)speed;
                      if(1<=speed&&speed<=e.lim){
                          if(G[e.to][speed][p.town]>cost){
                            G[e.to][speed][p.town]=cost;
                            que.push({e.to,speed,cost,p.town});
                          }
                      }
                  }
              }
          }

          if(res==INF){
              cout << "unreachable" << endl;
          }else{
          	printf("%5f\n",res);
          }
    }
}

Measured memory_bytes: 1780
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;
 
int main() {
    int N, W;
    cin >> N >> W;
 
    vec<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];
 
    ll MAX_VAL = 10000 * N;
    vec<vec<ll>> dp(N + 1, vec<ll>(MAX_VAL + 100, 1e14 + 5));
 	dp[0][0] = 0;
  
    for (int i = 1; i <= N; ++i) {
        for (int j = 0; j <= MAX_VAL; ++j) {
            dp[i][j] = min({dp[i][j], dp[i - 1][j]});
 
            dp[i][j + v[i - 1]] = min(dp[i][j + v[i - 1]], dp[i-1][j] + w[i - 1]);
        }
    }
 
    ll ans = 0;
 
    rep(i, MAX_VAL) if (dp[N][i] <= W) ans = max(ans, i);
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  map<int, int> X;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (X.count(a)) X.at(a) += 1;
    else X[a] = 1;
  }
  
  int ans = 0;
  for (auto p : X) {
    int k = p.first;
    if (X.at(k) < k) ans += X.at(k);
    else ans += X.at(k) - k;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4736