akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(void)
{

	int N, M, s;
	string S;
	char C;
	map<ll, bool> check;
	bool ans = true;

	cin >> N >> M;

	if(N>1){
		S = "1";
	}else{
		S="0";
	}

	for (ll i = 1; i < N; i++) {
		S = S + "0";
	}

	for (ll i = 0; i < M; i++) {
		cin >> s >> C;


		if (check[s - 1] == true && S[s-1] != C) {
			ans = false;
		}
		check[s - 1] = true;

		S[s - 1] = C;
	}

	if (S.size() > 1 && S[0] == '0') {
		ans = false;
	}

	if (ans) {
		cout << S << endl;
	}
	else {
		cout << -1 << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  
     int n,m,i,x=0;
  
     scanf("%d %d",&n,&m);
  
     int a[m];
  
     for(i=0;i<m;i++){
         scanf("%d",&a[i]);
      }
  
      for(i=0;i<m;i++){
          x+=a[i];
      }
      
      if(n-x>=0){
         printf("%d\n",n-x);
      }
      else{
          printf("-1\n");
      }
    
      return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

const int N = 307;
bool row[N], col[N];
string a[N];
int ans[N][N];

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif

    int n, m, k;
    cin >> n >> m >> k;
    int ptr = 1;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        for (int j = 0; j < m; ++j) {
            if (a[i][j] == '#') {
                ans[i][j] = ptr;
                ++ptr;
            }
        }   
    }
    
    for (int i = 0; i < n; ++i) {
        bool have = 0;
        for (int j = 0; j < m; ++j)
            have |= a[i][j] == '#';
        if (have) {
            for (int j = 0; j < m; ++j) {
                if (!ans[i][j] && ans[i][j - 1]) {
                    ans[i][j] = ans[i][j - 1];
                }   
            }   
            for (int j = m - 2; j >= 0; --j) {
                if (!ans[i][j] && ans[i][j + 1]) {
                    ans[i][j] = ans[i][j + 1];
                }   
            }   
        }   
    }   

    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (!ans[i][j] && ans[i - 1][j])
                ans[i][j] = ans[i - 1][j];
        }   
    }
    for (int i = n - 2; i >= 0; --i) {
        for (int j = 0; j < m; ++j)
            if (!ans[i][j] && ans[i + 1][j])
                ans[i][j] = ans[i + 1][j];
    }   

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cout << ans[i][j] << ' ';
        }   
        cout << endl;
    }   
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <math.h>
#define uint unsigned long long
#define ll long long
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9

