akhauriyash/Code-Regression huggingface dataset:
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[200000],a[220000], b[220000];
string str, ss;
bool f[200000];
char c[4000][4000];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>vec;
vector<edge>ed;
vector<LL>v;
map<string, LL>ma;
set<LL>st[200000];

void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
void dfs(int x) {
	LL gra = 0;
	while (st[x].find(gra)!=st[x].end()) {
		gra++;
	}
	dp[x] = gra;
	rep(i, n) {
		if(x+a[i]<=m)
		st[x + a[i]].insert(gra);
	}
}
int main() {
	cin >> n >> m;
	rep(i, n)
		cin >> a[i];
	rep(i, m + 1) {
		dfs(i);
	}
	cout << (dp[m]==0?"Second":"First") << endl;
	return 0;
}


Measured memory_bytes: 483840
#include "bits/stdc++.h"

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()

string a,b,c;;
int n,ans;

void input(){
	cin>>n;
	cin>>a>>b>>c;
	return;
}

void solve(){
	for(int i=0;i<n;i++){
		char c1=a[i],c2=b[i],c3=c[i];
		if(c1==c2&&c2==c3&&c1==c3)continue;
		if(c1==c2)ans++;
		else if(c2==c3)ans++;
		else if(c1==c3)ans++;
		else ans+=2;
	}
	cout<<ans<<endl;
	return;
}

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

Measured memory_bytes: 256
A, B, C = map(int, input().split())
odd_num = 0
for e in [A, B, C]:
    if e % 2 == 1:
        odd_num += 1
        
if odd_num == 3 or odd_num == 0:
    ans = 0
    for e in [A, B, C]:
        ans += (max(A, B, C) - e) // 2
    print(ans)
else:
    ans = 1
    ABC = [A, B, C]
    if odd_num == 1:
        for i in range(3):
            if ABC[i] % 2 == 0:
                ABC[i] += 1
        for e in ABC:
            ans += (max(ABC) - e) // 2
    else:
        for i in range(3):
            if ABC[i] % 2 == 1:
                ABC[i] += 1
        for e in ABC:
            ans += (max(ABC) - e) // 2
            
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i, a, b) for(ll i = a; i < b; i++)
#define rloop(i, e, s) for(ll i = e; i >= s; i--)
#define mod 1000000007
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr);

int main()
{
    ll n;
    cin >> n;
    if(n == 1){
        cout << "Yes\n";
        return 0;
    }
    bool flag = true;
    ll h[n];
    loop(i, 0, n) cin >> h[i];
    loop(i, 1, n) if(h[i]> h[i-1]) h[i] -= 1;
    loop(i, 0, n-1) if(h[i] > h[i+1]) flag = false;
    if(flag == true) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 1024
#include <stdio.h>
#define M 1002

void printline(int n,int a[]){
	int i;
	printf("%d",a[0]);
	for(i=1;i<n;i++){
		printf(" %d",a[i]);
	}
	return;
}

void insertsort(int p, int a[]){

	int pp=p,dum_a,dum_b,i;

	for(i=0;i<p;i++){
		if(a[p]<a[i]){
		 pp=i;
		 dum_a=a[p];
		 break;
		}
	}

	if(i==p) return;

	for(i=pp;i<p+1;i++){
		dum_b=a[i];
		a[i]=dum_a;
		dum_a=dum_b;
	}

	return;

}

int main(void){
	int i,n,a[M];
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}

	for(i=0;i<n-1;i++){
		insertsort(i,a);
		printline(n,a);
		printf("\n");
	}

	insertsort(n-1,a);
	printline(n,a);
	printf("\n");

	return 0;

}

Measured memory_bytes: 1756
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int c = sc.nextInt();
        int[] s = new int [r*c+1];
        int t, sum;
        for(int i = 0; i < r; i++)
        {
            sum = 0;
            for(int k = 0; k < c; k++)
            {
                t = sc.nextInt();
                sum += t;
                s[k] += t;
                System.out.print(t + " ");
            }
            s[c] += sum;
            System.out.println(sum);
        }
        for(int i = 0; i < c; i++){
            System.out.print(s[i] + " ");
        }
        System.out.println(s[c]);
    }

}


Measured memory_bytes: 40780
/******

AUTHOR : RUDRANSH TRIPATHI, IIIT NAGPUR, CCID(rt24) & CFID(rsgt24)

MOTTO : Use criticism as fuel and you will never run out of energy.
        AIM : TO BECOME A BETTER CODER
        INTROSPECT + COURSE CORRECTIONS = CATALYST FOR SUCCESS
        Every moment is an opportunity to better yourself
        
*******/

