akhauriyash/Code-Regression huggingface dataset:
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

a,b,c=get_i
puts yn_judge(b-a==c-b,"YES","NO")

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

int main () {

	int n;
	cin >> n;

	int ans = 0;
	int curr = 0;

	int lst;
	cin >> lst;

	for (int i = 1; i < n; ++i) {
		int x;
		scanf ("%d", &x);
		if (x <= lst) {
			++curr;
		} else {
			curr = 0;
		}

		ans = max (ans, curr);
		lst = x;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 10000001;
const int mod = 1e9 + 7;
LL a[N + 20], fact[N + 20], inv[N + 20];
LL qpow(LL a, LL b, LL p = mod) {
	LL ans = 1;
	for (; b; b >>= 1) {
		if (b & 1) ans = ans * a % p;
		a = a * a % p;
	}
	return ans % p;
}
void prework() {
	fact[0] = 1;
	for (int i = 1; i <= N; i++) fact[i] = fact[i - 1] * i % mod;
	inv[N - 1] = qpow(fact[N - 1], mod - 2) % mod;
	for (int i = N - 2; ~i; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
}
LL nCr(int n, int r) {  // calculate nCr
	if (n - r < 0 || r < 0) return 0;
	return fact[n] % mod * inv[r] % mod * inv[n - r] % mod % mod;
}
int main() {
  int k; cin >> k;
  string s; cin >> s;
  int n = s.length();
  prework();
  int S = 26;  // alphabet size
  LL ans = qpow(S, n + k);
  for (int r = 0; r < n; r++) {
    LL v = nCr(n + k, r) * qpow(S - 1, n + k - r) % mod;
    ans = (ans - v + mod * 2) % mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 160524
#include <stdio.h>
int main(){
	int A1, A2, A3;
	scanf("%d %d %d", &A1, &A2, &A3);
	if(A1+A2+A3<22){
		printf("win\n");
	}else if(A1+A2+A3>=22){
		printf("bust\n");
	}
	return 0;
}

Measured memory_bytes: 1624
s = [i for i in input()]
t = [j for j in input()]
s.sort()
t.sort(reverse=True)
flag = False

for i in range(min(len(s), len(t))):
  if s[i] < t[i]:
    print("Yes")
    flag = True
    break
  else:
    pass
  
if flag:
  pass
else:
  if len(s) < len(t) and len(set(s)) == len(set(t)):
    print("Yes")
  else:
    print("No")
  



Measured memory_bytes: 3064
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		for (int i = 1; i < arr.length; i++) {
			if (arr[i - 1] == 'A' && arr[i] == 'C') {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


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

int main(){
    int n;
    cin >> n;
    int p[25];
    for (int i=0;i<n;++i) cin >> p[i];
    
    int ans = 0;
    for (int i=1;i<n-1;++i){
        if (p[i-1] < p[i] && p[i] < p[i+1]) ++ans;
        else if (p[i+1] < p[i] && p[i] < p[i-1]) ++ans;
    }
    cout << ans << endl;
}

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

int n, r;

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

    cin >> n >> r;
    if(n >= 10) cout << r << '\n';
    else cout << r + 100 * (10 - n) << '\n';

    return 0;
}


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

int M, N;
string mas[1000];
string comp[2];
bool joi[1000][1000];


int check_st(){
  int sum = 0;
  for(int i = 0; i < M - 1; i++){
    for(int j = 0; j < N - 1; j++){
      bool flag = true;
      for(int k = 0; k < 2; k++){
        for(int l = 0; l < 2; l++){
          if(mas[i + k][j + l] != comp[k][l]){
            flag = false;
            break;
          }
          if(!flag) break;
        }
      }
      joi[i][j] = flag;
      sum += flag;
    }
  }
  return sum;
}

int check_nl(const int& x, const int& y, const int& pv){

  int ret = pv;

  for(int i = -1; i < 1; i++){
    for(int j = -1; j < 1; j++){
      if(y + i < 0 || x + j < 0 || y + i + 1 >= M || x + j + 1 >= N) continue;
      bool flag = true;
      for(int k = 0; k < 2; k++){
        for(int l = 0; l < 2; l++){
          if(mas[y + i + k][x + j + l] != comp[k][l]){
            flag = false;
            break;
          }
        }
        if(!flag) break;
      }
      if(flag){
        if(!joi[y + i][x + j]) ret++;
      }else{
        if(joi[y + i][x + j]) ret--;
      }
    }
  }
  
  return ret;
}
int main(){


  cin >> M >> N;
  for(int i = 0; i < M; i++){
    cin >> mas[i];
  }
  for(int i = 0; i < 2; i++){
    cin >> comp[i];
  }

  int ret = check_st();
  int pv = ret;

  for(int i = 0; i < M; i++){
    for(int j = 0; j < N; j++){
      char prev = mas[i][j];
      for(int k = 0; k < 3; k++){
        if(prev != k["JOI"]){
          mas[i][j] = k["JOI"];
          ret = max( ret, check_nl( j, i, pv));
        }
      }
      mas[i][j] = prev;
    }
  }

  cout << ret << endl;
}

Measured memory_bytes: 3232
import sys
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N = NI()
data = [[a,i] for i,a in enumerate(LI())]
data.sort(reverse=True)

dp = [[0] * (N+1) for _ in range(N+1)]

for i in range(N):
    a, p = data[i]
    for j in range(i+1):
        dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j] + abs(N-1-j-p)*a)
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + abs(i-j-p)*a)
print(max(dp[-1]))


Measured memory_bytes: 100412
import sys
bbn=1000000007
	
#+++++

		
def main():
	n = int(input())
	nnn=[0]*10
	for i in range(10):
		nnn[i]=[0]*10
	ret=0
	for i in range(1,n+1):
		bb=str(i)
		t=int(bb[0])
		b=int(bb[-1])
		nnn[t][b]+=1
		
	ret=0
	for i in range(10):
		for j in range(10):
			ret += nnn[i][j]*nnn[j][i]
	
	print(ret)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 40300
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

/** direction */
enum class Direction(val dx: Int, val dy: Int) {
    UP(0, -1),
    DOWN(0, 1),
    LEFT(-1, 0),
    RIGHT(1, 0),
}

data class Point(val i: Int, val j: Int)
fun solve() {
    val (h, w) = readIntegerList()
    val map = Array(h) { br.readLine()!! }
    val countMap = Array(h) { LongArray(w) }
    val checkedMap = Array(h) { BooleanArray(w) }
    val queue = ArrayDeque<Point>()
    queue.addLast(Point(0, 0))
    checkedMap[0][0] = true
    while (queue.isNotEmpty()) {
        val node = queue.removeFirst()
        for (d in Direction.values()) {
            val y= node.i + d.dy
            val x = node.j + d.dx
            if (!(y in 0 until h && x in 0 until w)) continue
            if (checkedMap[y][x]) continue
            if (map[y][x] == '#') continue

            countMap[y][x] = countMap[node.i][node.j] + 1
            checkedMap[y][x] = true
            queue.addLast(Point(y, x))
        }
    }

    val tmp = countMap[h - 1][w - 1]
    if (tmp == 0L) {
        out.println(-1)
        return
    }

    val whiteCount = map.fold(0L) { acc, s -> acc + s.count { it == '.' } } - 1
    out.println(whiteCount - tmp)
}


fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


Measured memory_bytes: 36628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
 
using namespace std;


	
int main()
{ 
	int MOD=1000000007;
	long long n;
	cin>>n;
	int k;
	cin>>k;
	long long cnt=0;
	for(long long i=k;i<=n+1;i++){
		cnt+=(i*(n-i+1)+1)%MOD;
		cnt=cnt%MOD;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

using namespace std;
/* UnionFind：素集合系管理の構造体(union by rank)
    isSame(x, y): x と y が同じ集合にいるか。 計算量はならし O(α(n))
    unite(x, y): x と y を同じ集合にする。計算量はならし O(α(n))
*/
struct UnionFind {  // The range of node number is u 0 v n-1
    vector<int> rank, parents;
    UnionFind() {}
    UnionFind(int n) {  // make n trees.
        rank.resize(n, 0);
        parents.resize(n, 0);
        for (int i = 0; i < n; i++) {
            makeTree(i);
        }
    }
    void makeTree(int x) {
        parents[x] = x;  // the parent of x is x
        rank[x] = 0;
    }
    bool isSame(int x, int y) { return findRoot(x) == findRoot(y); }
    void unite(int x, int y) {
        x = findRoot(x);
        y = findRoot(y);
        if (rank[x] > rank[y]) {
            parents[y] = x;
        } else {
            parents[x] = y;
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
    }
    int findRoot(int x) {
        if (x != parents[x]) parents[x] = findRoot(parents[x]);
        return parents[x];
    }
};
// 辺の定義
struct Edge {
    long long u;
    long long v;
    long long cost;
};
bool comp_e(const Edge &e1, const Edge &e2) { return e1.cost < e2.cost; } // 辺を直接比較するための関数
/* Kruskal :クラスカル法で minimum spanning tree を求める構造体
    入力: 辺のvector, 頂点数V
    最小全域木の重みの総和: sum
    計算量: O(|E|log|V|)
*/

struct Kruskal {
    UnionFind uft;
    long long sum;  // 最小全域木の重みの総和
    vector<Edge> edges;
    int V;
    Kruskal(const vector<Edge> &edges_, int V_) : edges(edges_), V(V_) { init(); }
    void init() {
        sort(edges.begin(), edges.end(), comp_e); // 辺の重みでソート
        uft = UnionFind(V);
        sum = 0;
    
        for (auto e : edges) {
            
            if (!uft.isSame(e.u, e.v)) { // 閉路にならなければ加える
                uft.unite(e.u, e.v);
                sum += e.cost;
            }
        }
    }
};
int main() {
    int V;
    cin >> V;
    vector<Edge> edges;
    vector<P>x(V),y(V);
    for (int i = 0; i < V; i++) {
        int a,b;
        cin >> a >> b;
        x[i] = make_pair(a,i);//座標、頂点
        y[i] = make_pair(b,i);//座標、頂点
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    rep(i,V-1) {
        edges.push_back({x[i].second,x[i+1].second,x[i+1].first - x[i].first});
        edges.push_back({y[i].second,y[i+1].second,y[i+1].first - y[i].first});
    }
    
   
    Kruskal krs(edges, V);
    cout << krs.sum << endl;
    return 0;
}

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

int main() {
  int h = 0, m = 0, s;
  cin >> s;
  while (s >= 60) {
    s -= 60;
    m++;
  }
  while (m >= 60) {
    m -= 60;
    h++;
  }
  cout << h << ':' << m << ':' << s << endl;
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(int argc, char **argv)
{
	int n;
	cin >> n;
	vector<ll> a(n+3);
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	vector<ll> cum_S(n+1, 0);
	for (int i = 0; i < n; ++i)
		cum_S[i+1] = cum_S[i] + a[i];

	map<ll, ll> count;
	for (int i = 0; i < n + 1; ++i)
		++count[cum_S[i]];

	ll ans{0};
	for (auto& e : count)
	{
		ll tmp = e.second;
		ans += tmp * (tmp - 1) / 2;
	}
	std::cout << ans << std::endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) (v.begin(),v.end())
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int n,a,b;
    cin >> n >> a >> b;
    pr(min(n*a, b));   
}

Measured memory_bytes: 256
N = int(input())
INF = 10**12
Data = list(map(int,input().split()))
Data.insert(0,0)
DP = [INF]*(N+1)
DP[1]=0
for i in range(2,N+1):
    diff1 = abs(Data[i]-Data[i-1])
    DP[i] = min(DP[i],DP[i-1]+diff1)
    if i >= 3:
        diff2 = abs(Data[i]-Data[i-2])
        DP[i] = min(DP[i],DP[i-2]+diff2)
print(DP[N])

Measured memory_bytes: 13976
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N , K ,Q,t;
  cin>>N>>K>>Q;
  int H[N]={0};
  for(int i=0;i<Q;i++){ 
      cin>>t;
      H[t-1]++;
    }
 for(int l=0;l<N;l++){
   if(K-Q+H[l]>0)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
 }
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  int M = nextInt();
  vector<ll> x(N), y(N), z(N);
  REP(i, N) {
    x[i] = nextLong();
    y[i] = nextLong();
    z[i] = nextLong();
  }
  const ll INF = 1LL << 58;
  ll ans = -INF;
  for (int a = -1; a <= 1; a += 2)
    for (int b = -1; b <= 1; b += 2)
      for (int c = -1; c <= 1; c += 2) {
        vector<ll> v(N);
        REP(i, N) v[i] = a*x[i] + b*y[i] + c*z[i];
        sort(ALL(v));
        chmax(ans, accumulate(v.rbegin(), v.rbegin() + M, 0LL));
      }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

typedef long long ll;

int main() {
  int A,B,C; cin >> A >> B >> C;
  int tmp = A;
  while( A <= B*tmp ) {
    if (  A % B == C ) {
      cout << "YES" << endl;
      return 0;
    }
    A+=tmp;
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k); i > (n); i--)
#define FORre(i, k, n) for(int i = (k); i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const ll INF = ll(1e18)+1;
const int mod = 1000000007;

int main(void){
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  sort(ALL(a));
  ll l = -INF, r = INF;
  while(r-l > 1){
    ll x = (l+r)/2;
    bool ok = [&]{
      ll total = 0;
      REP(i, n){
        if(a[i] < 0){
          int l = -1, r = n;
          while(r-l>1){
            int c = (l+r)/2;
            if(a[c]*a[i] < x) r = c;
            else l = c;
          }
          total += n-r;
        }else{
          int l = -1, r = n;
          while(r-l>1){
            int c = (l+r)/2;
            if(a[c]*a[i] < x) l = c;
            else r = c;
          }
          total += r;
        }
        if(a[i]*a[i] < x) total--;
      }
      total /= 2;
      return total < k;
    }();
    if(ok) l = x; else r = x;
  }
  cout << l << endl;
  
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include <boost/foreach.hpp>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N, K, p, ans = 0;
  cin >> N >> K;
  
  vector<int> vecP(N);
  
  for(int i = 0; i < N; i++){
    cin >> vecP.at(i);
  }
  sort(vecP.begin(), vecP.end());
  
  for(int j = 0; j < K; j++){
    ans += vecP.at(j);
  }
  cout << ans << endl;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N;
    cin>>N;
    int hoge=1;
    rep(i,N)hoge*=3;
    int ei=1;
    rep(i,N){
        int a;cin>>a;
        if(a%2==0)ei*=2;
    }
    cout<<hoge-ei<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N;cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    bool ok=true;
    
    int maxi=A[0];
    for(int i=1;i<N;i++){
        if(A[i]>maxi) maxi=A[i];
        else if(maxi-2>=A[i]) ok=false;
    }
    
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>

#define rep(i, n) for (int i = 0; i < n; i++) 
#define rrep(i, n) for(int i = n-1; i>=0; i--)
#define range(i, n, m) for (int i = n; i < m; i++) 
#define rrange(i, n, m) for (int i = n - 1; i => m; i--) 
#define MOD 1000000007;

typedef long long int ll;
typedef unsigned long long int ull;


using namespace std;

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

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

	ll H, W, K;
	ll dp[150][10];
	ll fib[] = { 0,1,1,2,3,5,8,13,21,34 };
	cin >> H >> W >> K;

	dp[0][0] = 1;
	dp[0][1] = dp[0][2] = dp[0][3] = dp[0][4] = dp[0][5] = dp[0][6] = dp[0][7] = dp[0][8] = dp[0][9] = 0;


	rep(i, H) {
		rep(k, W) {
			if (k == 0) {
				dp[i + 1][k] = (dp[i][k] * fib[W]) % MOD;
				dp[i + 1][k] += (dp[i][k + 1] * fib[W - 1]) % MOD;
			}
			else if (k == W - 1) {
				dp[i + 1][k] = (dp[i][k] * fib[W]) % MOD;
				dp[i + 1][k] += (dp[i][k - 1] * fib[W - 1]) % MOD;
			}
			else {
				dp[i + 1][k] = (dp[i][k] * fib[k + 1] * fib[W - k]) % MOD;
				dp[i + 1][k] += (dp[i][k - 1] * fib[k] * fib[W - k]) % MOD;
				dp[i + 1][k] += (dp[i][k + 1] * fib[k + 1] * fib[W - k - 1]) % MOD;
			}
		}
	}

	cout << dec << dp[H][K - 1]%MOD;


	return 0;
}


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

int main(){
	int n, m, x;
	vector<int> vec;
	cin >> n >> m >> x;
	for(int i = 0; i < m; i++){
		int a;
		cin >> a;
		vec.push_back(a);
	}
        vec.push_back(n+1);
	int count1=0, count2=0;
	int* first = &(vec[0]);
	int* last = &(vec[m]);
	for(int j = x; j < n; j++){
		if(find(first, last, j) != last){
			count1++;
		}
	}
	for(int k = x; k > 0; k--){
		if(find(first, last, k) != last){
			count2++;
		}
	}
	if(count2>count1){
		cout << count1 << endl;
	}else{
		cout << count2 << endl;
	}
}

Measured memory_bytes: 256
#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; }


long long num[3];

long long solve() {
    if (num[0] % 2 == 0) return 0;
    if (num[1] % 2 == 0) return 0;
    if (num[2] % 2 == 0) return 0;
    
    sort(num, num + 3);
    return num[0] * num[1];
}

int main() {
    while (cin >> num[0] >> num[1] >> num[2]) {
        cout << solve() << endl;
    }
}






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

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

	vector<vector<int>> mm(n,vector<int>(m+1));

	for (int i=0;i<n;++i)
	{
		for (int j=0;j<=m;++j)
		{
			cin >> mm[i][j];
		}
	}

	int maxpattern=1<<n;
	const int notavailable=100000000;
	int minprice=notavailable;
	for (int i=0;i<maxpattern;++i)
	{
		int price=0;
		vector<int> rikaido(m+1);
		for (int j=1;j<=m;++j)
		{
			rikaido[j]=0;
		}
		for (int j=0;j<n;++j)
		{
			if ((i&(1<<j))!=0)
			{
				price+=mm[j][0];
				for (int k=1;k<=m;++k)
				{
					rikaido[k]+=mm[j][k];
				}
			}
		}

		if (price<minprice)
		{
			int j;
			for (j=1;j<=m;++j)
			{
				if (rikaido[j]<x)
				{
					break;
				}
			}
			if (j>m)
			{
				minprice=price;
			}
		}
	}

	if (minprice==notavailable)
	{
		cout << -1 << endl;
	}
	else
	{
		cout << minprice << endl;
	}
}





Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    
   int a,b;
   int d,r;
   double f;
   cin>>a>>b;
   d=a/b;
   r=a%b;
   f=(double)a/b;
   printf("%d %d %f\n",d,r,f);
    
}
    


Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    
	ll n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++)cin>>a[i];
	map<ll,ll> m;
	for(int i=0;i<n;i++)
		m[a[i]]++;
	ll sum=0;
    for(auto it=m.begin();it!=m.end();it++)
		{
			sum+=((it->second*(it->second-1))/2);
		}
	ll ans=sum;
	for(ll i=0;i<n;i++)
	{
	    sum=ans;
		sum-=(m[a[i]]*(m[a[i]]-1))/2;
		sum+=((m[a[i]]-1)*(m[a[i]]-2))/2;
		cout<<sum<<"\n";
	}
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        static double ReadDouble()
        {
            return double.Parse(Console.ReadLine());
        }

        static double[] ReadDoubles()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }

        static string ReadString()
        {
            return Console.ReadLine();
        }

        static string[] ReadStringSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        static void A()
        {
            long N = ReadLong();
            Console.WriteLine(N * N * N);
        }

        static void B()
        {
            long N = ReadLong();
            long[] A = ReadLongs();
            long[] B = ReadLongs();
            long[] C = ReadLongs();
            long ans = 0;
            long prev = -100;
            for (int i = 0; i < N; i++)
            {
                ans += B[A[i] - 1];
                if (prev == A[i] - 1)
                {
                    ans += C[prev - 1];
                }
                prev = A[i];
            }
            Console.WriteLine(ans);
        }

        static void C()
        {
            long N = ReadLong();
            long[] B = ReadLongs();
            long ans = 0;
            for (int i = 0; i < N; i++)
            {
                if (i == 0)
                {
                    ans += B[0];
                }
                else if (i == N - 1)
                {
                    ans += B[N - 2];
                }
                else
                {
                    ans += Math.Min(B[i - 1], B[i]);
                }
            }
            Console.WriteLine(ans);
        }

        static void D()
        {

        }

        static void Main(string[] args)
        {
            //A();
            //B();
            C();
            //D();
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define ll          long long
#define dl          double
#define pb          push_back
#define eb          emplace_back
#define mp          make_pair
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(i=a;i<b;i++)
#define all(v)      v.begin(),v.end()
#define allr(v)     v.rbegin(),v.rend()
#define mod         998244353
#define CIN(V,s,n)  for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n) for(int i=s;i<n;i++){cout <<  V[i] << " ";}
#define fast        ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);   for(ll i=0;i<V.size();i++) V[i] = 0;
using namespace std;

bool SbS(const pair<int,int> &a,const pair<int,int> &b)
{return (a.second < b.second);}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;
}

ll BS(vector<ll> &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid]==ser)
    {
        return mid;
    }
    else if(PS[mid] > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}
*/
int nCrModp(int n, int r, int p)
{
    int C[r+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = min(i, r); j > 0; j--)

            C[j] = (C[j] + C[j-1])%p;
    }
    return C[r];
}

int main()
{
ll t=1;
//cin >> t;
while(t--)
{
    string st="abcdefghijklmnopqrstuvwxyz";
    ll n,m,p,k,i,j,l,t1,r,u,v,x,y,a,b,c,d,q,flag=1,x1,x2,y1,y2;
    cin >> n >> a >> b;

    cout <<min(n*a,b) ;


}
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pi pair<int,int>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

bool cb[4000];

signed main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  vi R,G,B;
  rep(i,n){
    if(s[i]=='R') R.pb(i);
    else if(s[i]=='G') G.pb(i);
    else {
      B.pb(i);
      cb[i]=true;
    }
  }
  int nb=B.size();
  int ans=0;
  for(auto r:R){
    for(auto g:G){
      vi ch;
      if((r+g)%2==0) ch.pb((r+g)/2);
      if(2*r-g>=0&&2*r-g<n) ch.pb(2*r-g);
      if(2*g-r>=0&&2*g-r<n) ch.pb(2*g-r);
      for(auto b:ch){
        if(cb[b]) ans--;
      }
      ans+=nb;
    }
  }
  

  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3672
#include <stdio.h>

int main(void)
{
	int a, b;
	int t1 = 0, t2;
	int n, x, snow;
	
	scanf("%d %d", &a, &b);
	
	for (n = 1; n <= 999; n++){
		t1 += n;
		t2 = t1 + n + 1;
		
		for (x = 1; x <= 499500; x++){
			if (a + x == t1 && b + x == t2){
				snow = x;
			}
		}
	}
	
	printf ("%d\n", snow);
	
	return (0);
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){
  int i,j,n,m;
  int A[100][100]={},b[100]={},c[100]={};

  scanf("%d %d", &n, &m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&A[i][j]);
    }
  }
  for(i=0;i<m;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i] += (A[i][j]*b[j]);
    }
  }
  for(i=0;i<n;i++){
    printf("%d\n",c[i]);
  }

  return 0;
}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<string> s(n);
  REP(i, n) cin >> s[i];
  ll ans = 0, a = 0, b = 0, ba = 0;
  REP(i, n) {
    if (s[i].back() == 'A' && s[i].front() == 'B')
      ba++;
    else if (s[i].back() == 'A')
      a++;
    else if (s[i].front() == 'B')
      b++;
    REP(j, s[i].size() - 1)
    if (s[i][j] == 'A' && s[i][j + 1] == 'B') ans++;
  }
  DEBUG(ba);
  DEBUG(a);
  DEBUG(b);
  ans += max(ba - 1, 0ll);
  if (a > 0 || b > 0) {
    if (ba > 0) a++, b++;
    ans += min(a, b);
  }
  cout << ans << endl;
  return 0;
}


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