using namespace std;
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}
const int N = 100010;
const int mod = 1e9 + 7;
ll a[N], b[N], aa[N], bb[N];
map<ll, int> Mp;
vector<int> p;
bool vis[2010];
int main()
{
    int n,ans = 0;
    rep(i, 2, 2000)
        if (!vis[i])
        {
            p.push_back(i);
            for (int j = i + i; j < 2000; j += i) vis[j] = 1;
        }
    cin >> n;
    rep(i, 0, n - 1)
    {
        cin >> a[i];
        b[i] = a[i];
    }
    rep(i, 0, n - 1)
    {
        aa[i] = 1, bb[i] = 1;
        int nn = p.size();
        rep(j, 0, nn - 1)
        {
            int cnt = 0;
            while (a[i] % p[j] == 0)
            {
                a[i] /= p[j];
                cnt ++;
            }
            if (cnt % 3 == 1) aa[i] *= p[j], bb[i] *= p[j] * p[j];
           	else if (cnt % 3 == 2) bb[i] *= p[j], aa[i] *= p[j] * p[j];
        }
        aa[i] *= a[i];
        ll t = floor(sqrt(a[i] * 1.0));
        if (t * t == a[i]) bb[i] *= t;
        else
        {
            if (bb[i] * a[i] > 0 && bb[i] * a[i] * a[i] > 0) bb[i] *= a[i] * a[i];
            else bb[i] = 0;
        }
        Mp[aa[i]] ++;
    }
    int flag = 0;
    rep(i, 0, n - 1)
    {
        if (aa[i] == 1)
        {
            if (flag == 0) ans ++, flag = 1;
        }
        else ans += max(Mp[aa[i]], Mp[bb[i]]), Mp[aa[i]] = Mp[bb[i]] = 0;
    }
    cout << ans;
    return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
const int INF=2012345678;
const ll LLINF=4012345678012345678LL;
const ll MOD=1000000007; //998244353; //
const ld PI=3.1415926535898;
const ld EPS=1e-9;
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(b==0)return a;return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll expo(ll b,ll p,ll m){ll res=1; while(p){if(p&1)res=(res*b)%m; b=(b*b)%m; p>>=1;} return res;}
inline ll modinv(ll a,ll m){return expo(a,m-2,m);}

const int N=1000005;

int main(){
	ll n;
	scanf("%lld",&n);
	bitset<N+1> isPrime;
	vector<int> primeList;
	isPrime.reset();
	isPrime.flip();
	isPrime[0] = isPrime[1] = 0;
	primeList.push_back(2);
	for(int i=4;i<=N;i+=2) isPrime[i]=0;
	for(long long i=3;i<=N;i+=2){
		if (!isPrime[i]) continue;
		primeList.push_back(i);
		for(long long j=i;j<=N;j+=i){
			isPrime[j]=0;
		}
	}
	int ans=0;
	for(int i=0;i<SZ(primeList);i++){
		ll x=primeList[i];
		int c=0;
		while(n%x==0){
			n/=x;c++;
		}
		int k=(int)sqrt(c*2)+10;
		while(k*(k+1)/2>c)k--;
		ans+=k;
	}
	if(n!=1)ans++;
	printf("%d",ans);
}


Measured memory_bytes: 4060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL N; cin >> N;
    string ans;
    while(N > 0){
        char x;
        if(N%26 == 0) {
            x = 'z';
            ans += x;
            N /= 26;
            N--;
        }
        else  {
            x = char('a' + N%26 - 1);
            ans += x;
            N /= 26;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

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

int main()
{
   int n;
   cin>>n;
   int last1=0,last2=0;
   int lose=0;
   for(int i=0;i<n;i++)
   {
       int x,y,z;
       cin>>x>>y>>z;
       int b=0;
       if(y+z-last1<0)
            b=-(y+z-last1);
       else
            b=y+z-last1;
        if(x-last2-b<0)
        {
            lose=1;

        }
       if((x-last2-b)%2==1)
       {
           lose=1;

       }
       last1=y+z;
       last2=x;

   }
   if(!lose)
    cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;


    return 0;
}


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

#define int long long

signed main(){
  //
  int N,W;
  cin>>N>>W;
  int dp[110][100010]={};
  dp[0][0]=0;
  int w[110];
  int v[110];
  for(int i=0;i<N;i++){
    cin>>w[i]>>v[i];
  }
  for(int i=0;i<N;i++){
    for(int sum_w=0;sum_w<=W;sum_w++){
      //i番目を選んだとき
      if(sum_w-w[i]>=0){
        dp[i+1][sum_w]=max(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i]);
      }
      //i番目を選ばなかったとき
      dp[i+1][sum_w]=max(dp[i+1][sum_w],dp[i][sum_w]);
    }
  }
  cout<<dp[N][W]<<endl; 
  return 0;
}


Measured memory_bytes: 89576
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }


void solve(void)
{
   int N,H; cin>>N; cin>>H; 
   vector<int> A (N,0);
   vector<int> B (N,0);
   int index = -1;
   int MAX = 0;
   vector<pair<int,int> > vp;
   for (int i = 0; i < N; i++)
   {
     cin>>A[i]>>B[i];
     vp.emplace_back(B[i],i);
     if(chmax(MAX,A[i]))
     {
       index = i;
     }
   }
   sort(ALL(vp));
   reverse(ALL(vp));
   int ANS2 = 0;
   int H2 = H;

    for (int i = 0; i < N; i++)
   {
     if(MAX < vp[i].first)
     {
       H2 -= vp[i].first;
       ANS2++;
     }
     if(H2 <= 0)
     break;
   }
  if(H2 > 0)ANS2 = INF;

   int ANS = 0;
   for (int i = 0; i < N; i++)
   {
     if(MAX < vp[i].first && vp[i].second != index)
     {
       H -= vp[i].first;
       ANS++;
     }
     if(H <= 0)
     break;
   }
   if(H > 0)
   {
     H -=B[index];
     ANS++;
     if(H >0)
     ANS += H/A[index] +(int)(H%A[index] > 0);

   }
   cout<<min(ANS,ANS2)<<endl;
   
   
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 3956
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

int main()
{
    int N;
    string S, T;
    cin >> N >> S >> T;
    for (int i = 0; i < N; i++) {
        cout << S[i] << T[i];
    }
    return 0;
}

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

int main()
{
    int d;
    cin >> d;
    int c[26];
    for(int i = 0; i < 26; i++) cin >> c[i];
    int s[400][26];
    for(int i = 0; i < d; i++){
        for(int j = 0; j < 26; j++) cin >> s[i][j];
    }
    int last[26];
    for(int i = 0; i < 26; i++) last[i] = -1;
    int ans = 0;
    for(int i = 0; i < d; i++){
        int l = 0;
        for(int j = 0; j < 26; j++){
            if(s[i][j] + (i - last[j]) * c[j] > s[i][l] + (i - last[l]) * c[l] &&
               s[i][j] + (i - last[j]) * c[j] - s[i][l] + (i - last[l]) * c[l] > (i - last[j]) * (c[j] - c[l])){
                l = j;
            }
        }
        last[l] = i;
        ans += s[i][l];
        for(int j = 0; j < 26; j++) ans -= (i - last[l]) * c[l];
        cout << l + 1 << endl;
    }
}


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

int main() {
	string n;
	cin >> n;
	for (int i = 0; i < n.length(); i++) {
		if (n.at(i) == '9') {
			n.at(i) = '1';
		} else if (n.at(i) == '1') {
			n.at(i) = '9';
		}
	}
	cout << n << endl;
	return 0;
}

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

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

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

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

  // LW[i]:i番目の人よりLeft にいる人のうち、Wを向いている人の数
  // RE[i]:i番目の人よりRightにいる人のうち、Lを向いている人の数
  // 求める答えは、LW[i]+RE[i]のうち最小のもの
  vi LW(n),RE(n);

  // LW の決定。LW[0]=0 としてよい
  for (int i = 1; i < n; i++) {
    if(s[i-1]=='W') LW[i] = LW[i-1] + 1;
    else LW[i] = LW[i-1];
  }
  // RE の決定。RE[n-1]=0
  for (int i = n-2; i >= 0; i--) {
    if(s[i+1]=='E') RE[i] = RE[i+1] + 1;
    else RE[i] = RE[i+1];
  }

  int ans = 1e9;
  rep(i, n) chmin(ans,LW[i]+RE[i]);
  cout << ans << '\n';
}


Measured memory_bytes: 2948
import java.util.*;

public class Main {

	static int[] tree = null;
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	tree = new int[N+1];
        for(int i = 1; i < N+1; i++){
        	tree[i] = sc.nextInt();
        }
        
        BuildMaxHeap();
        
        for(int i=1;i < tree.length;i++){System.out.print(" " + tree[i]);}
        System.out.println();
    }

    private static void BuildMaxHeap(){
    	for (int i = (tree.length-1)/2;i>=1;i--){
    		conMaxHeap(i);}
    }
    
    private static void conMaxHeap(int key){
    	int left  = left(key);
    	int right = right(key);
    	int largest = key;
    	if(left  < tree.length){ if(tree[largest] < tree[left] ){largest = left ;}}
    	if(right < tree.length){ if(tree[largest] < tree[right]){largest = right;}}
    	if(largest != key)     { swap(key,largest); conMaxHeap(largest);}
    }

    private static void swap(int i,int j){int temp = tree[i]; tree[i] = tree[j]; tree[j] = temp;}

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

Measured memory_bytes: 169772
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
using namespace std;
typedef long long ll;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
int main(){
	int n;
	cin>>n;
	if(n%2==0){
		cout<<n<<endl;
	}
	else{
		cout<<n*2<<endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        long N;

        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextLong();
        }
        long result = N /2;
        if(N%2 == 0){
            result--;
        }
        System.out.println(result);

    }

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {

      char x;
      cin >> x;
      
      if(x == 'a' || x == 'b' || x == 'c' || x == 'd' || x == 'e' || x == 'f' || x == 'g' || x == 'h' || x == 'i' || x == 'j' || x == 'k' || x == 'l' || x == 'm' || x == 'n' || x == 'o' || x == 'p' || x == 'q' || x == 'r' || x == 's' || x == 't' || x == 'u' || x == 'v' || x == 'w' || x == 'x' || x == 'y' || x == 'z' ){
        cout << "a" << endl;
      }
      else{
        cout << "A" << endl;
      }
    }

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N; cin >> N;
    vector<ll> d(N);
    rep(i,N){
        cin >> d[i];
    }
    sort(all(d));


    int idx = N/2;
    cout << d[idx]-d[idx-1] << endl;
}


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

