akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int a,b,t;
int main()
{
    cin>>a>>b;
    if(a>b)
    {
        t=a;
        a=b;
        b=t;
    }
        double w=12.5*a;
        double q=12.5*a+12.5;
        int e=10*b;
        int r=10*b+10;
        int c=(int)(12.5*a);
        if(e>=q||w>=r)
        cout<<-1<<endl;
    else
    {
        if(w<=e)
        {
            cout<<e<<endl;
        }
        else if(w>e)
        {
            if(w==c)
                cout<<w<<endl;
            else
            {

                    cout<<c+1<<endl;
            }
        }

    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);


ll gcd(ll a, ll b){  if(b==0){  return a; }   return gcd(b , a%b); }


void solve(int a[],int n){
  int flag = 0;
  for(int i=0;i<n-1;i++){
    if(a[i+1]-a[i] > 1 ){
      cout<<"NO\n";
      flag = 1;
      break;
    }
  }

  if(!flag){
    cout<<"YES\n";
  }
  
}

ll min(ll a , ll b){   if (a > b){    return b; }  return a; }



 int base_10(int num){
 
  vector<int> vect;
  vect.clear();
  while(num!=0){

    vect.push_back(num%10);
    num /= 10;

  }

  
   int number = 0;
   for(int i=vect.size()-1;i>=0;i--){
     number  = number*10 + vect[i];
   }


   return number;
 }

 int check(int num){
  vector<int> vect;

    while(num!=0){
      vect.push_back(num%10);
      num /= 10;
    }

    for(int i=0;i<vect.size()-1;i++){
       if(vect[i]!=vect[i+1])
          return 0;
    }

    return 1;


 }

int main(){
  int n;
  cin>>n;
  int flag = 0;
  
  while(1 && !flag){


   if(check(n)){
     cout<<n<<"\n";
     flag = 1;
     break;
   }
   n++;

   if(flag){
     break;
   }

  }



  return 0;
}




Measured memory_bytes: 3588
import sys
from itertools import combinations
from math import atan2, cos, sin


def apollonius(p1, c1, p2, c2):
    m1 = p1 + (p2 - p1) * c2 / (c1 + c2)
    m2 = p1 + (p2 - p1) * c2 / (c2 - c1)
    m = (m1 + m2) / 2
    r = abs(m1 - m)
    return m, r


def apollonius_intersections(p1, c1, p2, c2, p3, c3):
    m12, r12 = apollonius(p1, c1, p2, c2)
    m13, r13 = apollonius(p1, c1, p3, c3)
    v = m13 - m12
    d = abs(v)
    if d > r12 + r13 or d < abs(r12 - r13):
        return None, None
    theta = atan2(v.imag, v.real)
    xx = (r12 ** 2 - r13 ** 2 + d ** 2) / (2 * d)
    s = (r12 + r13 + d) / 2
    yy = 2 * (s * (s - r12) * (s - r13) * (s - d)) ** 0.5 / d
    st = sin(theta)
    ct = cos(theta)
    e1 = (xx * ct - yy * st) + (xx * st + yy * ct) * 1j + m12
    e2 = (xx * ct + yy * st) + (xx * st - yy * ct) * 1j + m12

    t1 = abs(e1 - p1) * c1
    t2 = abs(e2 - p1) * c1
    if t1 < t2:
        return e1, t1
    return e2, t2


def get_circumscribed_center(p1, p2, p3):
    A = abs(p2 - p3) ** 2
    B = abs(p3 - p1) ** 2
    C = abs(p1 - p2) ** 2
    T = A * (B + C - A)
    U = B * (C + A - B)
    W = C * (A + B - C)
    # Debug
    try:
        return (T * p1 + U * p2 + W * p3) / (T + U + W)
    except:
        return 0j


def solve(n, k, xyc):
    if k == 1:
        return 0

    xxx = xyc[0::3]
    yyy = xyc[1::3]
    ccc = xyc[2::3]
    beefs = [(i, x + y * 1j, c) for i, (x, y, c) in enumerate(zip(xxx, yyy, ccc))]

    ans = 1e18
    for (i1, p1, c1), (i2, p2, c2) in combinations(beefs, 2):
        # 肉2枚の比重を考慮した等距離点に熱源を置いたときの時間tを算出
        # →t以内に焼ける肉がK以上あれば、その2枚を含む場合の最小時間はt
        px = p1 + (p2 - p1) * (c2 / (c1 + c2))
        t = abs(px - p1) * c1 + 1e-8

        ok = 0
        ng = []
        for i, p, c in beefs:
            if abs(px - p) * c <= t:
                ok += 1
            else:
                ng.append(i)
        if ok >= k:
            ans = min(ans, t)
            continue

        # REが出る。原因はここ以下

        # K枚以上ない場合、範囲外のどれかの肉をギリギリ含めることを考える
        # （重複を防ぐため、j > i2 の肉を調べる）
        # 2点からの比が等しい点の軌跡は、c1==c2なら垂直二等分線、それ以外はアポロニウスの円
        # p1-p2, p2-p3, p3-p1 の3円（または直線）が1点で交わる箇所があるか
        # ある → そこに熱源を置き、時間tを算出、t以内に焼ける肉がK以上あるか調べる
        # ない → 他の2点または3点で考えた方がよい
        for i3 in ng:
            if i3 < i2:
                continue
            _, p3, c3 = beefs[i3]
            if c1 == c2:
                if c2 == c3:
                    e = get_circumscribed_center(p1, p2, p3)
                    t = abs(e - p1) * c1
                else:
                    e, t = apollonius_intersections(p3, c3, p1, c1, p2, c2)
            elif c1 == c3:
                e, t = apollonius_intersections(p2, c2, p1, c1, p3, c3)
            else:
                e, t = apollonius_intersections(p1, c1, p2, c2, p3, c3)

            if e is None:
                continue

            t += 1e-8
            ok2 = 0
            for i, p, c in beefs:
                if abs(e - p) * c <= t:
                    ok2 += 1
            if ok2 >= k:
                ans = min(ans, t)

    return ans


n, k = map(int, input().split())
xyc = list(map(int, sys.stdin.read().split()))
print(solve(n, k, xyc))


Measured memory_bytes: 3700
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main(){
    int N;
    cin >> N;
    map<int, int> m;
    bool ans = true;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        if(m.count(a) == 0) m.insert({a, 1});
        else ans = false;
    }
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;cin>>s>>t;
    cout<<t<<s<<endl;
    return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
using Node = tuple<int64_t, int, int>;
const int maxN = 50 + 5;
const int maxM = 100 + 5;
const int64_t INF = 1e18;

struct Edge {
    int to;
    int64_t a, b;

    Edge() {}
    Edge(int _to, int64_t _a, int64_t _b) : to(_to), a(_a), b(_b) {}
};

int n, m, s;
int c[maxN], d[maxN];
vector<Edge> g[maxN];

int64_t cost[maxN][maxN];
int64_t dist[maxN][maxN * maxM];
int64_t ans[maxN];

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

    cin >> n >> m >> s;

    for(int i = 0; i < m; i++) {
        int u, v;   int64_t a, b;
        cin >> u >> v >> a >> b;

        cost[u][v] = b;
        cost[v][u] = b;

        g[u].push_back(Edge(v, a, b));
        g[v].push_back(Edge(u, a, b));
    }

    for(int i = 1; i <= n; i++)
        cin >> c[i] >> d[i];

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= n; j++)
            cost[i][j] = INF;

    for(int i = 1; i <= n; i++)
        cost[i][i] = 0;

    for(int k = 1; k <= n; k++)
        for(int i = 1; i <= n; i++)
            for(int j = 1; j <= n; j++)
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);


    s = min(s, maxN * maxM - 1);

    for(int i = 0; i < maxN; i++)
        for(int j = 0; j < maxN * maxM; j++)
            dist[i][j] = INF;

    for(int i = 0; i < maxN; i++)
        ans[i] = INF;

    priority_queue<Node, vector<Node>, greater<Node> > pque;

    dist[1][s] = 0;
    pque.push({0, 1, s});

    while(!pque.empty()) {
        int64_t du = get<0>(pque.top());
        int u = get<1>(pque.top());
        int rem = get<2>(pque.top());

        pque.pop();

        ans[u] = min(ans[u], du);

        if(dist[u][rem] != du)
            continue;


        auto update = [&](int nxtU, int nxtRem, int64_t newDist) {
            if(dist[nxtU][nxtRem] > newDist) {
                dist[nxtU][nxtRem] = newDist;
                pque.push({dist[nxtU][nxtRem], nxtU, nxtRem});
            }
        };

        update(u, min(rem + c[u], maxN * maxM - 1), du + d[u]);

        for(Edge nxt : g[u]) {
            int v = nxt.to;
            int64_t a = nxt.a, b = nxt.b;

            if(rem - a >= 0)
                update(v, rem - a, du + b);
        }

        if(rem == maxN * maxM - 1) {
            for(int i = 1; i <= n; i++)
                ans[i] = min(ans[i], du + cost[u][i]);
        }
    }

    for(int i = 2; i <= n; i++)
        cout << ans[i] << '\n';

    return 0;
}


