akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

struct Point{
    double x;
    double y;
    Point (double x, double y) : x(x), y(y) {}
    Point operator-(Point p){
        return Point(x - p.x, y - p.y);
    }
    Point operator+(Point p){
        return Point(x + p.x, y + p.y);
    }
    Point operator*(double d){
        return Point(x * d, y * d);
    }
};
typedef Point Vector;
double cross(Vector v1, Vector v2){
    return v1.x * v2.y - v1.y * v2.x;
}
double dot(Vector v1, Vector v2){
    return v1.x * v1.x + v2.y * v2.y;
}
struct Segment{
    Point p1;
    Point p2;
    Segment(Point p1, Point p2) : p1(p1), p2(p2) {}
};
double get_d(Segment s, Point p){
    Vector v1 = s.p2 - s.p1;
    Vector v2 = p    - s.p1;
    return fabs(cross(v1, v2)) / sqrt(dot(v1, v1));
}
int main(){
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3;
        cin >> x_p0 >> y_p0 >> x_p1 >> y_p1;
        cin >> x_p2 >> y_p2 >> x_p3 >> y_p3;
        Point p0(x_p0, y_p0);
        Point p1(x_p1, y_p1);
        Point p2(x_p2, y_p2);
        Point p3(x_p3, y_p3);
        Segment s1(p0, p1);
        Segment s2(p2, p3);
        double d1 = get_d(s2, s1.p1);
        double d2 = get_d(s2, s1.p2);
        double t = d1 / (d1 + d2);
        Point ans = s1.p1 + (s1.p2 - s1.p1) * t;
        cout << fixed << setprecision(10);
        cout << ans.x << " " << ans.y << endl;
    }
    return 0;
}



Measured memory_bytes: 3296
def calc_price(strings):
    plus = 0
    
    for string in strings:
        if string == "o":
            plus += 1
    
    price = 700 + 100*plus
    
    return price

def main():
    #1. input
    s = input()
    
    #2. calculate price
    price = calc_price(s)
    
    print(price)

