akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main{
	public static void main(String[] args){
	 Scanner sc = new Scanner(System.in);
	 String s = sc.nextLine();
	 String t = sc.nextLine();
	 int n = 0;
	 for(int i = 0;i<3;i++){
       if(s.substring(i,i+1).equals(t.substring(i,i+1)))n++;
     }
	 System.out.println(n);
	}
}

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

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

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n,x;
    cin >> n >> x;
    vector<int> h(n),dp(n,INT_MAX);
    dp[0] = 0;
    for (int i = 0;i < n;++i) cin >> h[i];
    for (int i = 0;i < n;++i) for (int j = i+1;j < min(n,i+x+1);++j) dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]));
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
N = int(input(""))
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
b = 0
for a in range(N):
  if x[a] == y[a]:
    b += 1
    if b == 3:
      print("Yes")
      break
  else:
    b = 0
if b < 3:
  print("No")

Measured memory_bytes: 9188
n, m = map(int, input().split())
mod = 10**9+7
nums = 5*(10**5) # 制約に合わせよう
 
g1, g2, inverse = [1, 1] , [1, 1], [0, 1]
 
for num in range(2, nums + 1):
    g1.append((g1[-1] * num) % mod)
    inverse.append((-inverse[mod % num] * (mod//num)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)
    
def nPr(n, r):
    return g1[n] * g2[n-r] % mod
 
def nCr(n, r):
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
 
ans = 0
for r in range(n+1):
    tmp = nCr(n, r)*nPr(m, r)*(nPr(m-r, n-r)**2)%mod
    ans = (ans+(-1)**r*tmp)%mod
print(ans)

Measured memory_bytes: 68812
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		System.out.println(n == m ? "Yes" : "No");
	}

}

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;



int main() {

	ll s;
	cin >> s;

	cout << 0 << ' ' << 0 << ' ';

	int n = 0;
	

	s += 1000000000;
	cout << 1000000000 << ' ';

	ll t = s / 1000000000;

	if (s % 1000000000 == 0) {
		s = 0;
		cout << 0 << ' ' << 1 << ' ' << t-1 << endl;
		return 0;
	}

	
	s %= 1000000000;
	s = 1000000000 - s;
	cout << s << ' ' << 1 << ' ';
	cout << t << ' ';
	return 0;
}


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

int main(){

	char ch;

while(1){
    scanf("%c", &ch);
	if(isalpha(ch)){
		if(islower(ch)){
			printf("%c",toupper(ch));}
		else printf("%c",tolower(ch));}
	else printf("%c",ch);
    if ( ch == '\n' ) break;
}

	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

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

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int a,b,c,k;
void input(){
    fast_io();
    cin >> a >> b >> c >> k;
}

int solve(){
    int need = 0;
    while(a>=b){
        b*=2;
        need++;
    }
    while(b>=c){
        c*=2;
        need++;
    }
    if(k>=need) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3656
n, m = gets.split.map(&:to_i)

P = Struct.new(:a, :b)
l = []
n.times do |i|
  a, b = gets.split.map(&:to_i)
  l[i] = P.new(a, b)
end

l = l.sort{
  |l1, l2| l1.a <=> l2.a
}

ans = 0
l.each do |x|
  if m <= x.b
    ans += m * x.a
    break
  else
    ans += x.b * x.a
    m -= x.b
  end
  # puts ans
end
puts ans

Measured memory_bytes: 11128
import java.util.*;

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

    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    if(a == b) {
      System.out.println(c);
    } else if(b == c) {
      System.out.println(a);
    } else {
      System.out.println(b);
    }

  }
}

Measured memory_bytes: 23892
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    while(n > 0){
        cnt++;
        if(n < k)
            break;
        n /= k;
    }

    cout << cnt << endl;
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
const int N = 3*1e5, M = 7 + 1e9;
int k, a[N], fakeKR[N], fakeKL[N];
int main()
{
	int n, k, c;
	string s;
	cin >> n >> k >> c >> s;
	map<int, int> skipped;
	for(int i=0; i<n; )
	{ 
		if(i != 0)
			fakeKL[i] += fakeKL[i-1];
		if(s[i] == 'o'){
			fakeKL[i+c+1]++;
			int cc = c;
			for(i++;i<n&&cc--;++i){
				skipped[i] = 1;
				fakeKL[i] += fakeKL[i-1];
			}
		}
		else
			++i;
	}
	for(int i=n-1; i>=0; )
	{
		if(i != n-1)
			fakeKR[i] += fakeKR[i+1];
		if(s[i] == 'o'){
			int cc = c;
			fakeKR[i-c-1] ++;
			for(i--;i>=0&&cc--;--i){
				skipped[i] = 1;
				fakeKR[i] += fakeKR[i+1];
			}
		}
		else
			--i;
	}
	f(i, 0, n){
		if(!skipped[i] && s[i] == 'o' && fakeKL[i] + fakeKR[i] < k)
			cout << i+1 << '\n';
	}
}

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

typedef pair <int, int> pii;

const int MAXN = 1e2 + 5;

int N;
vector <pii> ans;
bool mat[MAXN][MAXN];
int sum[MAXN];

int main() {
	scanf("%d", &N);
	
	if (N % 2)
		for (int i = 1; i < N; i++)
			mat[i][N - i] = mat[N - i][i] = true;
	else
		for (int i = 1; i <= N; i++)
			mat[i][N + 1 - i] = mat[N + 1 - i][i] = true;
	
	for (int i = 1; i <= N; i++)
		for (int j = i + 1; j <= N; j++)
			if (!mat[i][j]) {
				ans.push_back({i, j});
				sum[i] += j;
				sum[j] += i;
			}
		
	for (int i = 1; i <= N; i++)
		assert(sum[i] == sum[1]);
		
	printf("%d\n", ans.size());
	for (auto it : ans)
		printf("%d %d\n", it.first, it.second);
		
	return 0;
}

Measured memory_bytes: 384
class ACGTHashList {
  static get MAP() {
    return {
      'A': 1,
      'C': 2,
      'G': 3,
      'T': 4,
    }
  }

  constructor(M) {
    this.M = M;
    this.H = [];
    for (let i = 0; i < M; i++) this.H[i] = '';
  }

 static _getKey(str) {
   let sum = 0;
   let p = 1;
   for (let i = 0, p = 1; i < str.length; i++, p *= 5) sum += p * ACGTHashList.MAP[str[i]];
   return sum;
 }

 _h1(key) { return key % this.M;}

 _h2(key) { return 1 + key % (this.M - 1);}

 find(str) {
   let key = ACGTHashList._getKey(str);
   let h;
   const h1 = this._h1(key), h2 = this._h2(key);
   for (let i = 0;; i++) {
     h = (h1 + i * h2) % this.M;
     if (this.H[h] === str) return 1;
     else if (this.H[h] === '') return 0;
   }
   return 0;
 }

 insert(str) {
   let key = ACGTHashList._getKey(str);
   let h;
   const h1 = this._h1(key), h2 = this._h2(key);
   for (let i = 0;; i++) {
     h = (h1 + i * h2) % this.M;
     if (this.H[h] === str) return 1;
     else if (this.H[h] === '') {
       this.H[h] = str;
       return 0;
     }
   }
   return 0;
 }

}

(function main(){
  let hl = new ACGTHashList(1046527);
  require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n").slice(1)
      .map(l => l.split(' ')).forEach(cmd => {
    if (cmd[0][0] === 'i') {
      hl.insert(cmd[1]);
    } else {
      console.log(hl.find(cmd[1]) ? 'yes' : 'no');
    }
  });
})();



Measured memory_bytes: 380136
s=input()
K=int(input())

alphabet="abcdefghijklmnopqrstuvwxyz"
arr=[]
for x in alphabet:
    #print('x:',x)
    for i in range(len(s)):
        #print('s[i]',i,s[i])
        if s[i]==x:
            #print("match")
            l=min(K,len(s)-i)
            #print('l',l)
            for j in range(l):
                arr.append(s[i:i+j+1])
                #print('append',s[i:i+j+1])
                #print('arr',arr)
    arr=list(set(arr))
    arr.sort()
    #print(arr)
    if len(arr)>=K:
        ans=arr[K-1]
        break
print(ans)

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

int main()
{
	int n,m,d;
	cin>>n>>m>>d;
	if(d)printf("%.12lf",1.0*(m-1)*2*(n-d)/n/n);
	else printf("%.12lf",1.0*(m-1)*(n-d)/n/n);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
using namespace std;
long long MOD = 1e9 + 7;

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

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
    private static Scanner sc = new Scanner(new BufferedInputStream(System.in));

    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        long sum = 0;
        if (a >= k) {
            sum += k;
            k = 0;
        } else {
            sum += a;
            k -= a;
        }
        k -= b;
        if (k > 0) {
            sum -= k;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 35856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pl;
const ll asize=1e5+5,inf=1000000000000000000;
 
int main(){
	ios_base::sync_with_stdio(0),cin.tie(NULL);
	ll n,k,a=1;
	cin>>n;
	vector<ll>v;
	for(int i=0;i<n;i++){
		cin>>k;
		if(k==0){
			cout<<0;
			return 0;
		}
		else v.push_back(k);
	}
	for(ll k:v){
	//	cout<<"a="<<a<<"\n";
		ll t=a*k;
		if(t>0&&t<=inf&&t/a==k&&t/k==a)a*=k;
		else{
			cout<<-1;
			return 0;
		}
	}
	if(a>0&&a<=inf)cout<<a;
	else cout<<-1;
	return 0;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  string s;
  cin>>s;
  int c(1e9),f(0);
  for(int i(0);i<int(s.size());i++){
    if(s[i] == 'C') c = min(c,i); 
    if(s[i] == 'F') f = max(f,i); 
  }
  //cout << c << " " << f << endl;
  if(c < f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;



int main(){
    ll n,k;
    cin>>n>>k;
    ll p=1;
    if(n>k){cout<<0<<endl; return 0;}
    for(int i=0;i<n;i++){
        p*=k;
        k--;
        p%=MOD;
    }
    cout<<p<<endl;
    
    
    return 0;
}


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

typedef long long ll;

#ifndef YUKININO
#define cerr if (false) cerr
#endif
#define debug(x) cerr << "[" << #x": " << x << "]" << endl
template <class T, class U> ostream& operator<< (ostream& out, const pair<T, U> &x) { return out << x.first << " " << x.second; }
template <class T> ostream& operator<< (ostream& out, const vector<T> &vec) { for (auto i = vec.begin(); i != vec.end(); i++) { if (i != vec.begin()) out << " "; out << *i; } return out; }

void solve();
int main() {
#ifdef YUKININO
  freopen("Testing.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  int T = 1;
  // cin >> T;
  while (T--) solve();
  debug((clock() * 1.0 / CLOCKS_PER_SEC));
}
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------
// ------------------------------------------------------------------------------

const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;

void solve() {
  int n, m;
  while (cin >> n >> m) {
    vector<pair<int, int>> edge;
    for (int i = 1; i <= m; i++) {
      int u, v; cin >> u >> v;
      --u, --v;
      edge.push_back({ u, v });
    }
    vector<int> fa(n), sz(n, 1);
    iota(fa.begin(), fa.end(), 0);
    function<int(int)> find = [&](int x) -> int {
      return x == fa[x] ? x : fa[x] = find(fa[x]);
    };
    
    vector<ll> ans(m);
    ll sum = n * (ll)(n - 1) / 2;
    for (int i = m - 1; i >= 0; i--) {
      ans[i] = sum;
      int a = find(edge[i].first), b = find(edge[i].second);
      if (a != b) {
        sum -= sz[a] * (ll)sz[b];
        fa[b] = a;
        sz[a] += sz[b];
      }
    }
    for (int i = 0; i < m; i++) {
      cout << ans[i] << "\n";
    }
  }
}

Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;
const int maxn = 102;

int n, m, X, Y, x, y;

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

	int maxx = -101;

	for (int i = 1; i <= n; ++i) {
		cin >> x;
		if (x > maxx)
			maxx = x;
	}

	// if (maxx >= Y) {
	// 	cout << "War" << endl;
	// 	return 0;
	// }

	int miny = 101;
	for (int i = 1; i <= m; ++i) {
		cin >> y;
		if (y < miny)
			miny = y;
	}

	for (int i = X+1; i <= Y; ++i)
	{
		if (i > maxx && i <= miny) {
			cout << "No War" << endl;
			return 0;
		}
	}

	// if (miny <= X || maxx >= miny)
	// 	cout << "War" << endl;
	// else 
	// 	cout << "No War" << endl;
	
	cout << "War" << endl;
	return 0;
}

Measured memory_bytes: 256
import qualified Data.IntMap as M
import Data.Array.IArray

solve :: Int -> [Int] -> [Int]
solve n a = go n M.empty
  where
    a' = listArray (1,n) a :: Array Int Int
    go :: Int -> M.IntMap Bool -> [Int]
    go 0 m = [ k | (k,v) <- M.toAscList m, v ]
    go i m = let ks = [ j | j <- [i,i*2..n], j `mod` i == 0 ]
                 l = length $ filter (\k ->
                        maybe False id (M.lookup k m)) ks
                 b = if l `mod` 2 == (a'!i) then False else True
                 m' = M.insert i b m
              in go (i-1) m'

main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map read . words <$> getLine :: IO [Int]
    let ret = solve n a
    print $ length ret
    mapM_ print ret

Measured memory_bytes: 190460
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

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

long long int INF = 1e18;
long long int MOD = 1e8 + 7;

vector<int> E[100];

int used[100];
vector<int> v_GCD;

long long int GCD(long long int a, long long int b){
	long long int dummy1, dummy2, dummy;
	dummy1 = max(a, b);
	dummy2 = min(a, b);
	while(true){
		dummy = dummy1 % dummy2;
		dummy1 = dummy2;
		dummy2 = dummy;
		if(dummy == 0){
			break;
		}
	}
	return dummy1;
}

void func(int pos, int pre, int step){
	if(used[pos] >= 0){
		if(step > used[pos]){
			v_GCD.push_back(step - used[pos]);
		}
		return;
	}
	used[pos] = step;
	for(int i = 0; i < E[pos].size(); i++){
		if(pre != E[pos][i]){
			func(E[pos][i], pos, step + 1);
		}
	}
}

int main(){
	while(true){
		long long int N, M, Z;
		cin >> N >> M >> Z;
		
		if(N == 0){
			break;
		}
		
		for(int i = 0; i < N; i++){
			E[i].clear();
		}
		for(int i = 0; i < M; i++){
			int s, t;
			cin >> s >> t;
			s--;
			t--;
			E[s].push_back(t);
			E[t].push_back(s);
		}
		
		vector<int> v_step;
		long long int pre[100], pre2[100];
		for(int i = 0; i < N; i++){
			pre[i] = -1;
		}
		pre[0] = INF;
		
		for(int loop = 1; loop <= min(Z, 11000LL); loop++){
			for(int i = 0; i < N; i++){
				pre2[i] = -1;
			}
			for(int i = 0; i < N; i++){
				if(pre[i] < 0){
					continue;
				}
				for(int j = 0; j < E[i].size(); j++){
					if(E[i][j] != pre[i]){
						if(pre2[E[i][j]] < 0){
							pre2[E[i][j]] = i;
						}else{
							pre2[E[i][j]] = INF;
						}
					}
				}
			}
			swap(pre, pre2);
			
			if(pre[N - 1] >= 0){
				v_step.push_back(loop);
			}
			
		}
		
		if(Z < 10000){
			if(pre[N - 1] >= 0){
				cout << "yes" << endl;
			}else{
				cout << "no" << endl;
			}
			continue;
		}
		
		for(int i = 0; i < N; i++){
			used[i] = -1;
		}
		v_GCD.clear();
		
		func(0, -1, 0);
		
		long long int G;
		if(v_GCD.size() == 0){
			G = INF;
		}else{
			G = v_GCD[0];
			for(int i = 0; i < v_GCD.size(); i++){
				G = GCD(G, v_GCD[i]);
			}
		}
		bool flag = false;
		for(int i = 0; i < v_step.size(); i++){
			if((Z - v_step[i]) % G == 0){
				flag = true;
			}
		}
		if(flag){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}
	return 0;
}



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

typedef long long ll;
typedef pair<int, int> pii;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repp(i, s, e) for (int i = (s); i < (e); i++)
#define all(x) x.begin(), x.end()

#define endl "\n"

void use_cio() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto x : V) os << x << ", ";
  return os << "]";
}

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

int main() {
  use_cio();
  int n;
  cin >> n;
  vector<int> va(n);
  rep(i, n) cin >> va[i];
  sort(all(va));
  cout << va[n / 2] - va[n / 2 - 1] << endl;
}


Measured memory_bytes: 640
S = input()
S_prime = ''
for c in S:
    S_prime += c + '+'
S_prime = S_prime[:-1]
def rem(s, N, target = '+'):
    cnt = -1
    ind = 0
    for i, c in enumerate(s):
        if c == target:
            cnt += 1
        if cnt == N:
            ind = i
            break
    return s[:i] + s[i+1:]
def f(s, N):
    # print(s)
    # if s.isdecimal():
    #     return int(s)
    tot = sum(map(int, s.split("+")))  # "+"なくても大丈夫
    for i in range(N, s.count("+")):
        tot += f(rem(s, i), i)
    return tot
print(f(S_prime, 0))

# 1+2+3+4 -> 12+3+4 -> 12+34
# 1+2+3+4 -> 1+2+34 -> 12+34
# 上二つが重複するのをなくした。サンプルケースはOK

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,A;
    cin >> N >> A;
    if(N%500 <= A) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3608
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define N 200005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 

		signed main()
		{
			 vector<int> v(1000,0);
    int x,n;cin>>x>>n;
    for(int i=0;i<n;i++){
        int in;
        cin>>in;
        v[in]++;
    }
    if(v[x]==0)
    cout<<x;
    else {
        int l;
        for(int i=x-1;i>=0;i--){
            if(v[i]!=1){
                l=i;
                break;
            }
        }
        int r;
        for(int i=x+1;i<1000;i++){
            if(v[i]!=1){
                r=i;
                break;
            }
        }
        if(x-l<=r-x)
            cout<<l;
        else 
        cout<<r;
    }
		}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 100000000000000000

vector<int> f (45, -1) ;

int fib (int x){
    if(f[x] >= 0){
        return f[x] ;
    }
    if (x <= 1){
        return 1 ;
    }
    else {
        
        return f[x] = fib(x -1) + fib(x - 2) ;
    }

}

int main () {
    int n ;
    cin >> n;
    cout << fib(n) << endl; 
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <math.h>
#include <iterator>

using namespace std;

bool find(int target, vector<int> p){
	for(size_t i = 0; i < p.size(); i++){
		if(target == p.at(i)) return true;
	}
	return false;
}

int main(){
	int x,n;
	cin >> x >> n;
	vector<int> p(n);
	int min_abs = 102;
	int ans = x;
	for(int i = 0; i < n; i++){
		cin >> p.at(i);
	}
	
	for(int i = 0; i < 102; i++){
		if(find(i, p)) continue;
		if(abs(x - i) < min_abs){
			min_abs = abs(x - i);
			ans = i;
		}
	}
	
	cout << ans << endl;
	
}

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

int main() {
  int A,B,C;
  cin >> A >> B >> C;

  if (A < C && C <B) {
    cout << "Yes" << endl;
  }
  else if (B < C  && C < A) {
    cout << "Yes" << endl;
  }
  else  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	int n;
	string s;
	cin>>n>>s;
	ll ans=0;
	for(int k=0; k<(1<<n); k++){
		string t1, t2;
		for(int i=0; i<n; i++){
			if(k&(1<<i)){
				t1+=s[i];
			}else{
				t2+=s[i];
            		}
		}
		ll dp[19][19]={};
		int m=t1.size();
		dp[0][0]=1;
		for(int i=1; i<=n; i++){
			for(int j=0; j<=m; j++){
				if(j>=1 && s[n+i-1]==t1[m-j]){
					dp[i][j]+=dp[i-1][j-1];
				}
				if(i-j-1>=0 && s[n+i-1]==t2[n-m-i+j]){
					dp[i][j]+=dp[i-1][j];
				}
			}
		}
		ans+=dp[n][m];
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
class UnionFind():
    # 初期化
    # 全てのノードの親は -1 とする
    def __init__(self, n):
        self.par = [-1] * n

    # xがどのグループに属しているか調べる
    def root(self, x):
        # xが親のとき
        if self.par[x] < 0:
            return x
        # xの親がさらに親をもつとき、それをxの親とする
        else:
            self.par[x] = self.root(self.par[x])
            return self.par[x]

    # 自分のいるグループの頂点数を調べる
    def size(self, x):
        return -self.par[self.root(x)]

    # xとyをくっつける
    def connect(self, x, y):
        x = self.root(x)
        y = self.root(y)
        # すでにくっついていたらくっつけない
        if x == y:
            return

        # 大きい方(x)に小さい方(y)をくっつける
        if self.size(x) < self.size(y):
            x, y = y, x

        # xのサイズを更新
        self.par[x] += self.par[y]
        # yの親をxに変更
        self.par[y] = x

        return


N, M = map(int, input().split())
A, B = [], []
for _ in range(M):
    a, b = map(int, input().split())
    # インデックスをずらす
    A.append(a-1)
    B.append(b-1)

uni = UnionFind(N)

ans = [N * (N-1) // 2]
for i in range(M-1, 0, -1):
    ans.append(ans[-1])
    # 繋がっていないグループがつながったとき
    if uni.root(A[i]) != uni.root(B[i]):
        ans[-1] -= uni.size(A[i]) * uni.size(B[i])
        uni.connect(A[i], B[i])

for item in reversed(ans):
    print(item)


Measured memory_bytes: 16916
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <numeric>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

using namespace std;

int main(void){
  int n, t;
  cin >> n >> t;
  int maxc = 1001;
  rep(i, n) {
    int a,b;
    cin >> a >> b;
    if (b <= t && a < maxc) maxc = a;
  }
  if (maxc < 1001) cout << maxc;
  else cout << "TLE";
  return 0;
}


Measured memory_bytes: 888
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n, m;
vector<string> s, t;

int main()
{
    cin >> n;
    s.resize(n); rep(i, n) cin >> s[i];
    cin >> m;
    t.resize(m); rep(i, m) cin >> t[i];

    int ans = -1;
    rep(k, n){
        int val = 0;
        string str = s[k];
        rep(i, n){ if(str == s[i]) val++; }
        rep(i, m){ if(str == t[i]) val--; }
        ans = max(ans, val);
    }
    if(ans < 0) cout << 0 << endl;
    else cout << ans << endl;

}


Measured memory_bytes: 256
using System;

class MyClass
{
    static void Main(string[] args)
    {
        string str2;
        while (!(str2 = Console.ReadLine()).Contains("?"))
        {
            string[] str = str2.Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[2]);
            int c;
            switch (str[1])
            {
                case "+":
                    c = a + b;
                    break;
                case "-":
                    c = a - b;
                    break;
                case "*":
                    c = a * b;
                    break;
                case "/":
                    c = (int)Math.Floor((double)a / b);
                    break;
                default:
                    c = 0;
                    break;
            }
            Console.WriteLine(c);
        }
    }
}


Measured memory_bytes: 20568
S = list(input())
T = list(input())

last = -1
for i in range(len(S)-len(T) + 1) :
    for j in range(len(T)) :
        if S[i+j] != T[j] and S[i+j] != '?' :
            break
    else :
        last = i

if last == -1 :
    print('UNRESTORABLE')
else :
    S[last:last+len(T)] = T[::]
    print(''.join(S).replace('?', 'a'))

Measured memory_bytes: 38256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
double pi=3.141592653589793;

const int MOD = 1000000007;

long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}
long myPow(long long x, long long n, long long m=MOD){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

class Point{
public:
	long long x;
	long long y;
	long long dis;
	Point(long long _x,long long _y,long long _dis){
		x=_x;
		y=_y;
		dis=_dis;
	}
};

set<string>myset;
ll n,k;
vector<string>d;

void dfs(int now,int now_k,string s=""){
	//cout<<s<<endl;
	if(now_k==k){
		myset.insert(s);
		cout<<s<<endl;
		return;
	}
	if(now==n)return;
	dfs(now+1,now_k+1,s+d[now]);
	dfs(now+1,now_k,s);
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll N;
	cin>>N;
	ll ans=0;
	vector<ll>v(N+1);
	v[0]=-1;
	for(int i=1;i<=N;i++){
		cin>>v[i];
	}
	for(int i=N;i>0;i--){
		if(v[i]==i && v[i-1]==i-1){
			ans++;
			i--;
		}else if(v[i]==i)ans++;
		
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    cout<<min(abs(n%k),1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	if (x == 2 || x == 11 || y == 4 || y == 2)
		cout << "No" << "\n";
	else if (x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10)
		if (y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)
			cout << "Yes" << "\n";
		else
			cout << "No" << "\n";
	else if (y == 6 || y == 9 || y == 11)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
}

Measured memory_bytes: 3556
use std::io;
use std::str::FromStr;
use std::collections::VecDeque;
use std::collections::HashSet;
use std::cmp::max;

fn input_tuple() -> (usize, usize) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<usize> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1])
}

fn input_tuple_three() -> (usize, usize, usize) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<usize> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn shortest_path(s: usize, g: usize, edges: &Vec<Vec<usize>>) -> Vec<usize> {
    let mut queue: VecDeque<usize> = VecDeque::new();
    queue.push_back(s);
    let mut visited: HashSet<usize> = HashSet::new();
    let mut prev = vec![edges.len(); edges.len()];
    visited.insert(s);
    while !queue.is_empty() {
        let target = queue.pop_front().unwrap();
        for edge in &edges[target] {
            if !visited.contains(edge) {
                prev[*edge] = target;
                queue.push_back(*edge);
                visited.insert(*edge);
            }
        }
    }
    let mut path: Vec<usize> = Vec::new();
    let mut i = g;
    while i != edges.len() {
        path.push(i);
        i = prev[i];
    }
    path.reverse();
    path
}

fn count(idx: usize, path: &Vec<usize>, edges: &Vec<Vec<usize>>, visited: &mut HashSet<usize>) -> usize {
    let mut ans = 0;
    visited.insert(idx);
    for edge in &edges[idx] {
        if !visited.contains(edge) && !path.contains(edge) {
            ans = max(ans, count(*edge, path, edges, visited) + 1);
            visited.insert(*edge);
        }
    }
    ans
}

fn main() {
    let (n, u, v) = input_tuple_three();
    let mut edges: Vec<Vec<usize>> = Vec::new();
    for _ in 0..n {
        edges.push(Vec::new());
    }
    for _ in 0..(n-1) {
        let (a, b) = input_tuple();
        edges[(a - 1) as usize].push(b - 1);
        edges[(b - 1) as usize].push(a - 1);
    }
    let path = shortest_path(u - 1, v - 1, &edges);

    let mut visited: HashSet<usize> = HashSet::new();
    // println!("{:?}", path);

    let mut ans = 0;
    for i in 0..path.len() / 2 {
        // println!("{} {}", path[i], count(path[i], &path, &edges, &mut visited));
        let len = path.len() - 1 - i + count(path[i], &path, &edges, &mut visited) - 1;
        // println!("len = {}", len);
        ans = max(ans, len);
    }
    println!("{}", ans);
}


Measured memory_bytes: 14196
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

int main(){

	ll x;cin>>x;
	string s;
	while(x > 0){
		x--;
		s += ('a' + (x % 26));
		x /= 26;
	}
	reverse(ALL(s));
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >> E;
  if ( A == 0 ) {
  cout << 1 <<endl;
   }
    else if ( B == 0 ) {
  cout << 2 <<endl;
   }
   else if ( C == 0 ) {
  cout << 3 <<endl;
   }
   else if ( D == 0 ) {
  cout << 4 <<endl;
   }
   else { 
   cout << 5 <<endl;
   }
} 
   

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var swr = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(swr);
            int ans = 0;
            StringBuilder s = new StringBuilder();
            s.Append(Console.ReadLine());
            int count = 0;
            string temp = string.Empty;
            for (int i = 0; i < s.Length / 2; i++)
            {
                // Console.WriteLine("Compare " + s[i] + " : " + s[(s.Length - 1) - i]);
                if (s[i] != s[(s.Length - 1) - i])
                {
                    s[i] = s[(s.Length - 1) - i];
                    count++;
                }
            }
            Console.WriteLine(count);

            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;

long long n,k,ans=1e12,l,r,mid,cnt,x;
long long a[MAXN],b[MAXN];

bool cmp(int a,int b)
{
 return a>b;
}

int main()
{
 cin >> n >> k;
 for(int i=1;i<=n;i++) cin >> a[i];
 for(int i=1;i<=n;i++) cin >> b[i];
 sort(a+1,a+n+1);
 sort(b+1,b+n+1,cmp);
 for(int i=1;i<=n;i++) r=max(r,a[i]*b[i]);
 while(l<=r)
 {
  mid=(l+r)/2;cnt=0;
  for(int i=1;i<=n;i++)
  {
   if(a[i]*b[i]>mid)
   {
    cnt+=a[i];
    x=mid/b[i];
    cnt-=x;
   }
  }
  if(cnt<=k)
  {
   ans=min(ans,mid);
   r=mid-1;
  }
  else l=mid+1;
 }
 cout << ans << endl;
 return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;
map<int, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.rbegin(), t.rend());
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
using namespace std;
int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    int p;
    for (int x=1; x<100; x++) {
        for (int y=1; y<100; y++) {
            for (int z=1; z<100; z++) {
                p = x*x + y*y + z*z + x*y + y*z + z*x;
                if (p > n) {
                    break;
                } else {
                    mp[p]++;
                }
            }
        }
    }
    for (int i=1; i<=n; i++) {
        cout << mp[i] << endl;
    }
}

Measured memory_bytes: 3892
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func count(in int) int {
	s := strconv.Itoa(in)
	length := len(s)
	if length%2 == 0 {
		return countFull(length - 1)
	}

	count := countMiddle(cancPowerOfTen(length-1), in)
	if length > 2 {
		count += countFull(length - 2)
	}
	return count
}
func countMiddle(start, end int) int {
	return end - start + 1
}

// n is odd
func countFull(n int) (count int) {
	for i := 1; i < n+1; i += 2 {
		count += 9 * cancPowerOfTen(i-1)
	}
	return
}

func cancPowerOfTen(v int) (result int) {
	result = 1
	for i := 0; i < v; i++ {
		result *= 10
	}
	return
}

func main() {
	n := nextInt()
	r := count(n)
	fmt.Println(r)
}


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

int main(){
  string s;
  int K;
  cin >> s >> K;
  int L=s.size();
  std::vector<std::string> sub={"zzzzzz","zzzzzz","zzzzzz","zzzzzz","zzzzzz"};
  for(int i=0; i<L; i++){
    string subs;
    for(int j=i; j<min(i+5,L); j++){
      subs.push_back(s.at(j));
      for(int k=0; k<5; k++){
        if(sub[k]>subs){
          sub.insert(sub.begin()+k,subs);
          break;
        }
        if(sub[k]==subs) break;
      }
    }
  }
  cout << sub[K-1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        if (n==1) System.out.println(1);
        else if (isPrime(n)) System.out.println(digitLength(n));
        else{
        	if (n/10==0) System.out.println(2);
        	else{
        		int mul1 = largestMultiplier(n);
        		int mul2 = (int)(n/mul1);
        		System.out.println(Math.max(digitLength(mul1), digitLength(mul2)));
        	}
        }
	}
	public static boolean isPrime(long n){
		if (n==2||n==3) return true;
		if (n%2==0) return false;
		else{
			int square = (int)Math.sqrt(n);
			for (int i=3;i<=square;i=i+2){
				if (n%i==0){
					return false;
				}
			}
		}
		return true;
	}
	public static int largestMultiplier(long n){
		int max = 0;
		int square = (int)Math.sqrt(n);
		for (int i=2;i<=square;i++){
			if (n%i==0){
				max = i;
			}
		}
		return max;
	}
	public static int digitLength(long n){
		int length = 0;
		while(n>0){
			n = n/10;
			length ++;
		}
		return length;
	}
}


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


int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  int ans = 0;
  for(int i=1;i<N-1;i++){
    vector<int> A(26,0);
    vector<int> B(26,0);
    int count = 0;
    for(int j=0;j<i;j++){
      A.at(S.at(j)-'a')=1;
    }
    for(int j=i;j<N;j++){
      B.at(S.at(j)-'a')=1;
    }
    for(int j=0;j<26;j++){
      if(A.at(j)*B.at(j)==1)count++;
    }
    if(count>ans)ans=count;
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
const int oo=1073741819;
using namespace std;
int tail[200000],d[200000],g[200000],ru[200000],chu[200000],v[200000],p[200000];
int next[2000000],flow[2000000],sora[2000000],po[2000000],st[2000000];
int cost[2000000];
int n,m,s,t,ss;
bool spfa(int s,int t)
{
	int h,r,ne,na;
	for (int i=1;i<=t;i++) d[i]=oo;
	h=r=0;
	st[r=1]=s,d[s]=0,v[s]=1,p[s]=0;
	for (;h<r;) {
		ne=st[++h];
		for (int i=ne;next[i];) {
			i=next[i],na=sora[i];
			if (flow[i] && d[ne]+cost[i]<d[na]) {
				d[na]=d[ne]+cost[i],p[na]=i;
				if (!v[na]) {
					v[na]=1;
					st[++r]=na;
				}
			}
		}
		v[ne]=0;
	}
	return d[t]<oo;
}
int widen()
{
	int sum=0,d=oo;
	for (int i=t;i!=s;i=sora[po[p[i]]]) 
		d=min(d,flow[p[i]]);
	for (int i=t;i!=s;i=sora[po[p[i]]]) {
		sum+=d*cost[p[i]];
		flow[p[i]]-=d,flow[po[p[i]]]+=d;
	}
	return sum;
}
void origin()
{
	s=n+1,t=s+1,ss=t;
	for (int i=1;i<=t;i++) tail[i]=i,next[i]=0;
}
void link(int x,int y,int z,int w)
{
	++ss,next[tail[x]]=ss,tail[x]=ss,sora[ss]=y,flow[ss]=z,cost[ss]=w,next[ss]=0;
	++ss,next[tail[y]]=ss,tail[y]=ss,sora[ss]=x,flow[ss]=0,cost[ss]=-w,next[ss]=0;
	po[ss]=ss-1,po[ss-1]=ss;
}
void bfs(int s,int t)
{
	spfa(s,t);
	g[t]=-d[t];
}
int main()
{
	//freopen("i.in","r",stdin);
	//freopen("i.out","w",stdout);
	scanf("%d%d",&n,&m);
	origin();
	int tot=0;
	for (int i=1;i<=m;i++) {
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		x++,y++;
		link(x,y,oo,-z);
		chu[x]++,ru[y]++;
		tot+=z;
	}
	bfs(1,n);
	for (int i=1;i<=n;i++)
		if (ru[i]>chu[i]) link(s,i,ru[i]-chu[i],0);
		else link(i,t,chu[i]-ru[i],0);
	link(n,1,oo,g[n]);
	int ans=0;
	for (;spfa(s,t);ans+=widen()) ;
	printf("%d\n",ans-tot);
	return 0;
}


Measured memory_bytes: 3316
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
負の数の割り算は絶対値が小さいほうに切り捨てられるex.-1/2=0ので、ある値>kみたいな式だとバグらせやすいので注意
ある値>=kとして、切り上げた値をとるべき
toLowerCase()はアルファベット以外に対して行ってもエラーにはならない
ArrayDequeではpopとpushはStackと同じ操作になる
//import static java.lang.System.*; はしばらく使わなそう(使うとしてもexit(0)のためだけ)←return;でよさそう
最後にout.flush()またはout.close()をするのを忘れずに！
Point2D p2d=new Point2D.Double(d1,d2);
*/
//入力終了→Ctrl+D
import java.util.*;
import java.io.*;
import java.awt.*;
import java.awt.geom.Point2D;
//import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        int ans=0;
        int a=sc.nextInt(),b=sc.nextInt();
        ans=max(a+a-1,max(a+b,b+b-1));
        out.println(ans);
        out.close();
    }

    static PrintWriter out = new PrintWriter(System.out);

    static class sc     {
        static Scanner s = new Scanner(System.in);

        static String next() {
            return s.next();
        }

        static String nextLine() {
            return s.nextLine();
        }

        static int nextInt() {
            return Integer.parseInt(s.next());
        }

        static long nextLong() {
            return Long.parseLong(s.next());
        }

        static double nextDouble() {
            return Double.parseDouble(s.next());
        }

        static boolean hasNext() {
            return s.hasNext();
        }
    }
}

Measured memory_bytes: 23252
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int gcd(int p, int q) {
    if (p % q == 0)return q;
    return gcd(q, p % q);
}

int main()
{

    int a, b;
    cin >> a >> b;
    int out = -1;

    for (int i = 10 * b; i < 10 * b + 10; i++) {
        if (i*0.08 >= a && i*0.08 < a + 1) {
            out = i;
            break;
        }
    }

    cout << out;

    
    return 0;
}



Measured memory_bytes: 3636
N,Q=map(int,input().split())
S=input()
isAC=[0]*N
index=0

while index<N:
    acindex=S.find("AC",index)
    if acindex==-1:
        break
    else:
        isAC[acindex+1]=1
        index=acindex+1

cumsum=[0]*(N+1)
for i in range(1,N+1):
    cumsum[i]=cumsum[i-1]+isAC[i-1]

for i in range(Q):
    l,r=map(int,input().split())
    print(cumsum[r]-cumsum[l])


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

using namespace std;

typedef long long ll;

int main(){
  int N;
  cin >> N;
  int ans = 0;
  vector<int> tako(N);
  for(int i = 0; i < N; i++){
    cin >> tako.at(i);
  }
  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N; j++){
      ans += tako.at(i) * tako.at(j);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
import sys

n,m,k = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(m)]
cd = [list(map(int,input().split())) for _ in range(k)]

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf = UnionFind(n)
ans = [0]*n
cnt = [0]*n

for a,b in ab:
    uf.union(a-1, b-1)
    cnt[a-1] += 1
    cnt[b-1] += 1

for i in range(n):
    ans[i] = uf.size(i)

for c,d in cd:
    if uf.same(c-1, d-1):
        ans[c-1] -= 1
        ans[d-1] -= 1

for i in range(n):
    print(ans[i] - cnt[i] - 1, end = ' ')


Measured memory_bytes: 119384