akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

int main(void) {
    string N;
    cin >> N;
    int L = N.size();
    vector<vector<int>> dp(L + 1, vector<int>(2, 0));
    dp[0][1] = 1;
    // dp[i][0] = 上から i 桁についてぴったり払うときの最小枚数
    // dp[i][1] = 上から i 桁について 1 多く払うときの最小枚数
    repr(i, 1, L + 1) {
        int d = N[i - 1] - '0'; // i 桁目の数字
        dp[i][0] = min(dp[i - 1][0] + d, dp[i - 1][1] + 10 - d);
        dp[i][1] = min(dp[i - 1][0] + d + 1, dp[i - 1][1] + 9 - d);
    }
    cout << dp[L][0] << endl;

    return 0;
}

Measured memory_bytes: 55940
#include "bits/stdc++.h"
using namespace std;

int main() {
	
	long long n, k;
	cin >> n >> k;
	long long arr[n];
	for (int i=0; i<n; i++) cin >> arr[i];
	long long sm = 0;
	sort(arr, arr+n);
	for (int i=0; i<n-k; i++) sm += arr[i];
	cout << sm << endl;
	
}


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

int main() {
    string S;
    long long K;
    cin >> S >> K;

    vector<int> len;
    int cnt = 1;
    if(S.size() == 1) len.push_back(1);
    for(int i=1; i<S.size(); ++i) {
        if(S[i] == S[i - 1]) ++cnt;
        if(S[i] != S[i - 1] || i + 1 == S.size()) {
            len.push_back(cnt);
            cnt = 1;
        }
    }

    if(len.size() && len[0] == S.size()) {
        cout << K * S.size() / 2 << endl;
        return 0;
    }

    long long res = 0;
    for(int n : len) res += n / 2;
    if(S[0] != S[S.size() - 1]) cout << res * K << endl;
    else cout << res * K - (*begin(len) / 2 + *rbegin(len) / 2 - (*begin(len) + *rbegin(len)) / 2) * (K - 1) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
//#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
template<class T> inline bool chmax(T & x, T const & y){ return x<y ? x=y,true : false; }
template<class T> inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif
// ll const mod = 1000000007;
// ll const inf = 1LL<<60;

struct Trie {
    int val;
    Trie * ch[26];
    Trie() : val(0) {}
    ~Trie(){
        for(auto & p : ch) delete p;
    }
};

void insert(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s=='\0'){
            cur->val++;
            break;
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) nxt = new Trie();
            cur = nxt;
            s++;
        }
    }
}

bool erase(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s == '\0'){
            cur->val--;
            return true;
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) return false;
            cur = nxt;
            s++;
        }
    }
}

bool find(char * s, Trie * t){
    Trie * cur = t;
    while(1){
        if(*s == '\0'){
            return cur->val > 0;
        } else {
            Trie * &nxt = cur->ch[*s-'A'];
            if(nxt == nullptr) return false;
            cur = nxt;
            s++;
        }
    }
}

int main(){
    int n;
    cin >> n;
    Trie * root = new Trie();
    rep(i,n){
        char com[15], str[15];
        cin >> com >> str;
        if(com[0] == 'i'){
            insert(str,root);
        } else {
            puts(find(str,root) ? "yes" : "no");
        }
    }
    delete root;
}

