akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(Int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(Int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using Int = long long;
using ll = long long;
using P = pair<Int,Int>;
using vi = vector<Int>;
using vvi = vector<vi>;
using vp = vector<P>;
using vvp = vector<vp>;

const Int INF = (1LL<<50);

void solve(long long N, long long K, std::vector<long long> p){
  sort(ALL(p));
  Int ans = 0;
  rep(i, K) ans += p[i];
  cout << ans << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> p(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}


Measured memory_bytes: 3676
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;

int main() {

  long long int k, a, b;
  cin >> k >> a >> b;
  k++;
  long long int tk = k;
  long long int cnt = 0;
  int n = k / (a+2);
  if (n == 0) {
    cout << k << endl;
    return 0;
  }
  cnt += b;
  k -= a + 2;

  cnt += (k / 2) * (b-a);
  cnt += k%2;

  cout << max(tk, cnt) << endl;

  return 0;
}


//EOF


Measured memory_bytes: 256
#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(int argc, const char * argv[]) {



    cin.tie(0);
    ios::sync_with_stdio(false);

    
    int k;
    string s;
    cin>>k>>s;
    if(s.size()>k) cout<<s.substr(0,k)<<"..."<<endl;
    else cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3644
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    static long[][] selfCon, selfUncon;
    static long mod = 1000000000+7;
    static int n;
    public static void main(String[] args) throws FileNotFoundException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] vc = new int[n][2];
        int[] v=new int[n], c = new int[n];
        for(int i=0;i<n;i++) v[i]=sc.nextInt();
        for(int i=0;i<n;i++) c[i]=sc.nextInt();
        int ans =  0;
        for(int i=0;i<n;i++) ans += Math.max(0,v[i]-c[i]);
        System.out.println(ans);
    }
}


Measured memory_bytes: 23508
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 1000010
using namespace std;

int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> h(n);
  REP(i,n) cin >> h[i];
  sort(h.begin(),h.end());
  
  ll ans = 0;
  REP(i,n-k) ans += h[i];
  cout << ans;
  return 0;
}

Measured memory_bytes: 1792
//**KEEP IT SHORT AND SIMPLE**
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FILES freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define REP(i,a,b) for (int i = a; i < b; i++)
#define NL '\n'
#define F first
#define S second
#define dot(a, b) (conj(a) * (b)).real()
#define cross(a, b) (conj(a)* (b)).imag()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef bool bl;
typedef vector < vector<long long> > vvl;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
typedef map <long long, long long> mll;
typedef map <long long, bool> mlb;
typedef priority_queue<long long, vector<long long>, greater<long long> > minPq;
typedef tuple<ll, ll, ll> line;
typedef complex<double> point;
const double pi = 2 * acos(0.0);
const int OO = 0x3f3f3f3f;
int main()
{
    IO
    string s;
    cin >> s;
    REP(i, 1, s.size())
        if(s[i] == s[i - 1])
            return cout << "Bad", 0;
    cout << "Good";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
const int inf = 1e9;

int main(){
	int n;
	scanf("%d", &n);
	printf("%d\n", n/3);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    
    int x,a,b;
    
    cin >> x >> a >>b;
    
    cout << (x-a)%b << endl;
    
    
    
    
    
    
    

    
/////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
  long long a,b;
  
  cin >> a >> b;
  if (a*b<=0) cout << "Zero"<< endl;
  else if (a>=0){
    cout << "Positive" << endl;
  } else{
    if ((-a)%2==(-b)%2) cout << "Negative" << endl;
    else cout << "Positive" << endl;
  }
  return 0;
}


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

const int N = 100005;
const long long mod = 998244353ll;

int n, d[N], cnt[N];
int main () {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) cnt[i] = 0;
	for (int i = 1; i <= n; i++) scanf("%d", &d[i]), cnt[d[i]]++;

	if (d[1] == 0 && cnt[0] == 1) {
		long long ans = 1ll;
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < cnt[i]; j++) ans = ans * cnt[i - 1] % mod;
		}
		printf("%lld\n", ans);
	}
	else printf("0\n");
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    int a,b,c;
    while(cin>>a>>b>>c){
    	a=b/a;
    	if(a>c) a=c;
    	cout<<a<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
class Fib():
    f = [1] * 50
    def fib(self, n):
        for i in range(2, n + 1):
            self.f[i] = self.f[i - 1] + self.f[i - 2]
        return(self.f[n])

x = Fib()
print(x.fib(int(input())))

Measured memory_bytes: 7692
#include<iostream>
    #include<algorithm>
    #define int long long
    using namespace std;
     
    int32_t main()
    {
    int n,k; cin>>n>>k;
      int arr[n];
      int sum=0;
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr,arr+n);
      for(int i=0;i<n-k;i++) sum+=arr[i];
      cout<<sum<<endl;
     
     
    return 0;
    }