Measured memory_bytes: 9948
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int count = scanner.nextInt();
		
		long min = Integer.MAX_VALUE;
		long max = Integer.MIN_VALUE;
		long sum = 0;
		
		for (int i=0;i<count;i++){
			long t = scanner.nextInt();
			if (t < min) {
				min = t;
			}
			if (t > max) {
				max = t;
			}
			sum = sum + t;
		}
		
		System.out.println(""+ min + " " + max + " " + sum);
		
	}

}

Measured memory_bytes: 42616
#include<iostream>
#include<string>

using namespace std;

void Run1(int&, int&, int&, int&, int&);
void Run2(int&, int&, int&, int&, int&, int&);
void Spin(int&, int&, int&, int&);

int main(){
  int i, n, sum, up, down, north, south, west, east;
  string str;

  while(1){
    cin >> n;
    if(n == 0) break;

    sum = 1;
    up = 1;
    down = 6;
    south = 2;
    north = 5;
    east = 3;
    west = 4;

    for(i=0; i<n; ++i){
      cin >> str;

      if(str == "South")
        Run1(sum, up, north, down, south);
      else if(str == "North")
        Run1(sum, up, south, down, north);
      else if(str == "East")
        Run1(sum, up, west, down, east);
      else if(str == "West")
        Run1(sum, up, east, down, west);
      else if(str == "Right")
        Run2(sum, up, south, east, north, west);
      else if(str == "Left")
        Run2(sum, up, south, west, north, east);
    }

    cout << sum << endl;
  }

  return 0;
}

