akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main{

     public static void main(String []args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int sum = 0 ;
        int next = n ;
        for(int i = 0 ; next!=0 ; i++){
            int digit = next%10 ;
            sum+=digit ;
             next = next/10 ;
        }
        if(n%sum== 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
     }
}

Measured memory_bytes: 20820
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define sz(x) (int)(x).size();
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	int n=in();
	int req=(n+999)/1000;req*=1000;
	cout<<req-n;
	
}

Measured memory_bytes: 3684
# 36
n, m = map(int, input().split())
l_max, r_min = -1, float('inf')
for i in range(m):
    li, ri = map(int, input().split())
    l_max = max(l_max, li)
    r_min = min(r_min, ri)

ans = r_min - l_max + 1 if (r_min - l_max >= 0) else 0
print(ans)

Measured memory_bytes: 9124
import sys

input = sys.stdin.readline

def main():
    ans = []
    A, B, C, X, Y = map(int, input().split())
    for i in range(10**5+1):
        ans.append((C*2*i) + (A*max(0, X-i)) + (B*max(0, Y-i)))

    print(min(ans))

if __name__ == '__main__':
    main()

Measured memory_bytes: 7096
//#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    vi v(3);
    REP(i, 3) cin >> v[i];

    sort(ALL(v));

    print(v[0] + v[1]);
}


Measured memory_bytes: 3636
A, B, K = map(int, input().split())
if B - A - 2 * K + 1 <= 0:
    for  i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)


Measured memory_bytes: 3060
#include <iostream>
#include <string.h>
using namespace std;

