akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> d(n);
    REP(i,n) cin >> d[i];
    ll ans = 0;
    REP(i,n) FOR(j,i+1,n) {
        ans += d[i]*d[j];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;

    int cnt = 0;
    REP(i, N - 1){
        if (s[i] == s[i + 1]) cnt++;
    }

    cout << (N - cnt) << endl;


    return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

//4Head

#define all(x) x.begin(), x.end()
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(NULL));

ll const mod = 1e9 + 7;

namespace {
	ll mul(ll a, ll b) {
		ll val = a * b - (ll)((ld)a * b / mod) * mod;
		if (val < 0) val += mod;
		if (val >= mod) val -= mod;
		return val;
	}

	ll poww(ll a, ll b) {
		ll val = 1;
		a %= mod;
		while (b > 0) {
			if (b % 2) val = mul(a, val);
			a = mul(a, a);
			b >>= 1;
		}
		return val % mod;
	}

	ll inv(ll a) {
		return poww(a, mod - 2);
	}
}

ll const maxn = 3e5 + 5;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n; cin >> n;
	vector<ll>x(n);
	for (ll i = 0; i < n; i++) cin >> x[i];
	ll ans = LLONG_MAX;
	for (ll p = 1; p <= 100; p++) {
		ll ans1 = 0;
		for (ll xx : x) {
			ans1 += (xx - p) * (xx - p);
		}
		ans = min(ans, ans1);
	}
	cout << ans << endl;
	return 0;
}

/*
3
0 1
3 0
1 0
*/

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.*;
import java.util.*;

import static java.util.stream.Collectors.*;
import static java.util.Map.Entry.*;

public class Main {

	public static void main(String[] args) throws IOException {
		 FastReader in = new FastReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = in.nextInt();
		List<Integer>a = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			a.add(in.nextInt());
		}
		while (a.size() > 1 ){
			Collections.sort(a);
			int x = a.get(0);
			for (int i = 1; i < a.size(); i++) {
				int y = a.get(i);
				y = y%x;
				if (y > 0) {
					a.set(i, y);
				} else {
					a.remove(i);
				}
			}
		}
		out.println(a.get(0));
		out.flush();
		out.close();

	}

	static class FastReader {
		StringTokenizer st;
		BufferedReader br;

		public FastReader(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public FastReader(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

		public int[] nextIntArray(int n) throws IOException {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = nextInt();
			}
			return ret;
		}

		public long[] nextIntLong(int n) throws IOException {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = nextLong();
			}
			return ret;
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}

}

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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long double PI=3.14159265358979323846;



int main() {
    cout<<fixed<<setprecision(16);

    ll a,b,h,m; cin>>a>>b>>h>>m;

    using ld = long double;

    ld t1 = 2.0*PI/12.0*(h+m/60.0);
    ld t2 = 2.0*PI/60.0*m;


    ld x1,x2,y1,y2;
    x1 = a*sin(t1);
    y1 = a*cos(t1);
    x2 = b*sin(t2);
    y2 = b*cos(t2);


    ld dx = x1 - x2;
    ld dy = y1 - y2;


    cout<<sqrt(dx*dx + dy*dy)<<endl;


    return 0;

}

Measured memory_bytes: 4164
#include <iostream>

using namespace std;

int main() {
    int n;  cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 3 && i % 5)
            ans += i;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

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

		int n = scan.nextInt();
		int r = scan.nextInt();

		int ans = 1;
		while(true) {
			if(n < Math.pow(r, ans) ) {
				System.out.println(ans);
				return;
			}
			ans++;
		}
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#define MN 200000
using namespace std;
inline int read()
{
	int x=0,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();}
	return x*f;
}
int n,T,a[MN+5],f[MN+5],pos[MN+5];
bool Check(int a,int b,int c){return (a<b&&b<c)||(a<b&&c<a)||(b<c&&c<a);}
int main()
{
	n=read();
	for(int i=1;i<=n;++i) pos[a[i]=read()]=i;
	for(int i=n;i;--i)
		if(!T&&i!=n&&pos[i]>pos[i+1]) f[T]=i+1,++T; 
		else if(T)
		{
			int F=f[T-1];
			if(!Check(pos[F],pos[i],pos[i+1])) f[T]=i+1,++T;
		}
	cout<<T<<endl;
	return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,r;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>r>>d>>ans;
    rep(i,10){
        ans=r*ans-d;
        Cout(ans);
    }
    return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	string s;
	cin >> s;
	int cou = 0;
	int len = s.length();
	for (int i = 0; i < s.length()/2; ++i) {
		if (s[i] != s[len - i - 1]) cou++;
	}
	cout << cou << endl;
}

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