Measured memory_bytes: 77236
using System;
using System.Collections.Generic;
namespace ITP1_3_C
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }

            return list_temp;
        }



        public static void Main (string[] args)
        {
            List<string[]> arr_result = new List<string[]>();
            arr_result = getinputdata ();

            for (int i = 0; i < (arr_result.Count)-1; i++)
            {
                if (int.Parse(arr_result[i][0]) <  int.Parse(arr_result[i][1]))
                {
                    Console.WriteLine(arr_result[i][0] + " " + arr_result[i][1]);
                }else{
                    Console.WriteLine(arr_result[i][1] + " " + arr_result[i][0]);

                }
            }



        }
    }
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
#define str(n) to_string(n)
#define int(w) stoi(w)
#define len(l) l.size()
#define append(l,i) l.push_back(i)
int main() {
    int n;
    cin>>n;
    vector<pair<int,int>> l;
    int b=1;
    int mod=pow(10,9)+7;
    if (n%2==1){
        rep(i,n/2+1){
          pair<int,int> d(i*2,0);
            append(l,d);
        }
        int n1;
        rep(i,n){
            cin>>n1;
            if (n1%2==1 || n1>n){
                b=0;
                break;
            }
            else{
                l.at(n1/2).second+=1;
            }
            
        }
        if (l.at(0).second!=1){
            b=0;
        }
        rep(i,n/2){
            if (l.at(i+1).second!=2){
                b=0;
                break;
            }
        }

    }
    else{
        rep(i,n/2){
          pair<int,int> d(i*2+1,0);
            append(l,d);
        }
        int n1;
        rep(i,n){
            cin>>n1;
            if (n1%2==0 || n1>n){
                b=0;
                break;
            }
            else{
                l.at(n1/2).second+=1;
            }
            
        }
        rep(i,n/2){
            if (l.at(i).second!=2){
                b=0;
                break;
            }
        }

    }
    if (b==1){
        long ans=1;
        rep(i,n/2){
            ans*=2;
            ans%=mod;
        }
        cout<<ans<<endl;
    }
    else{
        cout<<0<<endl;
    }

    return 0;
}


Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		/*
		 * Scannerで値取得。
		 */
		Scanner sc = new Scanner(System.in);

		//値を取得
		int nNum = sc.nextInt();
		int mNum = sc.nextInt();

		//nとmで組み合わせ計算する
		//nの場合
		int nRes = 0;
		int mRes = 0;

		if (nNum > 1) {
			nRes = CalcCombi(nNum);
		}

		if (mNum > 1) {
			mRes = CalcCombi(mNum);
		}

		//結果を足す
		System.out.println(nRes + mRes);
	}

	private static int CalcCombi(int num) {

		return (num * (num - 1) / 2);
	}
}


Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        System.out.println(Math.min(c,b/a));
        sc.close();
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <stdint.h>
#include <string>

using namespace std;
#define SIZE 26
static bool chars[SIZE];

int32_t main()
{
  string str;
  cin >> str;

  for (uint32_t i = 0; i < str.size(); i++) {
    chars[(int)str[i] - 'a'] = true;
  }

  for (uint32_t i = 0; i < SIZE; i++) {
    if (!chars[i]) {
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int h, w; cin >> h >> w;
    string a = "";
    rep(i, w+2) a += "#";
    cout << a << endl;
    rep(i, h) {
        string s;
        cin >> s;
        cout << "#" << s << "#" << endl;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long ,long long>pll;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}
ll lcm(ll a, ll b) {return ((a*b)/gcd(a,b));}
bool cmp(int a,int b){return a>b;}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

unsigned long long modpow(unsigned long long n, unsigned long long k, unsigned long long mod)
{
if (k == 0) return 1;
long long r = modpow(n * n % mod, k >> 1, mod);
if (k & 1) r = r * n % mod;
return r;
}

void solve(){
     int n,m;cin >> n >> m;
     vector<string>s(n);
     vector<vector<ll>>dp(n,vector<ll>(m,0));
     for(int i = 0;i<n;i++) cin >> s[i];
     for(int i = 0;i<m;i++) {
        if(s[0][i]=='#') break;
        dp[0][i] = 1;
     }
     for(int i = 0;i<n;i++){
        if(s[i][0]=='#') break;
        dp[i][0] = 1;
     }
     for(int i = 1;i<n;i++){
        for(int j = 1;j<m;j++){
            if(s[i][j]=='#') dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j]+dp[i][j-1]+mod)%mod;
        }
     }
     cout << dp[n-1][m-1];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll ans=0,n;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>arr[i];
        sort(arr,arr+n);
    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            for(int k=j+1; k<n; k++)
            {
                if((arr[i]<(arr[j]+arr[k])) && (arr[j]<(arr[i]+arr[k]))  && (arr[k]<(arr[j]+arr[i])) && arr[i]!=arr[j] && arr[j]!=arr[k] && arr[i]!=arr[k])
                         ans++;
            }
    }
}
cout<<ans<<endl;