int main(void) {
	char word[11], str[15];
	int count = 0, i, slen;
	cin >> word;
	while (1) {
		cin >> str;
		if (strcmp(str, "END_OF_TEXT") == 0)
			break;
		slen = strlen(str);
		for (i = 0; i < slen; i++) {
			if ('A' <= str[i] && str[i] <= 'Z')
				str[i] = str[i] - 'A' + 'a';
		}
		if (strcmp(str, word) == 0)
			count++;
	}
	cout << count << endl;
	return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

int main() {
    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    float diff = 1001001000;
    int h;
    int ans;
    rep(i, N) {
        cin >> h;
        float d = abs(A - (T - h * 0.006));
        if (d < diff) {
            diff = d;
            ans = i + 1;
        }
    }

    cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

	vector<int> a;
	inputVector(a, n);

	deque<int> b;
	rep(i, n) {
		if (i % 2) b.push_front(a[i]);
		else b.push_back(a[i]);
	}

	if (n % 2) {
		reverse(all(b));
	}

	rep(i, n) {
		cout << b[i];
		if (i < n - 1) cout << ' ';
	}
	cout << endl;

    return 0;
}


Measured memory_bytes: 3840
package main

import "fmt"

func rev(s string) string {
	r := make([]byte, len(s))
	i, j := len(s)-1, 0
	for i >= 0 {
		r[j] = s[i]
		j++
		i--
	}
	return string(r)
}

func main() {
	var s string
	fmt.Scan(&s)
	var n int
	fmt.Scan(&n)
	var ans []string
	var cmds []string
	for i := 0; i < n; i++ {
		var cmd string
		var a, b int
		fmt.Scan(&cmd, &a, &b)
		cmds = append(cmds, cmd)
		if cmd == "print" {
			ans = append(ans, s[a:b+1])
		} else if cmd == "replace" {
			var r string
			fmt.Scan(&r)
			// ans = append(ans, s[:a]+r+s[b+1:])
			s = s[:a] + r + s[b+1:]
			// ans = append(ans, s)
		} else { // reverse
			s = s[:a] + rev(s[a:b+1]) + s[b+1:]
			// ans = append(ans, s[:a]+rev(s[a:b+1])+s[b+1:])
		}
	}
	// fmt.Println(cmds)
	for i := 0; i < len(ans); i++ {
		fmt.Println(ans[i])
	}
}



Measured memory_bytes: 1284
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int a[3];
int main() {
  for (int i = 0; i < 3; ++i) cin >> a[i];
  sort(a, a+3);
  int res = 0;
  cout << a[0] + a[1] << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<55)+1e9; // ~ 3.6 * 1e16
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> &a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
template<class T>void prArr(T a,string s=" "){Int i=0;for(T t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class CumulativeSum{
public:
  vector<Int> sum;
  CumulativeSum(){}
  CumulativeSum(vector<Int> A){
    Int n = A.size();
    sum.resize(n+1,0);
    for(Int i=1;i<=n;i++) sum[i] += sum[i-1] + A[i-1];
  }
  Int get(Int l,Int r){assert(l<=r && l>=0 && r<=(Int)sum.size());return sum[r] - sum[l];} //[l,r)
};


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int n,K;
  cin>>n>>K;
  vector<Int> A(n);
  cin>>A;
  
  Int ans = INF;
  for(Int i=0;i<n;i++){
    Int l = i, r = i + K - 1;
    Int cost;
    if(i + K - 1 >= n) continue;
    if(A[l] <= 0 && A[r] <= 0) cost = max(abs(A[l]), abs(A[r]));
    else if(A[l] >= 0 && A[r] >= 0) cost = max(abs(A[l]), abs(A[r]));
    else{
      cost = min(2 * abs(A[l]) + abs(A[r]), abs(A[l]) + 2*(A[r]));
    }
    Min(ans, cost);
  }
  cout<<ans<<endl;
  
  
  return 0;
}


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

using namespace std;

#define int long long
#define u64 unsigned long long
#define u32 unsigned int
#define reg register
#define Raed Read
#define debug(x) cerr<<#x<<" = "<<x<<endl;
#define rep(a,b,c) for(reg int a=(b),a##_end_=(c); a<=a##_end_; ++a)
#define ret(a,b,c) for(reg int a=(b),a##_end_=(c); a<a##_end_; ++a)
#define drep(a,b,c) for(reg int a=(b),a##_end_=(c); a>=a##_end_; --a)
#define erep(i,G,x) for(reg int i=(G).Head[x]; i; i=(G).Nxt[i])

inline int Read() {
	int res = 0, f = 1;
	char c;
	while (c = getchar(), c < 48 || c > 57)if (c == '-')f = 0;
	do res = (res << 3) + (res << 1) + (c ^ 48);
	while (c = getchar(), c >= 48 && c <= 57);
	return f ? res : -res;
}

template<class T>inline bool Min(T &a, T const&b) {
	return a > b ? a = b, 1 : 0;
}
template<class T>inline bool Max(T &a, T const&b) {
	return a < b ? a = b, 1 : 0;
}

const int N = 1e4+5,M = 2e5 + 5,mod = 99999997;

bool MOP1;

int n,m;

bool MOP2;

inline void _main(void) {
	int n=Raed(),m=Raed(),f=0;
	cout<<max(max(n+m,n-m),n*m);
}

signed main() {
#define offline1
#ifdef offline
	freopen("truck.in", "r", stdin);
	freopen("truck.out", "w", stdout);
	_main();
	fclose(stdin);
	fclose(stdout);
#else
	_main();
#endif
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	

	
	ini(n);
	int tmp = 0;
	int morty[3] = {0};
	FOR(i,0,n){
		ins(x);
		if(x[0] == 'B' and x[x.size()-1] == 'A')morty[0]++;
		else if(x[0] == 'B')morty[1]++;
		else if(x[x.size()-1] == 'A')morty[2]++;

		FOR(i1,0,x.size()-1){
			if(x[i1] == 'A' and x[i1+1] == 'B')tmp++;
		}
	}
	if(morty[1] ==0 and morty[2] == 0){
		tmp+=max(0ll,morty[0]-1);
	}
	else{
		tmp+=min(morty[1],morty[2]);
		tmp+=morty[0];
	}
	out(tmp);







	return 0;
}


Measured memory_bytes: 256
import sys

N = int(input())
A = list(map(int, input().split()))
LA = len(A)
ans = A[0]
for j in range(LA):
    if A[j] == 0:
        print('0')
        sys.exit()

for i in range(LA-1):
    ans = ans*A[i+1]
    if ans > 10**18:
        print('-1')
        sys.exit()
        
print(ans)


Measured memory_bytes: 21616
#include <iostream>

using namespace std;

struct Dice
{
    int lable1;
    int lable2;
    int lable3;
    int lable4;
    int lable5;
    int lable6;
};

struct Dice num;

int main()
{
    string cmd;
    
    cin >> num.lable1 >> num.lable2 >> num.lable3 >> num.lable4 >> num.lable5 >> num.lable6;
    cin >> cmd;
    for (int i = 0; i < cmd.length(); i++)
    {
        int tmp = 0;
        if ('N' == cmd[i])
        {
            tmp = num.lable1;
            num.lable1 = num.lable2;
            num.lable2 = num.lable6;
            num.lable6 = num.lable5;
            num.lable5 = tmp;
        }
        else if ('S' == cmd[i])
        {
            tmp = num.lable1;
            num.lable1 = num.lable5;
            num.lable5 = num.lable6;
            num.lable6 = num.lable2;
            num.lable2 = tmp;
        }
        else if ('E' == cmd[i])
        {
            tmp = num.lable1;
            num.lable1 = num.lable4;
            num.lable4 = num.lable6;
            num.lable6 = num.lable3;
            num.lable3 = tmp;
        }
        else if ('W' == cmd[i])
        {
            tmp = num.lable1;
            num.lable1 = num.lable3;
            num.lable3 = num.lable6;
            num.lable6 = num.lable4;
            num.lable4 = tmp;
        }
    }
    
    cout << num.lable1 << endl;
    
    return 0;
}



Measured memory_bytes: 3168
n = gets.chomp.to_i
v = gets.chomp.split.map(&:to_i)

def fetch_max(h, exclude_num: -1) 
  cnt = 0
  num = 0  # Sentinel
  h.each do |k, v|
    if k == exclude_num
      next
    end
    if v > cnt
      cnt = v
      num = k
    end
  end

  [cnt, num]
end

even = v.select.with_index { |_, i| i % 2 == 0 }
odd  = v.select.with_index { |_, i| i % 2 == 1 }

# Calculate max element of even
even_h = {}
even.each do |e|
  even_h[e] ||= 0
  even_h[e] += 1
end
max_even_cnt, max_even_num = fetch_max(even_h)

# p "even num: #{max_even_num}, even cnt: #{max_even_cnt}"

# Calculate max element of odd
odd_h = {}
odd.each do |e|
  odd_h[e] ||= 0
  odd_h[e] += 1
end
max_odd_cnt, max_odd_num = fetch_max(odd_h)

# p "odd num: #{max_odd_num}, odd cnt: #{max_odd_cnt}"

if max_even_num == max_odd_num
  # Use the next largest value of odd
  odd_cnt, _ = fetch_max(odd_h, exclude_num: max_even_num)
  # Use the next largest value of even
  even_cnt, _ = fetch_max(even_h, exclude_num: max_even_num)
  cnt = [odd_cnt + max_even_cnt, even_cnt + max_odd_cnt].max # We use max pattern
else
  cnt = max_even_cnt + max_odd_cnt
end

# p "even num: #{max_even_num}, even cnt: #{max_even_cnt}"
# p "odd num: #{max_odd_num}, odd cnt: #{max_odd_cnt}"

p (n - cnt)

Measured memory_bytes: 16012
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int H,W;
    cin >> H >> W;
    vector<string> V(H);
    rep(i,0,H)cin >> V[i];
    int table[4][H+2][W+2];
    rep(i,0,4)rep(j,0,H+2)rep(k,0,W+2)table[i][j][k] = 0;

    rep(i,0,H)rep(j,0,W){
        if(V[i][j] == '.')table[0][i+1][j+1] = table[0][i+1][j] + 1;
        else table[0][i+1][j+1] = 0;
    }
    rep(i,0,H)rep(j,0,W){
        int jj = W-j;
        if(V[i][jj-1] == '.')table[1][i+1][jj] = table[1][i+1][jj+1] + 1;
        else table[1][i+1][jj] = 0;
    }
    rep(i,0,H)rep(j,0,W){
        if(V[i][j] == '.')table[2][i+1][j+1] = table[2][i][j+1] + 1;
        else table[2][i+1][j+1] = 0;
    }
    rep(i,0,H)rep(j,0,W){
        int ii = H-i;
        if(V[ii-1][j] == '.')table[3][ii][j+1] = table[3][ii+1][j+1] + 1;
        else table[3][ii][j+1] = 0;
    }
    /*
    rep(k,0,4){
        rep(i,0,H+2)rep(j,0,W+2)cout << table[k][i][j] << " \n"[j==W+1];
        cout << endl;
    }
    */
    int maxi = 0;
    rep(i,1,H+1)rep(j,1,W+1){
        int sum = 0;
        rep(k,0,4)sum += table[k][i][j];
        maxi = max(maxi, sum - 3);
    }
    cout << maxi << endl;
}

Measured memory_bytes: 66944
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	string s; cin >> s;

	bool flg = true;
	for (int i = 1; i < s.size()+1; ++i) {
		if (i % 2 == 1 && s[i-1] == 'L')flg=false;
		else if (i % 2 == 0 && s[i-1] == 'R')flg=false;
	}
	if (flg)cout << "Yes";
	else cout << "No";
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

/**
 * Joseph's Potato
 */
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while (!(line = br.readLine()).equals("0 0")) {

			int n = Integer.parseInt(line.substring(0, line.indexOf(' ')));
			int m = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

			Deque<Integer> q = new ArrayDeque<Integer>(n);

			for (int i = 1; i <= n; i++) {
				q.offer(i);
			}

			while (q.size() != 1) {
				for (int i = 0; i < m - 1; i++) {
					q.offer(q.poll());
				}
				q.poll();
			}
			System.out.println(q.poll());

		}

	}

}

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