int Tmp;

template<typename Drake>
void Read(Drake &x){
	x=0;char ch=getchar();int f=1;
	while(!isdigit(ch)){
		if(ch=='-')f=-f;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	x=x*f;
}

template<typename Drake>
void write(Drake x){
	if(x>=10)write(x/10);
	putchar((char)(x%10+'0'));
}

template<typename Drake>
void writeln(Drake x){
	write(x);
	puts("");
}

int main(){
	string st;
	cin>>st;
	if(st[st.size()-1]=='s')cout<<st<<"es"<<endl;
	else cout<<st<<"s"<<endl;


	return 0;
}


Measured memory_bytes: 3628
N = int(input())

PRIMES = 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97

xs = {}

for n in range(2, N+1):
    for p in PRIMES:
        while n % p == 0:
            n //= p
            xs[p] = xs.get(p, 0) + 1
        if n == 1:
            break

vs = xs.values()

u74 = sum(v >= 74 for v in vs)
u24 = sum(v >= 24 for v in vs)
u14 = sum(v >= 14 for v in vs)
u4 = sum(v >= 4 for v in vs)
u2 = sum(v >= 2 for v in vs)

result = 0

# 75
if u74 >= 1:
    result += u74

# 25 * 3
if u24 >= 1 and u2 - 1 >= 1:
    result += u24 * (u2 - 1)

# 15 * 5
if u14 >= 1 and u4 - 1 >= 1:
    result += u14 * (u4 - 1)

# 5 * 5 * 3
if u4 >= 2 and u2 - 2 >= 1:
    result += u4 * (u4 - 1) // 2 * (u2 - 2)

print(result)


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	bool f = true;
	for (ll a = in(), b = in(); a != 0; a = in(), b = in()) {
		if (!f)cout << endl;
		else f = false;
		ll cnt = 0;
		for (ll i = a; i <= b; ++i)if (i % 400 == 0 || i % 100 != 0 && i % 4 == 0) {
			cout << i << endl;
			++cnt;
		}
		if (cnt == 0) {
			cout << "NA" << endl;
		}
	}
}