if __name__ == "__main__":
    main()
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   string s, t;
   cin >> s >> t;
   rep(i, 0, n){cout << s[i] << t[i];} cout << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  int N, H;
  cin >> N >> H;
  vector<int> a(N), b(N);
  for (int i=0; i<N; i++) cin >> a[i] >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  int res = 0;
  for (int i=0; i<N; i++) {
    if (H>0&&b[i]>=a[N-1]) {
      H -= b[i];
      res++;
    }
    else if (H<=0) {
      cout << res << endl;
      return 0;
    }
    else if (b[i]<a[N-1]) break;
  }
  if (H<=0) cout << res << endl;
  else {
    if (H%a[N-1]==0) res += H/a[N-1];
    else res += H/a[N-1]+1;
    cout << res << endl;
  }
  return 0;
}

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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  vector<string> s(n);
  REP(i, n) cin >> s[i];

  int ret = 0;
  REP(i, n) {
    vector<string> t(n);
    REP(j, n) {
      t[j] = s[j].substr(i+1) + s[j].substr(0, i+1);
      // cout << s[j].substr(0, i+1) << " " << s[j].substr(i+1) << endl;
    }
    // cout << t << endl;
    // B=iのときokか
    bool flag = true;
    REP(j, n) REP(k, n) {
      if(j == (i+k)%n) continue;
      // cout << s[j][(i+k)%n] << " " << s[(i+k)%n][j] << endl;
      if(t[j][(i+k)%n] != t[(i+k)%n][j]) {
        flag = false;
      }
    }
    if(flag) {
      ret += n;
    }
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 600
import sys,collections
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()

lu = [0]*87
lu[0] = 2
lu[1] = 1

def luka(n):
    return lu[n-1] + lu[n-2]

for i in range(2,87):
    lu[i] = luka(i)

print(lu[n])

Measured memory_bytes: 3572
import java.util.Scanner;

class Main{
	public static void main(String[] ag) {
		Scanner sc=new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();

		if(A-B==B-C) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;

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

Measured memory_bytes: 256
k, n = map(int, input().split())
a = list(map(int, input().split()))
length = []

for i in range(n-1):
  length.append(a[i+1] - a[i])
length.append(a[0] + k - a[n-1])

max_length = max(length)
ans = k- max_length
print(ans)

Measured memory_bytes: 26436
import math

N = int(input())

ans = 0

def cal(n):
    limit = math.floor(math.sqrt(n))
    count = 0
    for i in range(1, limit+1):
        if n % i == 0:
            if n % i == i:
                count += 1
            else:
                count += 2
    return count

for i in range(1, N+1, 2):
    if cal(i) == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {   
    int n;
    cin >> n;
    unordered_map<long long int, long long int> um1, um2;
    um1[0] = 1000;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        um2 = um1;
        for (auto p : um1) {
            long long int s = p.first, m = p.second;
            um2[0] = max(um2[0], m + a * s);
            um2[s + m / a] = max(um2[s + m / a], m % a);
        }
        um1 = um2;
    }
    cout << um1[0] << endl;
}




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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int dy[]={-1,-1,-1,0,1,1,1,0}, dx[]={-1,0,1,1,1,0,-1,-1};
char mass[2]={'o','x'};
char s[16][16];

void solve(int p){
  int x=-1,y=-1,get=0;
  rep(i,8) rep(j,8){
    if(s[i][j]!='.') continue;
    //    cout << "i "<< i << " j " << j << endl;
    int nget=0;
    rep(d,8){
      int ny=i+dy[d], nx=j+dx[d];
      while(s[ny][nx]!='.' && ny>=0 && ny<8 && nx>=0 && nx<8){
	if(mass[p]==s[ny][nx]){
	  nget += max(abs(i-ny)-1, abs(j-nx)-1);
	  break;
	}
	ny+=dy[d]; nx+=dx[d];
      }
    }

    if(p && get <= nget){
      y = i; x = j; get = nget;
    }else if(!p && get < nget){
      y = i; x = j; get = nget;
    }
  }
  //  cout << y << "  " << x << endl;
  if(get>0){
    s[y][x] = mass[p];
    rep(d,8){
      int ny=y+dy[d], nx=x+dx[d];
      while(s[ny][nx]!='.' && ny>=0 && ny<8 && nx>=0 && nx<8){
	if(mass[p]==s[ny][nx]){
	  ny=y+dy[d],nx=x+dx[d];
	  while(s[ny][nx]!=mass[p]){
	    s[ny][nx] = mass[p];
	    ny+=dy[d]; nx+=dx[d];
	  }
	  break;
	}
	ny+=dy[d]; nx+=dx[d];
      }
    }
  }
}

int main(){
  rep(i,8) scanf("%s", s[i]);

  rep(i,64){
    //    cout << "i " << i << endl;
    solve(i%2);
  }

  rep(i,8) puts(s[i]);
  return 0;
}

Measured memory_bytes: 1112
#include <string.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
// #include <unordered_map>
// #include <unordered_set>
#include <utility>
#include <vector>

#define pb push_back
#define mp make_pair

#ifdef ONLINE_JUDGE
#define link renamelink
#define next renamenext
#define prev renameprev
#endif

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef long double ld;

inline void EnableFileIO(const string& fileName, bool local = 0) {
  if (fileName.empty()) return;
  if (local) {
    freopen((fileName + ".in").c_str(), "r", stdin);
    freopen((fileName + ".out").c_str(), "w", stdout);
    return;
  }
#ifdef ONLINE_JUDGE
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
#endif
}

const int INF = (1 << 30) - 1;
const LL LINF = (1LL << 61) - 1;
const double EPS = 1e-10, PI = acos(-1);
const int N = 1e5 + 100;

int n, k;
vector<int> G[N];
int vis[N], val[N];
priority_queue<pii> pq;

int main() {
  // srand((int)time(0));
  // printf("Hello, world!\n");
  // EnableFileIO("");

  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    G[u].pb(v), G[v].pb(u);
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    int v, p;
    cin >> v >> p;
    --v;
    vis[v] = 1, val[v] = p;
    pq.push(mp(p, v));
  }

  while (!pq.empty()) {
    int u = pq.top().second;
    pq.pop();

    for (int i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (vis[v]) continue;
      vis[v] = 1, val[v] = val[u] - 1;
      pq.push(mp(val[v], v));
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < G[i].size(); i++) {
      if (abs(val[i] - val[G[i][j]]) != 1) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < n; i++) cout << val[i] << endl;
  return 0;
}


Measured memory_bytes: 8308
def comb(n):
    if n <= 1:
        return 0
    return n * (n - 1) // 2


def check(L):
    r = {}
    a = 0
    c = 0
    for i in range(len(L)):
        if a != L[i]:
            if i != 0:
                r[a] = [comb(c), comb(c - 1)]
            a = L[i]
            c = 1 
        else:
            c += 1
    r[a] = [comb(c), comb(c - 1)]
    #print(r)
    return r

N = int(input())
A = [int(n) for n in input().split(" ")]

D = {}
for i in range(len(A)):
    D[i] = A[i]

D = sorted(D.items(), key=lambda x: x[1])
V = {}
for i in range(len(D)):
    V[D[i][0]] = i

AA = sorted(A)
rr = check(AA)
ss = 0
for k, v in rr.items():
    ss += v[0]
#print(ss)

for k in range(N):
    index = A[k]
    a = rr[index][0] - rr[index][1]
    print(ss - a)


Measured memory_bytes: 79760
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/ 
const int maxn=200005;
int n,m;
int head[maxn],t[maxn<<1],ne[maxn<<1],num,col[maxn],size[maxn];
int sumb,numb,sumn,numn;
i64 ans=0;
inline bool dfs(int x, int fa, int c){
	if(col[x]!=-1)return col[x]==c;
	col[x]=c;size[x]=1;
	bool res=true;
	forE(i,x){
		if(col[t[i]]==-1)
			res&=dfs(t[i],x,c^1),size[x]+=size[t[i]];
		else
			res&=dfs(t[i],x,c^1);
	}
	return res;
}
inline void addedge(int x,int y){
	ne[++num]=head[x];head[x]=num;t[num]=y;
	ne[++num]=head[y];head[y]=num;t[num]=x;
}
int main(){
	read(n);read(m);rep(i,1,n)head[i]=-1;
 	rep(i,1,m){
		int x,y;
		read(x);read(y);
		addedge(x,y);
	}
	memset(col,-1,sizeof(col));
	rep(i,1,n)if(col[i] == -1){
		bool flag=dfs(i, 0, 0);
		int sz=size[i];
		if(sz>1){
			if(flag)
				sumb+=sz,numb+=1;
			else
				sumn+=sz,numn+=1;
		}
	}
	ans=1ll*n*n;
	ans-=1ll*(sumb+sumn)*(sumb+sumn);
	ans+=1ll*(numb+numn)*(numb+numn);
	ans+=1ll*numb*numb;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 7680
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <tuple>
#include <list>
#include <deque>
#include <stack>
#include <complex>
#include <functional>
#include <regex>
#include <map>
#include <numeric>

using namespace std;

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

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

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const int PI = acos(-1);
const int INF = numeric_limits<int>::infinity() / 2;
const ll INFLL = numeric_limits<ll>::infinity() / 2;

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

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

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<ull> T(N);
  rep(i, N) cin >> T[i];
  ull ans = T[0];
  REP(i, 1, N)
    ans = lcm(ans, T[i]);
  cout << ans << endl;
  return 0;
}


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

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

    int r, g, b;
    cin >> r >> g >> b;

    int k = 100 * r + 10 * g + b;
    cout << (k % 4 ? "NO" : "YES") << endl;
}


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

int main() {
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    
    if(A*B >= C*D){
        cout << A*B << endl;
    }
    
    else{
        cout << C*D << endl;
    }
}

Measured memory_bytes: 256
lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a = 0
l = lines[1].length-1
for i in 0..l
  for j in 0..l
    if i != j then
      a = a + lines[1][i]*lines[1][j]
    end
  end
end
puts a/2

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;


int main() {
  string s;
  string sentou;
  ll q;
  cin >> s >> q;
  ll a;
  ll f;
  char c;
  ll recount = 0;
  for(ll i = 0; i< q;i++) {
    cin >> a;
    if (a == 2) {
      cin >> f >> c;
      if((f == 1 &&recount % 2 == 0) || (f == 2 &&recount % 2 == 1)) {
        sentou.push_back(c);
      } else {
        s.push_back(c);
      }
    } else {
      recount++;
    }
  }
  if(recount % 2 == 0) {
    reverse(sentou.begin(), sentou.end());
    cout << sentou << s;
  } else {
    reverse(s.begin(), s.end());
    cout << s << sentou;
  }
}


Measured memory_bytes: 960
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

path = []
for i in range(H):
    if i % 2 == 0:
        range_ = range(W)
    else:
        range_ = reversed(range(W))
    for j in range_:
        path.append((i, j))

c = []
for i, a in enumerate(A):
    for j in range(a):
        c.append(i+1)

ans = [[0]*W for _ in range(H)]
for k, p in enumerate(path):
    i, j = p
    ans[i][j] = c[k]

for elem in ans:
    print(' '.join(map(str, elem)))


Measured memory_bytes: 4340
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
B=[list(map(int,input().split()))for i in range(Q)]
dic_A=dict()
sum_A=sum(A)
ans=list()
tmp=0
for i in A:
    if i in dic_A:
        dic_A[i]+=1
    else:
        dic_A[i]=1
for j in range(Q):
    if B[j][0] in dic_A:
        tmp=sum_A+ dic_A[B[j][0]]*(B[j][1]-B[j][0])
        ans.append(tmp)
        sum_A=tmp
        if B[j][1] not in dic_A:
            dic_A[B[j][1]]=dic_A[B[j][0]]
        else:
            dic_A[B[j][1]]+=dic_A[B[j][0]]
        dic_A[B[j][0]]=0
    else:
        if tmp==0:
            ans.append(sum_A)
        else:
            ans.append(tmp)
for k in ans:
    print(k)

Measured memory_bytes: 38032
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>

using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

VLL V({
	111,222,333,444,555,666,777,888,999,1111
});

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	for (ll n = 0; n < V.size(); n++) {
		if (V[n] >= N) {
			cout << V[n] << "\n";
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()

int main(){
	int n; cin >> n;
	int a, b, c=0;
	bool ok=0;
	REP(i,n){
		cin >> a >> b;
		if(a==b){
			c++;
			if(c==3)
				ok=1;
		}
		else
			c=0;
	}
	if(ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C;
	cin >> A >> B >> C;
	int res = 0;
	res = max(A, max(B, C));
	int sum = A + B + C;
	if ((res + A + B + C) % 2 == 1) {
		res++;
	}
	cout << ((res * 3 - sum) / 2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(ll i=0;i<n;i++)

int main()
{
	ll h, n;
	cin >> h >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	ll sum = 0;
	rep(i, n) sum += a[i];
	if (h <= sum) cout << "Yes" << "\n";
	else  cout << "No" << "\n";

	return 0;
}

Measured memory_bytes: 3980
n,x = map(int,input().split())
s = list(map(int,input().split()))
c = 1
l = 0
for i in range(n):
  l+=s[i]
  if l>x:
    print(c)
    exit()
  c+=1
  if l==x:
    print(c)
    exit()
print(c)

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

ALPHABET = range(ord('A'), ord('Z')+1)

def enc(k, hirabun):
    hira = list(hirabun.encode("ascii"))
    ango = hira.copy()
    for i, code in enumerate(hira):
        if code in ALPHABET:
            if code + k > 90:
                ango[i] = code + k - 26
            else:
                ango[i] = code + k
    angobun = bytes(ango).decode("ascii")
    return(angobun)

print(enc(N, S))

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

const ll INF = (1LL<<60);

int main(){

    ll n; cin >> n;
    string s; cin >> s;

    cout << ((n%2==0 && s.substr(0, n/2)==s.substr(n/2, n)) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define heap priority_queue
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define len(v) ((int)v.size())
#define fa(a,c) for(auto &a:c)
#define endl '\n'


inline ll lcm(const ll &a, const ll &b) {
	return (a / __gcd(a, b)) * b; 
}




int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0);
  
  ll a, b;
  cin>>a>>b;
  cout<<lcm(a,b)<<endl;



}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    string s;
    cin >> s;
    stack<char> st;
    rep(i, s.length()) {
        if ( st.empty() ) {
            st.push(s[i]);
        }
        else if ( st.top() == '0' && s[i] == '1' ) {
            st.pop();
        }
        else if ( st.top() == '1' && s[i] == '0' ) {
            st.pop();
        }
        else {
            st.push(s[i]);
        }
    }
    cout << s.size() - st.size() << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cerr<<' ';cerr<<elem;}cerr<<endl;}

template<typename Type,typename Type_k>
Type ipow(Type n,Type_k k){//n^k. O(log n).
	if(k==0) return 1;
	Type res=ipow(n*n,k/2);
	if(k&1) res*=n;
	return res;
}

int main(){//解説参考.
	llong n;
	cin>>n;
	
	string ans="";
	for(int i=0;n!=0;++i){
		llong tmp=ipow(-2LL,i);
		if(n%(-2*tmp)){
			n-=tmp;
			ans+='1';
		}else ans+='0';
	}
	if(ans=="") ans="0";
	else reverse(ALL(ans));
	
	cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;
int main (){
    ll a,b,x;
    cin >> a >> b >> x;
    ll left = (a-1)/x+1;
    if(a==0) left=0;
    ll right= b/x+1;
    ll ans  = right-left;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();

    ll N;
    cin >> N;
    vector<ll> A(N), B(N+1, 0);
    Rep (i, N) {
        cin >> A[i];
        B[i+1] += A[i] + B[i];
    }

    map<ll, ll> cnt;
    
    for (auto e : B) {
        cnt[e]++;
        // cout << cnt[e] << endl;
    }

    // Rep (i, cnt.size()) cout << cnt[i] << "\n";

    ll ans = 0;
    for (auto i = cnt.begin(); i != cnt.end(); i++) {
        ans += i->second * (i->second - 1) / 2;
    }

    cout << ans << "\n";

}

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

using namespace std;

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    double xa, ya, ra, xb, yb, rb;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    double dis = sqrt(pow((xa - xb), 2) + pow((ya - yb), 2));
    if(fabs(ra - rb) > dis)
      if(ra > rb)
	cout << "2" << endl;
      else
	cout << "-2" << endl;
    else if(fabs(ra - rb) <= dis && ra + rb >= dis)
      cout << "1" << endl;
    else
      cout << "0" << endl;
  }
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n; cin >> n;
    string s; cin>> s;
    int num=0;
    int ans=0;
    rep(i,n){
        if(s[i]=='W') num++;
    }
    rep(i,num){
        if(s[n-i-1]=='R') ans++;
    }
    cout << ans << endl;
return 0;
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vi a(n), b(n);
	REP(i, n)cin >> a[i] >> b[i];
	int c = 0, d = 0;

	ll sum = 0;
	REP(i, n)sum += a[i];
	ll tmp = INF;
	REP(i, n) {
		if (a[i] > b[i])tmp = min(tmp, b[i]);
	}
	if (tmp == INF) {
		cout << 0 << endl;
	}else{
		cout << sum - tmp << endl;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  lol n, x, a;
  cin >> n >> x;
  priority_queue<int, vector<int>,greater<int> > ans;
  rep(i, n){
    cin >> a;
    ans.push(a);
  }
  int sum = 0;
  rep(i, n - 1){
    if(x >= ans.top()){
      sum ++;
      x -= ans.top();
    }
    ans.pop();
  }
  if(x == ans.top()){
    sum ++;
  }
  cout << sum << '\n';
  return 0;
}


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

int main()
{
  int n,i,j,sum=0;
  cin>>n;
  bitset<2000001> b;
  b.reset();
  b[0]=1;
  for(i=0;i<n;i++)
  {
    cin>>j;
    sum+=j;
    b|=b<<j;
  }
  for(i=(sum+1)/2;;i++)
    if(b[i])
      break;
  cout<<i;
  return 0;
}

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

int main() {
  int n,k; cin>>n>>k;
  vector<double> logLength(n);
  for(int i=0; i<n; i++) {
    cin >> logLength[i];
  }
  int ok = (int)*max_element(logLength.begin(),logLength.end());
  int ng=0;
  while(abs(ok-ng)>1) {
    int mid = (ok+ng)/2;
    //cout << "ok : " << ok << ", ng : " << ng << ", mid : " << mid << endl;
    int cutTime=0;
    for(int i=0; i<n; i++) {
      cutTime += (int)ceil(logLength[i]/mid-1);
    }
    if(cutTime<=k) ok=mid;
    else ng=mid;
  }
  cout << ok << endl;
}


Measured memory_bytes: 4736
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>
#include <vector>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
    int n;
    cin >> n;
    for(int i = 1; i < n+1; i++){
        if(i % 3 == 0) {
            cout << " " << i;
            continue;
        } if (((i / 10) % 10) == 3 || ((i / 100) % 10) == 3 || ((i / 1000) % 10) == 3 || i % 10 == 3)
            cout << " " << i;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1164
#include<iostream>
#include<math.h>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
#define INF 1<<20

struct edge{
	int to;
	int cost;
	edge() {};
	edge(int a, int b) {
		to = a;
		cost = b;
	}
};

struct Node {
	int pos;
	int cost;
	Node() {};
	Node(int a, int b) {
		pos = a;
		cost = b;
	}
	bool operator <(const Node& rhs) const {
		return cost > rhs.cost;
	}
};

void dijkistra(int st, int TO,int V,vector<vector<edge> > graph) {
	priority_queue<Node> q;
	vector<int> d(V);
	for (int i = 0;i < V;i++) {
		d[i] = INF;
	}
	d[st] = 0;
	q.push(Node(st, 0));
	while (!q.empty()) {
		Node s = q.top(); q.pop();
		int pos = s.pos;
		for (int i = 0;i < graph[pos].size();i++) {
			int to = graph[pos][i].to;
			int cost = graph[pos][i].cost;
			if (d[pos] + cost < d[to]) {
				d[to] = d[pos] + cost;
				q.push(Node(to, d[to]));
			}

		}
	}
	cout << d[TO] << endl;
}
int partition(int A[],int p, int r) {
	int x = A[r];
	int i = p - 1;
	for (int j = p;j < r;j++) {
		if (x >= A[j]) {
			i = i + 1;
			swap(A[i], A[j]);
		}
	}
		swap(A[i + 1], A[r]);
		return i + 1;
}
void quicksort(int A[], int p, int r) {
	if (p < r) {
		int q = partition(A, p, r);
		quicksort(A, p, q-1);
		quicksort(A, q + 1, r);
	}
}

int getNumberOfCoin(int C[],int n,int m) {
	int T[50000];
	for (int j = 0;j <= n;j++) {
		T[j] = INF;
	}
	T[0] = 0;
	for (int i = 0;i < m;i++) {
		for (int j = 0;j <= n;j++) {
			if (j - C[i] >=0  ) {
				T[j] = min(T[j], T[j - C[i]] + 1);
			}
		}
	}
	return T[n];
}
int knapsack(int w, int n,int* v,int* ww) {
	int W[101][10001];
		for (int j = 0;j <= w;j++) {
			W[0][j] = 0;
		}
	for (int i = 0;i < n;i++) {
		for (int k = 0;k < n;k++){
			for (int j = 0;j <= w;j++) {
				if (j - ww[k] < 0) {
					W[i + 1][j] = W[i][j];
				}
				if (j - ww[i] >= 0) {
					W[i + 1][j] = max(W[i][j], W[i][j - ww[k]] + v[k]);

				}
			}
		}
	}
	return W[n][w];
}
int fib(int n) {
	vector<int> v(n+1);
	v[0] = 1;
	v[1] = 1;
	for (int i = 2;i < n+1;i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	return v[n];
}
int isPrime(int x) {
	if (x <= 1) return false;
	if (x>2 && x % 2 == 0) return false;
	for (int i = 2;i <= sqrt(x);i++) {
		if (x%i == 0) {
			return false;
		}
	}
	if (x == 2) return true;
	return true;
}
int dp[11][1 << 10][341];
int main() {
	int n, s;
	dp[0][0][0] = 1;
	for (int i = 0;i < 10;i++) {
		for (int j = 0;j < (1 << 10);j++) {
			for (int k = 0;k <= 331;k++) {
				if (dp[i][j][k] == 0) continue;
				for (int c = 0;c < 10;c++) {
					if (!(j >> c & 1)) {
						dp[i+1][j | (1 << c)][(i+1)*c + k] += dp[i][j][k];
					}
				}
			}
		}
	}

	while (cin >> n >> s) {
		int ans = 0;
		if (s > 330 || n > 10) cout << 0 << endl;
		else {
			for (int i = 0;i < (1 << 10);i++) {
				ans += dp[n][i][s];
			}
			cout << ans << endl;
		}
		}
	}

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

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.length(); i++) {
     if (s[i] != t[i])
         ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3856
#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

const ll mod = 1e9 + 7;
const int N = 6e5 + 10, M = 1e6 + 10;
const ll INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;

#define pi acos(-1)

int n, k;
int a[N];
struct wc
{
    int l, r;
    int dat;
} tr[N << 4];

void pushup(int p)
{
    tr[p].dat = max(tr[p << 1].dat, tr[p << 1 | 1].dat);
}

void build(int p, int l, int r)
{
    tr[p] = {l, r};
    if (l == r)
        return;
    int mid = l + r >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
}

void modify(int p, int x, int v)
{
    if (tr[p].l == x && tr[p].r == x)
    {
        tr[p].dat = max(tr[p].dat, v);
        return;
    }
    int mid = tr[p].l + tr[p].r >> 1;
    if (x <= mid)
        modify(p << 1, x, v);
    else
        modify(p << 1 | 1, x, v);
    pushup(p);
}

int ask(int p, int l, int r)
{
    if (tr[p].l >= l && tr[p].r <= r)
    {
        return tr[p].dat;
    }
    int maxn = 0;
    int mid = tr[p].l + tr[p].r >> 1;
    if (r <= mid)
        maxn = max(maxn, ask(p << 1, l, r));
    else if (l > mid)
        maxn = max(maxn, ask(p << 1 | 1, l, r));
    else
    {
        maxn = max({maxn, ask(p << 1, l, mid), ask(p << 1 | 1, mid + 1, r)});
    }
    return maxn;
}
int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    build(1, 1, N - 1);
    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        int num = ask(1, max(1, a[i] - k), a[i] + k) + 1;
        ans = max(ans, num);
        modify(1, a[i], num);
        //cout << num << ' ';
    }
    cout << ans << endl;
}
/*

*/

Measured memory_bytes: 29480
#include <bits/stdc++.h>
#include <ctype.h>
using namespace std;
 
 
int main(){
    string S;
    cin>>S;
    int a=0,b=0;
    bool s=false;
    if(S.at(0)=='A')s=true;
    for(int i=2;i<S.size()-1;i++){
        if(S.at(i)=='C')a++;
    }
    if(a==1&&s)s=true;
    else s=false;
  
    for(int i=0;i<S.size();i++){
        if(islower(S.at(i)))b++;     
    }
    if(b==S.size()-2&&s)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;
    

}

Measured memory_bytes: 256
from collections import deque
import sys
input =sys.stdin.readline
N,Q = (int(x) for x in input().split())

#構造入力
connection = {i:set() for i in range(1,N+1)}
for i in range(1,N):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)

#ポイント入力
point ={i:0 for i in range(1,N+1)}
for i in range(1,Q+1):
    p,x = (int(x) for x in input().split())
    point[p] +=x

#深さ優先探索
que =deque()
que.append(1)
passed =set()
while que:
    now =que.pop()
    passed.add(now)
    for next in connection[now]:
        if next not in passed:
            point[next] +=point[now]
            que.append(next)
            #print(next,end=" ")
print(*point.values())

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

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long int
#define INF 1000000007
#define llINF 1000000000000000007
#define v(i) vector<i>
#define vv(i) vector<vector<i>>
// cin.eof() 入力個数の問題
// int num = atoi(string.c_str()); 文字列の整数変換

int main() {
int n;
cin>>n; n *= 3;
ll a[n]; 
rep(i,n){
   cin>>a[i]; 
}
sort(a,a+n);
ll ans = 0;
for(int i = n/3; i < n; i += 2){
ans += a[i];
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 5952
import java.util.*;

class Main {
    static List<Integer>[] graph;
    static int[] dp;

    public static int dfs(int pos) {
    	if(graph[pos].size() == 0) return 0;

    	if(dp[pos] == -1) {
    		for(int i = 0; i < graph[pos].size(); i++) {
    			dp[pos] = Math.max(dp[pos], dfs(graph[pos].get(i)) + 1);
    		}
    	}

    	return dp[pos];	
    }

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

    	int n = sc.nextInt();
    	int m = sc.nextInt();

    	graph = new ArrayList[n+1];
    	for(int i = 0; i < n+1; i++)
    		graph[i] = new ArrayList<>();
    	for(int i = 0; i < m; i++) {
    		int x = sc.nextInt();
    		int y = sc.nextInt();
    		graph[x].add(y);
    	}
    	// System.out.println(Arrays.deepToString(graph));

    	dp = new int[n+1];
    	Arrays.fill(dp, -1);

    	int ans = 0;
    	for(int i = 1; i < n+1; i++) {
    		ans = Math.max(ans, dfs(i));
    	}

    	System.out.println(ans);
    }
}

Measured memory_bytes: 73612
{-# LANGUAGE BangPatterns #-}

module Main where

import Data.Char
import Data.List
import Control.Monad
import Control.Applicative
import Text.Printf


readNum :: IO Double
readNum = read <$> (input `seq` input)
    where input = do
            !c <- getChar
            if isDigit c || c == '-' || c == '.'
                then (c :) <$> input
                else return []

prints :: Show a => [a] -> IO ()
prints as = putStrLn $ concat $ intersperse " " $ map show as

main = putStrLn . f =<< readNum
  where f n = printf "%f %f" (n * n * pi) (2 * n * pi)


Measured memory_bytes: 4060
import math

a,b,C = map(int, input().split())
S = (1/2)*a*b*math.sin(math.radians(C))
L = (a**2+b**2-2*a*b*math.cos(math.radians(C)))**(1/2)+a+b
h = 2*S/a
print(S)
print(L)
print(h)


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

int main() {
	int degree[5] = {0, 0, 0, 0, 0};
	for (int i=0; i<3; i++) {
		int a, b;
		cin>>a>>b;
		degree[a]++, degree[b]++;
	}
	for (int i=1; i<=4; i++) {
		if (degree[i] > 2 || degree[i] == 0) {
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
 // freopen("input.txt","r",stdin);
#endif

  map<ll,ll> mp;
  int n;
  cin>>n;
  ll sum=0;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    mp[x]++;
    sum+=x;
  }

  int q;
  cin>>q;
  for(int i=0;i<q;i++)
  {
      int x,y;
      cin>>x>>y;
      sum-=x*mp[x];
      sum+=y*mp[x];
      mp[y]+=mp[x];
      mp[x]=0;
      cout<<sum<<endl;
  }

  return 0;
}

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

int main() {
    string s;
    cin >> s;
    map<string,int> m;
    m.insert({"SUN",7});
    m.insert({"SAT",1});
    m.insert({"FRI",2});
    m.insert({"THU",3});
    m.insert({"WED",4});
    m.insert({"TUE",5});
    m.insert({"MON",6});
    cout << m[s] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

/*
 * return 1 if rectangle contains a given circle (pos_x, pos_y and radius), otherwise 0.
 */
int is_circle_in_rect(pos_x, pos_y, radius, width, height) {
  int ret;
  ret = 0;

  if ( ((pos_x - radius) >= 0)     && ((pos_y - radius) >= 0) &&
       ((pos_x + radius) <= width) && ((pos_y + radius) <= height) ) {
    ret = 1;
  }
  return ret;
}


int main(int argc, char *argv[]) {
  int width, height, pos_x, pos_y, radius;
  scanf("%d %d %d %d %d", &width, &height, &pos_x, &pos_y, &radius);

  if (is_circle_in_rect(pos_x, pos_y, radius, width, height)) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}




Measured memory_bytes: 2148
package main

import "bufio"
import "os"
import "math"
import "strconv"
import "fmt"

var rdr = bufio.NewReaderSize(os.Stdin, 100000)

func readLine() (string, error) {
    buf := make([]byte, 0, 100000)
    for {
        l, p, e := rdr.ReadLine()
        if e!=nil {
            return "", e
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf), nil
}


func main(){
    S, _ := readLine()
    len_S := len(S)
    mindiff := math.MaxInt32
    
    for i:=0; i<=len_S-3; i++{
        num, _ :=  strconv.Atoi(S[i:i+3])
        //fmt.Printf("num=>%d\n", num)
        diff := absint(num - 753)
        if diff < mindiff {
            mindiff = diff
        }
    }

    fmt.Printf("%d\n", mindiff)
}

func absint(x int) int {
    if x < 0 {
        return -x
    }
    return x
        
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
    int a, b;
    scanf("%d%d",&a, &b);

    if (a == b) {
        printf("a == b\n");
    } else if (a < b) {
        printf("a < b\n");
    } else {
        printf("a > b\n");
    }

    return 0;
}

Measured memory_bytes: 580
N = int(input())
x = 0

for i in range(1, N+1):

    if i % 3 == 0:
        print(" %d" % i, end="")
    else:
        x = i
        while (x):
            if x % 10 == 3:
                print(" %d" % i, end="")
                break
            x //= 10
print()


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

double sigma(int n)
{
    return (n+1)*n/2.0;
}

int p[200000];
int main() {
    int n, k;
    cin >> n >> k;

    int max = -1;
    int sum = 0;
    rep(i, n)
    {
        cin >> p[i];

        sum += p[i]+1;
        if ( i >= k )
            sum -= p[i-k]+1;

        if ( sum > max )
            max = sum;
    }

    cout << setprecision(15) << max/2.0;

    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        long ans = 1;
        int N = cin.nextInt();
        long mod = 1000000007;

        for (int i = 0; i < N; i++)
        {
            ans *= i + 1;
            ans %= mod;
        }
        Console.WriteLine(ans);
    }

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>

using namespace std;

const int N = 3e5 + 50;

string s, t, u;
int a, b;

int main()
{
#ifdef ONLINE_JUDGE
#else
    // freopen("r.txt", "r", stdin);
// freopen("w.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false);
    cin >> s >> t >> a >> b >> u;

    if (s == u)
        a--;
    if (t == u)
        b--;
    cout << a << " " << b;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
    public void Proc()
    {
        int procCnt = int.Parse(Console.ReadLine());
        PPoint a = new PPoint(0,0);
        PPoint b = new PPoint(100,0);

        Console.WriteLine(a.X.ToString("0.00000000") + " " + a.Y.ToString("0.00000000"));
        this.Koch(procCnt, a, b);
        Console.WriteLine(b.X.ToString("0.00000000") + " " + b.Y.ToString("0.00000000"));

    }

    public void Koch(int depth, PPoint p1, PPoint p2)
    {
        if(depth == 0)
        {
            return;
        }

        PPoint s = new PPoint(0, 0);
        PPoint t = new PPoint(0, 0);
        PPoint u = new PPoint(0, 0);
        double th = Math.PI / 3;

        s.X = (2 * p1.X + 1 * p2.X) / 3d;
        s.Y = (2 * p1.Y + 1 * p2.Y) / 3d;
        t.X = (1 * p1.X + 2 * p2.X) / 3d;
        t.Y = (1 * p1.Y + 2 * p2.Y) / 3d;
        u.X = (t.X - s.X) * Math.Cos(th) - (t.Y - s.Y) * Math.Sin(th) + s.X;
        u.Y = (t.X - s.X) * Math.Sin(th) + (t.Y - s.Y) * Math.Cos(th) + s.Y;

        Koch(depth - 1, p1, s);
        Console.WriteLine(s.X.ToString("0.00000000") + " " + s.Y.ToString("0.00000000"));
        Koch(depth - 1, s, u);
        Console.WriteLine(u.X.ToString("0.00000000") + " " + u.Y.ToString("0.00000000"));
        Koch(depth - 1, u, t);
        Console.WriteLine(t.X.ToString("0.00000000") + " " + t.Y.ToString("0.00000000"));
        Koch(depth - 1, t, p2);
    }

    public class PPoint
    {
        public double X = 0;
        public double Y = 0;
        public PPoint(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }
    }



    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

Measured memory_bytes: 9488
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
#define ll long long
const int INF = 0x7fffffff;
const int N = 5e3 + 5;
bool prime(ll n)
{
    for (int i = 2; i * i <= n; i++)
        if (n % i == 0)
            return false;
    return true;
}
int main()
{
    ll i, j, k;
    ll n, m, t;
    ll count = 0;
    cin >> n;
    for (i = 11; i <= 55555; i += 10)
    {
        if (prime(i))
        {
            cout << i << " ";
            count++;
        }
        if (count == n)
            break;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b){
		cout<<c<<endl;
	}
	else if(a==c){
		cout<<b<<endl;
	}
	else {
		cout<<a<<endl;
	}
}


Measured memory_bytes: 256