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

public class Main {
	static class Edge {
		int s,t,c;

		public Edge(int s, int t, int c) {
			this.s = s;
			this.t = t;
			this.c = c;
		}
		
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int L = sc.nextInt();
		int FOLK = 4;
		ArrayList<Edge> edges = solve(L, FOLK);
		System.out.println(edges.get(edges.size()-1).t + " " + edges.size());
		for(Edge e : edges) {
			System.out.println(e.s + " " + e.t + " " + e.c);
		}
		
		sc.close();

	}
	
	public static ArrayList<Edge> solve(int L, int FOLK) {
		
		ArrayList<Edge> edges = new ArrayList<>();
		
		int cur = 1;
		ArrayList<Integer> toEnd = new ArrayList<>();
		while(L>FOLK) {
			int cost = 0;
			for(int i=0; i<FOLK; i++) {
				if(i<L%FOLK) {
					edges.add(new Edge(cur, cur+1, cost));
					cost += L/FOLK+1;
				} else {
					edges.add(new Edge(cur, cur+(L%FOLK==0 ? 1 : 2), cost));
					cost += L/FOLK;
				}
			}
			if(L%FOLK!=0) {
				edges.add(new Edge(cur+1, cur+2, 1));
				toEnd.add(cur+1);
				cur++;
			}
			cur++;
			L /= FOLK;
		}
		for(int i=0; i<L; i++) {
			edges.add(new Edge(cur, cur+1, i));
		}
		cur++;
		
		for(int i : toEnd) {
			edges.add(new Edge(i, cur, 0));
		}
		
		return edges;

	}
}


Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

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

	auto plus = true;
	if (N < 0)
	{
		plus = false;
	}

	vector<char> S;
	auto n = abs(N);
	for (auto i = 0ull; i < 64; ++i)
	{
		if ((n & (1ull << i)) == 0)
		{
			if (S.size() <= i)
			{
				S.push_back(0);
			}
		}
		else if (plus)
		{
			if (S.size() >= i + 1)
			{
				S[i] = 0;
				S.push_back(1);
				S.push_back(1);
			}
			else
			{
				S.push_back(1);
			}
		}
		else
		{
			if (S.size() >= i + 1)
			{
				S[i] = 0;
			}
			else
			{
				S.push_back(1);
				S.push_back(1);
			}
		}
		plus = !plus;
	}

	auto start = false;
	for (auto i = (int)S.size() - 1; i >= 0; --i)
	{
		if (!start)
		{
			if (S[i] == 1)
			{
				start = true;
			}
		}
		if (start || i == 0)
		{
			cout << (char)(S[i] + '0');
		}
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long int
#define MOD 1000000007
#define P pair<ll,ll>
#define INF 1000000000000000000

//using namespace atcoder;
using namespace std;

int main(void){
  string s;
  cin >> s;
  
  ll ans = 0;
  char c = s[0];
  for (int i = 0; i < s.size(); i++){
    if (c != s[i]){
      ans++;
    }
    c = s[i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3760
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
A.sort(reverse=True)
ans=sum(A)
if ans%10!=0:
  print(ans)
  exit()
else:
  for i in range(N):
    tmp=ans-A[-(i+1)]
    if tmp%10!=0:
      print(tmp)
      exit()
print(0)

Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

struct TopologicalSort{
    vector<vector<int>> G;
    vector<int> used,indeg,order;
    TopologicalSort(int n):G(n),used(n,0),indeg(n,0){}
    void add_edge(int u,int v){
        G[u].push_back(v);
        ++indeg[v];
    }
    void bfs(int s){
        queue<int> que;
        que.emplace(s);
        used[s]=1;
        while(!que.empty()){
            int v=que.front(); que.pop();
            order.emplace_back(v);
            for (auto u:G[v]){
                --indeg[u];
                if (indeg[u]==0&&!used[u]){
                    used[u]=1;
                    que.emplace(u);
                }
            }
        }
    }
    vector<int> build(){
        rep(i,G.size()) if (indeg[i]==0&&!used[i]) bfs(i);
        return order;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int V,E; cin >> V >> E;
    TopologicalSort T(V);
    rep(i,E){
        int s,t; cin >> s >> t;
        T.add_edge(s,t);
    }
    vector<int> ans=T.build();
    rep(i,V) cout << ans[i] << endl;
}


Measured memory_bytes: 3812
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int n;
    cin >> n;
    int d[n];
    REP(i,n) cin >> d[i];
    ll ans=0;
    REP(i,n-1){
        FOR(j,i+1,n){
            ans+=d[i]*d[j];
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3584
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*P = map(int,read().split())

graph = [[] for _ in range(N+1)]
for i,x in enumerate(P,2):
    graph[i].append(x)
    graph[x].append(i)

root = 1
parent = [0] * (N+1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

dp = [0] * (N+1)
for v in order[::-1]:
    p = parent[v]
    A = [dp[c] for c in graph[v] if c != p]
    if not A:
        continue
    A.sort(reverse = True)
    A = [x + i for i,x in enumerate(A,1)]
    dp[v] = max(A)

answer = dp[1]
print(answer)

Measured memory_bytes: 28244
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    int i = 1;
    int count = 1;
    map<int, int> m;
    bool ok = false;
    do {
        if(i == 2) {
            ok = true;
            if (count != 1) {
                count--;
            }
           
            break;
        }
        else if (m.count(i) != 0) {
            ok = false;
            break;
        }

        count++;
        m.insert(make_pair(i, count));
        i = a[i];
    } while (true);


    cout << (ok ? count : -1) << endl;

    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

void _main() {
    int N;
    cin >> N;
    vector<int> L(N);
    cin >> L;
    SORT(L);
    int ans = 0;
    REP(i, SZ(L)) {
        FOR(j, i + 1, SZ(L)) {
            int a = L[i];
            int b = L[j];
            int ub = LBP(L, a + b);
            int lb = j + 1;
            ans += max(0LL, ub - lb);
        }
    }
    cout << ans << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i'))
            freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o'))
            freopen("output.txt", "w", stdout);
    }
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, n, m) for(ll i = n; i < (int)m; i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll inf = 1000000000;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-15;

template <typename T>
struct segment_tree {
private:
    int n;
    const function<T(T, T)> op;
    const T ie;
    vector<T> seq;
    
public:
    segment_tree(int _n, function<T(T, T)> op, const T ie) : op(op), ie(ie) {
        n = 1;
        while(n < _n) n *= 2;
        seq.resize(2 * n - 1);
        for(int i = 0; i < 2 * n - 1; i++) seq[i] = ie;
    }
    void update(int k, const T e) {
        k += n - 1;
        seq[k] = e;
        while(k > 0) {
            k = (k - 1) / 2;
            seq[k] = op(seq[k * 2 + 1], seq[k * 2 + 2]);
        }
    }
    T get(int k) {
        k += n - 1;
        return seq[k];
    }
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if(r == -1) r = n;
        if(r <= a || b <= l) return ie;
        if(a <= l && r <= b) return seq[k];
        T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
        T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
        return op(vl, vr);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = (int)s.size();
    segment_tree<int> rmq(n, [](int a, int b){return min(a, b);}, inf);
    int sum = 0;
    ll ans = 0;
    vector<char> ss;
    stack<P> st;
    vector<vector<int>> v(2 * n + 1);
    v[n].pb(0);
    rmq.update(0, 0);
    REP(i, n) {
        ll diff = 0;
        if(s[i] == '(' || s[i] == ')') {
            if(s[i] == '(') sum++;
            else sum--;
            ss.push_back(s[i]);
            int x = (int)st.size() + 1;
            rmq.update(x, sum);
            int l = -1, r = x;
            while(r - l > 1) {
                int m = (l + r) / 2;
                if(rmq.query(m, x) < sum) l = m;
                else r = m;
            }
            v[sum + n].push_back(x + 1);
            int tt = r;
            l = -1; r = (int)v[sum + n].size() - 1;
            while(r - l > 1) {
                int m = (l + r) / 2;
                if(v[sum + n][m] >= tt) r = m;
                else l = m;
            }
            diff = (int)v[sum + n].size() - 1 - r;
            ans += diff;
            st.push({sum, diff});
        } else {
            auto tmp = st.top();
            v[tmp.first + n].pop_back();
            ans -= tmp.second;
            st.pop();
            if(ss.back() == '(') sum--;
            else sum++;
            ss.pop_back();
        }
        cout << ans << endl;
    }
    return 0;
}



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

#define rep(i,n) for(int i=0;i<n;i++)
#define llint long long int
#define vvint vector<vector<int>>
#define vint vector<int>

using namespace std;

int main() {
	int k;
	string s;
	cin >> k >> s;
	int cnt = 0;
	int maxa = 0;
	rep(i, k) {
		if (s[i] == 'I')cnt++;
		else cnt--;
		maxa = max(maxa, cnt);
	}
	cout << maxa << endl;
	return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) begin(n),end(n)

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; }

#define DEBUG

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << (b-a == c-b ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
L=list(map(int,input().split()))
l=len(L)
ans=0
for i in range(l-2):
  for j in range(i+1,l-1):
    if L[i]==L[j]:
      continue
    for k in range(j+1,l):
      if L[j]==L[k] or L[k]==L[i]:
        continue
      m=max(L[i],L[j],L[k])
      s=L[i]+L[j]+L[k]
      if s <= 2*m:
        continue
      ans+=1
print(ans)

Measured memory_bytes: 9252
#include <tuple>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef tuple<string,int> Ttype;

template<int id> class CompTupleBy{
public:
    template<class T>
    bool operator()(const T& a,const T& b) const{
        return get<id>(a) > get<id>(b);
    }
};


int main(){
    int n,w=-1,l,d;
    string s;
    vector<Ttype> v;

    while(cin>>n,n){
        if(w!=-1) cout<<endl;
        for(int i=0;i<n;i++){
            cin>>s>>w>>l>>d;
            cin.ignore();
            v.push_back(Ttype(s,3*w+d));
        }

        stable_sort(v.begin(),v.end(),CompTupleBy<1>());

        for(auto t:v){
            cout<<get<0>(t)<<","<<get<1>(t)<<endl;
        }

        v.clear();
    }

    return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define mod(n) (n) % 1000000007
#define sp << " "
#define precision(n) cout << fixed << setprecision(n);
#define startTime time_t start, end;time(&start);
#define endTime time(&end);double tt = double(end-start);cout<<"Time taken : "<<fixed<<tt<<setprecision(5);cout <<" sec"<< endl;
 
using namespace std;
 
int main() { 
    IOS;
    precision(10);
    ll n;
    cin >> n;
    vector<double> p(n + 1, 0);
    for (int i = 1; i <= n; i++) {
    	cin >> p[i];
    }
    vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0));
    dp[0][0] = 1;
    for (int i = 1; i < n + 1; i++) {
    	dp[i][0] = (1 - p[i]) * dp[i - 1][0];
    }
    for (int i = 1; i < n + 1; i++) {
    	for (int j = 1; j <= i; j++) {
    		dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
    	}
    }
    double ans = 0.0;
    for (int i = n / 2 + 1; i <= n; i++) {
    	ans += dp[n][i];
    }
    cout << ans << endl;
}

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

int main(void){
    // Your code here!
   string a;
   cin >> a;
   char b = a[0];
   for(char f:a){
       if(b!=f){
           cout << "Yes" << endl;
           return 0;
       }
   }
   cout << "No" << endl;
}


Measured memory_bytes: 256
from itertools import permutations

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

for i, pat in enumerate(permutations(range(1, n + 1), n)):
    if pat == p:
        a = i

    if pat == q:
        b = i

ans = abs(a - b)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n, m;
    cin >> n >> m;
    auto g = make_vec<int>(n, 0);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
    }
    int s, t;
    cin >> s >> t;
    s--; t--;
    auto dist = make_vec<int>(n, 3);
    fill_v<int>(dist, INT_MAX);
    dist[s][0] = 0;
    using T = tuple<int, int, int>;
    priority_queue<T, vector<T>, greater<T>> q;
    q.push(T(0, s, 0));
    while (!q.empty()) {
        int d, v, r;
        tie(d, v, r) = q.top();
        q.pop();
        if (dist[v][r] < d) continue;
        int nr = (r+1) % 3;
        for (int u : g[v]) {
            if (dist[u][nr] > dist[v][r] + 1) {
                dist[u][nr] = dist[v][r] + 1;
                q.push(T(dist[u][nr], u, nr));
            }
        }
    }
    if (dist[t][0] != INT_MAX) {
        cout << dist[t][0] / 3 << endl;
    } else {
        cout << -1 << endl;
    }
}


Measured memory_bytes: 14212
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array;

void main() {
    int n, k;
    int[] a;

    scan(n, k);
    a = readln.split.to!(int[]);

    auto dp1 = new bool[][](n + 1, k);
    dp1[0][0] = 1;

    foreach (i ; 1 .. n + 1) {
        foreach (j ; 0 .. k) {
            dp1[i][j] = dp1[i-1][j];
            if (j - a[i-1] >= 0) dp1[i][j] |= dp1[i-1][j-a[i-1]];
        }
    }

    auto dp2 = new bool[][](n + 1, k);
    dp2[n][0] = 1;

    foreach_reverse (i ; 0 .. n) {
        foreach (j ; 0 .. k) {
            dp2[i][j] = dp2[i+1][j];
            if (j - a[i] >= 0) dp2[i][j] |= dp2[i+1][j-a[i]];
        }
    }

    int ans;

    foreach (i ; 0 .. n) {
        int mv;

        for (int l = 0, r = k-1; l < k; l++) {
            if (!dp1[i][l]) continue;
            for (; r >= 0; r--) {
                if (dp2[i+1][r] && l + r < k) {
                    mv = max(mv, l + r);
                    break;
                }
            }
        }

        if (mv < k - a[i]) ans++;
    }

    writeln(ans);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 82812
#include <stdio.h>
#include <math.h>

int main()
{	int r,p,t;
	double x,y;
	scanf("%d,%d",&r,&p);
	y=r;
	t=p;
	while(1){
		scanf("%d,%d",&r,&p);
		if(r==0&&p==0) break;
		y+=r*sin(M_PI_2 - t*M_PI/180);
		x+=r*cos(M_PI_2 - t*M_PI/180);
		t+=p;
	}
	printf("%d\n%d\n",(int)x,(int)y);
	return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
#include <cmath>
#include <bits/stdc++.h>



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int a, b; cin >> a >> b;
	int ans = 0;
	FOR(i,1,b-a+1){
		ans += i;
	}
	ans -= b;

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

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

		while(true){
			int persimmon = sc.nextInt();
			if(persimmon==0) break;
			int w = sc.nextInt();
			int h = sc.nextInt();
			int[][] field = new int[h][w];

			for(int i=0; i<persimmon; i++){
				int x = sc.nextInt();
				int y = sc.nextInt();
				field[y-1][x-1] = 1;
			}
			
			int s = sc.nextInt();
			int t = sc.nextInt();
			int xx = 0, yy = 0;
			int max = 0;

			while(yy+t<=h){
				xx = 0;
				while(xx+s<=w){
					int sum = 0;
					for(int i=yy; i<yy+t; i++){
						for(int j=xx; j<xx+s; j++){
							sum += field[i][j];
						}
					}
					max = Math.max(sum, max);
					xx++;
				}
				yy++;
			}

			System.out.println(max);
		}

	}
}

Measured memory_bytes: 42188
#include <iostream>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    for (int i = 0; i < 2; i++) {
        if (a > b) {
            swap(a, b);
        }
        if (b > c) {
            swap(b, c);
        }
    }
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e6 + 7, MOD = 1e9 + 7;

int F[N], I[N];

vector < pair < pair <int, int>, int > > v;

int P(int a, int b) {
    int r = 1;
    while(b) {
        if(b & 1) r = (r * a) % MOD;
        b >>= 1;
        a = (a * a) % MOD;
    }
    return r;
}

int f(int a, int b) {
    a = abs(a); b = abs(b);
    return (F[a + b] * ((I[a] * I[b]) % MOD)) % MOD;
}


int32_t main() {
    F[0] = I[0] = 1;
    for(int i = 1;  i < N; i++) {
        F[i] = (F[i - 1] * i) % MOD;
        I[i] = P(F[i], MOD - 2);
    }


    int n, m, k; scanf("%lld %lld %lld", &n, &m, &k);
    v.clear();
    v.push_back({{1, 1}, f(n - 1, m - 1)});
    for(int i = 1; i <= k; i++) {
        int x, y; scanf("%lld %lld", &x, &y);
        v.push_back({{x, y}, f(n - x, m - y)});
    }
    sort(v.begin(), v.end());
    for(int i = v.size() - 1; i >= 0; i--) {
            for(int j = i - 1; j >= 0; j--) {
                    int x1 = v[i].first.first, y1 = v[i].first.second, x2 = v[j].first.first, y2 = v[j].first.second, a = v[i].second, b = v[j].second;
                    if(x2 > x1 || y2 > y1) continue;
                    int r = f(x1 - x2, y1 - y2);
                    r = (r * a) % MOD;
                    r = ((b - r) % MOD + MOD) % MOD;
                    v[j].second = r;
            }
    }
    printf("%lld\n", v[0].second);

}


Measured memory_bytes: 16000
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    s = input()
    t = input()

    for i in range(len(s)):
        if s[i:]+s[:i] == t:
            print("Yes")
            break
        if i == len(s)-1:
            print("No")


Measured memory_bytes: 5656
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, K = map(int, input().split())

    if 2 * N < K:
        return N

    R = N % K
    
    if R < abs(R - K):
        return R
    else:
        return abs(R - K)


if __name__ == '__main__':
    print(main())

Measured memory_bytes: 38256
a,b=map(int, input().split())
c=list(input())
henka = c.pop(b-1)
if henka=="A":
    c.insert(b-1,"a")
elif henka=="B":
    c.insert(b-1,"b")
else:
    c.insert(b-1,"c")
print(''.join(c))

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

using namespace std;

long double Calc(long long a)
{
    long double Su=0, A=a, B;
    while (a > 0)
    {
        Su += a%10;
        a /= 10;
    }
    B = A/Su;
    return B;
}

int main()
{
    int k;
    long long I=0, a=1, b=0;
    cin >> k;
    while (k > 0)
    {
        k--;
        if (Calc(I+a) <= Calc(I+2*a))
        {
            I += a;
            b++;
            b %= 10;
        }
        else
        {
            while (b < 9)
            {
                b++;
                I += a;
            }
            a *= 10;
            long long A=I;
            b = 0;
            while (A > 0)
            {
                if (A%10 != 9)
                {
                    b = A % 10;
                    break;
                }
                A /= 10;
            }
            I += a;
            A = I;
            b += 10;
            while (A > 0)
            {
                if (A%10 != 9)
                {
                    b = A % 10;
                    break;
                }
                A /= 10;
            }
            if (b >= 10)
            {
                b = 9;
            }
        }
        cout << I << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 h, w, n;
using P = pair<i64, i64>;
set<P> ps;
int main() {
  cin >> h >> w >> n;
  set<P> st;
  for (i64 i = 0; i < n; ++i) {
    i64 a, b;
    cin >> a >> b;
    ps.emplace(a, b);
    for (i64 da = -2; da <= 0; ++da) {
      for (i64 db = -2; db <= 0; ++db) {
        i64 ta = a + da, tb = b + db;
        if (0 < ta && ta + 2 <= h && 0 < tb && tb + 2 <= w) {
          st.emplace(ta, tb);
        }
      }
    }
  }
  
  vector<i64> ans(10);
  for (const auto& p : st) {
    i64 a = p.first, b = p.second, c = 0;
    for (i64 da = 0; da < 3; ++da) {
      for (i64 db = 0; db < 3; ++db) {
        i64 ta = a + da, tb = b + db;
        c += ps.count({ta, tb});
      }
    }
    ans[c]++;
  }
  
  cout << (h - 2) * (w - 2) - accumulate(begin(ans), end(ans), 0) << '\n';
  for (i64 i = 1; i <= 9; ++i) {
    cout << ans[i] << '\n';
  }
  return 0;
}



Measured memory_bytes: 62720
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();

  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      for (int k = j; k < n; k++) {
        string a;
        a.append(s.begin(), s.begin() + j);
        a.append(s.begin() + k, s.end());
        if (a == "keyence") {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }

  cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main () {
    int N,K;
    cin >> N >> K;
    int h[N];
    map<int, int> list;
    for(int i = 1; i<=N; i++) list[i] = 0;

    for(int i = 0; i<K; i++) {
        int a;
        cin >> a;
        for(int j = 0; j<a; j++){
            int b;
            cin >> b;
            list[b]++;
        }
    }
    int cnt = 0;
    for(auto x : list) {
        if(x.second == 0) cnt++;
    }
    cout << cnt << endl;
    return 0; 
}

Measured memory_bytes: 3596
import sys
input = sys.stdin.readline
import numpy as np

s = input().strip()
t = input().strip()

sn = np.array([ord(a) for a in s])
tn = np.array([ord(a) for a in t])
mi = 1000
if t in s:
    print(0)

else:
    l = len(tn)
    for i in range(len(sn)-l+1):
        tt = sn[i:i+l] -tn
        mi = min(len(np.nonzero(tt)[0]), mi)
    print(mi)


Measured memory_bytes: 27060
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N, K;
    cin >> N >> K;
    std::cout << N % K << '\n';

    return 0;
}

Measured memory_bytes: 256
#include        <bits/stdc++.h>
#define ll      long long int
#define pb      push_back
#define mp      make_pair
#define F       first
#define S       second
#define MOD     1000000007
#define pii     pair<int,int>
#define vi      vector<int>
#define fio     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define N       200010
#define M       21
using namespace std;

int main()
{
    fio;
    int a,b;
    cin>>a>>b;
    int ar=a*b;
    ar-=a;
    ar-=b;
    ar+=1;
    cout<<ar;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = int(input())
W = int(input())

if H <= N: 
  h_ = 1
else:
  h_ = 0
if W <= N: 
  w_ = 1
else:
  w_ = 0

if h_ == 0 or w_ == 0 :
  result = 0
else:
  result  = (h_ + N - H)*(w_ + N - W)
print(result)

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

A = [int(x) for x in input().split()]

flag = ""

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            flag = flag + "1"
        else:
            flag = flag + "0"
    else:
        flag = flag + "1"

if "0" in flag:
    print("DENIED")
else:
    print("APPROVED")

Measured memory_bytes: 3060
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

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;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

main(){
    int n,x,ans=0;
    cin>>n>>x;
    int a[n];
    rep(i,n)cin>>a[i];
    rep(i,n-1){
        int d=max(0ll,a[i]+a[i+1]-x);
        a[i+1]-=d;
        if(a[i+1]<0){
            a[i]+=a[i+1];
            a[i+1]=0;
        }
        ans+=d;
    }
    dans;
}


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

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

Measured memory_bytes: 256
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define dump(x) cerr << "(L" << __LINE__ << ") " << #x << " = " << (x) << endl
#define clr(x, a) memset(x, a, sizeof(x))

#define sum(v) accumulate(all(v), 0)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!odd(n))

#define INF 1000000000
#define INFLL 1000000000000000000LL
#define MOD 1000000007
#define PI acos(-1)

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>

using namespace std;

// clang-format on

main {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  loop(i, sy, ty) cout << 'U';
  loop(i, sx, tx) cout << 'R';
  loop(i, sy, ty) cout << 'D';
  loop(i, sx, tx) cout << 'L';
  cout << 'L';
  loop(i, sy, ty + 1) cout << 'U';
  loop(i, sx, tx + 1) cout << 'R';
  cout << 'D' << 'R';
  loop(i, sy, ty + 1) cout << 'D';
  loop(i, sx, tx + 1) cout << 'L';
  cout << 'U';
  cout << endl;
  bye;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int s(ll x) {
	int res = 0;
	do {
		res += x % 10;
		x /= 10;
	}	while (x);
	return res;
}

bool good(ll x, ll y) {
	return x * s(y) < y * s(x);
}

vector <ll> vec;

ll f(ll x) {
	vec.clear();
	ll cur = 1, suf = 0;
	do {
		vec.pb(x * cur + suf);
		x /= 10;
		suf = suf * 10 + 9;
		cur *= 10;
	}	while (x);
	ll mn = -1;
	for (ll i : vec) {
		if (mn == -1 || good(i, mn)) mn = i;
	}
	return mn;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	int k;
	cin >> k;
	ll n = 1;
	while (k--) {
		cout << n << '\n';
		n = f(n + 1);
	}
}


Measured memory_bytes: 3656
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void)
{		
	int n, m, l;
	cin >> n >> m >>l;
	
	int a[100][100];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	
	int b[100][100];
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}
	
	long int c[100][100] = {0};
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			for (int k = 0; k < l; k++) {
				c[i][k] += a[i][j] * b[j][k];
			}
		}
	}
	
	for (int i = 0; i < n; i++) {
		for (int k = 0; k < l; k++) {
			cout << c[i][k];
			if (k < l - 1) cout << " ";
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3280
def mask_word(N: int, S: str, K: int)->str:
    return ''.join(c if c == S[K-1] else '*' for c in S)


if __name__ == "__main__":
    N = int(input())
    S = input()
    K = int(input())

    ans = mask_word(N, S, K)
    print(ans)


Measured memory_bytes: 2940
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;
const int MOD = 1000000007;
const ll INF = 1LL << 60;

// LRUD
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
// const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
// const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int n, k;
    string s;

    cin >> n >> k;
    cin >> s;

    s[k-1] = s[k-1] - ('A' - 'a');

    cout << s << endl;

    return 0;
}



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

int dp[12][MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,D,X;cin>>N>>D>>X;
    vector<vector<int>> A(D,vector<int>(N));
    
    for(int i=0;i<D;i++){
        for(int j=0;j<N;j++){
            cin>>A[i][j];
        }
    }
    
    for(int i=0;i<D-1;i++){
        memset(dp,0,sizeof(dp));
        
        for(int j=0;j<N;j++){
            for(int k=0;k<=X;k++){
                dp[j+1][k]=dp[j][k];
            }
            if(A[i][j]>=A[i+1][j]) continue;
            
            for(int k=A[i][j];k<=X;k++){
                dp[j+1][k]=max(dp[j+1][k],dp[j+1][k-A[i][j]]+A[i+1][j]);
            }
        }
        int maxi=0;
        for(int k=0;k<=X;k++){
            maxi=max(maxi,X-k+dp[N][k]);
        }
        
        X=maxi;
    }
    
    cout<<X<<endl;
}






Measured memory_bytes: 7908
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ull unsigned long long
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;
long long GCD(long long a, long long b) {
	if (a < b)
		swap(a, b);
	if (b == 0) return a;
	else return GCD(b, a % b);
}

int main() {
	ll i, ans = 0, j;
	ll N, AB = 0, tail_A = 0, head_B = 0, B_A = 0,k;
	bool zennhann = false, kouhann = false;
	string S;
	vector<int> A(100000), L(100000);
	cin >> S;
	if (S[0] == '0' && S[1] != '0') {
		zennhann = true;
	}
	else if (S[0] == '1' && (S[1] == '1' || S[1] == '2')) {
		zennhann = true;
	}
	if (S[2] == '0' && S[3] != '0') {
		kouhann = true;
	}
	else if (S[2] == '1' && (S[3] == '1' || S[3] == '2')) {
		kouhann = true;
	}
	if (zennhann && kouhann)
		cout << "AMBIGUOUS";
	else if (!zennhann && !kouhann)
		cout << "NA";
	else if (zennhann) {
		cout << "MMYY";
	}
	else
		cout << "YYMM";
	cout << endl;
	return 0;
}



Measured memory_bytes: 1024
import math
n, m = map(int, input().split())
if abs(n-m) >= 2:
    print(0)
    exit()
if (n+m) % 2 == 0:
    n, m = math.factorial(n), math.factorial(m)
    ans = n*m*2
else:
    n, m = math.factorial(n), math.factorial(m)
    ans = n*m
print(ans % (10**9 + 7))

Measured memory_bytes: 5180
package main

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

func main() {
	sc := NewScanner()
	A, B := sc.NextInt(), sc.NextInt()
	for i := 1; i <= 3; i++ {
		if A*B*i%2 == 1 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n;
cin >> n;
string t;
cin >> t;
long long r = 0;
long long g = 0;
long long b = 0;
for(int i = 0;i < n;i++){
if(t.at(i) == 'R')r++;
if(t.at(i) == 'G')g++;
if(t.at(i) == 'B')b++;
}
long long ans = r*g*b;
for(int i = 0;i < n;i++){
  for(int j = i+1;j < n;j++){
    if((j-i)%2==0){
      if(t.at(i)!=t.at(j) && t.at((i+j)/2)!=t.at(j) && t.at((i+j)/2)!=t.at(i))ans--;
    }
  }
}
  cout << ans << endl;
}

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

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A.at(i);
    sort(A.begin(),A.end());
    for(ll i=0;i < N-1;i++){
        if(A.at(i) == A.at(i+1)) A.at(i)=0;
    }
    ll cnt = 0;
    ll sum = 0;
    rep(i,N){
        if(A.at(i) == 0) sum++;
        else{
            sum++;
            if(sum%2 == 1){
                cnt++;
                sum = 0;
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
import numpy as np
N=int(input())
A=list(map(int, input().split()))

l=[]

i=1
for j in range(100):
    B=[n-i for n in A]
    C=(np.array(B))**2
    D=np.sum(C)
    l.append(D)
    i=i+1

print(min(l))

Measured memory_bytes: 13204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  int n,x,t;
  cin >> n >> x >> t;
  cout << (n+x-1)/x*t << endl;
}

Measured memory_bytes: 3596
N = int(raw_input())
A = map(int, raw_input().split())
count = 0
for i in range(0, N):
    min_j = i
    c = 0
    for j in range(i, N):
        if A[j] < A[min_j]:
            min_j = j
            c = 1
    A[i], A[min_j] = A[min_j], A[i]
    count += c
print " ".join(map(str, A))
print count

Measured memory_bytes: 6344
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<tuple>
#include<stdio.h>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Q;
ll longinf=1ll<<60;
int inf=1<<29;
//mleしなければぜんぶllでかく。

class unionFind{
      private:
      vector<int> parent;
      vector<int> rank;
      vector<int> sizes;

      public:
      unionFind(int n){
            rep0(i,n){
                  parent.push_back(i);
                  rank.push_back(0);
                  sizes.push_back(1);
            }
      }
      int root(int x){
            if(parent[x]==x){
                  return x;
            }
            else{
                  parent[x] = root(parent[x]);
                  return parent[x];
            }
      }
      void merge(int x,int y){
            x=root(x);
            y=root(y);
            if(x==y) return;
            if(rank[x]<rank[y]) swap(x,y);
            if(rank[x]==rank[y]) rank[x]++;
            parent[y]=x;
            sizes[x]+=sizes[y];
      }
      bool same(int x,int y){
            return root(x)==root(y);
      }
      ll size(int x){
            return sizes[root(x)];
      }
};

int main(){
      ll n,m;
      cin>>n>>m;
      P bridge[m];
      rep0(i,m){
            ll a,b;
            cin>>a>>b;
            --a,--b;
            bridge[i]={a,b};
      }
      reverse(bridge,bridge+m);
      unionFind u(n);
      vector<ll> ans;
      ll pos=(n*(n-1))/2;
      rep0(i,m){
            ans.push_back(pos);
            ll c=bridge[i].first;
            ll d=bridge[i].second;
            if(u.root(c)!=u.root(d)){
                  pos-=(u.size(c)*u.size(d));
            }
            u.merge(c,d);
      }
      reverse(ans.begin(),ans.end());
      for(auto a:ans){
            cout<<a<<endl;
      }

      return 0;
}

Measured memory_bytes: 4968
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<string> s(N);
    rep(i, N) cin >> s[i];
    
    vector<int> cnt(3, 0);
    rep(i, N) {
        if (s[i][0] == 'B' && s[i].back() == 'A') {
            ++cnt[0];
        } else {
            if (s[i][0] == 'B') ++cnt[1];
            else if (s[i].back() == 'A') ++cnt[2];
        }
    }
    int ans;
    if (cnt[1] || cnt[2]) {
        ans = cnt[0] + min(cnt[1], cnt[2]);
    } else {
        ans = max(0, cnt[0] - 1);
    }
    rep(i, N) {
        REP(j, s[i].size()) {
            if (s[i][j - 1] == 'A' && s[i][j] == 'B') ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 768