return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<iostream>
#define int long long
using namespace std;
int n;
int num=0;
bool judge(int a)
{
    bool have[3];
    memset(have,false,sizeof(have));
    while(a)
    {
        int temp=a%10;
        if(temp==3)
            have[0]=true;
        if(temp==5)
            have[1]=true;
        if(temp==7)
            have[2]=true;
        a/=10;
    }
    if(have[0]&&have[1]&&have[2])
        return true;
    return false;
}
void dfs(int a)
{
    if(a<=n&&judge(a))
    {
        num++;
        //printf("%d\n",a);
    }
    else if(a>n)
        return ;
    dfs(a*10+3);
    dfs(a*10+5);
    dfs(a*10+7);
}
signed main()
{
    scanf("%lld",&n);
    dfs(3);
    dfs(5);
    dfs(7);
    printf("%lld\n",num);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int partsum[105][26];
int main(){
    int N; string s;
    cin>>N>>s;
    int ans=-1;
    for(int i=0;i<N;i++)
    {
        int cnt2=0;
        bool chk1[26]={0},chk2[26]={0};
        for(int j=0;j<=i;j++)
        {
            chk1[s[j]-'a']=true;
        }
        for(int j=i+1;j<N;j++)
        {
            chk2[s[j]-'a']=true;
        }
        for(int j=0;j<26;j++)
        {
            if(chk1[j]==true && chk2[j]==true) cnt2++;
        }
        ans=max(cnt2,ans);
    }
    printf("%d",ans);
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
	int n;
	cin >> n;
	vector<string> s;
	bool ok = true;
	for (int i = 0; i < n; i++)
	{
		string ss;
		cin >> ss;
		s.push_back(ss);
	}
	for (int i = 0; i < n; i++)
	{
		if (i > 0)
		{
			if (s[i - 1][s[i - 1].length() - 1] != s[i][0])
			{
				ok = false;
				break;
			}
		}
	}
    
    for(int i = 0; i < n; i++)
    {
        if(ok==false) break;
        for(int j = 0; j < i; j++)
        {
            if(s[i]==s[j])
            {
                ok = false;
                break;
            }
        }
        
    }
    

	if (ok)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
3 2
acp
ae
)");
#define cin input
#endif
  
int main()
{
	int a, b;
	cin >> a >> b;

    cout << 40 << ' ' << 100 << endl;

    REP (i, 20)
    {
        REP (j, 100)
            cout << (i > 0 && j % 3 == i % 2 + 1 && --a > 0 ? '.' : '#');
        cout << endl;
    }

    REP (i, 20)
    {
        REP (j, 100)
            cout << (i > 0 && j % 3 == i % 2 + 1 && --b > 0 ? '#' : '.');
        cout << endl;
    }

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
    int A[3][3];
    int open[3][3];
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            cin >> A[i][j];
            open[i][j] = 0;
        }
    }

    int N;
    cin >> N;
    for (int i=0; i<N; i++) {
        int b;
        cin >> b;
        for (int u=0; u<3; u++) {
            for (int v=0; v<3; v++) {
                if (A[u][v] == b) open[u][v] = 1;
            }
        }
    }

    for (int row=0; row<3; row++) {
        if ((open[row][0] & open[row][1] & open[row][2]) ||
            (open[0][row] & open[1][row] & open[2][row])) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if ((open[0][0] & open[1][1] & open[2][2]) ||
        (open[2][0] & open[1][1] & open[0][2])) {
            cout << "Yes" << endl;
            return 0;
    }

    cout << "No" << endl;
    
    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = sum(a)

for i in range(len(b)):
  a[i] -= b[i]
  if(a[i] < 0):
    num = a[i] * (-1)
    a[i + 1] -= num
    a[i] = 0
    if(a[i + 1] < 0):
      a[i + 1] = 0

print(s - sum(a))  


Measured memory_bytes: 18476
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    long long a[3];
    cin>>a[0]>>a[1]>>a[2];
    if(a[0]%2==0 || a[1]%2==0 || a[2]%2==0){
        cout<<0<<endl;
        return 0;
    }
    sort(a,a+3);
    cout<<a[0]*a[1];
 
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const long long mod = 1e9 + 7;

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

ll powMod(ll n, ll k, ll m) {
	if (k == 0) {
		return 1;
	} else if (k % 2 == 1) {
		return powMod(n, k - 1, m) * n % m;
	} else {
		ll t = powMod(n, k / 2, m);
		return t * t % m;
	}
}

int main() {
	ll s, w;
	cin >> s >> w;

	if (s <= w) {
		cout << "unsafe" << endl;
	} else {
		cout << "safe" << endl;
	}
}


Measured memory_bytes: 3636
import math
N=int(input())
ans=[0 for i in range(N)]

nax=int(math.sqrt(N))

for x in range(1,nax):
    for y in range(1,x+1):
        for z in range(1,y+1):
            temp=x**2+y**2+z**2+x*y+y*z+z*x
            if temp<=N:
                if x==y and y!=z:
                    ans[temp-1]+=3
                elif y==z and z!=x:
                    ans[temp-1]+=3
                elif z==x and x!=y:
                    ans[temp-1]+=3
                elif x==y==z:
                    ans[temp-1]+=1
                elif x!=y and y!=z and z!=x:
                    ans[temp-1]+=6

                
                
for anss in ans:
    print(anss)


Measured memory_bytes: 9272
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	long long H, W, N;
	cin >> H >> W >> N;

	long long offset[9][2];
	auto tempOfs = 0;
	for (auto i = 0; i <= 2; ++i)
	{
		for (auto j = 0; j <= 2; ++j)
		{
			offset[tempOfs][0] = -i;
			offset[tempOfs][1] = -j;
			++tempOfs;
		}
	}

	map<unsigned long long, unsigned long long> m;
	for (auto i = 0; i < N; ++i)
	{
		long long a, b;
		cin >> a >> b;
		--a;
		--b;

		for (auto index = 0; index < 9; ++index)
		{
			auto startX = b + offset[index][1];
			auto startY = a + offset[index][0];

			if (startX < 0 || startX > W - 3 || startY < 0 || startY > H - 3)
			{
				continue;
			}

			auto temp = startY * W + startX;
			auto it = m.find(temp);
			if (it == m.end())
			{
				m[temp] = 1;
			}
			else
			{
				++(it->second);
			}
		}
	}

	long long count[10];
	memset(count, 0, sizeof(count));

	count[0] = (H - 2) * (W - 2) - m.size();
	for (auto it : m)
	{
		++count[it.second];
	}

	for (auto i = 0; i < 10; ++i)
	{
		cout << count[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 56448
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n; cin >> n;
  VI a(n); for (int i = 0; i < n; i++) cin >> a[i];

  map<int, int> mp;
  int t = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] <= t) continue;
    mp[i] = t = a[i];
  }
  
  sort(a.begin(), a.end());
  vector<lint> c(n + 1);
  for (int i = n - 1; i >= 0; i--) {
    c[i] = c[i + 1] + a[i];
  }
  auto lsum = [&](lint b) {
    int i = upper_bound(a.begin(), a.end(), b) - a.begin();
    return c[i] - b * (n - i);
  };

  t = 0;
  for (int i = 0; i < n; i++) {
    if (mp.count(i)) {
      cout << lsum(t) - lsum(mp[i]) << '\n';
      t = mp[i];
    } else {
      cout << 0 << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 6912
#include<stdio.h>
int main(){
    int a, b;
    scanf("%d %d", &a, &b);
    if(a>b){
        printf("a > b\n");
    }else if(a<b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2120
#include<bits/stdc++.h>
    using namespace std;
    # define LL long long
    # define int long long
    #define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    # define mo 998244353
    # define pi acos(-1)
    //vector<pair<int,int>> v;
    //int x0=INT_MAX,y0=INT_MAX;
    /*int crossprod(pair<int,int> a,pair<int,int> b,pair<int,int> c)
    {
        int x1 = a.first-b.first;
        int x2 = a.first-c.first;
        int y1 = a.second-b.second;
        int y2 = a.second-c.second;
        return x1*y2 - y1*x2;
    }
    int direction(pair<int,int> a,pair<int,int> b,pair<int,int> c) {
       int val = (b.y-a.y)*(c.x-b.x)-(b.x-a.x)*(c.y-b.y);
       if (val == 0)
          return 0;     //colinear
       else if(val < 0)
          return 2;    //anti-clockwise direction
          return 1;    //clockwise direction
    }*/
   const int N = 3005;
const int MOD = 998244353;

int n, s;
int a[N], cache[N][N];

int dp(int idx, int s)
{
	if(s == 0)
		return (n - idx + 2);
	if(s < 0)
		return 0;
	if(idx > n)
		return 0;
	int &ans = cache[idx][s];
	if(ans != -1)
		return ans;
	ans = dp(idx + 1, s) + dp(idx + 1, s - a[idx]);
	ans %= MOD;
	return ans;
}

signed main()
{
//	IOS;
gok
	memset(cache, -1, sizeof(cache));
	cin >> n >> s;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	int ans = 0;
	dp(1,s);
	for(int i = 1; i <= n; i++){
		//ans += dp(i, s);
	  ans += cache[i][s];
	}
	ans %= MOD;
	cout << ans;
	return 0;
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 10007;
const int MOD = 998244353;

int n;
char sa[MAXN], sb[MAXN];
int dp[MAXN][MAXN];
LL frac[MAXN], rf[MAXN];

void init ();
void input ();
void work ();

int add ( int x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
	return x;
}

void addv ( int &x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
}

int dec ( int x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
	return x;
}

void decv ( int &x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
}

int qpow ( int a, int b )
{
	LL base = a, ans = 1;
	while ( b ){
		if ( b & 1 ) ( ans *= base ) %= MOD;
		( base *= base ) %= MOD;
		b >>= 1;
	}
	return SC ( int, ans );
}

int C ( int n, int m )
{
	return SC ( int, frac[n] * rf[m] % MOD * rf[n-m] % MOD );
}



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
	
	frac[0] = 1;
	lp ( i, 1, MAXN ) frac[i] = frac[i-1] * i % MOD;
	rf[MAXN-1] = qpow ( frac[MAXN-1], MOD-2 );
	lpdi ( i, MAXN-2, 0 ) rf[i] = rf[i+1] * ( i + 1 ) % MOD;
}

void input ()
{
	// input method
	
	scanf ( "%s%s", sa, sb );
}

void work ()
{
	// main work
	
	n = strlen ( sa );
	
	int c0 = 0, c1 = 0;
	lp ( i, 0, n ){
		if ( sa[i] == '1' ){
			if ( sb[i] == '0' ) ++c0;
			else ++c1;
		}
	}
	
	dp[0][0] = 1;
	lpi ( i, 0, c1 ){
		lpi ( j, 0, c0 ){
			addv ( dp[i+1][j], dp[i][j] * SC ( LL, i + 1 ) * j % MOD );
			addv ( dp[i][j+1], dp[i][j] * ( SC ( LL, j + 1 ) * ( j + 1 ) ) % MOD );
		}
	}
	
	int ans = 0;
	lpi ( i, 0, c1 ) addv ( ans, frac[i] * frac[i] % MOD * dp[c1-i][c0] % MOD * C ( c1, i ) % MOD * C ( c1 + c0, i ) % MOD );
	
	cout << ans << endl;
}

Measured memory_bytes: 389760
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
const ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<ll> a(N),b(N);
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  vector<ll> vec[28];
  vector<int> num(29);
  for (int i = 0; i < 29; i++) num[i] = 0; 
  for (int i = 0; i < 29; i++) {
    for (int j = 0; j < N; j++) {
      if ((1LL << i) & b[j]) {
        num[i]++;
      }
    }
  }
  for (int i = 0; i < N; i++) { 
    for (int j = 0; j < 28; j++) {
      vec[j].push_back(b[i] % (1LL << (j+1)));
    }
  }
  for (int i = 0; i < 28; i++) {
    sort(vec[i].begin(),vec[i].end());
  }
  for (int i = 0; i < N; i++) {
    if (a[i] % 2 == 0) {
      if (num[0] % 2 == 1) {
        ans ^= 1;
      }
    } else {
      if ((num[0] + N) % 2 == 1) {
        ans ^= 1;
      }
    }

    for (int bit = 0; bit < 28; bit++) {
      ll t = a[i] % (1LL << (bit+1));
      int s = vec[bit].end() - lower_bound(vec[bit].begin(),vec[bit].end(), (1LL << (bit+1)) - t);
      int l = 0;
      if (a[i] & (1LL << (bit+1))) {
        l = N;
      }
      if ((num[bit+1] + s + l) % 2 == 1) {
        ans ^= (1LL << (bit+1));
      }
    }
  }

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

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

int main(void){
    int N;
    cin >> N;
    vector<long long> A(N), B(N), C(N - 1);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    for(int i = 0; i < N; i++){
        cin >> B[i];
    }
    for(int i = 0; i < N - 1; i++){
        cin >> C[i];
    }
    long long ans = 0;
    for(int i = 0; i < N; i++){
        ans += B[A[i] - 1];
        if(i >= 1 && A[i - 1] + 1 == A[i]) ans += C[A[i] - 2];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String line = in.nextLine();

		String count = String.valueOf(line.length() - 2);
		String ans = line.substring(0,1) + count + line.substring(line.length() - 1,line.length());

		System.out.println(ans);
	}
}

Measured memory_bytes: 22612
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(void){
    int n,k;cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    sort(a.begin(),a.end());

    ll facl = 1;
    for(ll i = 1;i <= n;i++)facl = (facl * i) % mod;

    vector<mint> dp(100010,0);
    vector<mint> inverse(100010);
    for(ll i = 1;i <= 100010;i++){
        mint num = (mint)i;
        inverse[i] = (mint)1 / num;
    }
    dp[k] = (mint)1;
    for(ll x = k;x >= 1;x--){
        mint cnt = 0;
        ll l = -1,r = n;
        while(l+1!=r){
            ll m = (l+r)/2;
            if(a[m] > x)r = m;
            else l = m;
        }
        cnt = (mint)(l + 1);
        if(cnt.x == 0){
            continue;
        }
        for(ll i = 0;i < cnt.x;i++){
            dp[x % a[i]] += dp[x]*inverse[cnt.x];
        }
        dp[x] = 0;
    }
    mint sum = 0;
    for(ll x = k;x >= 0;x--){
       sum += (mint)x * dp[x];
    }
    sum *= facl;
    cout << sum.x << '\n';
}


Measured memory_bytes: 1792
import numpy as np

n, m = map(int, input().split())

ab = []
for _ in range(n):
    a, b = map(int, input().split())
    ab.append((a, b))

result = np.zeros([m, n], dtype=np.int64)

cd = []
for i in range(m):
    c, d = map(int, input().split())
    for j, (a, b) in enumerate(ab):
        result[i, j] = abs(a - c) + abs(b - d)

print(*result.argmin(axis=0) + 1, sep="\n")

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

struct Shop
{
  int sale;
  char name;

  bool operator<(const Shop& right) const
  {
    return sale < right.sale;
  }
};

int main(void)
{
  while (true)
  {
    vector<Shop> shops;
    for (int i = 0, x, y; i < 5; ++i)
    {
      cin >> x >> y;
      shops.push_back( {x + y, (char)(65 + i)} );
    }
    if (cin.eof()) break;

    sort(shops.rbegin(), shops.rend() );
    cout << shops[0].name << " " << shops[0].sale << endl;
  }
  return 0;
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=1;
		while(true){
			int x=sc.nextInt();
			if(x==0) break;
			System.out.println("Case "+a+": "+x);
			a++;
		}
	}
}


Measured memory_bytes: 41380
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a==25)printf("Christmas");
  if(a==24)printf("Christmas Eve");
  if(a==23)printf("Christmas Eve Eve");
  if(a==22)printf("Christmas Eve Eve Eve");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 1e6+3;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<map<Int, Int>> v(m);
    for (Int i = 0; i < n; i++) {
        Int x;
        cin >> x;
        v[x % m][x]++;
    }
    vector<Int> vsum(m, 0);
    vector<vector<Int>> vsum2(m);
    for (Int i = 0; i < m; i++) {
        for (auto j : v[i]) {
            vsum[i] += j.se;
            vsum2[i].emplace_back(j.se);
        }
        sort(vsum2[i].begin(), vsum2[i].end());
    }
    Int res = vsum[0] / 2;
    for (Int i = 1; i <= m - i; i++) {        
        if (i == m - i) {
            res += vsum[i] / 2;
        }
        else {
            Int add = min(vsum[i], vsum[m - i]);
            res += add;
            if (vsum[i] == vsum[m - i]) continue;
            if (vsum[i] != add) {                
                Int sum = 0;
                Int odd = 0;
                for (Int j = 0; j < (Int)vsum2[i].size(); j++) {
                    if (vsum2[i][j] % 2 == 1 && odd < add) {
                        odd++;
                        vsum2[i][j]--;
                    }       
                    sum += vsum2[i][j];             
                }
                if (odd < add) {
                    res += (sum - (add - odd)) / 2;
                }
                else {
                    for (Int j = 0; j < (Int)vsum2[i].size(); j++) {
                        res += vsum2[i][j] / 2;
                    }
                }
            }
            else {
                Int sum = 0;
                Int odd = 0;
                for (Int j = 0; j < (Int)vsum2[m - i].size(); j++) {
                    if (vsum2[m - i][j] % 2 == 1 && odd < add) {
                        odd++;
                        vsum2[m - i][j]--;
                    }
                    sum += vsum2[m - i][j];
                }
                if (odd < add) {
                    res += (sum - (add - odd)) / 2;
                }
                else {
                    for (Int j = 0; j < (Int)vsum2[m - i].size(); j++) {
                        res += vsum2[m - i][j] / 2;
                    }
                }
            }
        }
    }
    dump(res);
    return 0;
}


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

int main(){
	int high[10];
	bool flag;
	for(int i = 0 ; i < 10 ; i++){
		cin >> high[i];
	}

	do{
		flag = false;
		for(int i = 0 ; i < 9 ; i++){
			if(high[i] < high[i+1]){
				int hold = high[i+1];
				high[i+1] = high[i];
				high[i] = hold;
				flag = true;
			}
		}
	}while(flag == true);

	cout << high[0] << endl;
	cout << high[1] << endl;
	cout << high[2] << endl;

    return 0;
}

Measured memory_bytes: 3068
using CompLib.Util;
using System;
using System.Linq;

public class Program
{
    int N;
    int[] T, V;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        T = sc.IntArray();
        V = sc.IntArray();
        int sum = T.Sum();
        // 時間 速度　距離
        var dp = new double[sum + 1, 201];
        for (int i = 0; i <= sum; i++)
        {
            for (int j = 0; j <= 200; j++)
            {
                dp[i, j] = double.MinValue;
            }
        }

        dp[0, 0] = 0;
        int index = 0;
        int p = 0;
        for (int i = 0; i < sum; i++)
        {
            if (i - p >= T[index])
            {

                p += T[index];
                index++;
            }
            for (int j = 0; j <= 200; j++)
            {
                if (j <= V[index])
                {
                    // 加速
                    if (j + 1 <= V[index])
                    {
                        dp[i + 1, j + 1] = Math.Max(dp[i + 1, j + 1], dp[i, j] + ((double)j + 0.5));
                    }
                    if (j - 1 >= 0)
                    {
                        dp[i + 1, j - 1] = Math.Max(dp[i + 1, j - 1], dp[i, j] + ((double)j - 0.5));
                    }

                    dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j] + j);
                    if (j < V[index])
                    {
                        dp[i + 1, j] = Math.Max(dp[i + 1, j], dp[i, j] + j + 0.25);
                    }
                }
            }
        }

        Console.WriteLine(dp[sum, 0]);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 42464