Measured memory_bytes: 3080
K = gets.chomp.to_i

runrun_array = [1, 2, 3, 4, 5, 6, 7, 8, 9]

K.times do
  @num = runrun_array.shift
  tmp = @num % 10
  runrun_array.push 10 * @num + tmp - 1 if tmp != 0
  runrun_array.push 10 * @num + tmp
  runrun_array.push 10 * @num + tmp + 1 if tmp != 9
end

p @num

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

int main()
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	if((abs(a-b)<=d && abs(b-c)<=d) || abs(a-c)<=d ) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main(){
  ll n;
  cin >> n;
  
  ll ans=1;

  bool mi=false;
  rep(i,n){
    ll x;
    cin>>x;
    if(x==0){
      cout << 0 << endl;
      return 0;
    }
    if(1000000000000000000/x<ans) {
      mi=true;
    }
    if(!mi)ans*=x;
  }

  if(mi) {
    cout << -1 << endl;
    return 0;
  }

  cout << ans << endl;       
}


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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    for (ll i=1; min(i*i,i*16)<=m; ++i) {
        if (m%i==0) {
            if (m >= n * i) ans = max(ans, i);
        }
    }
    if (m%n==0) ans = max(ans, m/n);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>

double dot(double x1, double y1, double x2, double y2){
    return(x1 * x2 + y1 * y2);
}