void Run1(int& sum, int& a, int& b, int& c, int& d){
  Spin(a, b, c, d);
  sum += a;
}

void Run2(int& sum, int& up, int& a, int& b, int& c, int& d){
  Spin(a, b, c, d);  
  sum += up;
}

void Spin(int& a, int& b, int& c, int& d){
  int e;
  e = a;
  a = b;
  b = c;
  c = d;
  d = e;
}

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

int fn[800010], s[800010], n, m, an;
pair<int, int> p[200000];

bool cmp(pair<int, int> const &a, pair<int, int> const &b){
	if (a.first == b.first)return a.second > b.second;
	return a.first < b.first;
}

void ad(int i, int z, int l = 0, int r = m + 2, int id = 1){
	if (l + 1 == r) { fn[id] += z, s[id] += z; return ; }
	int m = l + r >> 1, a = id << 1, b = id << 1 | 1;
	if (i < m)ad(i, z, l, m, a);
	else ad(i, z, m, r, b);
	fn[id] = max(fn[a] + s[b], fn[b]);
	s[id] = s[a] + s[b];
}

pair<int, int> gt(int x, int y, int l = 0, int r = m + 2, int id = 1){
	if (l >= y || r <= x)return make_pair(-1e9, 0);
	if (l >= x && r <= y)return make_pair(fn[id], s[id]);
	int m = l + r >> 1, a = id << 1, b = id << 1 | 1;
	pair<int, int> p = gt(x, y, l, m, a), q = gt(x, y, m, r, b);
	return make_pair(max(q.first, p.first + q.second), p.second + q.second);
}

int main(){
	scanf("%d%d", &n, &m);
	an = max(0, n - m);
	f(i, 0, n)scanf("%d%d", &p[i].first, &p[i].second);
	sort(p, p + n, cmp);
	f(i, 1, m + 1)ad(i, -1);
	f(i, 0, n){
		ad(p[i].second, 1);
		an = max(an, gt(p[i].first + 1, m + 2).first - p[i].first);
	}
	printf("%d\n", an);
}

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()

using ll = std::int64_t;
using vint = std::vector<int>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    int p[5];
    int k;
    rep(i, 5) {
        cin >> p[i];
    }
    cin >> k;

    if (p[4] - p[0] > k)puts(":(");
    else puts("Yay!");
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, M, X, Y;
int x[110], y[110];