//code_sm
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu ((int)1e9+7)
#define set0(a) memset(a,0,sizeof(a))
#define all(a) a.begin()+1,a.end()
#define endl "\n"
template<typename T,typename U>
bool compare(T x,U y)
{
	if(abs((T)x-y)<=1e-9)
	return 1;
	return 0;
}
//sieve generation begin
vi PRIME;
void sieve(int n)
{
	bool a[n+1];
	memset(a,0,sizeof(a));
	a[0]=1;
	a[1]=1;
	for(int i=2;i*i<=n;i++)
	{
		if(a[i]==0)
		{
			for(int j=i*i;j<=n;j+=i)
			a[j]=1;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]==0)
		PRIME.pb(i);
	}
}
//sieve generation end
ll gcd(ll a,ll b)
{
	while(b%a)
	{
		ll c=b;
		b=a;
		a=c%a;
	}
	return a;
}
ll bigpow(ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%chotu;
       base=(base*base)%chotu;
       exp/=2;
    }
    return res;
}
ll mulmodin(ll x)
{
	return(bigpow(x,chotu-2)%chotu);
}
ll ncr_mod(ll n,ll r)
{
	ll store[n+1];
	store[1]=1;
	for(ll i=2;i<=n;i++)
	{
		store[i]=(store[i-1]*i)%chotu;
	}
	ll ans=(((store[n]*mulmodin(store[r]))%chotu)*mulmodin(store[n-r]))%chotu;
	return ans;
}
void solve()
{
fastio
int k;
string s;
cin>>k>>s;
int n=s.length();
if(n<=k)
cout<<s;
else
cout<<string(s.begin(),s.begin()+k)<<"...";
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}


