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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  string s;
  cin >> s;
  if(s.length()==1){
    cout << 0 << endl;
    return 0;
  }
  vector<char> t(s.length());
  int count=0;
  for(int i=0;i<s.length();i++){
    if(s[i]!='x'){
      t[count]=s[i];
      count++;
    }
  }
  for(int i=0;i<count/2;i++){
    if(t[i]!=t[count-i-1]){
      cout << -1 << endl;
      return 0;
    }
  }
  vector<int> kosuu(s.length(),0);
  int now=0;
  for(int i=0;i<s.length();i++){
    if(s[i]=='x') kosuu[now]++;
    else now++;
  }
  now++;
  int ans=0;
  for(int i=0;i<now/2;i++){
    ans+=max(kosuu[i]-kosuu[now-i-1],kosuu[now-i-1]-kosuu[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n:usize,
    }
    let mut out = String::with_capacity(n * 2);
    let mut results = vec![0; n];
    let n_dash = (n as f64).sqrt() as usize + 1;
    for x in 1..=n_dash {
        let x2 = x.pow(2);
        for y in 1..=n_dash {
            let y2 = y.pow(2);
            let xy = x2 + y2 + x * y;
            if xy < n {
                for z in 1..=n_dash {
                    let r = xy + z.pow(2) + x * z + y * z;
                    if r > n {
                        break;
                    }
                    results[r - 1] += 1;
                }
            } else {
                break;
            }
        }
    }
    for v in results.iter() {
        out.push_str(&format!("{}\n", v));
    }
    out
}

test! {
    "20" => include_str!("c1_out.txt"),
}


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

int main(){
  int n;
  cin>>n;
  vector<int> v_even(n/2),v_odd(n/2);
  map<int,int> even,odd;
  for(int i=0;i<n;++i){
    if(i%2==0){
      cin>>v_even.at(i/2);
      even[v_even.at(i/2)]=even[v_even.at(i/2)]+1;
    }
    else{
      cin>>v_odd.at((i-1)/2);
      odd[v_odd.at((i-1)/2)]=odd[v_odd.at((i-1)/2)]+1;
    }
  }

  int count_even=0;
  int mord_even=0;
  for(auto p:even){
    if(p.second>count_even){
      count_even=p.second;
      mord_even=p.first;
    }
  }

  int count_odd=0;
  int mord_odd=0;
  for(auto p:odd){
    if(p.second>count_odd){
      count_odd=p.second;
      mord_odd=p.first;
    }
  }

  if(mord_even!=mord_odd){
    cout<<n-(count_even+count_odd)<<endl;
  }
  else{
    even.erase(mord_even);
    odd.erase(mord_odd);
    if(even.size()==0 && odd.size()==0){cout<<n/2<<endl;}
    else if(even.size()==0){
      int count_odd2=0;
      int mord_odd2=0;
      for(auto p:odd){
        if(p.second>count_odd2){
          count_odd2=p.second;
          mord_odd2=p.first;
        }
      }
      cout<<(n/2)-count_odd2<<endl;
    }
    else if(odd.size()==0){
      int count_even2=0;
      int mord_even2=0;
      for(auto p:even){
        if(p.second>count_even2){
          count_even2=p.second;
          mord_even2=p.first;
        }
      }
      cout<<(n/2)-count_even2<<endl;
    }
    else{
      int count_odd2=0;
      int mord_odd2=0;
      for(auto p:odd){
        if(p.second>count_odd2){
          count_odd2=p.second;
          mord_odd2=p.first;
        }
      }
      int count_even2=0;
      int mord_even2=0;
      for(auto p:even){
        if(p.second>count_even2){
          count_even2=p.second;
          mord_even2=p.first;
        }
      }
      cout<<min(n-(count_odd+count_even2),n-(count_even+count_odd2))<<endl;
    }
  }

}


Measured memory_bytes: 5376
#!ruby -na
f=->n,m,a,b{a/m*n*~-n/2+(a%=m
a>0?f[y=(n*a+b%=m)/m,a,m,(x=b-m*y)%a]+y*=n+x/a:0)}
p f[*$F.map(&:to_i)]if$.>1

Measured memory_bytes: 14276
import java.util.*;

class Main{
	public static void main(String[] args){
		Solve s = new Solve();
		s.solve();
	}	
}

class Solve{
	Solve(){}
	
	Scanner in = new Scanner(System.in);

	double EPS = 1e-9;

	void solve(){
		int n = in.nextInt();

		System.out.println((int)(Math.log(n) / Math.log(3) - EPS) + 1);
	}
	
}

// while(in.hasNext()){
		// 	int n = in.nextInt();
		// 	if(n == 0) return;
			
		// }

Measured memory_bytes: 26392
//Don't give up too easy bhai
#pragma GCC optimize("-O3")
 
#include<bits/stdc++.h>
using namespace std;

#define int long long int
#define double long double
#define inf 1e18

typedef pair<int,int> pii;
 
#define forall(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define minv(a) *min_element(all(a))
#define maxv(a) *max_element(all(a))
#define vi vector<int>
#define vd vector<double>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007
#define br cout<<"\n"
#define whatis(x) cerr << "var "<<#x << " ==> " << x<<"\n"
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define T int __t;cin>>__t;while(__t--)

void solve()
{
    
}

signed main()
{
    fast;

    int ans=0,d,l,r;cin>>l>>r>>d;

    forall(i,l,r+1)
    {
        if(i%d==0) ans++;
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N, Y;
    cin>>N>>Y;
    int i, j;
    bool found = false;
    for (i = 0; i <= N && !found; ++i) {
        for (j = 0; j <= N - i && !found; ++j) {
            int s, nr;
            s = (Y - i*5000 - j * 10000);
            nr = (Y - i*5000 - j * 10000) / 1000;
            if (s % 1000 == 0 && i + j + nr == N) {
                cout<<j<<' '<<i<<' '<<nr<<endl;
                found = true;
            }
        } 
    } 
    if (!found) cout<<"-1 -1 -1"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
 
int main(){
    int N, d;
    cin >>N;
    int ans =0;
    int mochi[110] = {};
 
    for(int i =0 ; i < N; i++){
        cin >> d;
        if(mochi[d] == 0) ans++;
        mochi[d]++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<stdlib.h>
using namespace std;
int main() {
	string a, b;
	cin >> a >> b;
	int x = stoi(a + b);
	for (int i = 0; i < 1000000; i++) {
		if (i * i == x) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";

}

Measured memory_bytes: 3584
object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val r = scanner.nextInt()
  val c = scanner.nextInt()

  val inputs = (1 to r).map {
    _ => (1 to c).map(_ => scanner.nextInt())
  }

  val row_sum = inputs.map { row =>
    row :+ row.sum
  }
  val column_sum = row_sum.foldLeft(Vector.fill(c+1)(0)) { (acc, row) =>
    (acc zip row).map(t => t._1 + t._2)
  }

  val outputs = row_sum :+ column_sum

  outputs.map(_.mkString(" ")).foreach(println)
}

Measured memory_bytes: 60184
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
      	int y1 = sc.nextInt();
      	int x2 = sc.nextInt();
      	int y2 = sc.nextInt();
      	int xdif = x2 - x1;
      	int ydif = y2 - y1;
        int x3 = x2 - ydif;
        int y3 = y2 + xdif;
      	int x4 = x1 - ydif;
      	int y4 = y1 + xdif;
      	System.out.println(x3+" "+y3+" "+x4+" "+y4);
    }
}

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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	int A, B;
	cin >> A >> B;
	if (A >= 13)cout << B << endl;
	else if (A >= 6)cout << B / 2 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;
int n, m, res = 1e9;
struct point {
	int b, e, ck;
	bool operator<(const point &p)const {
		return b < p.b;
	}
}w[410];
int D1[410][410], D2[410][410];
int main() {
	int i, RM = 0, j, k, MX = 0;
	scanf("%d%d", &n, &m);
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &w[i].b, &w[i].e);
		if (i <= m)w[i].ck = 1;
		else w[i].ck = 2;
		MX = max(MX, w[i].e);
	}
	sort(w + 1, w + n + 1);
	priority_queue<int>PQ;
	int pv = 1;
	for (i = 1; i <= MX; i++) {
		while (pv <= n && w[pv].b == i) {
			PQ.push(-w[pv].e);
			pv++;
		}
		while (!PQ.empty() && -PQ.top() < i)PQ.pop();
		if (!PQ.empty())RM++, PQ.pop();
	}
	printf("%d\n", RM);
	for (i = 0; i <= MX; i++)for (j = 0; j <= MX; j++)D1[i][j] = 1e9, D2[i][j] = 1e9;
	D1[0][0] = D2[0][0] = 0;
	for (i = 0; i <= MX; i++) {
		for (j = 0; j <= i; j++) {
			if (D1[i][j] > 1e8 && D2[i][j] > 1e8)continue;
			int pv = 1;
			while (pv <= n && w[pv].b <= j)pv++;
			priority_queue<int>PQ2, PQ1;
			for (k = j + 1; k <= i; k++) {
				while (pv <= n && w[pv].b == k) {
					if(w[pv].ck == 2) PQ2.push(-w[pv].e);
					else PQ1.push(-w[pv].e);
					pv++;
				}
			}
			int r2 = D1[i][j], r1 = D2[i][j];
			for (k = i + 1; k <= MX; k++){
				while (pv <= n && w[pv].b == k) {
					if (w[pv].ck == 2) PQ2.push(-w[pv].e);
					else PQ1.push(-w[pv].e);
					pv++;
				}
				while (!PQ2.empty() && -PQ2.top() < k)PQ2.pop();
				while (!PQ1.empty() && -PQ1.top() < k)PQ1.pop();
				if (!PQ2.empty()) {
					PQ2.pop();
					r2++;
				}
				if(PQ2.empty())D2[k][i] = min(D2[k][i], r2);
				if (!PQ1.empty()) {
					PQ1.pop();
					r1++;
				}
				if (PQ1.empty())D1[k][i] = min(D1[k][i], r1);
				if (k == MX)res = min(res, min(r1,r2));
			}
		}
	}
	printf("%d\n", res);
}

Measured memory_bytes: 4112
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int m = 26;
const int D = 365;
int c[m];
int s[D][m];
ll tmp[m];

int main(){
	int m = 26;
	rep(i,m) cin >> c[i];
	rep(i,D){
		rep(j,m) cin >> s[i][j];
	}
  rep(j,m) tmp[j] = c[j];
	rep(i,D){
    int num = -1;
    ll mx = 0;
    rep(j,m){
      if(chmax(mx, s[i][j] + tmp[j])){
        num = j;
      }
    }
    cout << num+1 << "\n";
    tmp[num] = 0;
    rep(j,m) tmp[j] += c[j];
  }
}

Measured memory_bytes: 3712
//繝・Φ繝励Ξ
#include <bits/stdc++.h>
#define int long long
#define REP(i,n) for(int i = 0; i < (n); ++i)
#define FOR(i,a,b)  for(int i = (a); i <= (b); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
//constexpr int MOD = 10e9+7;
//constexpr int INF = 1LL << 60;
template <class T> inline bool chmin(T& a, T b){if(a > b){ a = b; return 1;} return 0;}  
template <class T> inline bool chmax(T& a, T b){if(a < b){ a = b; return 1;} return 0;}  
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
//


string S;
int x;
int y;

bool dp[8010][16010];
vector<int> dis_x;
vector<int> dis_y;

bool dpdp(vector<int> dis,int value)
{
   REP(i,8010)REP(j,16010) dp[i][j] = false;
   dp[0][8000] = true;
   int N = dis.size();
   REP(i,N)
   {
      REP(j,16000)
      {
         if(j-dis[i] >= 0)
         {
            dp[i+1][j] |= dp[i][j-dis[i]];
         }
         if(j+dis[i] <= 16000)
         {
            dp[i+1][j] |= dp[i][j+dis[i]];
         }
         
      }
   }
   return dp[N][value +8000];
}

signed main (){
   ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
   cin >> S;
   cin >> x >> y;
   int i = 0;
   int mode = true;
   int cnt = 0;
   while(S[i] != '\0') 
   {
      if(S[i] == 'F') 
      {
         cnt ++;
      }
      else
      {
         (mode ? dis_x :dis_y).push_back(cnt) ;
         mode = !mode;
         cnt = 0;
      }
      i++;
   }
   (mode ? dis_x :dis_y).push_back(cnt) ;
   int ini_x = 0;
   if(S[0] = 'F')
   {
      ini_x = dis_x[0];
      dis_x[0] = 0;
   }

   bool ok = dpdp(dis_x,x-ini_x) && dpdp(dis_y,y);
   cout << (ok ? "Yes" : "No") << endl;
   

}

//驛ｨ蛻・・譛蟆丞､
//譖ｴ譁ｰ縺励↑縺・ｴ蜷遺・邏ｯ遨阪ｏ
//莠梧ｬ｡蜈・↓縺励◆縺・・縺・ｂ縺呎ｳ・
//荳邂・園繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Segment Tree(縺溘□縺怜叙蠕涌(logN))
//遽・峇繧剃ｽ募屓繧よ峩譁ｰ縺励◆縺・・Lazy Segment Tree


Measured memory_bytes: 125696
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    int n, m;
    cin >> n>>m;
    cout << (n-1)*(m-1) << endl;
}

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