Measured memory_bytes: 256
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

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

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    std::ifstream in("a.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    string s;
    cin >> s;

    if (s == "A") {
        cout << "T";
    }
    else if (s == "T") {
        cout << "A";
    }
    else if (s == "C") {
        cout << "G";
    }
    else {
        cout << "C";
    }

    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace __gnu_pbds;
using namespace std;

ll mod = 1e9+7;

ll add(ll a, ll b) { return (a % mod + b % mod) % mod; }
ll mul(ll a, ll b) { return (a % mod * b % mod) % mod; }
ll debug(vector<int> a) { for(int i: a) cout << i << " "; return puts("\n"), 0;}

ll power(ll base, ll exp) {
    ll res = 1;
    while(exp) {
        if(exp&1) res = mul(res, base);
        base = mul(base, base);
        exp >>= 1;
    }
    return res;
}

ll inv(ll p) {
    return power(p, mod-2);
}



int main() {
    fastio
    int n; cin >> n;
    vector<pair<int, int>> adj[n+2];
    vector<int> ans(n+2);
    vector<int> vis(n+2, 0);
    int indeg[n+2] = {0};
    
    int mxColor = 0;
    
    for(int i=0; i<n-1; i++) {
        int u, v; cin >> u >> v;
        adj[u].pb({v, i});
        adj[v].pb({u, i});
        indeg[u]++;
        indeg[v]++;
        mxColor = max(indeg[u], mxColor);
        mxColor = max(indeg[v], mxColor);
    }
    cout << mxColor << "\n";
    queue<pair<int, int>> q;
    q.push({1, -1});
    while(!q.empty()) {
        auto v = q.front();
        int x = v.second;
        q.pop();
        for(auto node: adj[v.first]) {
            if(!vis[node.second]) {
                ans[node.second] = (++x) % mxColor;
                q.push({node.first, ans[node.second]});
                vis[node.second] = 1;
            }
        }
    }

    for(int i=0; i<n-1; i++) cout << ans[i]+1 << "\n";    
}

Measured memory_bytes: 7936
c = [list(map(int, input().split())) for _ in range(3)]
b0 = c[0][0]
b1 = c[0][1]
b2 = c[0][2]
for i in range(1, 3):
    a0 = c[i][0] - b0
    a1 = c[i][1] - b1
    a2 = c[i][2] - b2
    if not a0 == a1 == a2:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  int n[3];
  cin >> N >> n[0] >> n[1] >> n[2];
  char a, b;
  cin >> a >> b;
  int k = (int)a - (int)'A';
  int j = (int)b - (int)'A';
  if (!(n[k] + n[j])) {
    cout << "No" << endl;
    return 0;
  }
  string key = "ABC";
  if (n[0] + n[1] + n[2] >= 3) {
    cout << "Yes" << endl;
    if (n[k] < n[j]) {
      cout << key[k] << endl;
      n[k] ++;
      n[j] --;
    }
    else {
      cout << key[j] << endl;
      n[k] --;
      n[j] ++;
    }
    for (int i = 1; i < N; i ++) {
      char c_, d_;
      cin >> c_ >> d_;
      int c = (int)c_ - (int)'A';
      int d = (int)d_ - (int)'A';
      if (n[c] < n[d]) {
        cout << key[c] << endl;
        n[c] ++;
        n[d] --;
        continue;
      }
      else {
        cout << key[d] << endl;
        n[d] ++;
        n[c] --;
      }
    }
    return 0;
  }
  vector<char>ans(N);
  vector<int>A(N);
  vector<int>B(N);
  A[0] = k;
  B[0] = j;
  for (int i = 1; i < N; i ++) {
    char c, d;
    cin >> c >> d;
    A[i] = (int)c - (int)'A';
    B[i] = (int)d - (int)'A';
  }
  for (int i = 0; i < N; i ++) {
    int x = A[i];
    int y = B[i];
    if (!(n[x] + n[y])){
      cout << "No" << endl;
      return 0;
    }
    if (n[x] < n[y]) {
      ans[i] = key[x];
      n[x] ++;
      n[y] --;
      //cout << "a ";
      continue;
    }
    if (n[x] > n[y]) {
      ans[i] = key[y];
      n[y] ++;
      n[x] --;
      //cout << "b ";
      continue;
    }
    if (n[x] == n[y]) {
      if (i == N - 1) {
        ans[i] = key[x];
        n[x] ++;
        n[y] --;
        //cout << "c ";
      }
      else {
        int u = A[i + 1];
        int v = B[i + 1];
        if (x + y == u + v) {
          ans[i] = key[x];
          n[x] ++;
          n[y] --;
          //cout << "d ";
        }
        else {
          int kj = 3 - u - v;
          int kore = x + y - kj;
          ans[i] = key[kore];
          n[kore] ++;
          n[kj] --;
          //cout << "e ";
        }
      }
    }
    //cout << n[0] << ' ' << n[1] << ' ' << n[2] << endl;
  }
  cout << "Yes" << endl;
  for (int i = 0; i < N; i ++) cout << ans[i] << endl;
}