double scalar2(double x, double y){
    return(x * x + y * y);
}

int main(void){
    double xp1, yp1, xp2, yp2, *xp, *yp;
    int q, i;
    double *x, *y, a;
    
    scanf("%lf %lf %lf %lf", &xp1, &yp1, &xp2, &yp2);
    scanf("%d", &q);
    
    xp = (double *)malloc(sizeof(double) * q);
    yp = (double *)malloc(sizeof(double) * q);
    x = (double *)malloc(sizeof(double) * q);
    y = (double *)malloc(sizeof(double) * q);
    
    for(i = 0; i < q; i ++){
        scanf("%lf %lf", &xp[i], &yp[i]);
    }
    
    for(i = 0; i < q; i ++){
        a = dot(xp2 - xp1, yp2 - yp1, xp1 - xp[i], yp1 - yp[i]) / (scalar2(xp2 - xp1, yp2 - yp1));
        x[i] = xp1 + a * (xp1 - xp2);
        y[i] = yp1 + a * (yp1 - yp2);
        
        printf("%.8f %.8f\n", x[i], y[i]);
    }
    
    free(xp);
    free(yp);
    free(x);
    free(y);
    
    return 0;
}

Measured memory_bytes: 696
#include <iostream>
using namespace std;
int main()
{
	int a,b,x,y,i;
	char op;
	for ( ; ; i++ )
{
		cin >> a >> op >> b;
		if ( op == '+' ){
			x = a + b;
            cout << x << endl; 
    }
        else if ( op == '-' ){
            x = a - b;
            cout << x << endl;  
    }
        else if ( op == '*' ){
        	x = a * b;
        	cout << x << endl;
    }
        else if ( op == '/' ){
        	x = a / b;
        	cout << x << endl;
    }
    if ( op == '?' )  break;{

    }
    }
    return 0;
}    

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		//A
		/*
		int a = sc.nextInt();
		int b = sc.nextInt();
		int dmp = Math.max(a+b, a-b);
		System.out.println(Math.max(dmp,a-b));
		*/
		//B
		int n = sc.nextInt();
		String s = sc.next();
		int[]ansdmp = new int[100];
		for(int i = 0 ; i < n ; i++){
			ansdmp[i]= 0;
			String s1 = s.substring(0,i);
			String s2 = s.substring(i,n);
			String s1sub = "";
			for(int j = 0 ; j < s1.length(); j++){
				if(s1sub.indexOf(s1.charAt(j)) == -1)
					s1sub+=s1.charAt(j);
			}
			//System.out.println(s1sub);
			String usedstr = "";
			for(int k = 0 ; k < s2.length(); k++){
				if (usedstr.indexOf(s2.charAt(k))== -1) {
					if (s1sub.indexOf(s2.charAt(k)) != -1) {
						ansdmp[i]++;
						usedstr += s2.charAt(k);
					}
				}
			}
			//System.out.println(ansdmp[i]);
		}
		int ans = 0;
		for(int x : ansdmp){
			ans = Math.max(ans,x);
		}
		System.out.println(ans);

	}
}


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