Measured memory_bytes: 256
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max=0;
        int num[]=new int[n];
        int sum=0;
        for(int i=0;i<n;i++){
            num[i]=sc.nextInt();
            max=Math.max(max,num[i]);
            sum+=num[i];
        }
        System.out.println(sum-max/2);
    }
}

Measured memory_bytes: 23124
N = int(input())
A = [0 for _ in range(N)]
B = [0 for _ in range(N)]
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b

A = A[::-1]
B = B[::-1]
R = [0 for _ in range(N)]
for i, (a, b) in enumerate(zip(A, B)):
    r = a % b
    if r > 0:
        r = b - r
    R[i] = r

ans = R[0]
for i in range(1, N):
    r = R[i]
    r = r - ans
    r = r % B[i]
    ans += r

print(ans)


Measured memory_bytes: 54320
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c; cin >> a >> b >> c;
  if((c-a)*(c-b) < 0) cout << "Yes" << endk;
  else cout << "No" << endk;
  return 0;
}


Measured memory_bytes: 3552
n = int(input())
li = list(map(int,input().split()))

s = sum(li)
size = s / 2
plus = 0

for i in li:
    plus += i
    if plus >= size:
        mid = i
        break

ans_x = plus * 2 - s
ans_y = s - (plus - mid) * 2