Measured memory_bytes: 4024
import bisect,collections,copy,heapq,itertools,math,numpy,string,decimal
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N,M,X = II()
CA=[list(map(int,list(input().split()))) for i in range(N)]
C_min = -1

for i in range(2 ** N):
  C_tmp = 0
  A_tmp = [0]*M
  for j in range(N):
    if ((i >> j) & 1):
      C_tmp += CA[j][0]
      for k in range(M):
        A_tmp[k] += CA[j][k+1]
  if all([l >= X for l in A_tmp]):
    if C_min == -1:
      C_min = C_tmp
    else:
      C_min = min(C_tmp,C_min)
print(C_min)

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

int main(){
  
  int n; cin>>n;
  string s; cin>>s;
  int r{},w{};
  for(int i=0; i<n; i++){
    if(s.at(i)=='R') r++;
    else w++;
  }
  int ans{};
  for(int i=0; i<r; i++){
    if(s.at(i)=='W') ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3752
#include<stdio.h>
#include<string.h>
main()
{
	int H,W,a,b,c,d;
	char i[1000][1000];
	d=1;
	scanf("%d %d",&H,&W);
	getchar();
       for(a=1;a<=H;a++)
	{	
	       scanf("%s",&i[a]);
	       if(a!=H)
	       getchar();
	}
	for(b=1;b<=H+2;b++)
	{
		for(c=1;c<=W+2;c++)
		{
			if(b==1||b==H+2)
		{
				printf("#");
		}
	        else
	        {
	        	if(c==1||c==W+2)
	        	{
	        		printf("#");
	        	}
	        else if(c==2)
	        {
	        		printf("%s",i[d]);
	        		d++;
	        }
	        }
		}
	        printf("\n");
	        
	}
	return 0;
}

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

typedef long long int64;

const int MAX_N = int(2e5) + 10;

void fail() {
	puts("-1");
	exit(0);
}

int n;
int a[MAX_N], b[MAX_N];
std::priority_queue<std::pair<int, int> > q;

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
	}
	for (int i = 1; i <= n; ++i) {
		scanf("%d", b + i);
		if (a[i] != b[i])
			q.push(std::make_pair(b[i], i));
	}

	int64 ans = 0;
	while (!q.empty()) {
		auto cur = q.top();
		q.pop();
		int i = cur.second, pre = i == 1 ? n : i - 1, nxt = i == n ? 1 : i + 1;
		int t = (b[i] - a[i]) / (b[pre] + b[nxt]);
		if (t == 0) fail();
		ans += t;
		b[i] -= t * (b[pre] + b[nxt]);
		if (a[i] != b[i])
			q.push(std::make_pair(b[i], i));
	}
	printf("%lld\n", ans);
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;
const ll MOD = 1e+9 + 7;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

int main() {
    int l,r,d;
    cin >> l >> r >> d;

    int count = 0;
    for(int i=l; i<=r; ++i){
        if(i%d==0) ++count;
    }
    print(count);

    return 0;
}

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

public class Main {

    void solve() {
	int[] a = new int[3];
	for (int i = 0; i < 3; i++) {
	    a[i] = sc.nextInt();
	}
	int five = 2;
	int seven = 1;

	for (int i = 0; i < 3; i++) {
	    if (a[i] == 5) {
		five--;
	    } else if (a[i] == 7) {
		seven--;
	    } else {
		break;
	    }
	}
	if (five == 0 && seven == 0) {
	    System.out.println("YES");
	} else {
	    System.out.println("NO");
	}
    }

    void print(int[] a) {
	out.print(a[0]);
	for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
	out.println();
    }

    public static void main(String[] args) throws Exception {
	new Main().run();
    }

    MyScanner sc = null;
    PrintWriter out = null;
    public void run() throws Exception {
	sc = new MyScanner(System.in);
	out = new PrintWriter(System.out);
	for (;sc.hasNext();) {
	    solve();
	    out.flush();
	}
	out.close();
    }

    class MyScanner {
	String line;
	BufferedReader reader;
	StringTokenizer tokenizer;

	public MyScanner(InputStream stream) {
	    reader = new BufferedReader(new InputStreamReader(stream));
	    tokenizer = null;
	}
	public void eat() {
	    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
		try {
		    line = reader.readLine();
		    if (line == null) {
			tokenizer = null;
			return;
		    }
		    tokenizer = new StringTokenizer(line);
		} catch (IOException e) {
		    throw new RuntimeException(e);
		}
	    }
	}
	public String next() {
	    eat();
	    return tokenizer.nextToken();
	}
	public String nextLine() {
	    try {
		return reader.readLine();
	    } catch (IOException e) {
		throw new RuntimeException(e);
	    }
	}
	public boolean hasNext() {
	    eat();
	    return (tokenizer != null && tokenizer.hasMoreElements());
	}
	public int nextInt() {
	    return Integer.parseInt(next());
	}
	public long nextLong() {
	    return Long.parseLong(next());
	}
	public double nextDouble() {
	    return Double.parseDouble(next());
	}
	public int[] nextIntArray(int n) {
	    int[] a = new int[n];
	    for (int i = 0; i < n; i++) a[i] = nextInt();
	    return a;
	}
    }
}