#include<bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define pb push_back
#define d(x) cout<<x<<"\n"

/*int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

int powermod(int A, int p, int MOD = mod){
    A%=MOD;
    int res  = 1;
    while(p){
        if(p&1)
            res = ((__int128)res*A)%MOD;
        
        A = ((__int128)A*A)%MOD;
        p>>=1;
    }

    return res;
}*/

//bool comp()
//{
//}

int32_t main(void)
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        string x;
        cin>>x;
        string temp="";
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(x[i]=='R')
            temp+='R';
        }
        for(int i=0;i<n;i++)
        {
            if(x[i]=='W')
            temp+='W';
        }
        int count=0;
        for(int i=0;i<n;i++)
        {
            if(temp[i]=='R')
            {
                if(temp[i]!=x[i])
                cnt++;
            }
            else
            {
                if(temp[i]!=x[i])
                count++;
            }
        }
        
        
        cout<<min(count,cnt)<<"\n";
    }
    
    return 0;
}

Measured memory_bytes: 3868
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

const int IINF = (1 << 30) - 1;
const long long LLINF = 1LL << 61;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

string s;
vector<int> q;
int cnt;
set<string> st;

string f(void){
    string res = s;
    rep(i, res.size()){
        if('A' <= res[i] && res[i] <= 'Z'){
            int j = i - 1;
            while(j >= 0 && (res[j] == '+' || res[j] == '-')){
                if(res[j] == '+'){
                    ++res[i];
                    if(res[i] > 'Z'){
                        res[i] = 'A';
                    }
                }else if(res[j] == '-'){
                    --res[i];
                    if(res[i] < 'A'){
                        res[i] = 'Z';
                    }
                }
                --j;
            }
        }
    }

    for(int i = 0 ; i < res.size() ; ){
        if(res[i] == '+' || res[i] == '-'){
            res.erase(res.begin() + i);
            continue;
        }
        ++i;
    }

    vector<int> v;
    for(int i = 0 ; i < res.size() ; ){
        if(res[i] == '['){
            v.emplace_back(i);
        }else if(res[i] == ']'){
            reverse(res.begin() + v.back() + 1, res.begin() + i);
            res.erase(res.begin() + v.back());
            res.erase(res.begin() + i - 1);
            --i;
            v.pop_back();
            continue;
        }
        ++i;
    }

    return res;
}

void dfs(int i){
    if(i == cnt){
        st.insert(f());
        return;
    }

    for(char c = 'A' ; c <= 'Z' ; c++){
        s[q[i]] = c;
        dfs(i + 1);
        s[q[i]] = '?';
    }

    return;
}

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

    while(cin >> s, s != "."){
        q.clear();
        cnt = 0;
        st.clear();
        rep(i, s.size()){
            if(s[i] == '?'){
                q.emplace_back(i);
                ++cnt;
            }
        }

        dfs(0);

        cout << *st.begin() << endl;
    }

    return 0;
}


Measured memory_bytes: 7016
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;
int par[114514];//親
int urank[114514];//深さ
int size[114514];
//n要素で初期化
void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        urank[i]=0;
        size[i]=1;
    }
    return;
}

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

//xとyの属する集合を併合
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    
    if(urank[x]<urank[y]){
        par[x]=y;
        size[y]+=size[x];
    }else{
        par[y]=x;
        size[x]+=size[y];
        if(urank[x]==urank[y])urank[x]++;
    }
    return;
}