if size == plus:
    ans_x = 0 

print(min(ans_x,ans_y))


Measured memory_bytes: 26220
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
std::vector<int> v;
int e=2,o=1;
while(v.size()!=n){ 
v.push_back(e);
    e=e+2;
}
 
while(v.size()!=(n+m)){ 
v.push_back(o);
    o=o+2;
}
int c=0;
int x= v.size();
for(int i=0;i<x;i++){
    for(int j=i+1;j<x;j++){
        if((v[i]+v[j])%2==0)
            c++;
    }
}
cout<<c;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
 ll n;sc(n);
 vector<string>s(n);
 string a;
 map<string,ll>hash;

 rep(i,0,n){
  sc(a);s[i]=a;
  sort(s[i]);
  ans+=hash[s[i]];
  //cout<<"i:"<<hash[s.at(i)]<<" s:"<<s.at(i)<<" ans:"<<ans<<endl;
  hash[s[i]]++;
 }
  
 pr(ans);
  return 0;}

Measured memory_bytes: 13960
S = [x for x in input()]
b = 101
e = 0

for k in range(len(S)):
    if S[k]=="C":
        b = k
        break

for k in range(1,len(S)):
    if S[-k]=="F":
        e = len(S)-k
        break

print("Yes" if b<e else "No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define X first
#define Y second

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

const int INF = 1e9;


int main(){
	int ans = INF;
	int n, w, d;
	vector<pair<int,pii> > vr;

	cin >> n >> w >> d;
	int N = 2*(w+d);
	rep(i,n){
		int x, y;
		char f;
		cin >> x >> y >> f;
		int l, r;
		if( f == 'W' ){
			l = 2*w + d - x + y;
			r = N + x - d + y;
		}
		if( f == 'E' ){
			l = x + d - y;
			r = 2*w + d - x - y;
		}
		if( f == 'N' ){
			l = 2*w + d + y + x;
			r = N + d - y + x;
		}
		if( f == 'S' ){
			l = 2*w + d - y - x;
			r = 2*w + d + y - x;
		}
		//cout << l << " " << r << endl;
		for(;r<5*N; r+=N, l+=N){
			vr.eb( r, pii(i, l) );
		}
	}
	sort( all(vr) );

	int start=N-1;
	rep(i,n+1){
		int cl = 0;
		auto cur = vr.begin();
		while( cur->X < start ) cur++;
		start = max(start+1, cur->X);
		int cnt = 0, sum = 0;
		bool f[1005] = {};
		for(;cnt < n; cur++){
			int r  = cur->X;
			int id = cur->Y.X;
			int l  = cur->Y.Y;
			if( f[id] ) continue;
			if( cl < l ){
				cl = r;
				sum++;
			}
			f[id] = true;
			cnt++;
		}
		ans = min(ans, sum);
	}

	cout << ans << endl;
}

Measured memory_bytes: 3220
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        scanner.nextLine();
        long[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToLong(Long::parseLong).toArray();
        long sum = Arrays.stream(n).sum();
        for (int i = 1; i < n.length; i++) {
            n[i] += n[i - 1];
        }
        long min = Long.MAX_VALUE;
        for (int i = 0; i < n.length; i++) {
            n[i] *= 2;
            min = Math.min(min, Math.abs(sum - n[i]));
        }
        System.out.println(min);
    }

}