Measured memory_bytes: 1792
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int sum=0;
		while(sc.hasNext()){
			String s = sc.next();
			int start=0;
			for(int i=0;i<s.length();i++){
				if(s.codePointAt(i)>47 && s.codePointAt(i)<58){
					start = i;
					while(i<s.length()-1 && s.codePointAt(i+1)>47 && s.codePointAt(i+1)<58)i++;
					sum += Integer.valueOf(s.substring(start,i+1));
				}
			}
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 17324
#include <iostream>
#define ll long long
using namespace std;
ll x;
int main(void)
{
    cin>>x;
    for(ll i=-1000;i<=1000;i++)
    {
        for(ll j=-1000;j<=1000;j++)
        {
            if(i*i*i*i*i-j*j*j*j*j==x)
            {
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3176
a = int(input())

if a == 1:
  b = "ACL"
elif a == 2:
  b = "ACLACL"
elif a == 3:
  b = "ACLACLACL"
elif a == 4:
  b = "ACLACLACLACL"
elif a == 5:
  b = "ACLACLACLACLACL"
  
  
print(b)

Measured memory_bytes: 9160
#include<bits/stdc++.h>
using namespace std;
const int N=10000;
int a,b,u,e;
int h;
int main()
{
	scanf("%d %d",&a,&b);
	e=(a+b)/2;
	u=(a+b)%2;
	h=(double)u/2*10;
	if(u==0)
	printf("%d\n",e);
	else if(h>=5)
		printf("%d\n",e+1);
	else
		printf("%d\n",e);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<pair<ll, ll>> pll;
 
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define popcount(x) __builtin_popcountll(x)
 
const long double PI = acos(-1);
 
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 stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}

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

  ll h, w;
  cin >> h >> w;
  string s[h];
  for(ll i = 0; i < h; i++) cin >> s[i];

  ll dp[100][100];
  for(ll i = 0; i < h; i++) for(ll j = 0; j < w; j++) dp[i][j] = mod;

  dp[0][0] = 0;
  for(ll i = 0; i < h; i++){
    for(ll j = 0; j < w; j++){
      if(i) dp[i][j] = min(dp[i][j], dp[i-1][j] + (s[i-1][j] != s[i][j]));
      if(j) dp[i][j] = min(dp[i][j], dp[i][j-1] + (s[i][j-1] != s[i][j]));
    }
  }

  cout << ((s[0][0] == '#') + (s[h-1][w-1] == '#') + dp[h-1][w-1]) / 2 << endl;
  return 0;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
)

func scanNums(len int) (nums []int64) {
	var num int64
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func findMin(nums []int64) (x int64) {
	x = nums[0]
	for j := 1; j < len(nums); j++ {
		if nums[j] < x {
			x = nums[j]
		}
	}
	return
}

func main() {
	var n int64
	fmt.Scan(&n)
	nums := scanNums(5)
	c := findMin(nums)
	var t int64
	if n%c == 0 {
		t = 4 + n/c
	} else {
		t = 5 + n/c
	}
	fmt.Println(t)
}


Measured memory_bytes: 512
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int count = 0;
    for (int i = 1; i <= N; i++) {
      if (i.ToString().Length % 2 == 1) {
        count++;
      }
    }
    Console.WriteLine(count);
  }
}

Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <numeric>
#include <cassert>
#include <functional>
using namespace std;

typedef unsigned long long int llui;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
constexpr double pi = 3.141592653589793238462643383279502884L;

// TODO: Mod class

const int sz = 1e5;

int main() {
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll& x : a) {
    cin >> x;
  }

  ll l = -1;
  ll r = 50 * 1e16 + 1;

  while (l < r) {
    ll m = l + (r - l) / 2;
    bool ok = false;
    for (int i = 0; i < n; ++i) {
      ll d = m - i;
      for (ll x : a) {
        x += m - i;
        if (x < n) {
          continue;
        }
        d -= (x + 1) / (n + 1);
        if (d < 0) {
          break;
        }
      }
      if (d >= 0) {
        ok = true;
        break;
      }
    }
    if (ok) {
      r = m;
    } else {
      l = m + 1;
    }
  }

  cout << r << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        final int[] prime = new int[]{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997};
		final int primeLength = prime.length;
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int mod = (int) 1E+9 +7;
        int[] factor = new int[primeLength];
        for(int n=2;n<=N;n++){
        	int m=n;
        	for(int i=0;i<primeLength;i++){
        		if(m==1)break;
        		while(m%prime[i]==0){
        			factor[i]++;
        			m = m/prime[i];
        		}
        	}
        }
        long answer = 1;
        for(int i=0;i<primeLength;i++)answer = (answer * (1+factor[i])) % mod;
        System.out.println(answer);
    }
}

Measured memory_bytes: 10064
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
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 ceilll(ll a, ll b) {return (a + b-1) / b;} // if(a%b == 0) (a/b) + 1
ll get_digit(ll a) {ll digit = 0; while(a != 0){a /= 10; digit++;} return digit;} // a != 0
template<typename T> void vecdbg(vector<T>& v){ rep(i, v.size()){cout << v[i] << " ";} br;}
template<typename T> void vecvecdbg(vector<vector<T>>& v){ rep(i, v.size()){rep(j, v[i].size()){cout << v[i][j] << " ";} br;}}

// 0 false, 1 true 
// string number to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp
// global vector -> 0 initialization

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll n, x, m; cin >> n >> x >> m;
    map<ll ,ll> mp;
    vector<ll> vec;

    ll amari;
    ll flag = -1;
    rep(i, n){
        
        if(i == 0){
            amari = x % m;
            vec.push_back(amari);
            mp[amari]++;
        }else{
            amari = (amari * amari) % m;
            
            if(mp[amari] >= 1){
                flag = amari;
                break;
            }
            vec.push_back(amari);
            mp[amari]++;
        }

        if(amari == 0){
            break;
        }
        
    }

    ll size = vec.size();
    ll ans = 0;

    if(flag != -1){
        ll ind;
        ll syuki_mae = 0;
        ll syuki = 0;
        bool syuki_flag = false;
        rep(i, vec.size()){
            if(vec[i] == flag){
                ind = i;
                syuki_flag = true;
            }
            if(syuki_flag){
                syuki += vec[i];
            }else{
                syuki_mae += vec[i];
            }
        }

        ans += syuki_mae;

        n = n - ind;
        ll syuki_size = vec.size() - 1 - ind + 1;
        ll syuki_num = n / syuki_size;
        ll syuki_amari = n % syuki_size;

        ans += syuki_num * syuki;

        for(ll i = ind; i < ind + syuki_amari; i++){
            //cout << "a " << ind << " " << syuki_amari << endl;
            ans += vec[i];
        }

        /*
        cout << "ind " << ind << endl; 
        cout << "flag " << flag << endl; 
        cout << "syuki_size " << syuki_size << endl;
        cout << "vec_size " << vec.size() << endl;
        */

    }else{
        //cout << "no" << endl;
        rep(i, vec.size()){
            ans += vec[i];
        }
    
    }
    

    cout << ans << endl;
    //cout << flag << endl;

}

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("test/sample-1.in");

    int N2;
    cin >> N2;

    int N = 1<<N2;
    vector<int> S(N);
    for (int i=0; i<N; ++i) cin >> S[i];
    sort(S.rbegin(), S.rend());
    
    if (S[0] == S[1]) {
        cout << "No" << endl;
        return 0;
    }

    vector<int> t(1, S[0]);
    while (1) {
        int l = t.size();
        int k = 0;
        sort(S.rbegin(), S.rend());
        sort(t.rbegin(), t.rend());
        for (int i=0; i<N; ++i) {
            if (S[i] == -1) break;
            if (t[k] > S[i]) {
                t.push_back(S[i]);
                S[i] = -1;
                k ++;
            }
            if (k >= l) break;
        }
        if (k != l) {
            cout << "No" << endl;
            return 0;
        }
        if ((int)t.size() == N) break;
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 2424
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll ;
#define rep(i, a, b) for (int i = a; i <= b; ++ i) 
const int N = 15, M = (1 << N) + 5, mo = 1e9 + 7 ;
using namespace std ;

bool G[N][N] ;
int n, m, fac[N * N + 5], A[N][M], B[N][M], f[M] ;

void upd(int &x, int y) {
	x = (x + y) % mo ;
}

int main() {
	scanf("%d%d", &n, &m) ;
	int x, y, st = (1 << n) - 1 ;
	fac[0] = 1 ;
	rep(i, 1, m) fac[i] = (ll) fac[i - 1] * 2 % mo ;
	rep(i, 1, m) {
		scanf("%d%d", &x, &y) ;
		G[x - 1][y - 1] = true ;
	}
	rep(i, 0, st) rep(j, 0, n - 1) if (!((i >> j) & 1)) {
		int cnt = 0 ;
		rep(k, 0, n - 1) if ((i >> k) & 1) cnt += G[j][k] ;
		B[j][i] = fac[cnt] - 1 ;
		A[j][i] = fac[cnt] ;
	}
	f[0] = 1 ;
	rep(i, 1, st) if (!(((i >> 0) & 1) ^ ((i >> 1) & 1))) {
		f[i] = 1 ;
		for (int j = i - 1 ; j > 0 ; j = (j - 1) & i) {
			int res = f[i ^ j] ;
			rep(k, 0, n - 1) if ((j >> k) & 1) res = (ll) res * A[k][i ^ j] % mo ;
			rep(k, 0, n - 1) if (!((j >> k) & 1) && ((i >> k) & 1)) res = (ll) res * B[k][j] % mo ;
			upd(f[i], res) ;
		}
	}
	int ans = (fac[m] - f[st]) % mo ;
	printf("%d\n", (ans + mo) % mo) ;
	return 0 ; 
}

Measured memory_bytes: 3840
#include <iostream>

using namespace std;

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

    if(s.length() != 4)
        return 0;

    for(int i = 0; i < s.length(); i++)
    {
        if((s[i]>= 'a') && (s[i]<='z'))
        {
            return 0;
        }

    }

    // AABB
    if(s[0] == s[1])
    {
        if(s[2] == s[3] && s[0] != s[2])
        {
            cout << "Yes" << endl;
            return 0;
        }
    } 

    // ABAB
    else if(s[0] == s[2])
    {
        if(s[1] == s[3] && s[0] != s[1])
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    // ABBA
    else if(s[0] == s[3])
    {
        if(s[1] == s[2] && s[0] != s[1])
        {
            cout << "Yes" << endl;
            return 0;
        }

    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
def input_number():
    return int(input())

def input_1line_list(number_of_input):
    return [input() for i in range(number_of_input)]

def print_unique_length(input_list):
    print(len(set(input_list)))

def main():
    n = input_number()
    print_unique_length(input_1line_list(n))

if __name__ == '__main__':
    main()

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

using namespace std;

const int maxn = 100001;

int h[maxn], dp[maxn], n, k;

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

    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    for(int i = 2; i <= n; i++){
        dp[i] = 1<<30;
        for(int j = i-1; j >= i-k && j >= 1; j--)
            dp[i] = min(dp[i],dp[j] + abs(h[i]-h[j]));
    }

    cout << dp[n];

    return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007

ll modinv(ll a, int b){// a/b mod MOD
    ll res=1;
    int n=MOD-2;
    ll x=b;
    while(n>0){
        if(n&1==1){
            res*=x;
            res%=MOD;
        }
        x*=x;
        x%=MOD;
        n>>=1;
    }
    res*=a;
    res%=MOD;
    return res;
}


int main() {
    int N;cin>>N;
    ll sumA=0;
    ll sumA2=0;
    for (int i = 0; i < N; i++){
        ll A;cin>>A;
        sumA+=A;sumA%=MOD;
        sumA2+=A*A;sumA2%=MOD;
    }
    ll ans=sumA*sumA-sumA2;ans%=MOD;
    ans=modinv(ans,2);
    cout<<ans<<endl;
}

Measured memory_bytes: 3628
def main(str)
  a = str.to_i
  a + a ** 2 + a ** 3
end

unless ENV["TEST"]
  puts(main($stdin.read.chomp))
  exit(0)
end

require 'minitest/autorun'

class TestA < Minitest::Test
  def test_main
    assert_equal("", main(""))
  end
end




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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const ll MOD=(ll)1e9+7;

const int MAX=(int)1e5+5;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD; 
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; 
        finv[i] = finv[i - 1] * inv[i] % MOD; 
    }
}

ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int N, K; cin >> N >> K;
    vi A(N);
    for(auto &x : A) cin >> x;
    sort(all(A), greater<int>());
    ll res=0;
    COMinit();
    for(int i=0; i<N-K+1; i++){
        res=(res+A[i]*COM(N-1-i, K-1)%MOD)%MOD;
    }
    sort(all(A));
    for(int i=0; i<N-K+1; i++){
        res=(res-A[i]*COM(N-1-i, K-1)%MOD)%MOD;
    }
    if(res < 0) res=MOD+res;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2944
#２つの整数 a, b と１つの演算子 op を読み込んで、
# a op b を計算するプログラム

while True:
    list = input().split()

    a = int(list[0]); b = int(list[2])
    op = list[1]
    if op == "?":
        break

    if op == "+":
        ans = a + b
    elif op == "-":
        ans = a - b
    elif op == "*":
        ans = a * b
    elif op == "/":
        ans = int(a / b)

    print(ans)


Measured memory_bytes: 5596
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	A := nextInt()
	V := nextInt()
	B := nextInt()
	W := nextInt()
	T := nextInt()

	var firstDistance int
	if A > 0 && B > 0 {
		firstDistance = B - A
	} else if A < 0 && B < 0 {
		firstDistance = int(math.Abs(float64(B) - float64(A)))
	} else if A > 0 && B < 0 {
		firstDistance = A + int(math.Abs(float64(B)))
	} else if A < 0 && B > 0 {
		firstDistance = int(math.Abs(float64(A))) + B
	} else { // A or B == 0
		firstDistance = int(math.Abs(float64(A))) + int(math.Abs(float64(B)))
	}

	if V*T >= W*T+firstDistance {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1756
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
long long A, B, C;
int main() {
	cin >> A >> B >> C;
	for (int i = 0; i <= 100000; i++) {
		if (A % 2 == 1 || B % 2 == 1 || C % 2 == 1) { cout << i << endl; break; }
		if (i == 99999) { cout << "-1" << endl; break; }
		long long D = (B + C) / 2, E = (A + C) / 2, F = (A + B) / 2;
		A = D; B = E; C = F;
	}
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%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;
  }
};

const int NMAX=200010; // we can calculate nCk until n is equal to NMAX
mint fact[NMAX],infac[NMAX];
void Make_Fact(){
  fact[0]=fact[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    fact[i]=fact[i-1]*(mint)i;
  }
}
void Make_InvFact(){
  infac[0]=infac[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    infac[i]=infac[i-1]/(mint)i;	
  }
}
mint Comb(int n,int k){
  if(n<0||k<0||n-k<0) return 0;
  return fact[n]*infac[k]*infac[n-k];
}

mint pow2[400010];

int main()
{
  int n; cin >> n;
  vector<int> c(n);
  rep(i,n) cin >> c[i];

  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  
  pow2[0].x = 1;
  rep(i,400000) {
    pow2[i+1] = pow2[i]*(mint)2;
  }

  mint res;
  rep(i,n) {
    res += (mint)c[i] * pow2[2*(n-i-1)] * pow2[2*i] * (mint)(i+2);
  }
  cout << res.x << "\n";
  
  return 0;
}


Measured memory_bytes: 7296
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int N,M;
int a,b,i,j,k;
int main()
{
  cin >> a>>b;
  
  N=max(a,b);
  M=min(a,b);
  
  for(i=0;i<N;i++)
  {
    cout << M;
  }
  
}

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

int n, m;
int s, t;
static vector<int> edge[200001];
static int label[200001][3];
static long long dist[200001][3];

long long counter = 0;
vector<int> next_v[2];

void op(int s) {
	bool check = false;
	for (int i = 0; i < edge[s].size(); i++) {
		if (label[s][0] == 1 && dist[edge[s][i]][1] > dist[s][0] + 1) {
			label[edge[s][i]][1] = 1;
			dist[edge[s][i]][1] = dist[s][0] + 1;
			check = true;
		}
		if (label[s][1] == 1 && dist[edge[s][i]][2] > dist[s][1] + 1) {
			label[edge[s][i]][2] = 1;
			dist[edge[s][i]][2] = dist[s][1] + 1;
			check = true;
		}
		if (label[s][2] == 1 && dist[edge[s][i]][0] > dist[s][2] + 1) {
			label[edge[s][i]][0] = 1;
			dist[edge[s][i]][0] = dist[s][2] + 1;
			check = true;
		}

		if (check) {
			if (counter == 0) {
				next_v[1].push_back(edge[s][i]);
			}
			else {
				next_v[0].push_back(edge[s][i]);
			}
		}
	}
}

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

	for (int i = 1; i <= n; i++) {
		label[i][0] = 0;
		label[i][1] = 0;
		label[i][2] = 0;
		dist[i][0] = 1000000009;
		dist[i][1] = 1000000009;
		dist[i][2] = 1000000009;
	}

	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		edge[u].push_back(v);
	}

	cin >> s >> t;

	label[s][0] = 1;
	dist[s][0] = 0;

	next_v[counter].clear();
	op(s);
	counter = 1;
	while (1) {
		if (next_v[counter].size() == 0) {
			break;
		}
		for (int i = 0; i < next_v[counter].size(); i++) {
			op(next_v[counter][i]);
		}
		next_v[counter].clear();
		if (counter == 0) {
			counter = 1;
		}
		else {
			counter = 0;
		}
	}
	

	if (label[t][0] == 1) {
		cout << dist[t][0] / 3<< endl;
	}
	else {
		cout << -1 << endl;
	}

	return 0;
}

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