int main() {
   cin >> N >> M >> X >> Y;
   int max_x = X;
   int min_y = Y;
   for (int i=1;i<=N;i++) {
      cin >> x[i];
      if (x[i] > max_x) {
         max_x = x[i];
      }
   } 
   for (int i=1;i<=M;i++) {
      cin >> y[i];
      if (y[i] < min_y) {
         min_y = y[i];
      }
   }
   if (max_x < min_y) {
      cout << "No War" << endl;
   } else {
      cout << "War" << endl;
   }
   return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
A = Counter(list(map(int,input().split())))
A = sorted(A.items(),reverse=True)
ans = list()
for key,value in A:
    if value >= 4:
        if len(ans) == 0:
            ans.append(key)
            ans.append(key)
            break
        else:
            ans.append(key)
            break
    elif value >= 2:
        if len(ans) == 0:
            ans.append(key)
        else:
            ans.append(key)
            break
if len(ans) <= 1:
    print(0)
else:
    print(ans[0]*ans[1])

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

int main () {
  int N, T, A;
  cin >> N >> T >> A;
  int I = 0;
  int min = 1<<30;
  for (int i=0; i < N; ++i) {
    int H;
    cin >> H;
    int d = abs(A*1000 - (T*1000 - H * 6));
    if (d < min) min = d, I = i;
  }
  cout << I + 1 << endl;
}


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

struct position{
    int y, x;
};

int main(){
    int H, W, D;
    cin >> H >> W >> D;
    position number_position[H * W];
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            int num;
            cin >> num;
            number_position[num - 1] = {i, j};
        }
    }
    int need_magic_cost[H * W];
    for(int i = H * W - D; i < H * W; i++){
        need_magic_cost[i] = 0;
    }
    for(int i = H * W - D - 1; i >= 0; i--){
        need_magic_cost[i] = need_magic_cost[i + D] + abs(number_position[i].y - number_position[i + D].y) + abs(number_position[i].x - number_position[i + D].x);
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int left, right;
        cin >> left >> right;
        cout << need_magic_cost[left - 1] - need_magic_cost[right - 1] << endl;
    }
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n, m; cin >> n >> m;
  vector<int> a(n, -1);
  vector<int> s(m);
  vector<int> c(m);
  for(int i=0; i<m; i++) {
    cin >> s[i] >> c[i];
    s[i]--;
  }

  if (n == 1) {
    for(int i=0; i<=9; i++) {
      bool f = true;
      string ss = to_string(i);
      for(int j=0; j<m; j++) {
        if (ss[s[j]]-'0' == c[j]) continue;
        f = false;
      }
      if (f) {
        cout << i << endl;
        return 0;
      }
    }
  } else if (n == 2) {
    for(int i=10; i<=99; i++) {
      bool f = true;
      string ss = to_string(i);
      for(int j=0; j<m; j++) {
        if (ss[s[j]]-'0' == c[j]) continue;
        f = false;
      }
      if (f) {
        cout << i << endl;
        return 0;
      }
    }
  } else if (n == 3) {
    for(int i=100; i<=999; i++) {
      bool f = true;
      string ss = to_string(i);
      for(int j=0; j<m; j++) {
        if (ss[s[j]]-'0' == c[j]) continue;
        f = false;
      }
      if (f) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  
  return 0;
}

// EOF


Measured memory_bytes: 256
a=[]
b=[]
while True:
    x,y=map(int,input().split())
    if x==0 and y==0:
        break
    a.append(x)
    b.append(y)

for i in range(len(a)):
    for i2 in range(a[i]):
        print('#'*b[i])
    print('')


Measured memory_bytes: 5624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

int main() {
    int n;
    string s;
    cin >> n >> s;
    ll r = 0, g = 0, b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') r++;
        if (s[i] == 'G') g++;
        if (s[i] == 'B') b++;
    }
    ll cnt = r * g * b;
    for (int i = 0; i < n - 2; i++) {
        for (int j = i + 1; j < n - 1; j++) {
            if (2 * j - i >= n) continue;
            if (s[i] != s[j] and s[j] != s[2 * j - i] and s[2 * j - i] != s[i])
                cnt--;
            // cout << "i,j,k=" << i << "," << j << "," << 2 * j - i << endl;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3604
import java.io.*;
import java.util.*;

public class Main {
  private static InputReader in;
  private static PrintWriter out;

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out, true);

    int n = in.nextInt(), m = in.nextInt();
    boolean[] havered = new boolean[n];
    int[] count = new int[n];
    Arrays.fill(count, 1);
    havered[0] = true;
    for (int i = 0; i < m; i++) {
      int a = in.nextInt()-1, b = in.nextInt()-1;
      havered[b] |= havered[a];
      count[b] += 1;
      count[a] -= 1;
      if (havered[a] && count[a] == 0) {
        havered[a] = false;
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) if (havered[i]) ans++;
    out.println(ans);
    out.close();
    System.exit(0);
  }

  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

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


}


Measured memory_bytes: 20792
n = int(input())
a = [int(x) for x in input().split()]
counta = [0 for _ in range(100000)]
ans = 0

for elem in a:
    counta[elem] += 1

for x in range(1, 100000 - 1):
    ans = max(ans, counta[x-1] + counta[x] + counta[x+1])

print(ans)


Measured memory_bytes: 13964
#include<iostream>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;

int main(){
double a,b,c,d,e,f,x,y;
while(cin>>a>>b>>c>>d>>e>>f){
	x=0.00;
	y=0.00;
	x=double((c*e-b*f)/(a*e-b*d));
	y=double((c*d-a*f)/(b*d-a*e));
	if(x==0)x=0;
	if(y==0)y=0;
	cout<<fixed<<setprecision(3)<<x<<" "<<y<<endl;
}
return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using lint = long long;
using P = pair<int, int>;

int F, H, I, J, K, L, M, N, S, T, U, W;
// lint F, H, I, J, K, L, M, N, S, T, U, W;
// string A, B;
// string ans;
vector<string> alph = {"a","b","c","d","e","f","g","h","i","j"};

void generate(string deliverable, int variety) {
	rep(i, variety) {
		if (deliverable.length() == N - 1) {
			cout << deliverable + alph[i] << endl;
		} else {
			if (i == variety - 1) {
				generate(deliverable + alph[i], variety + 1);
			} else {
				generate(deliverable + alph[i], variety);
			}
		}
	}
}

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

	cin >> N;

	generate("", 1);

	return 0;
}

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

int main() {
  int H, W; cin >> H >> W;
  vector<vector<int>> a(H, vector<int>(W));
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) cin >> a[i][j];
  }
  auto fi = [&](int x) { return x / W; };
  auto fj = [&](int x) { return (x / W % 2) ? W - 1 - x % W : x % W; };
  vector<vector<int>> x;
  for (int k = 0; k < H * W - 1; ++k) {
    if (a[fi(k)][fj(k)] % 2) {
      x.push_back({fi(k) + 1, fj(k) + 1, fi(k + 1) + 1, fj(k + 1) + 1});
      --a[fi(k)][fj(k)];
      ++a[fi(k + 1)][fj(k + 1)];
    }
  }
  cout << x.size() << endl;
  for (int i = 0; i < (int)x.size(); ++i) {
    for (int j = 0; j < 4; ++j) {
      cout << x[i][j] << ( (j == 3) ? '\n' : ' ' );
    }
  }
  return 0;
}


Measured memory_bytes: 10032
#include <stdio.h>