const int N = 1e5 + 10;
int n, a[N], cnt, ans;

int main() {
    cin >> n;
    rep(i, 1, n) cin >> a[i];
    rep(i, 1, n) {
        if (a[i] > a[i - 1]) {
            ans = max(ans, cnt); cnt = 1;
        } else cnt++;
        // printf("%d %d\n", i, ans);
    }
    ans = max(ans, cnt);
    printf("%d\n", ans - 1);
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<iomanip>
using namespace std;
vector<double>dat;
vector<vector<double>>dp(3000,vector<double>(3000,-1));
int n;
double m(int i,int h){
    if(dp[i][h]!=-1){
        return dp[i][h];
    }
    if(i>=dat.size() && h>n){
        return 1;
    }
    if(i>=dat.size()){
        return 0;
    }
    dp[i][h]=(m(i+1,h+1)*dat[i])+(m(i+1,h)*(1.0-dat[i]));
    return dp[i][h];
}
int main(){
    int a;
    double aux;
    cin>>a;
    for(int i=0;i<a;i++){
        cin>>aux;
        dat.push_back(aux);
    }
    n=a/2;
    cout<<fixed<<setprecision(10)<<m(0,0)<<endl;
    return 0;
}


Measured memory_bytes: 74460
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
using namespace std;
const int maxn=2010;
int n,k,mx;
struct nod{
	int y,next;
}e[maxn*2];
int head[maxn]={},tot=0;
int dep[maxn]={},d[maxn][30]={};
int ke[maxn]={},vis[maxn]={};
int val[maxn][maxn]={};
int zz[maxn]={};
void init(int x,int y){
	e[++tot].y=y;e[tot].next=head[x];head[x]=tot;
}
void dfs(int x,int f){
	int y;dep[x]=dep[f]+1;d[x][0]=f;
	for(int i=head[x];i;i=e[i].next){
		y=e[i].y;++ke[x];
		if(y==f)continue;
		dfs(y,x);
	}
}
inline void getd(){
	mx=0;
	for(int i=1;i<=n;i<<=1){
		mx++;
		for(int j=1;j<=n;j++){
			d[j][mx]=d[d[j][mx-1]][mx-1];
		}
	}
}
int getdis(int x,int y){
	if(dep[y]<dep[x])swap(x,y);
	int z=dep[y]-dep[x];
	for(int i=1,j=0;i<=z;i<<=1,j++)
		if(i&z)
			y=d[y][j];
	if(x!=y){
		for(int i=mx;i>=0;i--){
			if(d[x][i]!=d[y][i]){
				x=d[x][i];y=d[y][i];
			}
		}
		x=d[x][0];
	}return x;
}
int main(){
	//freopen("c.in","r",stdin);
	//freopen("c.out","w",stdout);
	scanf("%d%d",&n,&k);
	int x,y,ans=0;
	for(int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		init(x,y);init(y,x);
	}
	dfs(1,1);getd();
	int w=0;
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			x=getdis(i,j);
			y=dep[i]+dep[j]-2*dep[x];
			w=max(w,y);//if(y>27)cout<<y<<endl;
			if(y>k){zz[i]++;zz[j]++;}
			val[i][j]=val[j][i]=y;
		}
	}
	//for(int i=1;i<=n;i++)cout<<i<<' '<<zz[i]<<' '<<ke[i]<<endl;
	for(;;){
		y=0;
		for(int i=1;i<=n;i++){
			if(ke[i]==1&&(!vis[i])){
				if(zz[i]>y){
					x=i;y=zz[i];
				}
			}
		}vis[x]=1;
		if(y==0)break;ans++;
		for(int i=1;i<=n;i++)
			if(val[x][i]>k)zz[i]--;
		for(int i=head[x];i;i=e[i].next){
			y=e[i].y;ke[y]--;
		}
	}
	printf("%d\n",ans);
	return 0;
}
/*
12 4
1 2
1 5
2 3
2 4
3 7
3 11
4 8
4 10
5 6
6 9
6 12

*/