using namespace std;

using ll = long long;

#define MOD_NUMBER 1000000007

template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}

int main() {
  ll n, m, h, a, b, ans = 0;
  cin >> n >> m;
  vector<pair<int, int>> H(n);
  for (int i = 0; i < n; i++) {
    cin >> h;
    H.at(i) = make_pair(h, 1);
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    if (H.at(a-1).first <= H.at(b-1).first) {
      H.at(a-1) = make_pair(H.at(a-1).first, 0);
    }
    if (H.at(a-1).first >= H.at(b-1).first) {
      H.at(b-1) = make_pair(H.at(b-1).first, 0);
    }
  }
  for (int i = 0; i < n; i++) {
    if (H.at(i).second) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, temp;
    vector <int> v;
    set <int> s;
    cin>>n;
    while(n--) {
        cin>>temp;
        v.push_back(temp);
        s.insert(temp);
    }
    if(s.size()==v.size()) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 10356
#include<stdio.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
using namespace std;

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size()-1;i++) if(s[i]=='A'&&s[i+1]=='C'){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
{- SPDX-License-Identifier: X11
 -
 - Copyright 2020 Elias Yuan <a@jthv.ai>, MIT/X11 License
 -   https://jthv.ai/LICENSE/X11.txt
 -
 - ANU-CPC Observation Workshop - B: Sorted Arrays
 -   2020-05-06
 -}

module Main where

import System.IO (print)

solve :: String -> Int
solve = sol . unDup . strToInts
  where
    strToInts :: String -> [Int]
    strToInts = map (read :: String -> Int) . words

    unDup :: [Int] -> [Int]
    unDup (x:y:ys)
      | x == y    = unDup (y:ys)
      | otherwise = x:unDup (y:ys)
    unDup x = x

    sol :: [Int] -> Int
    sol []  = 0
    sol [_] = 1
    sol (x:y:ys)
      | x < y     = s 1 True (y:ys)
      | x > y     = s 1 False (y:ys)
      | otherwise = error "sol: That shouldn't have been possible"
      where
        s :: Int -> Bool -> [Int] -> Int
        s acc fl (a:b:c:cs)
          | fl == True && a < b || fl == False && a > b = s acc fl (b:c:cs)

          | fl == True && a > b  = if b < c
                                     then s (acc + 1) fl (b:c:cs)
                                     else s (acc + 1) (not fl) (b:c:cs)
          | fl == False && a < b = if b > c
                                     then s (acc + 1) fl (b:c:cs)
                                     else s (acc + 1) (not fl) (b:c:cs)

          | otherwise            = error "s: That shouldn't have been possible"

        s acc fl [a,b]
          | fl == True && a < b || fl == False && a > b = acc
          | fl == True && a > b || fl == False && a < b = acc + 1
          | otherwise                                   = error "s: That shouldn't have been possible"

        s acc _ _ = acc


main :: IO ()
main = getLine >> getLine >>= \x -> print $ solve x


Measured memory_bytes: 36220
import java.io.PrintWriter
val pw = PrintWriter(System.out)


fun main(args: Array<String>) {
    val S = next()

    if(S[0] == S[1] && S[1] == S[2] && S[0] == S[2]){
        println("No")
    }else{
        println("Yes")
    }
}

fun func() {

}



fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextListOfString() = next().split(" ")
fun nextListOfInt() = nextListOfString().map { it.toInt() }
fun nextListOfLong() = nextListOfString().map { it.toLong() }
fun nextListOfDouble() = nextListOfString().map { it.toDouble() }



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

int main() {
  int n;cin>>n;
  vector<int> vec(n);
  rep(i,n)cin>>vec[i];
  int cnt=0,a=0;
  rep(i,n){
    if(a<=vec[i]){
      a=vec[i];
      cnt++;
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3612
use std::cmp::min;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let p: Vec<i32> = (0..n).map(|_| read()).collect();

    let mut ans = 0;
    let mut mini = p[0];

    for p_i in p {
        if mini >= p_i {
            ans += 1;
        }
        mini = min(mini, p_i)
    }

    println!("{}", ans);
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
N = int(input())
T, X, Y = 0, 0, 0
cnt = 0
for _ in range(N):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[N!=cnt::2])
    

Measured memory_bytes: 3316
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<int> h(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h.at(i);
	}

	vector<int> dp(n, inf);

	dp.at(0) = 0;

	for (int i = 1; i < n; i++)
	{
		dp.at(i) = min(dp.at(i), dp.at(i - 1) + abs(h.at(i) - h.at(i - 1)));
		if (i - 2 >= 0)
		{
			dp.at(i) = min(dp.at(i), dp.at(i - 2) + abs(h.at(i) - h.at(i - 2)));
		}
	}

	cout << dp.back() << endl;
}

Measured memory_bytes: 1024
k,s = map(int,input().split())
ans = 0
for x in range(k+1):
    for y in range(x, k+1):
        z = s - x - y
        if y<=z and z<=k:
            tmp = set([x,y,z])
            if len(tmp)==3:
                ans += 6
            elif len(tmp)==2:
                ans += 3
            else:
                ans += 1
print(ans)

Measured memory_bytes: 41436
n, k = map(int, input().split())
p = list(map(int, input().split()))
e = []
for pi in p:
    e.append((pi + 1) / 2)

total = sum(e[:k])
ans = total
for i in range(0, n - k):
    total = total - e[i] + e[i + k]
    ans = max(ans, total)

print(ans)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
struct node{
	int b,num;
}q[200010];
long long a[200010];
int cmp(const node&x,const node&y)
{
	if(x.b!=y.b)
	 return x.b<y.b;
	return x.num<y.num;
}
int main()
{
	int n,i,l;
	long long k,ans=0;
	scanf("%d%lld",&n,&k);
	for(i=1;i<=n;i++)
	 {
	 	scanf("%lld",&a[i]);
	 	a[i]+=a[i-1];
	 	q[i].b=(((a[i]-i)%k)+k)%k;
	 	q[i].num=i;
	 }
	sort(q+1,q+n+1,cmp);
	l=0;
	for(i=1;i<=n;i++)
	 if(q[i].b==q[i-1].b)
	  {
	  		while(q[i].num-q[l].num>=k)
	  		 l++;
	  		ans+=i-l;
	  }
	else
	 l=i;
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}
int digits(int n)
{
	int count = 0;
	while (n > 0)
	{
		n /= 10;
		count++;
	}
	return count;
}
ll combination(ll n, ll r)
{
	if (r * 2 > n)
		r = n - r;
	ll dividend = 1;
	ll divisor = 1;
	for (ll i = 1; i <= r; ++i)
	{
		dividend *= (n - i + 1);
		divisor *= i;
	}
	return dividend / divisor;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}
vector<int> divisor(int n)
{
	vector<int> value;
	FOR(i, 1, pow(n, 0.5) + 1)
	{
		if (i <= sqrt(n))
		{
			if (n % i == 0)
			{
				value.push_back(i);
				if (i * i != n)
				{
					value.push_back(n / i);
				}
			}
		}
	}
	return value;
}

int main()
{
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,n)cin>>a[i];
	int cnt=1;
	int ans=0;
	rep(i,n){
		if(a[i]==a[i+1]){
			cnt++;
		}else{
			ans+=cnt/2;
			cnt=1;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		float r = 0;
		for (int i = 0; i < n; i++)
			r += 1f / (float) in.nextInt();
		System.out.println(1 / r);
	}
}

Measured memory_bytes: 21588
(* O(n^2) *)
open String
let s = read_line ()
let n = length s
let rec find i =
  let m = n - i in
  if sub s 0 @@ m / 2 = sub s (m / 2) @@ m / 2 then m
  else find @@ i + 2
let _ = Printf.printf "%d\n" @@ find 2

Measured memory_bytes: 384
using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#define out(S) cout<<(S)<<endl;
#define mod(i) ((i)%(ll)(1000000000 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define For(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFor(i,a,b) for(size_t i=(a)-1;i>=(b);i--)
#define Rep(i,a) for(size_t i=0;i<(a);i++)
#define rRep(i,a) for(size_t i=(a)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)

vector<int> makeFactor(int x) {
	vector<int> factors;
	factors.push_back(2);
	for (size_t i = 3; i <= sqrt(x); i+=2)
	{
		bool flag = false;
		Foreach(item, factors) if (i%item == 0) { flag = true; break; }
		if (!flag) factors.push_back(i);
	}
	return factors;
}

int main(){
	vector<string> A;
	string B;
	int N, M;
	cin >> N >> M;
	A.resize(N);
	Rep(i, N) {
		cin >> A[i];
	}
	Rep(i, M) {
		string a;
		cin >> a;
		B += a;
	}

	Rep(i, N - M + 1) {
		For(n, 0, N - M + 1) {
			string s = "";
			Rep(k, M) {
				s += A[k + i].substr(n, M);
			}
			if (s == B) { out("Yes"); return 0; }
		}
	}
	out("No");
}



Measured memory_bytes: 256
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var n = toInt(input[0]);
	var as = toIntArr(input[1].split(' '));
	var ans = 0;
	for(var i = 0; i < n-1; i++){
		if(as[i]===as[i+1]){
			ans++;
			as[i+1] = 200 + i;
		}
	}
	console.log(ans);
}

Measured memory_bytes: 22332
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	int x=(n+1)/2;
	double ans=(double)x/(double)n;
	printf("%.7lf\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;


int main (){
    ll X,Y;
    cin >> X >> Y;
    ll ans = 0;
    
    while(X<=Y) {
        X*=2;
        ans++;
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int n;
int a[100010];
pair<int,int>x[100010];
pair<int,int>y[100010];

int main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		if (i % 2 == 0) {
			x[a[i]].first++;
			x[a[i]].second = a[i];
		}
		else {
			y[a[i]].first++;
			y[a[i]].second = a[i];
		}
	}
	sort(x, x + 100005);
	sort(y, y + 100005);

	if(x[100004].second!=y[100004].second)cout << n - (x[100004].first + y[100004].first) << endl;
	else cout <<n-( max(x[100003].first+y[100004].first,x[100004].first+y[100003].first))<< endl;
	getchar();
	getchar();
	return 0;
}

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

int main()
{
    int n, x, t;
    cin >> n >> x >> t;
    if(n % x == 0)
        cout << (n / x)*t << endl;
    else
        cout << (n / x)*t+t << endl;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;
typedef pair< int, P > PP;

//-------------------------------------------------

string s;
ll dp[100010][4]; // 0: ?, 1: A, 2: AB, 3: ABC
const int MOD = 1e9 + 7;

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

    cin >> s;
	int n = s.size();
	dp[0][0] = 1;
	REP(i, n) {
		bool flg = (s[i] == '?');
		if (flg || s[i] == 'A') {
			dp[i + 1][1] += dp[i][0];
			REP(j, 4) (dp[i + 1][j] += dp[i][j]) %= MOD;
		}
		if (flg || s[i] == 'B') {
			dp[i + 1][2] += dp[i][1];
			REP(j, 4) (dp[i + 1][j] += dp[i][j]) %= MOD;
		}
		if (flg || s[i] == 'C') {
			dp[i + 1][3] += dp[i][2];
			REP(j, 4) (dp[i + 1][j] += dp[i][j]) %= MOD;
		}
    }
	cout << dp[n][3] % MOD << endl;

	return 0;
}




Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

const int INF = 1e9+5;
int main(){
 int n,a;
 cin >> n >> a;
 if(n%500 <= a) cout << "Yes" <<endl;
 else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
int n, l = 9;
int s[l];
for(int i = 0;i < 9;i++){
  cin >> s[i];//ビンゴの紙に書いてある数
	}
cin >> n;
int a[n];
for(int i = 0;i < n;i++){
  cin >> a[i];//ビンゴをぐるぐる回して出で来た数
	}
int b[n];
for(int i = 0;i < 9;i++){
	int k = 0;
	for(int j = 0;j < n;j++){
		if(s[i] == a[j]){//入力した数字何れかとs[i]が同じであればk++;即ち１
			k++;
			}
		}
	b[i] = k;//s[i] == a[どれか]であれば1,otherwise,0
	}
if(b[0] == 1 && b[1] == 1 && b[2] == 1){
	cout << "Yes" << '\n';
	}
else if(b[3] == 1 && b[4] == 1 && b[5] == 1){
	cout << "Yes" << '\n';
	}
else if(b[6] == 1 && b[7] == 1 && b[8] == 1){
	cout << "Yes" << '\n';
	}
else if(b[0] == 1 && b[3] == 1 && b[6] == 1){
	cout << "Yes" << '\n';
	}
else if(b[1] == 1 && b[4] == 1 && b[7] == 1){
	cout << "Yes" << '\n';
	}
else if(b[2] == 1 && b[5] == 1 && b[8] == 1){
	cout << "Yes" << '\n';
	}
else if(b[0] == 1 && b[4] == 1 && b[8] == 1){
	cout << "Yes" << '\n';
	}
else if(b[6] == 1 && b[4] == 1 && b[2] == 1){
	cout << "Yes" << '\n';
	}
else{
	cout << "No" << '\n';
	}
/*for(int i = 0;i < 9;i++){
	cout << b[i] << '\n';
	}*/
return 0;
}

Measured memory_bytes: 3552
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>

using namespace std;

char s[4];

int main()
{
    int i, j, maximum;

    scanf("%s", s);

    maximum = 0;
    i = 0;
    while(i < 3){
        j = i;
        while(j + 1 < 3 && s[j + 1] == s[i])
            ++j;
        if(s[i] == 'R')
            maximum = max(maximum, j - i + 1);
        i = j + 1;
    }
    printf("%d", maximum);

    return 0;
}


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

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

    if((N[0] == N[1] && N[1] == N[2] && N[2] == N[3]) || (N[0] == N[1] && N[1] == N[2]) || (N[1] == N[2] && N[2] == N[3])) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
S=input()
T=input()
s=len(S)
t=len(T)
max_count=0
count=0
for i in range(s-t+1):
  for j in range(t):
    if T[j]==S[i+j]:
      count += 1
  max_count=max(max_count,count)
  count=0  
print(t-max_count)

Measured memory_bytes: 9040
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

#define FOR(it,c) for(__typeof((c).begin())it=(c).begin(); it!=(c).end();++it)

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

int mat[7][7];
bool visited[7];

bool find_cycle(int idx) {
	visited[idx] = true;
	for(int i = 0; i < 7; ++i)
		if(mat[idx][i] && (visited[i] || find_cycle(i)))
			return true;

	visited[idx] = false;
	return false;
}

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

	int n;
	cin >> n;

	while(n--) {
		int h, w;
		cin >> h >> w;

		vector<string> field(h);
		map<char, int> convert;
		for(int i = 0; i < h; ++i)
			cin >> field[i];

		vector<int> mx_x(7, -1), mx_y(7, -1), mn_x(7, w), mn_y(7, h);
		for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				if(field[i][j] == '.')
					continue;

				if(!convert.count(field[i][j]))
					convert.insert(make_pair(field[i][j], convert.size()));

				const int idx = convert[field[i][j]];
				chmax(mx_x[idx], j);
				chmax(mx_y[idx], i);
				chmin(mn_x[idx], j);
				chmin(mn_y[idx], i);
			}
		}

		const int num = (int)convert.size();

		memset(mat, false, sizeof(mat));
		FOR(it, convert) {
			const char target = it->first;
			const int idx = it->second;
			for(int i = mn_y[idx]; i <= mx_y[idx]; ++i) {
				for(int j = mn_x[idx]; j <= mx_x[idx]; ++j) {
					if(field[i][j] == '.')
						goto ng;

					if(field[i][j] != target)
						mat[convert[field[i][j]]][idx] = true;
				}
			}
		}
		
		memset(visited, false, sizeof(visited));
		for(int i = 0; i < num; ++i)
			if(find_cycle(i))
				goto ng;

		cout << "SAFE" << endl;
		continue;

	ng:;
		cout << "SUSPICIOUS" << endl;
	}

	return EXIT_SUCCESS;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}