Measured memory_bytes: 81612
#include<stdio.h>
int main(void)
{
	int s;
	int a, b, c;
	scanf("%d", &s);
	a=s/3600;
	b=s%3600;
	printf("%d:", a);
	a=b/60;
	b=b%60;
	printf("%d:%d\n", a, b);
	return 0;
}

Measured memory_bytes: 1020
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s: String = sc.next()
    for (i in 0 until s.length) {
        if (s[i] == ',') {
            print(' ')
        } else {
            print(s[i])
        }
    }
    println()
}


Measured memory_bytes: 31144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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; }
 
int main(){
    string S;
    cin >> S;
    string res = "AC";
    if (S[0] != 'A') res = "WA";
    ll c = 0;
    FOR(i, 2, S.size()-1) {
        if (S[i]=='C') c++;
        else if (isupper(S[i])) res = "WA";
    }
    if (isupper(S[1])) res = "WA";
    if (isupper(S[S.size()-1])) res = "WA";
    if (c != 1) res = "WA";
    cout << res << "\n";
}


Measured memory_bytes: 256
//45
#include<iostream>
#include<cmath>
#include<iomanip>
#include<complex>

using namespace std;

int main(){
  int no=0;
  for(int n;cin>>n,n;){
    typedef complex<double> P;
    int x,xx,y,yy;
    cin>>x>>y>>xx>>yy;
    P p(x,y);
    P l=P(xx,yy)-p;
    double area=0;
    for(int i=0;i<n-2;i++){
      int x,y;
      cin>>x>>y;
      P ll=P(x,y)-p;
      area+=-(l.real()*ll.imag()-l.imag()*ll.real())/2;
      l=ll;
    }
    no++;
    cout<<no<<' '<<fixed<<setprecision(1)<<area<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
    int N;
    int L;
    int i;
    int ap[201];
    scanf("%d %d",&N,&L);
    for(i=1;i<=N;i++){
        ap[i]=L+i-1;
    }
    int sum=0;
    int k;
    for(k=1;k<=N;k++){
        sum+=ap[k];
    }
    int pie;
    if(L>=0){
        pie = sum-L;
    }
    else if(L+N>=1){
        pie=sum;
    }
    else{
        pie=sum -(L+N)+1;
    }
    printf("%d\n",pie);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  int minia,maxa;
  int num = 0;
  rep(j,n){
    rep(i,n-1){
        if(a.at(i) > a.at(i+1) ){
          maxa = a.at(i);
          minia = a.at(i+1);
          a.at(i+1) = maxa;
          a.at(i) = minia;
          num++;
        }
      }
  }
  rep(i,n){
    cout << a.at(i);
    if(i == n-1) break;
    cout << " ";
  }
  cout << endl;
  cout << num << endl;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const int EPS = 1e-9; 

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> H(N+1);
  Graph G(N+1);
  for(int i = 1; i <= N; ++i) cin >> H.at(i); 
  int A, B;
  for(int i = 0; i < M; ++i) {
    cin >> A >> B;
    G.at(A).push_back(B);
    G.at(B).push_back(A);
  }
  int cnt = 0;
  for (int i = 1; i <= N; ++i) {
    if (G.at(i).size() == 0) cnt++;
    else {
      for (int j = 0; j < G.at(i).size(); ++j) {
        if (H.at(i) <= H.at(G.at(i).at(j))) break;
        else if (j == G.at(i).size()-1) {
          // cout << i << endl;
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}

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

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if (a * b % 2 == 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}


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

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

    int a, b;
    int d, r;
    double f;

    std::cin >> a >> b;

    d = a / b;
    r = a % b;
    f = (double)a / (double)b;

    std::cout << std::fixed << std::setprecision(5) << d << " " << r << " " << f << std::endl;
}


Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a, b, k, i;
    map<long long, long long> mp;
    cin >> a >> b >> k;
    for(i=0;i<k;i++){
        if(a+i<=b)mp[a+i]++;
        if(b-i>=a)mp[b-i]++;
    }
    for(auto x : mp){
        cout << x.first <<endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long S;
	cin >> S;

	long long b = 1000000007;

	vector<long long> v(2001, 1);
	v[0] = 0;
	v[1] = 0;
	v[2] = 0;

	for (long long i = 6; i <= 2000; i++) {
		for (long long j = 3; j <= i - 3; j++) {
			v[i] += v[i - j];
			v[i] = v[i] % b;
		}
	}

	cout << v[S] << endl;

	return 0;
}

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

int main()
{
  char c;
  cin >> c;
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel" << endl;
  else  cout << "consonant" << endl;
  
  return 0;
}


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

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;

const int N = 410;
const int Mod = 1e9 + 7;

int n, rk[N];
LL A[N], B[N], C[N], D[N], delt[N], k;
map<uLL, vector<pair<LL, LL> > > M;

bool cmp(int x, int y){
	return C[x] < C[y];
}

int main(){

	scanf("%d%lld", &n, &k);
	For(i, 1, n) scanf("%lld", &A[i]);
	sort(A + 1, A + n + 1);

	For(bit, 0, 60){
		For(j, 1, n) B[j] = A[j] >> bit, C[j] = A[j] & ((1ll << bit) - 1);
		For(j, 1, n) rk[j] = j;
		sort(rk + 1, rk + n + 1, cmp);
		For(pos, 1, n){
			LL L = pos == 1 ? 0 : C[rk[pos - 1]] + 1, R = C[rk[pos]];
			if(L > R) continue;
			LL use = bit;
			
			if(L){
				Forr(i, 60, 0){
					bool a = (L - 1) & (1ll << i), b = R & (1ll << i);
					if(a ^ b){
						++use;
						break;
					}
					if(a) ++use;
				}
			}

			bool ok = true;
			For(i, 1, n){
				if(!B[i] && C[i] < L){
					ok = false;
					break;
				}
				else D[i] = B[i] - (C[i] < L);
			}
			if(!ok || use > k) continue;

			Forr(i, n, 1) D[i] = D[i] - D[i - 1];
			uLL hval = 0;
			For(i, 2, n) hval = (hval * 43894893ull + (D[i] + 463781) * 34267837ull) ^ 38463478328463743ull;

			LL lb = A[1] - D[1], rb = min(A[1] - D[1] + k - use, A[1]);
			if(rb >= lb) M[hval].pb(mp(lb, rb));
		}
	}

	LL ans = 0;
	for(auto S : M){
		sort(S.y.begin(), S.y.end());
		LL maxy = -1;
		for(auto p : S.y){
			if(p.y <= maxy) continue;
			if(p.x <= maxy) (ans += p.y - maxy) %= Mod;
			else (ans += p.y - p.x + 1) %= Mod;
			maxy = p.y;
		}
	}

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

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cmath>
#include <vector>
#include <cstring>
#include <map>

using namespace std;

bool used[10];
bool tabu[10];
int keisu[10];
int ans;
int cnt; // 文字数


void dfs(int k, int sum){
    if (k == cnt) {
        if (sum == 0) {
            ans++;
        }
        return;
    }
    
    for (int i = 0; i < 10; i++) {
        if (used[i] || (i == 0 && tabu[k])) {
            continue;
        }
        used[i] = true;
        dfs(k + 1, sum + i * keisu[k]);
        used[i] = false;
    }
    return;
}

int main(){
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            return 0;
        }
        map<char, int> id;
        vector<string> str(n);
        cnt = 0;
        ans = 0;
        
        for (int i = 0; i < 10; i++) {
            used[i] = false;
            tabu[i] = false;
            keisu[i] = 0;
        }

        for(int i = 0; i < n; i++){
            cin >> str[i];
            string s = str[i];
            for (int j = 0; j < s.size(); j++) {
                if (id.find(s[j]) == id.end()) {
                    id[s[j]] = cnt++;
                }
                if (j == 0 && s.size() > 1) { // 0にならない記号か
                    tabu[id[s[j]]] = true;
                }
                if (i != n - 1) {
                    keisu[id[s[j]]] += pow(10, s.size() - j - 1);
                }else{
                    keisu[id[s[j]]] -= pow(10, s.size() - j - 1);
                }
            }
        }
        dfs(0, 0);
        cout << ans << endl;
    }
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(ll i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define j1 j1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int N,K; cin>>N>>K;

  ll v[N];

  ll ans=0;

  rep(i,N){
    cin>>v[i];
  }

  rep(l,N+1){
    rep(r,N+1-l){
      int ks=K-l-r;
      if(ks<0) continue;
      ll temp=0;
      vector<ll> ve;

      rep(i,l){
        temp+=v[i];
        ve.emplace_back(v[i]);
      }
      rep(i,r){
        temp+=v[N-1-i];
        ve.emplace_back(v[N-1-i]);
      }

      SORT(ve);

      rep(i,ve.size()){
        if(!ks--) break;
        if(ve[i]>=0) break;
        temp-=ve[i];
      }

      maxi(ans,temp);
    }
  }

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define MAX 1000000007

struct Card {
    char name;
    int number;
};

int partition(vector<Card> &array, int p, int r)
{
    Card v = array[r];
    int i = p - 1;
    int j = p;
    for (int j = p; j < r; j++)
    {
        if (array[j].number <= v.number)
        {
            i++;
            Card t = array[i];
            array[i] = array[j];
            array[j] = t;
        }
    }
    i++;
    Card t = array[i];
    array[i] = v;
    array[r] = t;
    return i;
}

void quickSort(vector<Card>& array,int p, int r) {
    if(p < r) {
        int q = partition(array, p, r);
        quickSort(array, p, q-1);
        quickSort(array, q+1, r);
    }
}

void merge(vector<Card>& array, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    vector<Card> array1, array2;
    for(int i=0; i<n1; i++) {
        array1.push_back(array[left + i]);
    }
    Card maxCard = {'x', MAX};
    array1.push_back(maxCard);
    for(int i=0; i<n2; i++) {
        array2.push_back(array[mid+i]);
    }
    array2.push_back(maxCard);
    int c1 =0, c2 = 0;
    for(int i=0; i<n1+n2; i++) {
        if(array1[c1].number <= array2[c2].number) {
            array[left + i] = array1[c1];
            c1++;
        } else {
            array[left + i] = array2[c2];
            c2++;
        }
    }
}

void mergeSort(vector<Card> &array, int left, int right) {
    if(left+1<right) {
        int mid = (left+right)/2;
        mergeSort(array, left, mid);
        mergeSort(array, mid, right);
        merge(array, left, mid, right);
    }
}
int main() {
    int num;
    cin >> num;
    vector<Card> cardSet;  
    vector<Card> cardSetForMerge;  
    for(int i=0; i<num; i++) {
        char c;
        int n;
        cin >> c >> n;
        Card card = {c,n};
        cardSet.push_back(card);
        cardSetForMerge.push_back(card);
    }

    quickSort(cardSet, 0, num-1);
    mergeSort(cardSetForMerge, 0, num);

    int index = 0;
    for(; index<num; index++) {
        if(cardSet[index].name != cardSetForMerge[index].name) {
            cout << "Not stable" << endl;
            break;
        }
    }
    if(index == num) {
        cout << "Stable" << endl;
    }

    for(int i=0; i<num; i++) {
        cout << cardSet[i].name << " " << cardSet[i].number << endl;
    }
}



Measured memory_bytes: 5732
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.nextLine();
		
		List<String> terms = Arrays.asList("eraser", "erase", "dreamer", "dream");
		
		
		
		for(String tar : terms) {
			s = s.replaceAll(tar, "");
		}
		
		if(s.equals("") || s.isEmpty()) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
		
		
	}

}


Measured memory_bytes: 29260
N, Y, Z = map(int, input().split())
As = list(map(int, input().split()))
dpx, dpy = [0]*(N-1), [0]*(N-1)
#dpx[i] = min(dpy[i+1]...dpy[N-2], abs(As[N-1]-As[i]))
#dpy[i] = max(dpx[i+1]...dpx[N-2], abs(As[N-1]-As[i]))
for i in range(N-2, -1, -1):
    mny, mxx = 10**10, 0
    for j in range(i+1, N-1):
        mny = min(mny, dpy[j])
        mxx = max(mxx, dpx[j])
    dpx[i] = min(mny, abs(As[N-1]-As[i]))
    dpy[i] = max(mxx, abs(As[N-1]-As[i]))
dpx.append(abs(As[N-1]-Z))
print(max(dpx))


Measured memory_bytes: 42588
N,M = map(int, input().split())
AC = [0]*N
WA = [0]*N
for _ in range(M):
    p,s = input().split()
    if AC[int(p)-1] == 0:
        if s == "WA":
            WA[int(p)-1] += 1
        elif s == "AC":
            AC[int(p)-1] = 1
print(sum(AC),sum(w*a for w,a in zip(WA,AC)))

Measured memory_bytes: 4724
#include <iostream>

using namespace std;

int main()
{
    string a, b;
    cin>>a>>b;
    for(int i = 0; i <= a.size() - 1; i++)
    if(a[i] != b[i]){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");
   return 0;
}




Measured memory_bytes: 3620
import sys
input = sys.stdin.readline
from sys import setrecursionlimit
setrecursionlimit(10**9)

def inpl(): return list(map(int, input().split()))
N, M = inpl()
MOD = 10**9 + 7
A = [1]*(N+3)
A[N+2] = 0
A[N+1] = 0
for _ in range(M):
    a = int(input())
    A[a] = 0

DP = [0]*(N+3)
DP[0] = 1
for i in range(N):
    DP[i+1] = ((DP[i+1] + DP[i])*A[i+1])%MOD
    DP[i+2] = ((DP[i+2] + DP[i])*A[i+2])%MOD
print(DP[N]%MOD)

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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

// chmax, chmin
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; }

using pint = pair<int,int>;

tuple<vector<int>,int> maxpos( vector<int> x ){
    vector<int> ans;
    int xmax = 0;
    REP(i,x.size()){
        xmax = max(xmax,x[i]);
    }
    //cout << "max" << xmax << endl;
    REP(i,x.size()){
        if ( xmax == x[i] ) ans.push_back(i);
    }
    return forward_as_tuple(ans,xmax);
}

int main() {
    int H,W,M;
    cin >> H >> W >> M;
    vector<int> h(M),w(M);
    vector<int> x(H,0),y(W,0);
    set<pint> st;
    REP(i,M) {
        int a,b;
        cin >> a >> b; --a; --b;
        h[i] = a; w[i] = b;
        x[h[i]] += 1;
        y[w[i]] += 1;
        st.insert(pint(h[i],w[i]));
    }
    
    vector<int> xmax,ymax;
    int xl,yl;
    tie(xmax,xl) = maxpos(x); tie(ymax,yl) = maxpos(y);
    
    
    
    int ans = xl + yl - 1;
    for ( auto xx: xmax ) {
        for ( auto yy: ymax ){
            if ( st.find(pint(xx,yy)) == st.end() ){
                ++ans;
                goto OUT;
            }
        }
    }
    OUT:
    cout << ans << endl;
    
    return 0;
}

/*
 3 3 3
 1 1
 2 2
 3 3
 -> ans = 2
 */


Measured memory_bytes: 27548
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair
#define deb(x) cout << #x << " --> " << x << endl;
#define deb1a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
        cout << it << " ";        \
    cout << endl;
#define deb2a(v)                  \
    cout << #v << "--->" << endl; \
    for (auto it : v)             \
    {                             \
        for (auto it1 : it)       \
        {                         \
            cout << it1 << " ";   \
        }                         \
        cout << endl;             \
    }
#define deb3a(v)                               \
    cout << #v << "-->" << endl;               \
    for (auto it : v)                          \
    {                                          \
        cout << it.fi << " " << it.se << endl; \
    }
#define mod 1000000007
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
#define db1(x) cout << #x << "=" << x << endl
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int mI(int a, int m)
{
    return power(a, m - 2, m);
}
vector<vector<int>> dir = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

#define MAXN 10000001
#define double long double



void solve()
{
    int n;
    cin >> n;
    cout << 1 - n;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);
    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;
        
        solve();
    }
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int h,w; cin>>h>>w;
  char x='0';
  int y=-1;
  rep(i,h) rep(j,w)
  {
    string s; cin>>s;
    if(s=="snuke")
    {
      x='A'+j;
      y=i+1;
    }
  }
  cout<<x<<y<<endl;


  return 0;
}

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


int main() {
	int N;
	cin >> N;
	int A[N];
	int A_sort[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		A_sort[i] = A[i];
	}
	sort(A_sort, A_sort + N);
	for (int i = 0; i < N; i++) {
		int ret;
		if (A[i] == A_sort[N-1]) ret = A_sort[N-2];
		else ret = A_sort[N-1];
		cout << ret << endl;
	}
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846

ll pow(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}

vvi allsubsets;

void generate(vi c,int n,vi res){
	if(c.size() == 0){
		if(res.size() > 0)
		allsubsets.pb(res);
		return;
	}

	vi cx;
	fo(i,1,c.size())cx.pb(c[i]);
	vi resx;
	fo(i,0,res.size())resx.pb(res[i]);
	if(c.size() > 0)
	resx.pb(c[0]);

	generate(cx,n,res);
	generate(cx,n,resx);

	}


int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
 //    int t;
 //     cin >> t;

 //     while(t--){

 // }

int n,m,x;
cin >> n >> m >> x;
vi c(n);
int mat[n][m];
fo(i,0,n){
	cin >> c[i];
	fo(j,0,m){
		cin >> mat[i][j];
	}
}
vi res;
vi ind;
fo(i,0,n)ind.pb(i);
generate(ind,n,res);
int mi = 1e9;
for(auto a : allsubsets){
	int sum = 0;
	vi sec(m);
	for(auto b : a){
		sum += c[b];

	}
	for(auto b: a){
		// cout << b << ' ';
		for(int j = 0;j < m;j++)sec[j] += mat[b][j];
	}

	int flag = 1;
	
		fo(j,0,m){
			if(sec[j] < x){
				flag = 0;
				break;
			}
		}
	
	if(flag){
		mi = min(mi,sum);
	}
}
if(mi == (int)1e9)cout << -1 << endl;
else cout << mi << endl;
return 0;
	
	}




Measured memory_bytes: 3956
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

signed main(){
	int n;
	cin>>n;
	int ans=0;
	vector<int>b(n+1);
	for(int i=1;i<n;++i)cin>>b[i];
	b[0]=b[1];b[n]=b[n-1];
	rep(i,n){
		ans+=min(b[i],b[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256