Measured memory_bytes: 16384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  char S[10000];
  cin>>N>>S;
  int len=strlen(S);
  
  for(int i=0;i<len;i++){
  int a=S[i]-'A';
    a=(a+N)%26;
   
    
      cout<<(char)('A'+a);
    
  }
  cout<<endl;
 
 
  
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
void solve() {
	int k;
	string s;
	cin >> k >> s;

	if (s.length() <= k)
		cout << s << endl;
	else {
		s = s.substr(0, k);
		s.append("...");
		cout << s << endl;
	}

}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
int main(){
    int n,u,v;cin >> n >> u >> v;
    vector<int> path[n+1];
    for(int i=0; i<n-1; i++){
        int a,b;cin >> a >> b;
        path[a].push_back(b);
        path[b].push_back(a);
    }
    vector<int> du(n+1);
    du[u]=0;
    queue<int> uq;
    uq.push(u);
    vector<bool> used1(n+1,false);
    used1[u]=1;
    while(!uq.empty()){
        int now=uq.front();uq.pop();
        for(auto next: path[now]){
            if(used1[next]) continue;
            used1[next]=true;
            uq.push(next);
            du[next]=du[now]+1;
        }
    }
    vector<int> dv(n+1);
    dv[v]=0;
    queue<int> vq;
    vq.push(v);
    vector<bool> used2(n+1,false);
    used2[v]=1;
    while(!vq.empty()){
        int now=vq.front();vq.pop();
        for(auto next: path[now]){
            if(used2[next]) continue;
            used2[next]=true;
            vq.push(next);
            dv[next]=dv[now]+1;
        }
    }
    int max_d=0;
    for(int i=1; i<=n; i++){
        if(du[i]<dv[i]) max_d=max(max_d,dv[i]);
    }
    cout << max_d-1 << endl;
    return 0;
}

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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b==c+d)cout << "Balanced" << endl;
  else if (a+b>c+d) cout << "Left" << endl;
  else if (a+b<c+d) cout << "Right" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
    int a, b, c, i;
     
    while(scanf("%d %d", &a, &b) != EOF){
     
        c = a + b;
     
        for(i = 0; c != 0; i++) c = c / 10;
     
        printf("%d\n", i);
    }
     
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n=s.length();
    if(s[n-1]=='s')
    {
        s=s+"es";
    }
    else
    {
        s=s+"s";
    }
    cout<<s;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b + c - max({ a, b, c })) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n, i;
	int count = 0;
	char s[51];

	scanf("%d", &n);
	scanf("%s", &s);

	//ABCが連続する数を調べる
	for (i = 0; i < n; i++) {
		if ((s[i] == 'A') && (s[i + 1] == 'B') && (s[i + 2] == 'C')) {
			count++;//ABCが連続したらカウントする
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace myApp
{
    public class Reader
    {
        //
        public int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        //
        public int[] IntArray(char separator = ' ')
        {
            return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            Reader reader = new Reader();

            int         s       = reader.Int();
            List<int>   s_list  = new List<int>();
            s_list.Add(s);

            while(true)
            {
                int n = s_list.Last() % 2 == 0 ? s_list.Last() / 2 : 3 * s_list.Last() + 1;

                if(s_list.Contains(n))
                    break;
                else
                    s_list.Add(n);
            }

            Console.WriteLine(s_list.Count() + 1);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define x first
#define y second
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const long long INF = 1e18;
const int mod = 100003;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;
int n;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	ll ans = 0;
	for(int i = 1;i <= n;i++) {
		ans += n/i;
		if(i*(n/i) == n) ans--;
	}
	cout << ans;
	return 0;
}

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

#define MAX 100000 

bool prime_table[MAX];
int head;

int main(){
	int n, i, j;
	int last;
	// make table
	for (i = 0; i < MAX; i++) {
		if(i==0||i==1){
			prime_table[i] = false;
		}else{
			prime_table[i] = true;
		}
	}
	// find prime
	for (i = 2; i < MAX; i++) {
		if(prime_table[i]){
			for (j = i+i; j < MAX; j+=i) {
				prime_table[j] = false;
			}
		}
	}
	
	while(cin >> n){
		for (i = 0; i <= MAX; i++) {
			if(prime_table[i]){
				if(i > n){
					cout << last << " " << i << endl;
					break;
				}else if(i != n){
					last = i;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0