void _main() {
        int n; cin >> n;
        vector<int> a(n); cin >> a;
        sort(all(a));

        auto it = upper_bound(all(a), (a[n - 1] +1) / 2);
        int which = *it;
        if (it != a.begin() && abs(*prev(it) - a[n - 1] / 2) <= abs(*it - a[n - 1] / 2)) which = *prev(it);
        cout << a[n - 1] << ' ' << which;
}




signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3696
from fractions import gcd

N, M = map(int, input().split())
S = input()
T = input()

r = gcd(N, M)
n = N // r
m = M // r

ans = -1
if S[0] != T[0]:
    print(ans)
    exit(0)

X = {}
for i, s in enumerate(S[1:]):
    idx = (i + 1) * m + 1
    X[idx] = s
    ans = max(ans, idx)

for i, t in enumerate(T[1:]):
    idx = (i + 1) * n + 1
    if (idx in X) and (X[idx] != t):
        print(-1)
        exit(0)
    else:
        ans = max(ans, idx)

print(max(ans, r * m * n))


Measured memory_bytes: 76140
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ctoi(x) x-'0'
#define pshb(a) cin >> x;a.push_back(x)
#define fr(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);
using namespace std;
bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
int main()
{
    char a ,b  ;
    cin>>a>>b ;
    string s="" , h="" ;
    for (int i ='0' ; i<a; i++)
        s.push_back(b)  ;
    for (int  i ='0' ; i < b ; i++)
        h.push_back(a) ;
    cout<<min(s,h) ;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=15;
int n,m,x,c[N],a[N][N];
int f[1<<N][N];
int main()
{
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>c[i];
		for(int j=1;j<=m;j++)
			cin>>a[i][j];
	}
	int ans=0x3f3f3f3f;
	for(int i=1;i<(1<<n);i++)
	{
		int res[15];
		for(int j=1;j<=m;j++) res[j]=0;
		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				for(int k=1;k<=m;k++)
					res[k]+=a[j+1][k];
			}
		}
		bool flag=1;
		int cnt=0;
		for(int j=1;j<=m;j++)
			if(res[j]<x)
			{
				flag=0;
				break;
			}
		if(flag)
		{
			for(int j=0;j<n;j++)
				if(i&(1<<j))
					cnt+=c[j+1];
			ans=min(ans,cnt);
		}
	}
	if(ans==0x3f3f3f3f) puts("-1");
	else
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long int ll;
static const int INF = 1 << 30;