int main(){
    int n, k;
    long long attack_num=0;
    vector<int> h;

    cin >> n >> k;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        h.push_back(tmp);
    }

    sort(h.begin(), h.end(), greater<int>());

    for(int j=k; j<n; j++){
        attack_num += h[j];
    }

    cout << attack_num << endl;
    return 0;
}

Measured memory_bytes: 1528
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>
#include <queue>

using namespace std;
const int64_t INF=10000000000000000;
#include <vector>
#include<cstdint>
#include <iostream>
#include <vector>

template<class T>
void read_1d(std::vector<T>& a,int64_t num){
	a.reserve(num);
	for(int64_t i1=0;i1<num;i1++){
		T temp;
		std::cin>>temp;
		a.push_back(temp);
	}
}
template<class T>
void read_2d(std::vector<std::vector<T> >&a,int64_t x,int64_t y ){
	a.resize(x);
	for(int64_t i1=0;i1<x;i1++){
		a[i1].reserve(y);
		for(int64_t i2=0;i2<y;i2++){
			char temp;
			std::cin>>temp;
			if(temp=='0'){
				a[i1].push_back(0);
			}else{
				a[i1].push_back(1);
			}
		}
	}
}
template<class InputIterator>
void debug(InputIterator first,InputIterator last){
	for(auto i1=first;i1!=last;i1++){
		std::cout<<(*i1);
	}
}