Measured memory_bytes: 3656
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define CLR2d(x,m,n) memset(x, -1, sizeof(x[0][0]) * m * n)
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    int x;
    cin>>x;
    cout<<(x^1)<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("input.txt","r",stdin);
        freopen ("output.txt","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




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

#define int long long
#define ct(n) cout<<n<<endl;
#define cts(n) cout<<n<<" ";
#define cte cout<<endl;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define vint vector<int>
#define vchar vector<char>
#define vstr vector<string>
#define pb(n) push_back(n)

int n;
signed main(){
  int count=0,count2=0,F=0;
  str S,W,T;
  char B;
  vector<long long> a(1000000);
  cin>>S>>T;
  sort(all(S));
  sort(all(T));
  reverse(all(T));
  if(S<T)ct("Yes")
  else ct("No")
}


Measured memory_bytes: 8064
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main() {
  	cout.precision(22);
  long double n,m,d;
  cin>>n>>m>>d;
  if(d==0){
    cout<<fixed<<((n-d)*(m-1)/(n*n))<<endl;
  }else{
    cout<<fixed<<((n-d)*(m-1)/(n*n))*2<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
using namespace std;

int main(){
  string s;
  int aa[100];
  for(int i=0;i<100;i++){
    aa[i]=0;
  }
  int x=0;
  int ans=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A' or s[i]=='C' or s[i]=='G' or s[i]=='T'){
      ans++;
      aa[i]=ans;
    }
    if(s[i]!='A' and s[i]!='C' and s[i]!='G' and s[i]!='T'){
    aa[i]=ans;
    ans=0;
  }
  }
  for(int i=0;i<s.size();i++){
    x=max(x,aa[i]);
  }
  cout<<x<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n, W;
	cin >> n >> W;
	V w(n), v(n);
	rep(i, n) {
		cin >> w[i] >> v[i];
	}
	int maxvalue = *max_element(all(v));
	VVL dp(n + 1, VL(110000, UPPER)); // i個目までで価値をjにするための最小の重さ(ここでは重さが上限を超えることは考えない)
	dp[0][0] = 0;
	rep(i, n) {
		rep(j, 100100) {
			if (j >= v[i]) chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]); // 貰うdpのほうがやりやすい
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}
	for (int i = 100001; i >= 0; i--) {
		if (dp[n][i] <= W) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 87936
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
int main(){
    int a,prod[90];
    int k=0,cnt1=0;
    scanf("%d",&a);
    for(int i=1; i<10; i++){
        for(int j=1;j<10;j++)
            prod[k++]=i*j;}
    for(int i=0;i<81;i++){
        if(prod[i]==a){
        cnt1++;
        break;}
        else{
        cnt1=0;
        }
    }
    if(cnt1==1)
        printf("Yes");
    else
        printf("No");
        return 0;
}

Measured memory_bytes: 128