int N, M, R;
int r[200];
int A[19900], B[19900], C[19900];

ll d[200][200];
ll d2[8][8];
int V[8];
ll dist, mini;
 
void dfs(int num){
	V[num] = 1;
	bool def = true;
	for(int i = 0; i < R; i++){
		if(V[i] == 0) def = false; 
	}
	if(def == true && dist < mini){
		mini = dist;
		//printf("%d\n", dist);
	}
	for(int i = 0; i < R; i++){
		if(V[i] == 0 && d2[num][i] != 0){
			V[i] = 1;
			dist += d2[num][i];
			dfs(i);
			V[i] = 0;
			dist -= d2[num][i];
		}
	}
}

void warshall_floyd(){
	for(int k = 0; k < N; k++)
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

void solve(){
	for(int i = 0; i < N; i++)
		for(int j = 0; j < N; j++) d[i][j] = INF;
	for(int i = 0; i < M; i++){
		d[A[i]][B[i]] = C[i];
		d[B[i]][A[i]] = C[i];
	}
	warshall_floyd();
	/*for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			printf("%d", d[i][j]);
		}
		printf("\n");
	}*/
	for(int i = 0; i < R; i++){
		for(int j = 0; j < R; j++){
			d2[i][j] = d[r[i]][r[j]];
			d2[j][i] = d[r[j]][r[i]];
		}
	}
	/*for(int i = 0; i < R; i++){
		for(int j = 0; j < R; j++){
			printf("%d", d2[i][j]);
		}
		printf("\n");
	}*/
	mini = 1 << 30;
	for(int i = 0; i < R; i++){
		for(int j = 0; j < 8; j++) V[j] = 0;
		dfs(i);
	}
	printf("%lld\n", mini);
}
int main(){
	scanf("%d %d %d", &N, &M, &R);
	for(int i = 0; i < R; i++){
		scanf("%d", &r[i]);
		r[i]--;
	}
	for(int i = 0; i < M; i++){
		scanf("%d %d %d", &A[i], &B[i], &C[i]);
		A[i]--; B[i]--;
	}
	solve();
	return 0;
}


Measured memory_bytes: 768
import sys
readline = sys.stdin.buffer.readline
N, M = map(int, readline().split())
graph = [0 for i in range(N)]
ab = []
for i in range(M):
    a, b = map(int, readline().split())
    a -= 1
    b -= 1
    ab.append([a, b])
    graph[a] |= 1 << b
    graph[b] |= 1 << a

all_use = (1 << N) - 1


def rec(v, use):
    use |= 1 << v
    for u in range(N):
        if (not graph[v] >> u & 1) or (use >> u) & 1:
            continue
        use |= rec(u, use)
    return use

ans = 0
for a, b in ab:
    graph[a] ^= 1 << b
    graph[b] ^= 1 << a
    if rec(0, 0) != all_use:
        ans += 1
    graph[a] ^= 1 << b
    graph[b] ^= 1 << a
print(ans)
    

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n;
	cin >> n;
  	ll a[n];
    ll b[n];
    ll ans=0;
    fr(i,n){
      cin >> a[i];
      cin >> b[i];
    }
    sort(a,a+n);
  	sort(b,b+n);
  	if(n%2==0){
      ans+=b[n/2]+b[n/2-1]-a[n/2]-a[n/2-1];
      ans+=1LL;
    }else{
      ans=b[n/2]-a[n/2]+1LL;
    }
  cout << ans << endl;
}