int main(){
	int64_t n;
	cin>>n;
	vector<int64_t> c_num;
	c_num.resize(26);
	for(int64_t i1=0;i1<n;i1++){
		char temp;
		cin>>temp;
		c_num[temp-'a']++;
	}
	int64_t sum=1;
	int64_t mod=1000000007;
	for(auto i1=c_num.begin();i1!=c_num.end();i1++){
		sum=sum*((*i1)+1);
		sum=sum%mod;
	}
	cout<<sum-1<<endl;

}

Measured memory_bytes: 256
#include<stdio.h>

#include<math.h>

int main ()

{

	int A,B,C,D,m,n,s;

	while(scanf("%d %d %d %d",&A,&B,&C,&D)!=EOF)

	{

		if(A>C)

		m=A;

		else

		m=C;

		if(B>D)

		n=D;

		else

		n=B;

		s=n-m;

		if(s<0)

		printf("0\n");

		else

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

	}

	return 0;

}

Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
pair<LL, LL> P[100011];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) {
	LL x, l;
	scanf("%lld%lld", &x, &l);
	P[i] = make_pair(x+l, x-l);
    }
    sort(P, P+N);

    LL x = -(1LL<<60);

    int ans = 0;
    REP (i, N) {
	if (x <= P[i].second) {
	    ans++;
	    x = P[i].first;
	}
    }
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>
#include <queue>
#include <stack>

using namespace std;


int main() {
	long long int n, t[5];
	cin >> n;
	for (int i = 0; i < 5; i++) {
		cin >> t[i];
	}
	sort(t, t + 5);
	if (n % t[0] == 0)cout << 4 + n / t[0] << endl;
	else cout << 5 + n / t[0] << endl;

	return 0;
}


Measured memory_bytes: 256
using static System.Math;
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int tmax { get; set; }
    public int tmin { get; set; }
}

public class hello
{
    public static int smax, smin;
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var n = int.Parse(line[0]);
            var d = int.Parse(line[1]);
            if (n == 0 && d == 0) break;
            smax = 0; smin = int.MaxValue;
            var a = new List<int>[n];
            var sum = new int[n];
            for (int i = 0; i < n; i++) a[i] = new List<int>();
            for (int i = 0; i < n; i++)
            {
                line = Console.ReadLine().Trim().Split(' ');
                var m = int.Parse(line[0]);
                for (int j = 0; j < m; j++) a[i].Add(int.Parse(line[j + 1]));
                a[i].Reverse();
                sum[i] = a[i].Sum();
                smax = Max(smax, sum[i]);
                smin = Min(smin, sum[i]);
            }
            getAns(a, sum, n, d);
        }
    }
    static void getAns(List<int>[] a, int[] sum, int n, int d)
    {
        while (true)
        {
            var ret = Dec(a, sum, n, d);
            if (!ret) { Console.WriteLine("No"); return; }
            else if (sum.Sum() == 0) { Console.WriteLine("Yes"); return; }
        }
    }
    static bool Dec(List<int>[] a, int[] sum, int n, int d)
    {
        var deL = false;
        for (int i = 0; i < n; i++)
        {
            if (a[i].Count() == 0) continue;
            var w = a[i][0];
            sum[i] -= w;
            var p = getMaxMin(sum, n);
            var tmax = p.tmax;
            var tmin = p.tmin;
            if (tmax - tmin <= d) { smax = tmax; smin = tmin; a[i].RemoveAt(0); deL = true; continue; }
            else sum[i] += w;
        }
        return deL;
    }
    static P getMaxMin(int[] sum, int n)
    {
        var tmax = int.MinValue; var tmin = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            tmax = Max(tmax, sum[i]);
            tmin = Min(tmin, sum[i]);
        }
        return new P { tmax = tmax, tmin = tmin };
    }
}



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