int main(void)
{
    int i;
    int n,m;
    int a[10001];
    int holiday;

    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d",&a[i]);
    }

    holiday=n;
    for(i=0;i<m;i++){
        holiday-=a[i];
    }

    if(holiday<=-1){
        holiday=-1;
    }

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

    return 0;
}

Measured memory_bytes: 1772
#include<string>
#include<list>
#include<iostream>
using namespace std;
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  string str;
  list<int> data;
  list<int>::iterator it,l;
  int n,x;
  cin >> n;
  while(n--){
    cin >> str;
    if(str == "insert"){
      cin >> x;
      data.push_front(x);
    }else if(str == "delete"){
      cin >> x;
      for(it=data.begin(),l=data.end();it!=l;++it){
	if(*it == x){
	  data.erase(it);
	  break;
	}
      }
    }else if(str == "deleteFirst") data.pop_front();
    else data.pop_back();
  }
  for(it=data.begin(),l=--data.end();it!=l;++it) cout << *it << " ";
  cout << *it << endl;
}



Measured memory_bytes: 34432
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll INF = 1e18;

int main() {
    int a, b, q;
    cin >> a >> b >> q;

    vector<ll> s(a+2), t(b+2);
    s[0] = t[0] = -INF;
    for(int i = 1; i <= a; i++) {
        cin >> s[i];
    }
    for(int i = 1; i <= b; i++) {
        cin >> t[i];
    }
    s[a+1] = t[b+1] = INF;
    
    vector<vector<ll>> u(2, vector<ll>(2));
    vector<ll> ans(q, INF);
    rep(h, q) {
        ll x;
        cin >> x;

        auto sepos = lower_bound(s.begin(), s.end(), x);
        int idse = sepos - s.begin(); 
        u[0][1] = s[idse];
        u[0][0] = s[idse-1];

        auto tepos = lower_bound(t.begin(), t.end(), x);
        int idte = tepos - t.begin();
        u[1][1] = t[idte];
        u[1][0] = t[idte-1];

        rep(i, 2) {
            rep(j, 2) {
                rep(k, 2) {
                   ll dist = 0;
                   dist += abs(u[i][j] - x) + abs(u[i][j] - u[i^1][k]);
                   ans[h] = min(ans[h], dist);
                }
            }
        }
    }
    
    rep(i, q) {
        cout << ans[i] << endl;
    }
    
    return 0;
}

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


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

Measured memory_bytes: 3620
A , B, M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
res = min(a) + min(b)
for _ in range(M):
    x,y, c = list(map(int,input().split(" ")))
    x-=1
    y-=1
    res = min(res,a[x]+b[y]-c)
print(res)


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

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

  string ans;

  while (n > 0) {
    n--;
    ans.insert(0, 1, 'a' + n % 26);
    n /= 26;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3580
#include<iostream>
using namespace std;
int main()
{
	int a[4],b[4],i,j,x,y;
	while(cin>>a[0])
	{
		x=y=0;
		for(i=1;i<4;i++)
			cin>>a[i];
		for(i=0;i<4;i++)
		{
			cin>>b[i];
			if(b[i]==a[i])
			{
				x++;
				continue;
			}
			for(j=0;j<4;j++)
				if(b[i]==a[j])
				{
					y++;
					break;
				}
		}
		cout<<x<<' '<<y<<endl;
	}
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x-a) < abs(x-b))
        cout << "A" << "\n";
    else
        cout << "B" << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int S = sc.nextInt();

    int A = S / 100 ; //前2桁
    int B = S % 100 ; //後ろ2桁

    if ( 1 <= A && A <= 12 ){
      if ( 1 <= B && B <= 12 ){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("MMYY");
      }
    }else{
      if ( 1 <= B && B <= 12 ){
        System.out.println("YYMM");
      }else{
        System.out.println("NA");
      }
    }
  }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

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

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

typedef vector<double> VD;
typedef vector< VD > VVD;

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

	cout.precision( 2 );
	cout << fixed;

	while ( true )
	{
		int n, m;
		cin >> n >> m;

		if ( !( n | m ) )
		{
			break;
		}

		VVD table( n, VD( n, 0. ) );

		REP( i, 0, n )
		{
			REP( j, 0, n )
			{
				cin >> table[i][j];
			}
		}

		VVD dp( m, VD( n, 0. ) );
		fill( ALL( dp[0] ), 1. );

		REP( i, 0, m - 1 )
		{
			REP( j, 0, n )
			{
				REP( k, 0, n )
				{
					dp[ i + 1 ][k] = max( dp[ i + 1 ][k], dp[i][j] * table[j][k] );
				}
			}
		}

		cout << *max_element( ALL( dp[ m - 1 ] ) ) << endl;
	}

	return 0;
}

Measured memory_bytes: 1412
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f(i,p,q) for(int i=p;i<q;i++)
#define vi vector<int>v;
#define tc int t; cin>>t; while(t--)
//#define an long long n; cin>>n; long long a[n]; for(int i=0;i<n;i++) cin>>a[i];
int main()
{   
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    long long i=0,j,x,y,len,ans=0; string s; bool flag;
    tc{
        cin>>x>>y; 
        if(x==y){i++;}
        else i=0;
        if(i==3){ans=1;}
    }
    if(ans==1)cout<<"Yes\n";
    else cout<<"No\n";
    ans=0;
}