Measured memory_bytes: 6740
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

vector<int> divisor(int n){
  vector<int> ret;
  for(int i=1; i*i<=n; i++){
    if(n%i==0){
      ret.push_back(i);
      if(i!=n/i) ret.push_back(n/i);
    }
  }
  return ret;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> div = divisor(M);
  int ret = 0;
  rep(i,div.size()){
    if(N <= M/div[i]) ret = max(ret, div[i]);
  }

  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
	int j,x[8];
	char y[10];
		scanf("%s",y);
		for(j=0;j<8;j++){
			x[j]=y[j]-'0';
		}
		sort(x,x+8);
		printf("%d\n",x[7]*9999999+x[6]*999990+x[5]*99900+x[4]*9000-x[3]*9000-x[2]*99900-x[1]*999990-x[0]*9999999);
	}
	return 0;
}

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

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            new Solution().answer();
        }
    }

    class Solution
    {
        //string[] input;
        string input;
        public Solution()
        {
            //input = Console.ReadLine().Split(' ');
            input = Console.ReadLine();
        }
        
        public void answer()
        {
            int i,j,adjust;
            adjust = 0;
            string k,q;
            for (i = 0; i < input.Length; i++) 
            {
                k = input.Substring(i, 1);
                for (j = 0; j < input.Length; j++)
                {
                    q = input.Substring(j, 1);
                    if (k == q && i != j) 
                    { adjust = 1;}
                }           
            }
            if (adjust == 0) { Console.WriteLine("yes"); }
            else { Console.WriteLine("no"); }
        }
    }
}

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