using namespace std;

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

	if(n%10 == 7 || (n/10)%10 == 7 || n/100 == 7)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        System.out.printf("%d ",a/b);
        System.out.printf("%d ",a%b);
        System.out.printf("%.10f",(double)a/b);
    }

}



Measured memory_bytes: 26492
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100+10;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
int a[maxn][maxn];
int main(){
	int n=read(),m=read();
	int num=read();
	int kx=1,ky=1;
	for(int i=1;i<=num;i++){
		int x=read();
		while(x--){
			a[kx][ky]=i;
			if(kx&1) ky++;
			else ky--;
			if(ky>m) ky=m,kx++;
			else if(ky<=0) ky=1,kx++;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			printf("%d%c",a[i][j],j==m?'\n':' ');
	return 0;
}

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

class Radix {
private:
  const char* s;
  int a[128];
public:
  Radix(const char* s = "0123456789ABCDEF") : s(s) {
    int i;
    for(i = 0; s[i]; ++i)
      a[(int)s[i]] = i;
  }
  std::string to(long long p, int q) {
    int i;
    if(!p)
      return "0";
    char t[64] = { };
    for(i = 62; p; --i) {
      t[i] = s[p % q];
      p /= q;
    }
    return std::string(t + i + 1);
  }
  std::string to(const std::string& t, int p, int q) {
    return to(to(t, p), q);
  }
  long long to(const std::string& t, int p) {
    int i;
    long long sm = a[(int)t[0]];
    for(i = 1; i < (int)t.length(); ++i)
      sm = sm * p + a[(int)t[i]];
    return sm;
  }
};

int main() {
    int n,k;cin >> n >> k;
    Radix r;

    string s = r.to(n, k);
    std::cout << s.size() << std::endl; //
}

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

int main()
{
    int N, L;
    cin >> N >> L;

    int taste = 0;
    int tmp_taste = 0;
    int min_taste = INT_MAX;

    for (int i = 1; i <= N;i++){
        tmp_taste = L + i - 1;
        taste += tmp_taste;
        if (abs(tmp_taste) < abs(min_taste)){
            min_taste = tmp_taste;
        }
    }
    taste -= min_taste;
    cout << taste << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){

    int a[10][10];
    int n, b[1000];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >>b[i];
    for(int ii = 0; ii < 3; ii++){
        for(int j = 0; j < 3; j++){
            if(b[i] == a[ii][j])a[ii][j] = 0;
        }
    }

    }

    bool ans = false;
    for(int i=0;i<3;i++){
        if(!a[0][i] &&!a[1][i] &&!a[2][i]) ans = true;
        if(!a[i][0]&&!a[i][1]&&!a[i][2]) ans=true;
    }
    if(!a[0][0]&&!a[1][1]&&!a[2][2] || !a[0][2]&&!a[1][1]&&!a[2][0]) ans = true;

    if(ans) cout << "Yes" << endl;
    else cout <<"No"<<endl;
}


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

char s[100005];
int n,i,t=1;

int main(){
	cin >> s+1;
	n=strlen(s+1);
	if(s[1]=='0' || s[n]=='1'){
		cout << -1;
		return 0;
	}
	for(i=1;i<n;i++)
		if(s[i]^s[n-i]){
			cout << -1;
			return 0;
		}
	for(i=2;i<=n;i++){
		cout << t << ' ' << i << endl;
		if(s[i-1]=='1')t=i;
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  
  if(n == 1){cout << "No" << endl;
            return 0;}
  if(n == 2){
    char t,y;
    cin >> t >> y;
    if(t == y){cout << "Yes" << endl;}else{cout << "No" << endl;}
            return 0;}
  
  int r;
  if(n%2 == 1){r= (n-1)/2;}else{
  r =n/2-1;}
  char a[r],b[r];
  
  for(int i=0;i<=r;++i){
  cin >>a[i];}
  
  if(n%2 ==1){
  char k;
  cin >> k;}
  
  for(int q=0;q<=r;++q){
  cin >>b[q];}
  
  for(int p=0;p<=r;++p){
  if(a[p] != b[p]){cout << "No" << endl;
                   return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  for(int i=0;i<1000;i++){
    int c[3] = {i/100,(i/10)%10,i%10};
    int f = 0;
    for(int j=0;j<N;j++){
      if((S[j]-'0')==c[f]){f++;}
      if(f==3){count++;break;}
    }
  }
  cout << count << endl;
}

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

int main()
{
  int n ;
  string s, t ;
  cin >> n >> s >> t ;
  string answer ;
  int sc = 0 ;
  int tc = 0 ;
  for(int i = 0 ; i < n * 2 ; i++)
  {
    if(i == 0 || i % 2 == 0)
    {
      answer += s.at(sc) ;
      sc++ ;
    }
    else
    {
      answer += t.at(tc) ;
      tc++ ;
    }
    
  }
  cout << answer << endl ;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 100000
#define MAXL 100
typedef long long int lli;

lli h, w, d;
vector<vector<lli>> a_matrix;
vector<pair<lli, lli>> edge2_vec;

lli getAbs(lli x);

int main(){
    cin >> h >> w >> d;
    vector<pair<lli, lli>> num_grid_vec(h * w + 1);
    for(lli i = 0; i < h; i++){
        vector<lli> a_vec;
        for(lli j = 0; j < w; j++){
            lli a_input;
            cin >> a_input;
            num_grid_vec[a_input].first = i;
            num_grid_vec[a_input].second = j;
            a_vec.push_back(a_input);
        }
        a_matrix.push_back(a_vec);
    }

    lli q;
    cin >> q;
    //vector<pair<lli, lli>> edge2_vec;
    for(lli i = 0; i < q; i++){
        pair<lli, lli> edge2_input;
        cin >> edge2_input.first >> edge2_input.second;
        edge2_vec.push_back(edge2_input);
    }

    /*for(lli i = 0; i < h; i++){
        for(lli j = 0; j < w; j++){
            char cprint = (j == w - 1)? '\n' : ' ';
            cout << a_matrix[i][j] << cprint;
        }
    }

    for(lli i = 0; i < q; i++){
        cout << edge2_vec[i].first << " " << edge2_vec[i].second << endl;
    }*/

    /*for(lli i = 1; i < h * w + 1; i++){
        cout << setw(6) << i << " is located at (" << num_grid_vec[i].first << ", " << num_grid_vec[i].second << ")" << endl;
    }*/

    vector<lli> d_vec(h * w + 1);
    for(lli i = 1; i < h * w + 1; i++){
        if(i <= d){
            d_vec[i] = 0;
        }else{
            d_vec[i] = d_vec[i - d] + getAbs(num_grid_vec[i].first - num_grid_vec[i - d].first) + getAbs(num_grid_vec[i].second - num_grid_vec[i - d].second);
        }

        //cout << "d_vec[" << i << "] = " << d_vec[i] << endl;
    }

    for(lli i = 0; i < q; i++){
        cout << d_vec[edge2_vec[i].second] - d_vec[edge2_vec[i].first] << endl;
    }
    return 0;
}

lli getAbs(lli x){
    return (x > 0)? x : (-x);
}

Measured memory_bytes: 5500
### constant

MOD = 1000000007

### classes

class Bit
  @tree = []
  @size = 0

  def initialize(size)
    @size = size
    @tree = Array.new(size + 1){0}
  end

  def sum(i)
    sum = 0
    while i > 0
      sum += @tree[i]
      i -= (i & -i)
    end
    sum
  end

  def add(i, val)
    while i <= @size
      @tree[i] += val
      i += (i & -i)
    end
  end
end

### main

while true
  $n = gets.strip.to_i
  break if $n == 0

  facts = [1]
  for i in (1..$n)
    facts[i] = (i * facts[i - 1]) % MOD
  end

  words = (1..$n).to_a
  bit = Bit.new($n)

  r = gets.strip.to_i

  r.times do
    si, ti = gets.strip.split(' ').map{|s| s.to_i}
    si -= 1
    ti -= 1
    tmp = words[si]; words[si] = words[ti]; words[ti] = tmp
  end

  count = 0

  for i in (0...$n)
    w = words[$n - 1 - i]
    count = (count + (bit.sum(w - 1) * facts[i]) % MOD) % MOD
    bit.add(w, 1)
  end

  puts count
end

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

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main(){
    int x, y;
    cin >> x >> y;
    if((x+y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }

    int npm = (x+y)/3;
    int n = y -npm;
    int m = x - npm;
    if(n < 0 || m < 0){
        cout << 0 << endl;
        return 0;
    }

    combination c(n+m);
    mint ans = c(n+m,n);
    cout << ans.x << endl;


    return 0;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
const int N = 2e5+5, mod = 1e9+7;
int val[N];
int main() 
{
	int n, cnt = 0;
	cin >> n;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	vector<int> vec(N, -1);
	for(int i=0; i<n; i++)
	{
		int l = lower_bound(vec.begin(), vec.end(), a[i])-vec.begin()-1;
		if(vec[l] == -1) cnt++;
		vec[l] = a[i];
	}
	cout << cnt << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
const ll mod = 1e9 + 7;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    vector<vector<ll>> dp(n + 1, vector<ll>(2));
    dp[0][0] = 0;
    dp[0][1] = INT_MIN;
    rep(i, n)
    {
        dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i]);
        dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i]);
    }
    cout << dp[n][0] << endl;
    return 0;
}


Measured memory_bytes: 6528
n,m,k = map(int,input().split())
root = [i for i in range(n)]
height = [1 for i in range(n)]
def find(n):
  sn = n
  while n != root[n]:
    n = root[n]
  root[sn] = n
  return n
def union(a,b):
  a = find(a)
  b = find(b)
  if a==b:
    return
  elif height[a]>=height[b]:
    height[a] += height[b]
    height[b] = 0
    root[b] = a
  else:
    height[b] += height[a]
    height[a] = 0
    root[a] = b
l = [set() for _ in range(n)]
for i in range(m):
  a,b = map(lambda x:int(x)-1,input().split())
  union(a,b)
  l[a].add(b)
  l[b].add(a)
for i in range(k):
  a,b = map(lambda x:int(x)-1,input().split())
  if find(a)==find(b):
    l[a].add(b)
    l[b].add(a)
print(*[height[find(i)]-len(l[i])-1 for i in range(n)])

Measured memory_bytes: 72696
c11,c12,c13=map(int,input().split())
c21,c22,c23=map(int,input().split())
c31,c32,c33=map(int,input().split())
if c11-c21==c12-c22==c13-c23 and c11-c31==c12-c32==c13-c33:
  print('Yes')
else:
  print('No')

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

int main() {
  
  long long K,A,B;
  cin >> K >> A >> B;

  if(B-A <= 2 || K < A-1) {
    cout << K+1 << endl;
  }else {
    K -= A-1;
    if(K%2 == 0) {
      cout << (B-A)*(K/2)+A << endl;
    }else {
      cout << (B-A)*(K/2)+A+1 << endl;
    }
  }
}






Measured memory_bytes: 256
#include <cstdio>
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
	int x, y;

	while(true)
	{
		cin >> x >> y;
		if (x == 0 && y == 0)
		{
			break;
		}
		else
		{
			if (x <= y)
			{
				printf("%d %d\n", x, y);
			}
			else
			{
				printf("%d %d\n", y, x);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
#include <ext/rope>

#define min3(a,b,c)   min(a,min(b,c))
#define max3(a,b,c)   max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

#define count_one(a) __builtin_popcount(a)  // Returns the number of set bits(1) in a number(a). In long long use __builtin_popcountll(a)
#define parity(i)    __builtin_parity(i)  //even parity 0 and odd parity 1
#define blz(a)       __builtin_clz(a) //Returns the number of leading zeroes in a number(a)
#define btz(a)       __builtin_ctz(a) //Returns the number of trailing zeroes in a number(a)
#define gcd(a,b)     __gcd(a,b)
#define lcm(a,b)     (a*(b/gcd(a,b)))

#define pb   push_back
#define PI   M_PI
#define endl "\n"
#define sc   scanf
#define pf   printf

#define ll  long long
#define ull unsigned long long

#define W(t)            while(t--)
#define rep1(i,n)       for(int i = 0; i < n; i++)
#define rep2(a,b)       for(int i = a; i <= b; i++)
#define rep3(a,b,c)     for(int i = a; i <= b; i+=c)
#define irep(a,b,c)     for(int i = b; i >=a; i-=c)
#define repit(it,type)  for(it = type.begin(); it != type.end(); it++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_cxx;

int main()
{
     IOS
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,n;
    cin>>n;
    cout<<n+n*n+n*n*n<<endl;

     return 0;
}



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

int isInt(float f){
  if(ceil(f) == floor(f))
    return 1;
  else
    return 0;
}

int main(){
    int n, d;
    cin >> n >> d;
    vector<vector<ll>> x(n, vector<ll>(d));
    rep(i, n) {
      rep(j, d) cin >> x[i][j]; 
    }
    float f;
    int ans = 0;
    rep(i, n-1){
      for(int j = i + 1; j < n;j++){
        f = 0;
        rep(k, d){
		    f += pow((x[i][k] - x[j][k]), 2);
        }
//        cout << f << endl;
        ans += isInt(sqrt(f));
      }
    }
  cout << ans << endl;
  }

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
# }}}

def solve():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")

    return 0

if __name__ == "__main__":# {{{
    solve()

# vim: set foldmethod=marker: }}}


Measured memory_bytes: 79852
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,a,b = iim()

if (a%2)^(b%2):
    num = min(a-1,n-b)+1
    print((b-a)//2+num)
else:
    print((b-a)//2)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

size_t N, M;
vector<int> g[int(1e5)];

vector<intmax_t> dp(int(1e5), -1LL);

intmax_t dfs(size_t now) {
    if (~dp[now]) return dp[now];

    intmax_t ret = 0;
    for (auto next: g[now]) {
        chmax(ret, dfs(next) + 1);
    }

    return dp[now] = ret;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N >> M;

    for (size_t i = 0; i < M; ++i) {
        size_t from, to; cin >> from >> to;
        --from, --to;
        g[from].emplace_back(to);
    }

    intmax_t maxv = 0;
    for (size_t node = 0; node < N; ++node) {
        chmax(maxv, dfs(node));
    }

    cout << maxv << "\n";

    return 0;
}


Measured memory_bytes: 8704
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int H, h, b, e;
  while (cin >> H, H){
    int C[H][5], ans = 0;
    for (int i = 0; i < H; ++i){
      for (int j = 0; j < 5; ++j){
	cin >> C[H-1-i][j];
      }
    }
    bool f = true;
    vector< vector<int> > V;
    while (f){
      f = false;
      for (int i = 0; i < H; ++i){
	b = 0;
	e = 0;
	for (int j = 1; j < 5; ++j){
	  if (C[i][j] && C[i][j-1] == C[i][j]){
	    e = j;
	  }else{
	    if (e - b > 1){
	      f = true;
	      V.push_back({i,b,e});
	    }
	    b = j;
	    e = j;
	  }
	}
	if (e - b > 1){
	  f = true;
	  V.push_back({i,b,e});
	}
      }
      while (!V.empty()){
	h = V.back()[0];
	b = V.back()[1];
	e = V.back()[2];
	V.pop_back();
	ans += C[h][b]*(e-b+1);
	for (int i = h; i < H; ++i){
	  for (int j = b; j <= e; ++j){
	    if (i+1 < H){
	      C[i][j] = C[i+1][j];
	    }else{
	      C[i][j] = 0;
	    }
	  }
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3012
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),m=sc.nextInt();
		int k = sc.nextInt();
		int[] x=new int[n*m];
		int l = 0;
		for(int t=1;t<=k;t++){
			int u=sc.nextInt();
			for(int i=0;i<u;i++){
				x[l] = t;
				l++;
			}
		}
		l = 0;
		int[][] y=new int[n][m];
		for(int i=0;i<n;i++){
			if(i%2==0){
				for(int j=0;j<m;j++){
					y[i][j] = x[l];
					l++;
				}
			}
			else{
				for(int j=m-1;j>=0;j--){
					y[i][j] = x[l];
					l++;
				}
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				System.out.print(y[i][j]+" ");
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 31684
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
    #define chmin(a, b) a = min(a, b)
    #define chmax(a, b) a = max(a, b)
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<ll, ll>;
     
const int MOD = 1e9 + 7;



int main(){
   int n;
   cin >> n;
   vector<int> p(n);
   rep(i, n)cin >> p[i];
   sort(ALL(p), greater<int>());
   ll res = 0;
   rep(i, n){
      if(i == 0)res += p[i] / 2;
      else res += p[i];
   }
   cout << res << endl;
}


Measured memory_bytes: 3624