Measured memory_bytes: 3612
import numpy as np


def main():
    # 整数の入力
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ans = N - sum(np.array(A))
    if ans < 0:
        print('-1')
    else:
        print(ans)


if __name__ == '__main__':
    main()


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

const int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    int K;
    cin>>K;
    cout<<a[K-1]<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define M 10*10*10*10*10*10*10*10*10
int gcd(int x,int y);
int swap(int x,int y);

int main(){
  int x,y;
  int d;
  scanf("%d%d",&x,&y);
  if(x<1 || y>M) exit(1);
  
  d = gcd(x,y);
  printf("%d\n",d);
  return 0;
}

int gcd(int x,int y){
  int r;
  if(x<y){
    swap(x,y);
  }
  while(y>0){
    r = x%y;
    x = y;
    y = r;
  }
  return x;
}

int swap(int x,int y){
  int temp;
  temp = y;
  y = x;
  x = temp;
  return y;
}



Measured memory_bytes: 2128
import sys
x=sys.stdin.read().split()
        
def otsuri(x):
    a=0
    y=1000-x
    if y==1000:
        sys.exit(0)
    else:

         while y>=0:
            if y-500<0:
                break
            else:
                y=y-500
                a=a+1
         while y>=0:
            if y-100<0:
                break
            else:
                y=y-100
                a=a+1
         while y>=0:
            if y-50<0:
                break
            else:
                y=y-50
                a=a+1
         while y>=0:
            if y-10<0:
                break
            else:
                y=y-10
                a=a+1
         while y>=0:
            if y-5<0:
                break
            else:
                y=y-5
                a=a+1
         while y>=0:
            if y-1<0:
                break
            else:
                y=y-1
                a=a+1
         return a

x=map(int,x)
for change in x:
    print otsuri(change)
    
    
    
         
         
    

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

using namespace std;

#define DIM 1000009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define amen exit(0)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
#define y1 trymax_lox
#define y2 sijgkvdfbo
#define eps 1000000

long long i,j,k,l,n,m;

int main(){

   // freopen("boards.in","r",stdin);
   // freopen("boards.out","w",stdout);
    fast;

    cin>>n>>m;
    if(m==n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    amen;
}

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

int main(){
    int x;// 1st k n8
    int k;
    int y;
    int n;// stayed
    int total;
    cin >> n;
    cin >> k;
    cin >> x;
    cin >> y;

    if(n<k){
        total = x*n;
    }else{
        total = x*k + y*(n-k);
    }

    cout << total;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void debug(vec &v) {
	int n = v.size();
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << v[i];
	}
	cout << endl;
}

bool isp(int x) {
	for (int i = 2; i < x; i++) {
		if (x%i == 0)return false;
	}
	return true;
}
void solve() {
	int x; cin >> x;
	while (!isp(x))x++;
	cout << x << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	stop
		return 0;
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, x, y;

int main() {
    cin >> n >> x >> y; x--; y--;
    VVi adj(n);
    REP(i, n) {
        if (i != 0) adj[i].push_back(i-1);
        if (i != n-1) adj[i].push_back(i+1);
    }
    adj[x].push_back(y);
    adj[y].push_back(x);

    Vi cnt(n, 0);
    VVi d(n, Vi(n, -1));
    REP(i, n) {
        queue<int> q;
        q.push(i);
        d[i][i] = 0;
        while (!q.empty()) {
            int node = q.front();
            q.pop();
            for (auto x: adj[node]) {
                if (d[i][x] == -1) {
                    d[i][x] = d[i][node] + 1;
                    cnt[d[i][x]]++;
                    q.push(x);
                }
            }
        }
    }

    REP2(i, 1, n) {
        cout << cnt[i]/2 << '\n';
    }

    return 0;
}


Measured memory_bytes: 16128
import java.util.Scanner;

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

        while (true) {
            int a = scan.nextInt();
            String op = scan.next();
            int b = scan.nextInt();

            if (op.equals("?")) {
                break;
            }

            if (op.equals("+")) {
                answer = a + b;
            } else if (op.equals("-")) {
                answer = a - b;;
            } else if (op.equals("*")) {
                answer = a * b;
            } else if (op.equals("/")) {
                answer = a / b;
            }
            System.out.println(answer);
        }
    }
}