template<typename T>
void read(T &x)
{
	x = 0; int f = 1; char c = getchar();
	while (!isdigit(c)) { if (c == '-'); f = -1; c = getchar(); }
	while (isdigit(c)) { x = x * 10 + c - 48; c = getchar(); }
	x *= f;
} 

const int Mod = 1e9 + 7;

inline int add(int a, int b) { return a + b >= Mod ? a + b - Mod : a + b; }
inline int sub(int a, int b) { return a - b < 0 ? a - b + Mod : a - b; }
inline void updateA(int &a, int b) { a = add(a, b); }

const int MAXN = 2e3 + 9;

int n, m, k, ans = 0;
int f[MAXN]; // 和为 j 的方案数
int s[MAXN];

inline bool equiv(int a, int b, int p) { return a % p == b % p; }

inline bool chk(int i, int j) 
{ 
	int res = 1 + i * (k - 1) - j;
	return 
		equiv(j, m, k - 1) && 
		res <= n && equiv(res, n, k - 1);
}

int main() 
{
	read(n), read(m), read(k);

	for (int i = 0; i <= m; ++i) s[i] = 1;
	for (int i = 1, tt = (n + m - 1) / (k - 1); i <= tt; ++i) // 总位数
	{
		for (int j = 1; j <= m; ++j) // 各个位数之和
		{
			f[j] = sub(s[j - 1], j >= k ? s[j - k] : 0); // 新加的一位至少是 1，如果位数之和 >= k ，那么要把不能一步过来的减掉，即 j - k + 1 之前的
			if (chk(i, j)) updateA(ans, f[j]);
		}
		for (int j = 1; j <= m; ++j) updateA(f[j], f[j - 1]), updateA(s[j], f[j]); // 前缀和优化
	}

  	printf("%d\n", ans);

   return 0;
}