//xとyが同じ集合に属するか否か
bool same(int x,int y){
    return find(x)==find(y);
}
signed main(){
    int n,m;
    cin>>n>>m;
    vector<int> p[114514];
    for(int i=0;i<n;i++){
        int k;
        cin>>k;
        for(int j=0;j<k;j++){
            int l;
            cin>>l;
            p[l-1].push_back(i);
        }
    }
    init(114514);
    for(int i=0;i<m;i++){
        for(int j=1;j<p[i].size();j++){
            unite(p[i][j],p[i][0]);
        }
    }
    if(size[find(0)]==n)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 7680
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val d = sc.nextInt()
    val x = (1..n).map { (1..d).map { sc.nextInt() } }
    val p = (1..200).map { it * it }.toHashSet()
    var ans = 0
    for (i in 0 until n) {
        for (j in i + 1 until n) {
            var sum = (0 until d).map { (x[i][it]-x[j][it])*(x[i][it]-x[j][it]) }.sum()
            if (p.contains(sum)) {
                ans++
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 29588
x, y = map(int, input().split())
l1= [1,3,5,7,8,10,12]
l2=[4,6,9,11]
l3=[2]
if x in l1 and y in l1:
    print('Yes')
elif x in l2 and y in l2 :
    print('Yes')
else :
    print('No')

Measured memory_bytes: 3060
"use strict";
    
const permutateWithRepetitions = (
  permutationOptions,
  permutationLength
) => {
  if (permutationLength === 1) {
    return permutationOptions.map(permutationOption => [permutationOption]);
  }

  // Init permutations array.
  const permutations = [];

  // Get smaller permutations.
  const smallerPermutations = permutateWithRepetitions(
    permutationOptions,
    permutationLength - 1
  );

  // Go through all options and join it to the smaller permutations.
  permutationOptions.forEach((currentOption) => {
    smallerPermutations.forEach((smallerPermutation) => {
      permutations.push([currentOption].concat(smallerPermutation));
    });
  });

  return permutations;
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const M = parseInt(arg[0].split(" ")[1]);
    
    const info = arg.slice(1, M + 1);
    const p = arg.slice(-1)[0].split(" ").map(n=>parseInt(n));
    
    const combos = permutateWithRepetitions([0, 1], N);
    let answer = 0;

    for(let i in combos) {
        let lightOn = 0;

        for(let j=0; j<M; j++) {
            let temp = info[j].split(" ").map(n=>parseInt(n));
            let k = temp[0];
            let s = temp.slice(1, k + 1);
            
            let cnt = 0;
            
            for(let k=0; k<s.length; k++) {
                if(combos[i][s[k] - 1] === 1) cnt++;
            }

            if(cnt % 2 === p[j]) {
                lightOn++;
            }
        }
        
        if(lightOn === M) {
            answer++;
        }
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
  ll n, m;
  cin >> n >> m;
  vector<ll> vec(m);
  ll sum = 0; 
  rep(i, m) {
    cin >> vec[i];
    sum += vec[i];
  }
  if (n - sum >= 0) cout << n - sum << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3676
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever while (true)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
using namespace std;
// clang-format on

template<typename InputIterator> constexpr std::string join(InputIterator first, InputIterator last, const std::string &sep) {
  if (first == last) return "";
  std::stringstream ss;
  ss << *(first++);
  for_each(first, last, [&](auto &x) { ss << sep << x; });
  return ss.str();
}

main {
  int n;
  cin >> n;
  vi a(n);
  cin >> a;
  cout << join(all(a), " ") << endl;
  loop(i, 1, n) {
    int v = a[i];
    int j = i - 1;
    while (j >= 0 && a[j] > v) {
      a[j + 1] = a[j];
      j--;
    }
    a[j + 1] = v;
    cout << join(all(a), " ") << endl;
  }
}

Measured memory_bytes: 3172
from collections import defaultdict


def solve(N, W, vs, ws):
    dp = [[0] * (W + 1) for _ in range(N + 1)]
    for i in range(N):
        v, w = vs[i], ws[i]
        for j in range(len(dp[0])):
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
            if j + w < len(dp[0]):
                dp[i + 1][j + w] = max(dp[i + 1][j + w], dp[i][j] + v)
    ans = 0
    for line in dp:
        ans = max(line)
    return ans


def main():
    N, W = map(int, input().split())
    vs, ws = [], []
    for _ in range(N):
        v, w = map(int, input().split())
        vs.append(v)
        ws.append(w)

    print(solve(N, W, vs, ws))

if __name__ == '__main__':
    main()

Measured memory_bytes: 44312
#include<iostream>
using namespace std;
int main(){
for(int x,y,i=0;  ; i++){
cin >> x >> y;
if(x==0 && y==0)break;
if(x>y) cout << y << " " << x <<endl;
else cout << x << " " << y <<endl;
}
return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
 
using namespace std;
 
#define x first
#define y second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
 
const ll MOD = 1e9+7;
const ll INF = 1e9+5;
const int MAXN = 500005;
 
int n, m, k;
int a, b, c, d, e, f;
string s, t, r;
char c1, c2, c3;
 
int A[MAXN];
int B[MAXN];
 
int main() {
	cin >>s>>t>>a>>b;
  	cin >>r;
  	if (r == s) a--;
  	else b--;
	cout <<a<<" "<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

W = [0] * N

for i in range(1, N):
    W[i] = A[i] - A[i - 1]
B = [0]
for w in W:
    if not w == 0:
        B.append(w)
l = len(B)
money = 1000
kabu = 0
value = A[0]
for i in range(l):
    value += B[i]
    if (i == l - 1) or (B[i] > 0 and B[i + 1] < 0):
        money += kabu * value
        kabu = 0
    elif (i == 0 and B[i + 1] > 0) or (B[i] < 0 and B[i + 1] > 0):
        n = money // value
        money -= n * value
        kabu += n

print(money)


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

int main()
{
	int n,m;
	map<string, int>mp;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		
		if (mp.count(s) != 0) {
			mp[s]++;
		}
		else {
			mp[s] = 1;
		}
		
	}

	cin >> m;
	for(int i = 0; i < m; i++)
	{
		string s;
		cin >> s;
		
		if (mp.count(s) != 0) {
			mp[s]--;
		}
		else {
			mp[s] = -1;
		}
	}
    int maxv = 0;
    for ( auto &x : mp ) {
        maxv = max(maxv, x.second);
    }
    cout << maxv << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
signed main(){
int a,b,c,d;
  cin>>a>>b;
  c=min(a,b);
  d=max(a,b);
  for(int i=0;i<d;i++){
	cout<<c;
  }
  cout<<"\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	long long T;
	while(~scanf("%lld", &T)) {
		int N;
		scanf("%d", &N);
		vector<pair<ll,ll>> v(N);
		rep(i, N) {
			long long s; long long t;
			scanf("%lld%lld", &s, &t);
			v[i] = { s,t };
		}
		ll ans = 0;
		rep(rev, 2) {
			ll sum = 0;
			int j = 0;
			rep(i, N) {
				ll R = v[i].first + T;
				for(; j < N && v[j].second <= R; ++ j)
					sum += v[j].second - v[j].first;
				ll t = sum;
				if(j < N && v[j].first < R)
					t += R - v[j].first;
				amax(ans, t);
				sum -= v[i].second - v[i].first;
			}
			rep(i, N)
				v[i] = { -v[i].second, -v[i].first };
			reverse(v.begin(), v.end());
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

using namespace std;

int main(){
	int n, c;
	cin >> n >> c;
	int v[n+1], w[n+1];
	for (int i = 1; i <= n; ++i)
	{
		cin >> w[i] >> v[i];
	}
	long long d[n+1][100001];
	for (int i = 0; i <= n; ++i)
	{
		for (int j = 1; j <= 100000; ++j)
		{
			d[i][j] = (1<<30);
		}
	}
	for (int i = 0; i <= n; ++i)
	{
		d[i][0] = 0;
	}
	int t = 0;
	for(int i = 1; i <= n; ++i){
		for(int j = 0; j < v[i]; ++j){
			d[i][j] = d[i-1][j];
		}
		for (int j = 0; j <= t; ++j)
		{
			d[i][j+v[i]] = min(d[i-1][j+v[i]], d[i-1][j] + w[i]); 
		}
		t += v[i];
	}
	int ans;
	for(int i = 0; i <= 100000; ++i){
		if(d[n][i] <= c) ans = i; 
	}
	cout << ans;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

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

  double R;
  cin >> R;

  double ans = 2.0 * R * M_PI;

  Decimal(ans);

  return 0;
};


Measured memory_bytes: 3800
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long n,k,j,d,a[200]={0},i,l,h,s=0;
    cin>>n>>k;
    for(i=1;i<=k;i++)
    {
        cin>>d;
        for(j=1;j<=d;j++)
        {
            cin>>l;
            a[l]=a[l]+1;
        }
    }
    for(h=1;h<=n;h++)
    {
        if(a[h]==0)
        {
            s++;
        }
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <algorithm>

using namespace std;

int n, a, b;
char str[123456];
int at = 0, bt = 0;
bool pass[123456];

int main()
{
	scanf("%d %d %d", &n, &a, &b);
	scanf("%s", str);
	fill(pass, pass + n, false);
	for (int i = 0; i < n; ++i)
	{
		switch (str[i])
		{
		case 'a':
			if (at + bt < a + b)
			{
				++at;
				pass[i] = true;
			}
			break;
		case 'b':
			if (at + bt < a + b && bt < b)
			{
				++bt;
				pass[i] = true;
			}
			break;
		case 'c':
			break;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		if (pass[i])
		{
			printf("Yes\n");
		}
		else
		{
			printf("No\n");
		}
	}
	return 0;
}



Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)

int main(){

  int n, m; cin>> n>> m;
  using i64=long long;
  vector<i64> x(n), y(n), z(n);
  rep(i, n) cin>> x[i]>> y[i]>> z[i];

  i64 mx=0;
  rep(bit, (1<<3)){
    int o1=(bit&1) ? 1 : -1,
        o2=(bit&2) ? 1 : -1,
        o3=(bit&4) ? 1 : -1;
    vector<i64> arr;
    rep(i, n) arr.push_back(x[i]*o1+y[i]*o2+z[i]*o3);
    sort(arr.rbegin(), arr.rend());
    i64 sum=0;
    rep(i, m) sum+=arr[i];
    mx=max(mx, sum);
  }

  cout<< mx<< endl;

  return 0;
}

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

int main() {
	string s; cin>>s;
	bool flag = false;
	for(int i =0; i<s.size()-1 && flag ==false; i++){
		if(s[i] == s[i+1]){
			flag = true;
		}
	}
	if(flag)cout<<"Bad"<<endl;
	else cout<<"Good"<<endl;
	return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

const int INF = 1001001001;

vector<int> to[1005];
int n;

vector<int> bfs(int sv) {
    vector<int> dist(n, INF), pre(n, -1);

    queue<int> q;
    dist[sv] = 0;
    q.push(sv);

    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int u : to[v]) {
            if (dist[u] != INF) continue;
            pre[u] = v;
            dist[u] = dist[v] + 1;
            q.push(u);
        }
    }

    pair<int, int> best(INF, -1);

    rep(v, n) {
        if (v == sv) continue;
        for (int u : to[v]) {
            if (u == sv) {
                best = min(best, make_pair(dist[v], v));
            }
        }
    }

    if(best.first == INF) return vector<int>(n+1);

    int v = best.second;
    vector<int>res;
    while(v != -1) {
        res.push_back(v);
        v = pre[v];
    }
    return res;
}

int main() {

    int m;
    cin >> n >> m;

    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;

        to[a].push_back(b);
    }

    vector<int> ans(n + 1);
    rep(s, n) {
        vector<int> now = bfs(s);
        if (now.size() < ans.size()) ans = now;
    }

    if (ans.size() == n + 1) {
        cout << -1 << endl;
        return 0;
    }

    cout << ans.size() << endl;
    for (int v : ans) {
        cout << v + 1 << endl;
    }
}


Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (n); ++i)
template <typename T>
struct BIT
{
    int n;            // 要素数
    vector<T> bit[2]; // データの格納先
    BIT(int n_) { init(n_); }
    void init(int n_)
    {
        n = n_ + 1;
        for (int p = 0; p < 2; p++)
            bit[p].assign(n, 0);
    }
    void add_sub(int p, int i, T x)
    {
        for (int idx = i; idx < n; idx += (idx & -idx))
        {
            bit[p][idx] += x;
        }
    }
    void add(int l, int r, T x)
    { // [l,r) に加算
        add_sub(0, l, -x * (l - 1));
        add_sub(0, r, x * (r - 1));
        add_sub(1, l, x);
        add_sub(1, r, -x);
    }
    T sum_sub(int p, int i)
    {
        T s(0);
        for (int idx = i; idx > 0; idx -= (idx & -idx))
        {
            s += bit[p][idx];
        }
        return s;
    }
    T sum(int i) { return sum_sub(0, i) + sum_sub(1, i) * i; }
};

ll inf = (1 << 30);
int main()
{
    int n;
    ll D, A;
    cin >> n >> D >> A;
    ll x,h;
    pair<ll, ll> xh[n + 1];
    rep(i, n)
    {
        cin >> x >> h;
        xh[i] = make_pair(x, h);
    }
    xh[n] = make_pair(inf, 0);
    sort(xh, xh + n + 1);
    // rep(i,n){
    //     cout << xh[i+1].first << " "<<xh[i+1].second << endl;
    // }
    // cout << inf << endl;

    BIT<ll> bit(n);
    rep(i, n)
    {
        bit.add(i + 1, i + 2, xh[i].second);
    }
    // bit.add(2, 4, -4);
    // rep(i,n){
    //     int now_hp = bit.sum(i + 1) - bit.sum(i);
    //     printf("%dは %d hp ある\n", i, now_hp);
    // }
    // printf("----\n");
    ll ans = 0;
    rep(i, n)
    {
        ll now_hp = bit.sum(i + 1) - bit.sum(i);
        if (now_hp <= 0)
            continue;
        x = xh[i].first;
        pair<ll, ll>  *x_2d = upper_bound(xh, xh + n + 1, make_pair(x + 2 * D, inf));
        // P *x_2d = upper_bound(xh, xh + n + 1, make_pair(x + 2*D, INF));
        ll next_idx = x_2d - xh;
        ll count = (A + (now_hp - 1)) / A;
        ans += count;
        ll damage = count * A;
        // printf("%dは %d hp ある\n", i+1, now_hp);
        // printf("[%d から　%d) に %d回 %dダメージ\n", i+1, next_idx+1, (a+(now_hp - 1))/a, damage);
        bit.add(i + 1, next_idx + 1, -damage);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 9544
/*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        long int temp_a = a;
        long int temp_b = b;
        while(1){
            long int l = max(temp_a,temp_b);
            long int r = min(temp_a,temp_b);
            
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                l = l-r;
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(){
    vector<vector<int> > a(3,vector<int>(3));
    int n;
    rep(i,3){
        rep(j,3){
            cin >> a[i][j];
        }
    }
    /*rep(i,3){
        rep(j,3){
            cout << a[i][j] << " ";
        }
        cout << endl;
    }*/
    cin >> n;
    vi(b,n);
    rep(i,n) cin >> b[i];
    //cout << b[0] << " " << b[n-1] << endl;
    vector<vector<bool> > ch(3,vector<bool>(3));
    rep(i,3){
        rep(j,3){
            ch[i][j] = 0;
        }
    }
    rep(i,n){
        rep(j,3){
            rep(k,3){
                if(a[j][k] == b[i]){
                    ch[j][k] = 1;
                    //cout << "A[" << j + 1 << "][" << k + 1 << "]" << endl;
                    //cout << ch[j][k] << endl;
                }
 
            }
        }
    }
    //cout << ch[0][0] << endl;
    //if(ch[0][0] /*&& ch[0][1] && ch[0][2]*/) cout << "hoge" << endl;
    if((ch[0][0] && ch[0][1] && ch[0][2]) || (ch[1][0] && ch[1][1] && ch[1][2]) || (ch[2][0] && ch[2][1] && ch[2][2]) || (ch[0][0] && ch[1][0] && ch[2][0]) || (ch[0][1] && ch[1][1] && ch[2][1]) || (ch[0][2] && ch[1][2] && ch[2][2]) || (ch[0][0] && ch[1][1] && ch[2][2]) || (ch[0][2] && ch[1][1] && ch[2][0])){
            cout << "Yes" << endl;
        }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n,y=map(int,input().split())
y//=1000
c=-1
d=-1
e=-1
for a in range(2001):
  for b in range(2001):
    if 9*a+4*b+n==y and n-a-b>=0:
      c=a
      d=b
      e=n-a-b
      break
print(c,d,e)



Measured memory_bytes: 3064
/*input
3
abcxyx
cyx
abc

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

const int N = 26; // changable

struct Trie {
	Trie* child[N];
	int endVal;
	Trie(){
		for(int i = 0; i < N; i++){
			child[i] = NULL;
		}
		endVal = 0;
	}
	~Trie(){
		for(int i = 0; i < N;i ++){
			delete child[i];
		}
	}
} *root = new Trie();

void add(string s){
	Trie* cur = root;
	for(int i = 0; i < s.length(); i++){
		int j = s[i] - 'a';
		if(cur -> child[j] == NULL){
			cur -> child[j] = new Trie();
		}
		cur = cur -> child[j];
	}
	cur -> endVal ++;
}

int search(string s){
	Trie* cur = root;
	for(int i = 0; i < s.length(); i++){
		int j = s[i] - 'a';
		if(cur -> child[j] == NULL) return 0;
		cur = cur -> child[j];
	}
	if(cur == NULL) return 0;
	else return cur -> endVal;
}

long long res(string s){
    Trie* cur = root;
    vector<int> cnt(N, 0);
    long long ans = 0;
    for(int i = 0; i < s.length();i ++){
         cnt[s[i] - 'a'] ++;
    }
    for(int i = 0; i < s.length(); i++){
        for(int k = 'a'; k <= 'z'; k++){
            int jk = k - 'a';
            if(cnt[jk] > 0 && cur->child[jk] != NULL) ans += cur->child[jk]->endVal;
        }
        int j = s[i] - 'a';
        cnt[j] --;
        if(cur->child[j] == NULL) return ans;
        cur = cur->child[j];
    }
    return ans;
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> s(n);
	for(int i = 0; i < n; i++){
		cin >> s[i];
		reverse(s[i].begin(), s[i].end());
		#ifdef DEBUG
		cout << s[i] << endl;
		#endif
		add(s[i]);
	}
	long long ans = 0;
	for(int i = 0; i < n; i++){
        ans += res(s[i]);
	}
	cout << ans - n;
}


Measured memory_bytes: 223132
#include<iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include <functional>
using namespace std;

int main(void) {
	int N = 0;
	int V[50] = { 0 }, C[50] = { 0 }, ans = 0;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> V[i];
	}
	for (int i = 0;i < N;i++) {
		cin >> C[i];
	}
	for (int i = 0;i < N;i++) {
		if (V[i] - C[i] >= 0)
			ans += V[i] - C[i];
	}
	cout <<ans << endl;
	return 0;
}

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

void solve(int N, vector<string> S)
{
    vector<int> C(4);
    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == "AC")
            C.at(0)++;
        else if (S.at(i) == "WA")
            C.at(1)++;
        else if (S.at(i) == "TLE")
            C.at(2)++;
        else
            C.at(3)++;
    }
    cout << "AC x " << C.at(0) << endl;
    cout << "WA x " << C.at(1) << endl;
    cout << "TLE x " << C.at(2) << endl;
    cout << "RE x " << C.at(3) << endl;
}

int main()
{
    int N;
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++)
    {
        cin >> S.at(i);
    }
    solve(N, move(S));
    return 0;
}


Measured memory_bytes: 6344
H, W, K = map(int, input().split())
C = [input() for _ in range(H)]

ans = 0
for bit in range(1 << H):
    drow = []
    for i in range(H):
        if (bit >> i) % 2 == 1:
            drow.append(i)
    for bit2 in range(1 << W):
        dcol = []
        for j in range(W):
            if (bit2 >> j) % 2 == 1:
                dcol.append(j)
        b = 0
        for y in range(H):
            for x in range(W):
                if y in drow:
                    continue
                if x in dcol:
                    continue
                if C[y][x] == "#":
                    b += 1
        if b == K:
            ans += 1
print(ans)

Measured memory_bytes: 8952
/*
 * Created by KeigoOgawa
 */


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <cmath>

#define INF (int)1e8
#define EPS 1e-10
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define RFOR(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)
#define debug(x) cerr << #x << ": " << x << endl
#define all(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> PII;

// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len - 1) s << "\t";
    }
    return s;
}

// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
    int len = vv.size();
    for (int i = 0; i < len; ++i) {
        s << vv[i] << endl;
    }
    return s;
}


int N;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<vector<int>> a;
    vector<vector<int>> dp(2);
    cin >> N;
    a.resize(2);
    dp.resize(2);
    REP(i, N) {
      int t;
      cin >> t;
      a[0].push_back(t);
    }
    REP(i, N) {
      int t;
      cin >> t;
      a[1].push_back(t);
    }

    dp[0].resize(a[0].size()+1);
    dp[1].resize(a[1].size()+1);
    dp[0][0] = a[0][0];
    FOR(i, 1, N) {
      dp[0][i] = dp[0][i-1] + a[0][i];
    }
    dp[1][0] = a[0][0] + a[1][0];
    FOR(i, 1, N) {
      dp[1][i] = max(dp[1][i-1] + a[1][i], dp[0][i] + a[1][i]);
    }

    cout << dp[1][N-1] << endl;


    return 0;
}


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

int main() {
	int n, k, s;
	cin >> n >> k >> s;
	for (int i = 0; i < k; i++) {
		cout << s << ' ';
	}
	if (s == 1e9) {
		s--;
	} else {
		s++;
	}
	for (int i = k; i < n; i++) {
		cout << s << ' ';
	}
	cout << endl;

	return 0;
}



Measured memory_bytes: 1280
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
map<size_t, int> words;

int main(){
	string S;
	int N;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> S;
		sort(S.begin(), S.end());
		words[hash<string>()(S)]++;
	}

	ll count = 0;
	auto end = words.end();
	for (auto itr = words.begin(); itr != end; itr++) {
		if (itr->second > 1){
			count += (ll)itr->second * (itr->second-1) / 2;
		}
	}

	cout << count << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, x, d;
    scanf("%d %d %d", &n, &x, &d);
    if (d == 0) {
        if (x == 0) {
            return printf("1"), 0;
        }
        return printf("%d", n + 1), 0;
    }
    ll res = 0;
    map <int, vector <pair <ll, ll> > > mp;
    for (int i = 0; i <= n; i++) {
        ll mn = (ll)i * x + (ll)i * (i - 1) / 2 * d;
        ll mx = (ll)i * x + (ll)i * (n + n - i - 1) / 2 * d;
        if (mn > mx) swap(mn, mx);
        mp[((mn%abs(d))+abs(d))%abs(d)].pb({mn, mx});
    }
    for (auto x : mp) {
        sort(mp[x.fi].begin(), mp[x.fi].end());
    }
    for (auto x : mp) {
        /*printf("%d: ", x.fi);
        for (auto y : x.se) {
            printf("%lld %lld\n", y.fi, y.se);
        }*/
        ll hold = -9e18, mx = hold, mn;
        for (auto y : x.se) {
            if (mx == hold) {
                mn = y.fi;
                mx = y.se;
                continue;
            }
            if (y.fi > mx) {
                res += (mx - mn) / abs(d) + 1;
                mn = y.fi;
                mx = y.se;
            } else {
                mx = max(mx, y.se);
            }
        }
        res += (mx - mn) / abs(d) + 1;
    }
    printf("%lld", res);
    return 0;
}
/*
8 6 -4
16 8 -4
17 10 -3
199993 97973447 -20
199954 -78743456 4
199943 -40 8
2 3 -3
*/


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


int main() {
  long long int X;
  long long int K;
  long long int D;
  
cin >> X >> K >> D;
  X=abs(X);
  if(log(K)+log(D)<log(X)){
    cout <<abs(X-K*D);
  }
  else{
    if((X/D)%2==K%2){
      cout <<X%D;
    }
    else{
      cout <<D-X%D;
    }
  }
}

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

ll numxor(ll n){
  if(n%2){
    return ((n+1)/2)%2?1:0;
  }else{
    return n^((n/2)%2?1:0);
  }
}
int main(){
  ll a,b;cin>>a>>b;
  ll ans = numxor(a-1)^numxor(b);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool pal(string str,int s,int e)
{
    int i=s,j=e;
    while(i<e)
    {
        if(str[i]!=str[j])
        return false;
        i++;
        j--;
    }
    return true;
}
int main() {
   string s;
   cin>>s;
   int len=s.length();
   int s1=(len-1)/2;
   int s2=(len+3)/2;
   if(pal(s,0,s1-1)&&pal(s,0,len-1)&&pal(s,s2-1,len-1))
   cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}


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

int main(){

  string s, k;
  int count = 0;
  
  cin >> s >> k;
  for(int i; i < s.size(); i++){
    if(s[i] != k[i]){
      count++;
    }
  }
  
  cout << count << endl;
  return 0;

}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
const int N=1e2+10;

int  a[N];

int main()
{
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)
		for(int j=i+1;j<n;j++)
		for(int k=j+1;k<n;k++)
	{
		if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
		{
			if(a[i]>a[j]&&a[i]>a[k])
			{
				if(a[j]+a[k]>a[i])ans++;
			}
			else if(a[j]>a[i]&&a[j]>a[k])
			{
				if(a[i]+a[k]>a[j])ans++;
			}
			else if(a[k]>a[i]&&a[k]>a[j])
			{
				if(a[j]+a[i]>a[k])ans++;
			}

		}
	}
	cout<<ans<<endl;
	return 0;
}

//多写注释 理清思路 理解题意 think twice





Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
#define LL long long
int main(){
    LL k,if_kin,ans;
    cin >> k >> if_kin ;
    ans = k * 500;
    if(ans >= if_kin) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const int MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return min;
	}
	if (val > max) {
		return max;
	}
	return val;
}
template<class T,class T1>
bool array_find(const T& array, const T1& dst) {
	auto result = find(array.first(), array.end(), dst);
	if (result == array.end()) {
		return false;
	}
	else {
		return true;
	}
}

int main() {
	string str;
	cin >> str;
	int ans = 0;
	REP(i, str.size()/2) {
		if (str[str.size() - i - 1] != str[i])
			ans++;
	}
	cout << ans << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


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


namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] str2 = Console.ReadLine().Split(' ');
            int n = int.Parse(str);
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(str2[i]);
            }
            for (int i = n; i > 0; i--)
            {
                Console.Write(a[i-1]);
                if (i == 1)
                {
                    break;
                }
                Console.Write(" ");
            }
            Console.WriteLine("");
        }
    }
}

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
pair<string,int> pa[2];
string u;
int main() 
{
  cin>>pa[0].first>>pa[1].first;
  cin>>pa[0].second>>pa[1].second;
  cin>>u;
  if(u==pa[0].first){cout<<pa[0].second-1<<" "<<pa[1].second;}
  if(u==pa[1].first){cout<<pa[0].second<<" "<<pa[1].second-1;}

}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }

int main() {
	string s;
	stack<int> st;
	int a, b;
	while (cin >> s) {
		if (s == "+") {
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(a + b);
		}
		else if (s == "-") {
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(b - a);
		}
		else if (s == "*") {
			a = st.top();
			st.pop();
			b = st.top();
			st.pop();
			st.push(a * b);
		}
		else {
			st.push(stoi(s));
		}
	}

	cout << st.top() << endl;

	return 0;
}

Measured memory_bytes: 3176
n = gets.to_i

m = Array.new(n){ Array.new(n, 0) }

n.times do
	line = gets.split.map &:to_i
	u, k = line.shift, line.shift
	u -= 1
	k.times do
		v = line.shift
		v -= 1
		m[u][v] = 1
	end
end

n.times do |i|
	n.times do |j|
		print " " if j != 0
		print m[i][j]
	end
	puts
end

Measured memory_bytes: 8884