Measured memory_bytes: 8020
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main() {
    int n;
    readf("%s", &n);
    readln;
   
    foreach (i; 1 .. 10) {
        if (n % i == 0) {
            int j = n / i;
            if (j < 10) {
                writeln("Yes");
                return;
            }
        }
    }
    
    writeln("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif


struct UnionFind {
  vector<ll> par, siz;
  UnionFind(ll n):par(n),siz(n,1) {
    for (ll i = 0; i < n; ++i) par[i] = i;
  }
  ll size() { return par.size(); };
  ll root(ll x) {
    assert(x < size());
    if (par[x] == x) return x;
    else return par[x] = root(par[x]);
  }
  void merge(ll x, ll y) {
    assert(x < size());
    assert(y < size());
    ll rx = root(x);
    ll ry = root(y);
    if (rx == ry) return;
    if (siz[rx] < siz[y]) std::swap(rx, ry);
    par[rx] = ry;
    siz[ry] += siz[rx];
  }
  bool same(ll x, ll y) { 
    assert(x < size());
    assert(y < size());
    return root(x) == root(y);
  }
  ll size(ll x) {
    assert(x < size());
    return siz[root(x)];
  }
};

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

int dx2[4] = {-2, 0, 2, 0};
int dy2[4] = {0, -2, 0, 2};


int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll h,w;
  cin >> h >> w;
  vector<string> S(h);
  rep(i,h) cin >> S[i];

  auto get_id = [&](int x, int y) {
    return w*y + x;
  };
  UnionFind tree(h*w);
  rep(y,h) rep(x,w) {
    if (S[y][x] == '#') {
      for (int i = 4; i < 8; ++i) { //斜め移動
        int nx = x + dx[i],  ny = y + dy[i];
        if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
        if (S[ny][nx] == '#' && (S[ny][x] == '.' || S[y][nx] == '.')) {
          tree.merge(get_id(x,y), get_id(nx,ny));
        }
      }
      rep(i,4) { //1つ飛ばし
        int nx = x + dx2[i],  ny = y + dy2[i];
        if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
        if (S[ny][nx] == '#' && S[y + dy[i]][x + dx[i]] == '.') {
          tree.merge(get_id(x,y), get_id(nx,ny));
        }
      }
    }
  }
 
  vector<vector<int> > A(h*w);
  rep(y,h) rep(x,w) {
    if (S[y][x] == '#') {
      rep(i,4) {
        int nx = x + dx[i], ny = y + dy[i];
        if (nx < 0 || ny < 0 || nx >= w || ny >= h) continue;
        if (S[ny][nx] == '.') {
          A[tree.root(get_id(x,y))].emplace_back(get_id(nx,ny));
        }
      }
    }
  }
  ll ans = 0;
  rep(i,h*w) {
    if (A[i].size() == 0) continue;
    vector<bool> checked(h*w,false);
    ll cnt = 0;
    for (auto x : A[i]) {
      if (!checked[x]) {
        cnt++;
        checked[x] = true;
      }
    }
    ans += tree.size(i) * cnt;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11628
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define MOD 1000000007;

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for(int i=0; i<m; i++)
		cin >> a[i];
	vector<long long> dp(n+2);
	dp[n]=1;
	int key=m-1;
	for(int i=n-1; i>=0; i--){
		dp[i] = (dp[i+1]+dp[i+2])%MOD;
		if(key>=0 && i==a[key]){
			dp[i] = 0;
			key--;
		}
	}
	cout << dp[0] << endl;
	return 0;
}

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

int main(){
    int h,w,k;
    cin>>h>>w>>k;
    vector<string>s(h),t(h);
    rep(i,h)cin>>s[i];
    int ans=0;
    rep(i,1<<h){
        rep(j,1<<w){
            rep(a,h)t[a]=s[a];
            rep(a,h){
                if(i&(1<<a)){
                    rep(b,w)t[a][b]='.';
                }
            }
            rep(a,w){
                if(j&(1<<a)){
                    rep(b,h)t[b][a]='.';
                }
            }
            int cnt=0;
            rep(a,h)rep(b,w)if(t[a][b]=='#')cnt++;
            if(cnt==k)ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3540
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	N := nextInt()
	S := nextString()

	count := 0
	for i := 0; i < N-2; i++ {
		if S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C' {
			count += 1
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long int
// #define ld long double
// #define f first
// #define s second
// #define pb push_back
// #define eb emplace_back
// #define mk make_pair
// #define mt make_tuple
// #define MOD 1000000007
// #define fo(i,a,b) for(i=a;i<b;i++)
// #define foe(i,a,b) for(i=a;i<=b;i++)
// #define all(x) x.begin(), x.end()
// #define vi vector<int>
// #define vl vector <long long int>
// #define pii pair <int,int>
// #define pll pair <long long int, long long int>
// #define vpii vector< pair<int,int> >
// #define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

const int N = 1e4 + 5;
int dp[N];
int main()
{
	boost;
	int n, w, i, j;
	cin >> w >> n;
	int a[n], b[n];
	for(i=0;i<n;i++)
	cin >> a[i] >> b[i];
	fill(dp, dp + N, inf);
	dp[0] = 0;
	for(i=1;i<=w;i++) {
		for(j=0;j<n;j++)
		{
		    if(a[j]>i)
		    {
		        dp[i]=min(dp[i],b[j]);
		    }
		    else
		    {
		        dp[i]=min(dp[i],dp[i-a[j]]+b[j]);
		    }
		}
	}
	cout << dp[w];
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> keys(M);
    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        keys[i].first = a;
        rep(j, b)
        {
            int c;
            cin >> c;
            keys[i].second += pow(2, c - 1);
        }
    }

    vector<vector<int>> dp(M + 1, vector<int>(pow(2, N), INT32_MAX));
    dp[0][0] = 0;
    rep(i_key, M) rep(i_state, pow(2, N))
    {
        if (dp[i_key][i_state] == INT32_MAX)
            continue;

        dp[i_key + 1][i_state] = min(dp[i_key + 1][i_state], dp[i_key][i_state]);
        int next_state = keys[i_key].second | i_state;
        dp[i_key + 1][next_state] = min(dp[i_key + 1][next_state], dp[i_key][i_state] + keys[i_key].first);
    }
    int ans = dp[M][pow(2, N) - 1];
    if (ans == INT32_MAX)
        ans = -1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 16384
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <utility>
#include <cstring>
using namespace std;
typedef long long ll;

int N;
vector<pair<int, int>> ps;

int sq(int v) { return v*v; }

int sq(int x1, int y1, int x2, int y2) { return sq(x2-x1) + sq(y2-y1); }

int main() {
	scanf("%d", &N);
	int X,Y;
	for (int i = 0; i < N; ++i) {
		scanf("%d %d", &X, &Y);
		ps.push_back(make_pair(X, Y));
	}
	sort(ps.begin(), ps.end());
	int ans = 1000000000;
	for (int i = 0; i < N; ++i) {
		for (int j = i-1; j >= 0; --j) {
			if (sq(ps[i].first - ps[j].first) >= ans) break;
			ans = min(ans, sq(ps[i].first, ps[i].second, ps[j].first, ps[j].second));
		}
		for (int j = i+1; j < N; ++j) {
			if (sq(ps[i].first - ps[j].first) >= ans) break;
			ans = min(ans, sq(ps[i].first, ps[i].second, ps[j].first, ps[j].second));
		}
	}
	printf("%d\n", ans);
}

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

int main(){
  int x1,x2,x3,x4,x5;
  cin>>x1>>x2>>x3>>x4>>x5;
  
  if(x1==0){
    cout << 1 << endl;
  }
  if(x2==0){
    cout << 2 << endl;
  }
  if(x3==0){
    cout << 3 << endl;
  }
  if(x4==0){
    cout << 4 << endl;
  }
  if(x5==0){
    cout << 5 << endl;
  }
}

Measured memory_bytes: 3580
while True:
	try:
		temp = [float(x) for x in raw_input().split()]
		y = float(temp[0]*temp[5] - temp[3]*temp[2]) / (temp[0]*temp[4]-temp[3]*temp[1])
		x = float(temp[2] - temp[1]*y) / temp[0]
		print "%.3f %.3f" % (round(x, 3), round(y, 3))
			
	except:
		break

Measured memory_bytes: 4248
n, m = map(int, input().split())

s = []
for i in range(n):
   tmp = [int(x) for x in input().split()]
   s.append(tmp)

c = []
for i in range(m):
   tmp = [int(x) for x in input().split()]
   c.append(tmp)

for i in range(n):
   d1 = []
   for j in range(m):
      d2 = abs(s[i][0] - c[j][0]) + abs(s[i][1] - c[j][1])
      d1.append(d2)

   print(d1.index(min(d1)) + 1)


Measured memory_bytes: 3064
n,a,b,c,d=map(int,input().split())
a,b,c,d=a-1,b-1,c-1,d-1
s=list(input())
flg=True
for i in range(a,c):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
for i in range(b,d):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if c>d:
    flg=False
    for i in range(b,d+1):
        if s[i-1]==s[i]==s[i+1]==".":
            flg=True
if flg:       
    print("Yes")
else:
    print("No")

Measured memory_bytes: 10688
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

//#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define BASE  (1000000007)
#define MAX_N (3000)
#define MAX_M (3000)

int N, M;
ll DP[MAX_M + 1][MAX_N + 1][2];

void print_row(int i) {
#ifdef DEBUG
  for (int j = 0; j <= N; j++) debug_printf("%lld/%lld ", DP[i][j][0], DP[i][j][1]);
  debug_printf("\n");
#endif
}

void solve() {
  for (int j = 0; j <= N; j++)
    for (int k = 0; k < 2; k++) DP[0][j][k] = (j != 0)? k: 1 - k;
  print_row(0);

  for (int i = 0; i < M; i++) {
    for (int j = 0; j <= N; j++) {
      ll d0 = 0, d1 = 0;
      if (j == 0) {
        d0 += DP[i][j][0] + DP[i][j][1] + DP[i][j + 1][0] + DP[i][j + 1][1];
      } else {
        d0 += DP[i][j - 1][0] + DP[i][j][0];
        d1 += DP[i][j - 1][1];

        if (j == 1) d0 += DP[i][j][1];
        else d1 += DP[i][j][1];

        if (j < N) {
          d0 += DP[i][j][0] + DP[i][j + 1][0];
          d1 += DP[i][j][1] + DP[i][j + 1][1];
        }
      }
      DP[i + 1][j][0] = d0 % BASE;
      DP[i + 1][j][1] = d1 % BASE;
    }
    print_row(i);
  }

  ll ans = 0;
  for (int j = 0; j <= N; j++) ans = (ans + DP[M][j][0]) % BASE;
  printf("%lld\n", ans);
}

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

  solve();

  return 0;
}


Measured memory_bytes: 140928
#include<stdio.h>
#define N 3
#define M 2

int main(){
  int i, j, min, x, pasta[N], drink[M];

  for(i=0; i<N; i++)
    scanf("%d", &pasta[i]);

  for(i=0; i<M; i++)
    scanf("%d", &drink[i]);

  for(i=0, min=4000; i<N; i++){
    for(j=0; j<M; j++){
      x = pasta[i] + drink[j] - 50;
      if(min > x) min = x;
    }
  }

  printf("%d\n", min);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

bool is_integer( double x ){
    return std::floor(x)==x;
}

int main() {
    ll N,M;
    cin >> N >> M;

    string S,T;
    cin >> S;
    cin >> T;

    REP(j, M) {
        double i = (double)N/M*j;

        if (is_integer(i)) {
            if (S[i] != T[j]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }

    ll lcm = N*M/gcd(N,M);
    cout << lcm << endl;

    return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    ll total = A+B+C;

    ll ans = 0;
    while( A%2==0 && B%2==0 && C%2==0 )
    {
        ll tmp_A = (B+C)/2;
        if( (B+C)%2 != 0 ) tmp_A++;

        ll tmp_B = (A+C)/2;
        if( (A+C)%2 != 0 ) tmp_B++;

        ll tmp_C = (A+B)/2;
        if( (A+B)%2 != 0 ) tmp_C++;

        set<ll> check_before;
        set<ll> check_after;

        check_before.insert(A);
        check_before.insert(B);
        check_before.insert(C);

        check_after.insert(tmp_A);
        check_after.insert(tmp_B);
        check_after.insert(tmp_C);

        if( check_before == check_after )
        {
            cout << -1 << endl;
            return 0;
        }

        A = tmp_A;
        B = tmp_B;
        C = tmp_C;
        ans++;
    }
    cout << ans << endl;
}


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

#define int long long

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

using namespace std;

using P = pair<int, int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[a]+=siz[b];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
const int MOD=1e9+7;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
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;
    }
}
long long 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;
}

signed main(){
	int n;
	cin>>n;
	int x[110000],l[110000];
	rep(i,n){
		cin>>x[i]>>l[i];
	}
	vector<P> so;
	rep(i,n){
		so.push_back(P(x[i]+l[i],i));
	}
	sort(so.begin(),so.end());
	int memo=-INF;
	int ans=0;
	rep(i,n){
		int k=so[i].second;
		if(memo<=x[k]-l[k]){
			ans++;
			memo=so[i].first;
		}
	}
	cout<<ans<<endl;
}


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

int n,x,y,t,sx,sy,tp;

int main()
{
    cin>>n;

    sx=0;sy=0;tp=0;

    int chk=0;

    for(int i=1;i<=n;++i)
    {
        cin>>t>>x>>y;

        if(chk)continue;

        int bc=t-tp;

        if((abs(x-sx)>bc) || abs(y-sy)>bc || abs(x-sx+y-sy)>bc || ((abs(x-sx+y-sy))%2 != bc%2))chk=1;

        sx=x;
        sy=y;
        tp=t;
    }

    if(chk)cout<<"No";

    else cout<<"Yes";
}


Measured memory_bytes: 256
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SORT(v) sort(all(v))
#define TROS(v) sort(all(v), std::greater<Type>());
#pragma endregion

int main() {
    // template
    string a,b,c;cin>>a>>b>>c;
    cout<<a[0]<<b[1]<<c[2]<<endl;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 2019;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
  

   
 void solve() {
	  int n,m;
	  cin>>n>>m;
	  vi v(m,0);
	  int sm=0;
	  rep(i,0,m) {
		  cin>>v[i];
		  sm+=v[i];
	  }
	  if(n-sm<0) cout<<-1<<endl;
	  else cout<<n-sm<<endl;
	  
	  	
						   
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1000003;

ll pow_mod(ll v, ll st) {
	ll ans = 1ll;
	for(; st; st >>= 1) {
		if (st & 1) {
			ans = (ans * v) % MOD;
		}
		v = (v * v) % MOD;
	}
	return ans;
}

ll get_inv(ll v) {
	return pow_mod(v, MOD - 2);
}

ll f[MOD], f_inv[MOD];

void solve(){
	f[0] = 1;
	REP(i, 1, MOD) {
		f[i] = (f[i - 1] * i) % MOD;
	}
	f_inv[MOD - 1] = MOD - 1;
	for(int i = MOD - 2; i >= 0; i--) {
		f_inv[i] = (f_inv[i + 1] * (i + 1)) % MOD;
	}
	int q;
	scanf("%d", &q);
	while(q--) {
		ll x, d, n;
		scanf("%lld%lld%lld", &x, &d, &n);
		if (d == 0) {
			ll ans = pow_mod(x, n);
			printf("%lld\n", ans);
			continue;
		}
		x = (x * get_inv(d)) % MOD;
		if (x == 0 || x / MOD != (x + n - 1) / MOD) {
			printf("0\n");
			continue;
		}
		ll ans = (f[x + n - 1] * f_inv[x - 1]) % MOD;
		ans = (ans * pow_mod(d, n)) % MOD;
		//printf("%lld %lld ", x, n);
		printf("%lld\n", ans);
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 16512
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    i = 0
    now = 0
    ans = 0
    while i < len(s):
        if s[i] == "R":
            if now == 0:
                now += 1
                i += 1
                while i < len(s):
                    if s[i] == "R":
                        now += 1
                    else:
                        now -= 1
                    now = now % 4
                    i += 1
                    if now == 0:
                        if s[i-1] == "R":
                            ans += 1
                        break

            else:
                now += 1
                now = now % 4
                i += 1
        else:
            now -= 1
            now = now % 4
            i += 1

    print(ans)


    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()



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

int main() {
    //入力
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
    }

    //処理
    int count = 0;
    for (int element : vec) {
        if(element % 2 == 1) {
            count++;
        }
    }

    if(count % 2 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3776