Measured memory_bytes: 26004
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  long long int n;
  cin >> n;
  long long int ans = 1;
  
  for(int i = 1; i <= n; i++){
    ans = (ans * i) % (int)(pow(10,9) + 7);
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    alpha = [0 for _ in range(3)]
    s = input()

    for si in s:
        if si == 'a':
            alpha[0] += 1
        elif si == 'b':
            alpha[1] += 1
        else:
            alpha[2] += 1

    if max(alpha) - min(alpha) <= 1:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


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

int main(){
	string s;
	int q;
	cin >> s >> q;
	bool dir=1;
	int a, b, c;
	int f, ff;
	string st;
	string inv_s;
	string ans;

	for(int i=0;i<q;i++){
		cin >> f;
		if(f == 1){
			dir = !dir;
		}else{
			cin >> ff;ff--;
			cin >> st;
			if(dir == 1 && ff == 1 || dir == 0 && ff == 0){
				s += st;
			}else{
				inv_s += st;
			}
		}
	}
	if(dir == 1){
		reverse(inv_s.begin(), inv_s.end());
		ans = inv_s + s;
	}else{
		reverse(s.begin(), s.end());
		ans = s + inv_s;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define LL long long
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

LL a[200000];

int main()
{
    FAST();
    int i,n;
    LL x,xr=0;
    cin >> n;
    for(i=0;i<n;i++)cin >> a[i],xr^=a[i];
    for(i=0;i<n;i++)x=xr^a[i],cout << x << ' ';
    return 0;
}


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

int main()
{
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  
  int ans = 0;
  for(int i = 1; i <= k; i++){
    if(i <= a){
      ans += 1;
    }else if(i <= b + a){
      ans += 0;
    }else{
      ans -= 1;
    }//else
  }//for
  
  cout << ans << endl;
}

Measured memory_bytes: 3504
def main():
    from bisect import bisect_right

    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()

    def calc(x):
        tmp = 0
        for a in A:
            tmp += N - bisect_right(A, x - a - 0.5)
        return tmp

    l = 0
    r = 3 * 10 ** 5
    while r - l > 1:
        mid = (l + r) // 2
        if calc(mid) >= M:
            l = mid
        else:
            r = mid

    B = [0] * (N + 1)
    for i in range(N):
        B[i + 1] = B[i] + A[i]

    ans = 0
    for a in A:
        tmp = bisect_right(A, r - a - 0.5)
        M -= (N - tmp)
        ans += a * (N - tmp) + (B[-1] - B[tmp])

    ans += M * l
    print (ans)

if __name__ == '__main__':
    main()

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

using namespace std;
int main (){
    int n;
    cin >> n;
    map<int,int> ap;
    int tmp;
    for (int i = 0; i < n; i++){
        cin >> tmp;
        ap[tmp]++;
    }
    if(ap.size()==n) cout << "YES\n";
    else             cout << "NO\n";
}

Measured memory_bytes: 9600
import heapq

class ErasableHeapq:
    def __init__(self):
        self.p = list()
        self.q = list()
        self.len = 0

    def insert(self, x):
        heapq.heappush(self.p, x)
        self.len += 1
        return

    def erase(self, x):
        heapq.heappush(self.q, x)
        self.len -= 1
        return

    def minimum(self):
        while self.q and self.p[0] == self.q[0]:
            heapq.heappop(self.p)
            heapq.heappop(self.q)
        return self.p[0]

    def __len__(self):
        return self.len

    def empty(self):
        return self.len == 0

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

    # 大きい順
    A.sort()
    sA = A[::-1]

    ans = sA[0]

    eq = ErasableHeapq()
    eq.insert((-sA[1], -sA[0]))
    eq.insert((-sA[1], -sA[0]))

    for a in sA[2:]:
        best_pair = eq.minimum()
        eq.erase(best_pair)
        # print(a, best_pair)
        ans += -best_pair[0]
        eq.insert((-a, best_pair[0]))
        eq.insert((-a, best_pair[1]))

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 113672
L, R= map(int,input().split())
m = 2019
ans = 0
if R-L < m:
    ans = m
    L = L%m
    R = R%m
    lis = list(range(L,R+1))
    lis2 = [i%m for i in lis]
    for i in range(len(lis2)):
        for j in range(i+1,len(lis2)):
            if ans > (lis2[i]*lis[j])%m:
                ans = (lis2[i]*lis[j])%m
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
vector<int> v;

const int maxn = 5e5+400;
typedef long long ll;

int main(){
    int n;
    cin>>n;
    bool ok=false;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n)ok=true;
        }
    }
    if(ok)puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
N, D = map(int, input().split())
pts = [tuple(map(int, input().split())) for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1, N):
        dist = 0
        for k in range(D):
            dist += (pts[i][k]-pts[j][k])**2
        if dist**0.5 == int(dist**0.5):
            ans += 1

print(ans)


Measured memory_bytes: 3060
import sys

s = input().split(' ') #['ringo', 'gorira', 'apple']

def isSeritori(A,B):
    if A[-1] == B[0] :
        return True
    else:
        return False

for i in range(2):
    if (isSeritori(s[i],s[i+1])):
        continue
    else:
        print('NO')
        sys.exit(0)
print('YES')

Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
long long L[5100];
long long R[5100];
long long l[5100];
long long r[5100];
pair<long long,int>p[5100];
long long dp[5100][2600][2];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld%lld",L+i,R+i);
	for(int i=0;i<a;i++){
		p[i]=make_pair(R[i]+L[i],i);
	}
	std::sort(p,p+a);
	for(int i=0;i<a;i++){
		l[i]=L[p[i].second];
		r[i]=R[p[i].second];
	}
	for(int i=0;i<5100;i++)for(int j=0;j<5100;j++)dp[i][j][0]=dp[i][j][1]=inf;
	dp[0][0][0]=0;
	for(int i=0;i<a;i++){
		for(int j=0;j<=min(i,a/2);j++){
			for(int k=0;k<2;k++){
				if(dp[i][j][k]==inf)continue;
				if(k==0){
					dp[i+1][j][k+1]=min(dp[i+1][j][k+1],dp[i][j][k]+(l[i]+r[i])*(a/2));
				}
				dp[i+1][j+1][k]=min(dp[i+1][j+1][k],dp[i][j][k]+l[i]*(a/2-j)+r[i]*(a/2-j-1));
				dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]+l[i]*(a/2-(i-j-k)-1)+r[i]*(a/2-(i-j-k)));
			}
		}
	}
	long long ret=dp[a][a/2][a%2];
	printf("%lld\n",ret);
}