Measured memory_bytes: 256
n = int(input())
H = tuple(map(int, input().split()))

def rec(H):
    # Hに0が存在しないと仮定して
    if not H:
        return 0
    ans = min(H)
    H = [h-ans for h in H]

    ranges = []
    preh = 0
    left = -1
    for i, h in enumerate(H):
        # lrを記録
        if preh == 0 and h > 0:
            left = i
        elif preh > 0 and h == 0:
            ranges.append((left, i))
            left = -1
        preh = h
    else:
        if left >= 0:
            ranges.append((left, len(H)))
        
    for l, r in ranges:
        ans += rec(H[l:r])
    return ans

print(rec(H))


Measured memory_bytes: 65532
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 10;
const int X = 1<<8;

//head

int n, a[3];
int l[N];
int dp[3][X];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> a[0] >> a[1] >> a[2];
  rep(i, n) cin >> l[i];

  rep(u, 3) {
    rep(i, 1<<n) {
      if(!i) dp[u][i] = INF;
      else {
        int sum = 0;
        int cnt = 0;
        rep(j, n) if(i>>j&1) {
          sum += l[j];
          cnt++;
        }
        dp[u][i] = 10*(cnt-1) + abs(sum-a[u]);
      }
    }
    rep(i, n) rep(j, 1<<n) {
      if(j>>i&1) chmin(dp[u][j], dp[u][j^(1<<i)]);
    }
  }

  int ans = INF;
  rep(i, 1<<n) {
    int x = ((1<<n)-1)^i;
    for(int j = x; j > 0;) {
      j--;
      j &= x;
      int k = (1<<n)-1-i-j;
      chmin(ans, dp[0][i] + dp[1][j] + dp[2][k]);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdlib.h>
#include <numeric>
#include <cmath>
#include <iomanip>
#define mod 1000000007
typedef unsigned long long int ll;
using namespace std;





int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin>>n;
    vector<int> a;
    for(int i=0;i<n;i++)
    {
        int temp;cin>>temp;
        a.push_back(temp);

    }
    sort(a.begin(),a.end());
    double result=a[0]*1.0;
    for(int i=1;i<n;i++)
    {
       result=(result+a[i])/2.0;
    }
    cout<<result<<"\n";
    
}


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

signed main(void)
{
	string s, ans;
	cin >> s;
	rep(i, s.size())
	{
		if (s[i] == 'B')
		{
			ans = ans.substr(0, ans.size() - 1);
		}
		else if (s[i] == '0')
		{
			ans+= '0';
		}
		else if (s[i] == '1')
		{
			ans += '1';
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIF(v, n) printf("%."#n"f\n", v)
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define MINS(a,b) a = min(a,(decltype(a))(b))
#define MAXS(a,b) a = max(a,(decltype(a))(b))

ll modpow(ll r, ll n, ll mod) {
	ll ans = 1;
	ll tmp = r;
	while (n > 0) {
		if ((n & 1) > 0)ans = ans * tmp % mod;
		tmp = tmp * tmp % mod;
		n >>= 1;
	}
	return ans;
}
int main() {
	ll N, S;
	ll mod = 998244353;
	cin >> N >> S;
	vector<ll> A(1+N);
	vector<vector<ll>> dp(1 + N);
	REP(i, 1, 1 + N) {
		cin >> A[i];
		dp[i].resize(1 + S, 0);
	}
	if(A[1] <= S)dp[1][A[1]] = 1;
	REP(i, 2, N + 1) {
		REP(j, 1, S + 1) {
			dp[i][j] = dp[i - 1][j] * 2 % mod;
			if (j - A[i] > 0) {
				dp[i][j] += dp[i - 1][j - A[i]];
				dp[i][j] %= mod;
			}
		}
		if (A[i] <= S) {
			dp[i][A[i]] += modpow(2, i - 1, mod);
			dp[i][A[i]] %= mod;
		}
	}
	PRI(dp[N][S]);
	return 0;
}

Measured memory_bytes: 74016
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t;
    //cin>>t;
    //while(t--)
    {
     ll i,j,k,l,m,n,c=0;
     cin>>n;
     map <string ,ll> mp;
     while(n--)
     {
         string str;
         cin>>str;
         mp[str]++;


     }
     cout<<mp.size()<<endl;
    }


}


Measured memory_bytes: 19120
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;


ll mymod(ll a,ll b){
    a%=MOD;
    ll result=1;
    while(b>0){
        if(b&1){
            result=(result*a)%MOD;
        }
        a=(a*a)%MOD;
        b>>=1;
    }
    return result;
    
}

ll modInverse(ll n){
    return mymod(n,MOD-2);
}

ll nCk(ll n,ll k){
    ll num=1;
    ll den=1;
    ll ans=0;
    while(k){
        num=(n*num)%MOD;
        den=(k*den)%MOD;
        n--;
        k--;
    }
    den=modInverse(den);
    ans=(num*den)%MOD;
    return ans;
}


int main(){
    int N,A,B;
    cin>>N>>A>>B;
    ll ans=mymod(2,N)-1;
    if(A<=N){
        ans-=nCk(N,A);
    }
    if(B<=N){
        ans-=nCk(N,B);
    }
    ans=ans%MOD;
    if(ans<0){
        ans+=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;
const int Max_N(3050);

int N, MOD, Fac[Max_N], Inv[Max_N], power2[Max_N * Max_N], power2_phi[Max_N * Max_N], S2[Max_N][Max_N], Ans;

inline int Mult(int a, int b)
{
	return a * 1LL * b % MOD;
}

inline int Add(int a, int b)
{
	return a + b >= MOD ? a + b - MOD : a + b;
}

inline int Sub(int a, int b)
{
	return a - b < 0 ? a - b + MOD : a - b;
}

void exgcd(int a, int b, int &x, int &y)
{
	if (b == 0)
		x = 1, y = 0;
	else
		exgcd(b, a % b, y, x), y -= x * (a / b);
}

inline int inverse(int a)
{
	int invx, invy;
	exgcd(a, MOD, invx, invy);
	return (invx % MOD + MOD) % MOD;
}

int power(int a, int n)
{
	int Ret(1);
	while (n)
	{
		if (n & 1)
			Ret = Mult(Ret, a);
		a = Mult(a, a), n >>= 1;
	}
	return Ret;
}

/*
¿¼ÂÇÈÝ³â£¬Ã¶¾ÙÄÄÐ©Ô­ÁÏ±»¼ÓÈëµ½²»³¬¹ýÒ»ÍëÀ­ÃæÖÐÈ¥ÁË
È»ºó°ÑÕâÐ©Ô­ÁÏ·Ö³ÉÈô¸É×é£¬°üÀ¨Ò»¸ö¿ÉÒÔÎª¿ÕµÄÌØÊâ×é±íÊ¾Ã»±»¼ÓÈë£¬³ýÁËÌØÊâ×éµÄÃ¿Ò»×é±»Í¬Ê±¼ÓÈëµ½ÁËÒ»ÍëÀ­ÃæÖÐ
Ans = Sum{(-1)^i * C(N, i) * Sum{(S2(i, j) + S2(i, j + 1) * (j + 1)) * 2^(2^(N - i)) * (2^(N - i))^j   |   0 <= j <= i}   |   0 <= i <= N} 
*/

inline int Com(int n, int m)
{
	return Mult(Fac[n], Mult(Inv[m], Inv[n - m]));
}

int main()
{
	scanf("%d%d", &N, &MOD);
	power2[0] = power2_phi[0] = 1;
	for (int i = 1;i <= N * N;++i)
	{
		power2[i] = Add(power2[i - 1], power2[i - 1]);
		power2_phi[i] = (power2_phi[i - 1] + power2_phi[i - 1]) % (MOD - 1);
	}
	S2[0][0] = 1;
	for (int i = 1;i <= N;++i)
		for (int j = 1;j <= i;++j)
			S2[i][j] = Add(S2[i - 1][j - 1], Mult(S2[i - 1][j], j));
	Fac[0] = 1;
	for (int i = 1;i <= N;++i)
		Fac[i] = Mult(Fac[i - 1], i);
	Inv[N] = inverse(Fac[N]);
	for (int i = N - 1;i >= 0;--i)
		Inv[i] = Mult(Inv[i + 1], i + 1);
	for (int i = 0, Sum;i <= N;++i)
	{
		Sum = 0;
		for (int j = 0, inv2 = inverse(2), pow2 = power(2, power2_phi[N - i]);j <= i;++j)
			Sum = Add(Sum, Mult(Add(S2[i][j], Mult(S2[i][j + 1], j + 1)), Mult(power2[(N - i) * j], pow2)));
		Sum = Mult(Sum, Com(N, i));
		if (i & 1)
			Ans = Sub(Ans, Sum);
		else
			Ans = Add(Ans, Sum);
	}
	printf("%d", Ans);
	return 0;
}

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

int main(){
  int K;
  string S;
  cin >> K >> S;
  
  int length=S.size();
  
  if(length<=K){
    cout << S << endl;
    return 0;
  }
  else{
    for(int i=0;i<K;i++){
      cout << S[i];
    }
  }
  cout << "..." << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

void rectangle(int a, int b, int *s, int *l)
{
    *s = a * b;
    *l = 2 * a + 2 * b;
}

int main(void)
{
    int a, b, s, l;
    scanf("%d %d", &a, &b);
    rectangle(a, b, &s, &l);
    printf("%d %d\n", s, l);
    return 0;
}



Measured memory_bytes: 2672
#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define RALL(X) (X).rbegin(), (X).rend()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRVI(N, X) VI X(N); for (int ___I=0; ___I<n; ___I++) scanf("%d", &(X[___I]))  
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

const int mod = 998244353;
int main(){
    DRII(a,b);
    DRII(c,d);
    c-=a;
    d-=b;
    vector<VL> res(c+1, VL(d+1,0));
    res[0][0]=1;
    REP(i,c){
        res[i+1][0]= (b*res[i][0])%mod;
    }
    REP(j,d){
        res[0][j+1] = (a*res[0][j])%mod;
    }
    REP(i,c){
        REP(j,d){
            res[i+1][j+1]+=((b+j+1)*res[i][j+1]);
            res[i+1][j+1]+=((a+i+1)*res[i+1][j]);
            res[i+1][j+1]-= (res[i][j] * (a+i) * (b+j))%mod;
            
            res[i+1][j+1]%=mod;
        }
    }
    res[c][d]+=mod;
    res[c][d]%=mod;
    printf("%lld\n", res[c][d]);
}


Measured memory_bytes: 73504
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int i,n,max=0,min=0,diff=0;
    scanf("%ld",&n);
    int array[n];
    for(i=0;i<n;i++){
        scanf("%ld",&array[i]);
    }
    min=array[0];
    max=array[0];
    for(i=0;i<n;i++){
        if(max>array[i]){
           max=array[i];
        }
        if (min<array[i]){
            min=array[i];
        }
        diff=min-max;
    }
    printf("%ld\n",diff);
    return 0;
}


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

int main(){
  int n;
  string s;
  int ans = 0, temp = 0;
  cin >> n >> s;
  
  rep(i,n){
    if(s[i] == 'I') temp++;
    if(s[i] == 'D') temp--;
    ans = max(ans,temp);
  }
  cout << ans << endl;
  
  
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String args[]){
		new Main().mainrun();
	}

	private Scanner scan;

	private void mainrun() {
		scan = new Scanner(System.in);

		char[] ch = scan.nextLine().toCharArray();

		for(int i = ch.length-1;i >=0 ;i--) {
			System.out.print(ch[i]);
		}

		System.out.println();

		scan.close();

	}

}


Measured memory_bytes: 26104
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//const ll INF = 1e18;
//const ll MOD = 1e9+7;
//const double pi = 3.14159265358979;
using vl = vector<ll>;
using P = pair<ll, ll>;
# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((ll)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((ll)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
 
ll h, w, k;

ll Main() {
    cin >> h >> w >> k;
    char c[6][6];
    rep(i, h) rep(j, w) cin >> c[i][j];
    
    ll ans = 0;
    rep(is, pow(2,h)) {
    rep(js, pow(2,w)) {
        ll cnt = 0;
        rep(i, h) {
        rep(j, w) {
            if (is>>i&1) continue;
            if (js>>j&1) continue;
            if (c[i][j] == '#') cnt++;
        }}
        if (cnt == k) ans++;
    }}
    
    cout << ans << endl;
    return 0;
}
 
int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 4124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 文字列の入力
            string s = Console.ReadLine();

            List<string> days = new List<string> {
                "SAT",
                "FRI",
                "THU",
                "WED",
                "TUE",
                "MON",
                "SUN"
            };
            
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Console.WriteLine(days.IndexOf(s) + 1);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13152
N=int(input())
ans = [0]*10000000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            ans[i**2+j**2+k**2+i*j+j*k+i*k] += 1
for i in range(1,N+1):
    print(ans[i])


Measured memory_bytes: 146784
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
using namespace std;

int main()
{
	string s;
	cin >> s;
	int start = 0;
	int finish = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == 'A') {
			start = i + 1;
			break;
		}
	}
	for (int i = s.size() - 1; i > 0; i--) {
		if (s.at(i) == 'Z') {
			finish = i + 1;
			break;
		}
	}
	cout << finish - start + 1 << endl;
}

Measured memory_bytes: 640
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        new Main();
    }

    public Main() {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        Set<Integer> nums = new HashSet<Integer>(3) {{
            add(1);
            add(2);
            add(3);
        }};
        nums.remove(a);
        nums.remove(b);
        for (Integer i : nums) {
            System.out.println(i);
            break;
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
int w, a, b;
cin >> w >> a >> b;
if(a>b){
if(a-(w+b)>=0){
cout << a-(w+b) << endl;
}
else{
a=0;
cout << a << endl;
}
}
else if(a==b){
a=0; 
cout << a << endl;
}
else{
if(b-(a+w)>=0){
cout << b-(a+w) << endl;
}
else{
a=0;
cout << a << endl;
}
}
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            Console.WriteLine(a + a*a + a*a*a);
        }
    }
}


Measured memory_bytes: 27292