typedef long long ll;
#define MAXN 200010
#define X first
#define Y second

bool vis[MAXN], vis2[MAXN];

int main()
{
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);
	
	int N, M, x, y;
	scanf("%d %d", &N, &M);
	for (int i = 1; i <= M; ++i)
	{
		scanf("%d %d", &x, &y);
		if (x == 1) vis[y] = true;
		if (y == N) vis2[x] = true;
	}
	bool f = false;
	for (int i = 2; i < N; ++i)
		if (vis[i] && vis2[i])
			f = true;
	puts(f? "POSSIBLE":"IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll X,Y,A,B,C; cin>>X>>Y>>A>>B>>C;
    vec a(A), b(B), c(C);
    rep(i,A) cin>>a.at(i);
    rep(i,B) cin>>b.at(i);
    rep(i,C) cin>>c.at(i);

    sort(ALL(a)); reverse(ALL(a));
    sort(ALL(b)); reverse(ALL(b));
    sort(ALL(c)); reverse(ALL(c));

    ll ans=0;
    vec K;
    rep(i,X) {K.pb(a.at(i)); ans+=a.at(i);}
    rep(i,Y) {K.pb(b.at(i)); ans+=b.at(i);}

    SORT(K);
    ll T=min(C,X+Y);

    rep(i,T){
        if(K.at(i)>=c.at(i)) break;
        ans+=(c.at(i)-K.at(i));
    }
    cout<<ans<<endl;


}

Measured memory_bytes: 4724
import math
import itertools
n=int(input())
uselist=[i for i in range(1,n+1)]
inputlist=list(tuple(map(int,input().split())) for i in range(n))
use=list(itertools.permutations(uselist))

ans=0
for some in use:
    for i in range(n-1):
        ans+=math.sqrt((inputlist[some[i]-1][1]-inputlist[some[i+1]-1][1])**2+(inputlist[some[i]-1][0]-inputlist[some[i+1]-1][0])**2)
c=1
for j in use[0]:
    c*=j

print(ans/c)

Measured memory_bytes: 8052
n = int(input())
arr = [int(i) for i in input().split()]

cnt = 0

for i in range(1, n-1):
    if(arr[i-1] < arr[i] and arr[i] < arr[i+1]):
        cnt += 1
    elif(arr[i-1] > arr[i] and arr[i] > arr[i+1]):
        cnt += 1

print(cnt)

Measured memory_bytes: 3060