Measured memory_bytes: 207616
/* --- author: dxm --- */
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

void qread(int &x){
	int neg=1;x=0;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}

const int maxn=3005;
const int mod=1e9+7;
int n;
char c[maxn];
int dp[maxn][maxn],sum[maxn][maxn];

int main(){
#ifdef FILE
	freopen("FILE.in","r",stdin);
	freopen("FILE.out","w",stdout);
#endif
	scanf("%d%s",&n,c+1);
	dp[1][1]=sum[1][1]=1;
	for(int i=2;i<=n;i++)REP(j,i){
		if(c[i-1]=='<')dp[i][j]=sum[i-1][j-1];
		else dp[i][j]=(sum[i-1][i-1]-sum[i-1][j-1]+mod)%mod;
		sum[i][j]=(sum[i][j-1]+dp[i][j])%mod;
	}
	printf("%d\n",sum[n][n]);
#ifdef TIME
	printf("Running Time = %d ms\n",int(clock()*1000.0/CLOCKS_PER_SEC));
#endif
	return 0;
}

/*
Input:
-----------------
Output:
*/


Measured memory_bytes: 69504
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		char[] s  = scanner.nextLine().toCharArray();
		int n     = s.length;
		int mid   = (n - 1) / 2 + 1;
		String an = "Yes";

		for(int i = 0; i < mid; i++) {

			if(s[i] != s[n - i - 1]) {

				an = "No";
				break;
			}
		}

		int mmid = (mid - 1) / 2 + 1;
		int nn   = mid -1;
		for(int i = 0; i < mmid; i++) {

			if(s[i] != s[nn - i - 1]) {

				an = "No";
				break;
			}
		}

		int start = (n + 3) / 2 + n;
		int mmmid = start / 2 + 1;
		for(int i = start; i < mmmid; i++) {

			if(s[i] != s[n - i - 1]) {

				an = "No";
				break;
			}
		}
		System.out.println(an);

	}
}

Measured memory_bytes: 35472
import java.util.Scanner;

public class Main { 
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String weather = sc.nextLine();
    	String result = "";
    	if("Sunny".equals(weather)) {
    		result = "Cloudy";
    	}else if("Cloudy".equals(weather)) {
    		result = "Rainy";
    	}else if("Rainy".equals(weather)) {
    		result = "Sunny";
    	}
 
    	System.out.println(result);
    	
    	
    }
}

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

using namespace std;

int main()
{
int N, K;
int count = 0;
cin >> N >> K;
int A[N];
for(int i = 0; i < N; i++) cin >> A[i];
while(N > K) {
N = N - K + 1;
count++;
}
cout << count + 1 << endl;
}

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

#include <atcoder/all>

// #LIB#

using namespace std;
using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

int main() {
  ll n, q;
  cin >> n >> q;
  dsu d(n);
  rep(i, q) {
    ll t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      d.merge(u, v);
    } else {
      cout << d.same(u, v) << endl;
    }
  }
}


Measured memory_bytes: 3976
using System;

class WhileSample
{
    static void Main()
    {

        while (true)
        {
            string input = Console.ReadLine();
            if (input == null) return;
            string[] input_array = input.Split(' ');

            int a = int.Parse(input_array[0]);
            int b = int.Parse(input_array[1]);

            int sum = a + b;

            Console.WriteLine(sum.ToString().Length);

        }
    }
}



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



int main(void)
{
    string s, t;
    cin >> s >> t;

    int ans = 0;

    for(int i = 0; i < s.size(); ++i){
        if(s[i] == t[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
# -*- coding: utf-8 -*-

import sys

dic = {'A':0, 'B':0, 'AB':0, 'O':0}
for line in sys.stdin:
    id, type = map(str, line.split(','))
    type = type[:len(type)-1]
    dic[type] += 1
print dic['A']
print dic['B']
print dic['AB']
print dic['O']

Measured memory_bytes: 6436
#include<iostream>
#include<cctype>
using namespace std;
int main()
{
	char ma;
	int sum[123] = {}, i, j=0;
	while (cin.get(ma))
	{
		if (ma == '\n')j++;
		if (j >= 5)break;
		ma = tolower(ma);
		if (isalpha(ma))sum[ma]++;
	}
	for (i = 97; i <= 122; i++)
		cout << static_cast<char>(i) << " : " << sum[i] << endl;
	return 0;
}


Measured memory_bytes: 3092