akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v; stringstream ss(s); string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}
#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int n, m; cin >> n >> m;
	vector<int> dp(n + 1, 0);
	REPU(i, 0, n) {
		int x; cin >> x;
		dp[i + 1] = (dp[i] + x) % m;
	}
	unordered_map<int, int> mp;
	ll ans = 0;
	REPD(i, n, 0) {
		mp[dp[i]]++;
		ans += mp[dp[i - 1]];
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4108
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef string str;
typedef std::pair<ll,ll> pl;
typedef std::map<string, ll> msl;
typedef std::map<ll, ll> mll;
typedef std::vector<ll> vl;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = mod * mod;
const ll MAX_N = 100000;

#define rep(i, n) for(ll (i) = 0; (i) < (n) ; (i)++ )
#define For(i, a, b) for(ll (i) = (a); (i) < (b) ; (i)++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define tol(c) char((c)+0x20)
#define tou(c) char((c)-0x20)
#define pb push_back
#define mp make_pair
#define pr(a) cout << (a)
#define prl(a) cout << (a) << endl
#define prs(a) cout << (a) << " "
#define yn(condition) if ((condition)) prl("Yes"); else prl("No");
#define YN(condition) if ((condition)) prl("YES"); else prl("NO");
#define rpr(i,n,ans) rep((i),(n)) prs((ans[(i)]))
#define cpr(i,n,ans) rep((i),(n)) prl((ans[(i)]))
#define in1(a) cin >> (a)
#define in2(a,b) cin >> (a) >> (b)
#define in3(a,b,c) cin >> (a) >> (b) >> (c)
#define in4(a,b,c,d) cin >> (a) >> (b) >> (c) >> (d)
#define rin1(i,n,a) rep((i),(n)) cin >> (a[(i)])
#define rin2(i,n,a,b) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)])
#define rin3(i,n,a,b,c) rep((i),(n)) cin >> (a[(i)]) >> (b[(i)]) >> (c[(i)])
#define e1 first
#define e2 second
#define ctol(c) ll((c)) - ll('0')
#define ltos(n) to_string((n))
#define items(kv, v) for(auto &(kv): (v))
#define ndig(N, n) ctol(ll(ltos((N))[ll(ltos((N)).length()) - (n)]))

int main(void){
    ll a,b;
    in2(a,b);

    prl(((b-a-1)*(b-a))/2 - a);
    
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def store_lamp(g, j, v):
    while j >= 0:
        if g[j] is not None:
            break
        g[j] = v
        j -= 1


def store_lamp_h(g, i, j, v):
    while i >= 0:
        if g[i][j] is not None:
            break
        g[i][j] = v
        i -= 1

h, w = map(int, input().split())
s = []

hg = [[None] * w for _ in range(h)]
wg = [[None] * w for _ in range(h)]

for _ in range(h):
    s.append(input())

for i in range(h):
    pre = 0
    for j in range(w):
        if s[i][j] == '#':
            hg[i][j] = 0
            if pre != 0:
                store_lamp(hg[i], j-1, pre)
            pre = 0
        else:
            pre += 1

    if pre != 0:
        store_lamp(hg[i], w-1, pre)

for j in range(w):
    pre = 0
    for i in range(h):
        if s[i][j] == '#':
            wg[i][j] = 0
            if pre != 0:
                store_lamp_h(wg, i-1, j, pre)
            pre = 0
        else:
            pre += 1

    if pre != 0:
        store_lamp_h(wg, h-1, j, pre)

l = 0
for hh, wh in zip(hg, wg):
    for hw, ww in zip(hh, wh):
        l = max(l, hw+ww)

print(l-1)


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if(a < b) {a = b; return true;}
    return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if(a > b) {a = b; return true;}
    return false;
}

template<class T>
struct edge {
    int src, to;
    T cost;
};

template<typename T>
using Graph = vector<vector<edge<T>>>;

template<typename T>
void bubble_sort(vector<T>& a, int l, int r) {
    for (int k = l; k < r; ++k) {
        for (int m = r - 1; m - 1 >= k; --m) {
            if (a[m-1] > a[m]) swap(a[m-1], a[m]);
        }
    }
}


template<typename T>
void quick_sort(vector<T>& a, int l, int r) {
    if (l >= r) return;
    int i = l, j = r - 1;
    T pivot = a[(l + r) / 2];
    while (true) {
        while (a[i] < pivot) ++i;
        while (pivot < a[j]) --j;
        if (i >= j) break;
        swap(a[i], a[j]);
        ++i, --j;
    }
    quick_sort(a, l, i);
    quick_sort(a, j + 1, r);
}


int main() {

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

    //quick_sort(a, 0, n);
    bubble_sort(a, 0, n);

    int alice = 0, bob = 0;
    REP(i, n) {
        (i & 1 ? bob : alice) += a[n-1-i];
    }

    cout << alice - bob << endl;

    return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

template <class T>
struct edge {
  int from, to; T cost;
  edge() {}
  edge(int f, int t, T c): from(f), to(t), cost(c) {}
};

vector<edge<int>> G[100010];
int dis[100010];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int K;
  cin >> K;

  for (int i = 0; i < K; i++) {
    G[i].emplace_back(i, (i + 1) % K, 1);
    if (i) G[i].emplace_back(i, i * 10 % K, 0);
  }

  fill(dis, dis + K, 1 << 30);
  dis[1] = 1;
  deque<int> deq = {1};
  while (!deq.empty()) {
    int v = deq.front(); deq.pop_front();
    for (auto e : G[v]) {
      if (dis[e.to] > dis[v] + e.cost) {
        dis[e.to] = dis[v] + e.cost;
        if (e.cost) deq.emplace_front(e.to);
        else deq.emplace_back(e.to);
      }
    }
  }
  cout << dis[0] << endl;

  return 0;
}

Measured memory_bytes: 6400
import java.util.*;
public class Main{
    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int result = 0;

        for(int i=0; i<N; i++){
            result += sc.nextInt()-1;
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 25968
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
#define ll long long
#define W 1000000007
using namespace std;

int main(){
	int n,ans=111;
	cin>>n;
	while(ans<n){
		ans+=111;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner number = new Scanner(System.in);
		int a  = number.nextInt();
		int[] b = new int[a];
		int c = 0,count = 0;
		double d;

		for(int i = 0;i < a;i++) {
			b[i] = number.nextInt();
		}
		for(int i = 0;i < b.length - 1;i++) {
			for(int j = 0;j < a - 1;j++) {
				if(j + 1 > b.length) break;
				if(b[j] > b[j + 1]) {
					c = b[j];
					b[j] = b[j + 1];
					b[j + 1] = c;
					count++;
				}
				
				
			}
			
			a--;
		}
		for(int i = 0;i < b.length;i++) {
			System.out.print(b[i]);
			if(i != b.length - 1) System.out.print(" ");
			else System.out.println("");
		}
		System.out.println(count);
	}
}



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

def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    total1 = 0
    total2 = 0
    ans1 = 0
    ans2 = 0
    for i in range(n):
        total1 += a_list[i]
        if i % 2 != 0 and total1 <= 0:
            ans1 += abs(total1) + 1
            total1 = 1
        elif i % 2 == 0 and total1 >= 0:
            ans1 += total1 + 1
            total1 = -1
    for j in range(n):
        total2 += a_list[j]
        if j % 2 != 0 and total2 >= 0:
            ans2 += total2 + 1
            total2 = -1
        elif j % 2 == 0 and total2 <= 0:
            ans2 += abs(total2) + 1
            total2 = 1
    print(min(ans1, ans2))

            

if __name__ == '__main__':
    main()

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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    int N; cin >> N;
    vector<int> p(N);
    bool j;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    for(int i = 0; i < N; i++) {
        if(i != N - 1) {
            if(p[i] == i + 1) {
                swap(p[i], p[i + 1]);
                ans++;
            }
        }
        else {
            if(p[i] == i + 1) {
                swap(p[i], p[i - 1]);
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3668
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

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

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    string s;
    cin >> s;

    int a = 0;
    int b = 0;

    rep(i,0,3){
	if(s[i] == 'R'){
	    b++;
	}else b  = 0;

	a = max(a,b);
    }
    P(a);
    return  0;
}


Measured memory_bytes: 3584
#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define INF 1000000

typedef struct{
  int g;
  int b;
  int c;
}data;

void single(int);

int n,A[N];
data G[500000];

int main()
{
  int i,u,k,j,cnt = 0;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    A[i] = INF;
    A[0] = 0;
  }
    
  for(i = 0; i < n; i++){
    scanf("%d %d",&u,&k);
    for(j = 0; j < k; j++){
      G[cnt].b = u;
      scanf("%d%d",&G[cnt].g, &G[cnt].c);
      cnt++;
    }
  }
  single(cnt);

  for(i = 0; i < n; i++){
    printf("%d %d\n",i,A[i]);
  }

  return 0;
}

void single(int num){
  int i,flag = 1;

  for(i = 0; i < n; i++){
    A[i] = INF;
    A[0] = 0;
  }

    while(flag != 0){
      flag = 0;
      for(i = 0; i < num; i++){
	if(G[i].c + A[G[i].b] < A[G[i].g]){
	  A[G[i].g] = G[i].c + A[G[i].b];
	  flag = 1;
	}
      }
    }
}



Measured memory_bytes: 7584
function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var A = Number.parseInt(inputStr[0]);
  var B = Number.parseInt(inputStr[1]);
  var C = Number.parseInt(inputStr[2]);
  //計算式(三項演算子を使い、値が0を下回る場合は0とする)
  console.log( C-(A-B) > 0 ? C-(A-B) : 0 );  
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<stdio.h>

int main()
{
  int t=0;
  int i;
  int a;
  char s[3];
  scanf("%s",s);
  for(i=0;i<3;i++){
    if(s[i]=='o') t++;
  }
  a=700+100*t;
  printf("%d\n",a);
  return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if(a >= 13) cout << b << endl;
    else if(a >= 6) cout << b / 2 << endl;
    else cout << 0 << endl;
}


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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; }

const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


int main() {
	int n, m;
	cin >> n >> m;
	VI h(n);
	REP(i, n)cin >> h[i];
	VB ans(n, true);

	REP(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (h[a] >= h[b]) {
			ans[b] = false;
		}
		if (h[a] <= h[b]) {
			ans[a] = false;
		}
	}
	int cnt = 0;
	REP(i, n)if (ans[i])cnt++;
	cout << cnt << endl;

}


Measured memory_bytes: 3788
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int bit = 0;
        for (int i = 0; i < N; i++) {
           bit |= Integer.parseInt(sc.next());
        }
        System.out.println(Integer.numberOfTrailingZeros(bit));
    }
}

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

using namespace std;

int main(){
    set<char> S;
    int n;
    string str;
    cin >> n;
    cin.ignore();
    getline(cin, str);
    for(int i = str.size() - 1; i >= 0; i--)
        if(str[i] != ' ') S.insert(str[i]);
    cout << ((S.size() == 3)? "Three":"Four")<< endl;
}


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

int main() {
  int n, k, ans;

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

  ans = 1000000000;
  for (int i = 0; i < n - k + 1; i++) {
    int cand;
    cand = x[i + k - 1] - x[i] + min(abs(x[i + k - 1]), abs(x[i]));
    ans = min(ans, cand);
  }

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

  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>

int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int n,m;
int b[500],r[500];
int flow[500][500];
int sink[500];

int visitb[500];
int visitr[500];
int blue(int i){
	int j;
	if(visitb[i]==1)return 0;
	visitb[i]=1;
	for(j=0;j<n;j++){
		if(flow[i][j]==0 && red(j)==1){
			flow[i][j] = 1;
			return 1;
		}
	}
	return 0;
}
int red(int j){
	int i;
	if(visitr[j]==1)return 0;
	visitr[j]=1;
	if(sink[j]==0){
		sink[j]=1;
		return 1;
	}
	for(i=0;i<n;i++){
		if(flow[i][j]==1 && blue(i)==1){
			flow[i][j] = 0;
			return 1;
		}
	}
	return 0;
}
int main(){
	int i,j;
	int res;
	while(scanf("%d%d",&m,&n)==2&&(m|n)){
		for(i=0;i<m;i++)scanf("%d",&b[i]);
		for(i=0;i<n;i++)scanf("%d",&r[i]);
		memset(flow,0,sizeof(flow));
		memset(sink,0,sizeof(sink));
		for(i=0;i<m;i++){
			for(j=0;j<n;j++){
				if(1==gcd(b[i],r[j])){
					flow[i][j] = -1;
				}
			}
		}
		res=0;
		for(i=0;i<m;i++){
			memset(visitb,0,sizeof(visitb));
			memset(visitr,0,sizeof(visitr));
			res += blue(i);
		}
		printf("%d\n",res);
	}
}

Measured memory_bytes: 1420
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	string s, t;
	cin >> s >>t;
	int l = s.size();
	int c(0);
	rep(i,l) {
		if (s[i] != t[i]) {
			++c;
		}
	}
	cout << c;
	return 0;

}

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

int main(){
    int N, T;
    cin >> N >> T;
    vector<int> ans;
    int num = 0;
    for(int i = 1; i <= N; i++){
        int tmpc, tmpt;
        cin >> tmpc >> tmpt;
        if(tmpt <= T){
            ans.push_back(tmpc);
            num++;
        }
    }
    int min = *min_element(ans.begin(), ans.end());
    if(num != 0) cout << min << endl;
    else cout << "TLE" << endl;
    
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
#define ll long long

using namespace std;
ll N[3*100000];

bool comp(pair<int,int> a, pair<int,int> b){
    return a.first < b.first;
}

int main(){
    int n,d,a;
    scanf(" %d %d %d",&n,&d,&a);
    pair<int,int> ar[n];
    for(int i = 0; i < n;++i) scanf(" %d %d",&ar[i].first,&ar[i].second);
    sort(ar,ar+n,comp);
    ll ans = 0;
    ll cum = 0;
    for(int i = 0; i < n;++i){
        cum += N[i];
        if(ar[i].second + cum <= 0) continue;
        pair<int,int> look = {ar[i].first+(d<<1),0};
        int to = lower_bound(ar+i,ar+n,look,comp)-ar;
        if(to != n && ar[to].first == look.first) ++to;
        ll temp = ar[i].second + cum;
        ll mul = temp /(ll)a;
        if(temp %(ll)a) ++mul;
        cum -= mul*(ll)a;
        N[to] += mul*(ll)a;
        ans += mul;
    }
    printf("%lld\n",ans);
    return 0;
}


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

int main(){
    int r, g, b;
    int num;
    cin >> r >> g >> b;
    num = 100*r + 10*g +b;
    if(num%4==0) cout  << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> card(N); 
  for(int k=0;k<N;k++){
    cin>>card.at(k);}//cards' number
  
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
    int i;
  i=0;
    int Alice;
  Alice=0;
  while(i<N){Alice+=card.at(i);
             i+=2;}
  i=1;
    int Bob;
  Bob=0;
    while(i<N){Bob+=card.at(i);
               i+=2;}
  cout<<Alice-Bob<<endl;
 
  
    
}



Measured memory_bytes: 256
import java.util.Arrays;

public class Main {
  private static void solve() {
    int n = ni();
    int[][] p = ntable(n, 2);
    Arrays.sort(p, (o1, o2) -> Double.compare(Math.atan2(o1[1], o1[0]), Math.atan2(o2[1], o2[0])));

    long max = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j <= i + n; j++) {
        long xs = 0;
        long ys = 0;
        for (int k = i; k < j; k++) {
          xs += p[k % n][0];
          ys += p[k % n][1];
        }

        long d = xs * xs + ys * ys;
        max = Math.max(d, max);
      }
    }

    System.out.printf("%.12f\n", Math.sqrt(max));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 27844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;
signed main(){
  int n;
  cin >> n;
  vint A(5);
  rep(i,n){
    string s;
    cin >> s;
    if(s[0] == 'M') A[0]++;
    if(s[0] == 'A') A[1]++;
    if(s[0] == 'R') A[2]++;
    if(s[0] == 'C') A[3]++;
    if(s[0] == 'H') A[4]++;
  }
  int ans = 0;
  rep(i,3) for(int j = i+1;j<4;j++) for(int s = j+1;s<5;s++){
    ans += A[i]*A[j]*A[s];
  }
  cout << ans << endl;

}

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

const int N = 300005;
const int mod = 1e9 + 7;

int n;
string s;
int dp[N][5][3];

void add(int &x, int y) {
	x += y; while(x >= mod) x -= mod;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> s;
	n = s.size();
	s = ' ' + s;

	dp[0][2][0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int diff = -2; diff <= 2; ++diff) {
			int low = 0, high = 1;
			if (s[i] == '0') high = 0;
			else if (s[i] == '1') low = 1;

			for (int last0 = 0; last0 <= 2; ++last0) {
				if (!dp[i - 1][diff + 2][last0]) continue;
				for (int nxt = low; nxt <= high; ++nxt) {
					int ndiff = diff + (nxt == 0 ? -1 : +1);

					int nlast0;
					if (last0 == 0 || last0 == 1) {
						if (nxt == 0) nlast0 = last0 + 1;
						else nlast0 = 0;
					} else if (last0 == 2) {
						if (nxt == 1) nlast0 = 1;
						else nlast0 = 1, ndiff += 2;
					}

					if (diff == 2) ndiff = 2;

					add(dp[i][ndiff + 2][nlast0], dp[i - 1][diff + 2][last0]);
				}
			}
		}
	}

	int res = 0;
	for (int diff = 1; diff <= 2; ++diff) {
		for (int last0 = 0; last0 <= 2; ++last0) {
			add(res, dp[n][diff + 2][last0]);
		}
	}

	cout << res << '\n';
}

Measured memory_bytes: 18284
/***
*	???????????????
*	???????¨??????????????????§?????????????°????minj???????????????????????????????????????????????´???????????¢?????´????????????
****/

#include <iostream>
#include <vector>
using namespace std;


void selectionSort(vector<int> &str, int n, int *cnter){
	for( int i=0 ; i <= ( n-1 ) ; i++ ){
		int minj = i;
		int p = 0;
		for(int j = i ; j<= ( n-1 ); j++ ){
			
			if( str[j] < str[minj]){	//???????????????????????§????°??????????????´?minj????±???????
				minj = j;
				p++;
			}
		}
		if(p!=0){//???????????????????????´???
			int temp   = str[i];		//str[j]??¨str[minj]?????????????´??????????
			str[i]     = str[minj];
			str[minj]  = temp;
			(*cnter) ++;
		}else{
			//???????????????????????´???
		}
	}
	return;
}

int main(void)		//???????????¢??°
{
	int n;
	cin >> n;
	
	vector <int> str;
	str.resize(n);
	
	for(int i =0; i < n ;  i++){	//????????\???
		cin >> str[i] ;
	}
	int cnter =0;
//-----------------------------------??\???????????????
	selectionSort(str, n, &cnter);
//----------------------------------	???????????????
	for(int i =0; i<n ; i++){
		cout << str[i] ;
		if(i != (n-1)){
			cout << " ";
		}
	}
	cout << endl;
	
	cout << cnter << endl;
	
	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  vector<char> x(a+b+1);
  string s="1234567890";
  for(int i=0;i<a+b+1;i++){
    cin>>x[i];
  }
  int z=0;
  for(int i=0;i<a+b+1;i++){
    if(i<a){
      for(int j=0;j<10;j++){
        if(x[i]==s[j]){
          z++;
          break;
        }
      }
    }
    else if(i==a){
      if(x[i]=='-'){
        z++;
      }
    }
    else if(i>a){
      for(int j=0;j<10;j++){
        if(x[i]==s[j]){
          z++;
          break;
        }
      }
    }
  }
  if(z==a+b+1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod 1000000007
#define pi 3.14159265358979323846//20 decimals
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define double long double
#define N 200005

int gcd(int a,int b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
int32_t main()
{
    IOS;

    int n,m;
    string s,t;
    cin>>n>>m;
    cin>>s>>t;
    int g=gcd(n,m);
    int lcm=(n*m)/g;
    int l=lcm/n;
    int r=lcm/m;
    int sleft=0;
    int sright=0;
    bool ch=1;
    map<int,char> v;
    for(int i=0;i<n;i++)
    {
        v[i*l]=s[i];
    }
    for(int i=0;i<m;i++)
    {
        if(v.find(i*r)!=v.end())
        {
            if(v[i*r]!=t[i])
            {
                //trace2(v[i*r],t[i]);
                ch=0;
                break;
            }

        }
    }
    if(ch)
        cout<<lcm;
    else
        cout<<-1;
    return 0;

}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> t(N + 1), x(N + 1), y(N + 1);
  t[0] = x[0] = y[0] = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
  }

  bool can = true;
  for (int i = 0; i < N; i++)
  {
    int dt = t[i + 1] - t[i];
    int dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
    if (dt < dist)
    {
      can = false;
    }
    if (dist % 2 != dt % 2)
    {
      can = false;
    }
  }

  if (can)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 1408
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CAttention solver = new CAttention();
        solver.solve(1, in, out);
        out.close();
    }

    static class CAttention {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int acchi = 0;
            int kocchi = 0;
            int res = 0;
            for (int i = 1; i < s.length(); i++) {
                if (s.charAt(i) == 'W') {
                    kocchi++;
                } else {
                    acchi++;
                }
            }
            res = acchi;
            for (int i = 1; i < n; i++) {
                if (s.charAt(i) == 'W') {
                    kocchi--;
                } else {
                    acchi--;
                }
                if (s.charAt(i - 1) == 'W') {
                    acchi++;
                } else {
                    kocchi++;
                }
                res = Math.min(res, acchi);
            }
            out.println(res);
        }

    }
}



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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    string a, b;
    cin>> a>> b;

    string s= a, t= b;

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());


    if(a!= b)
    {
        cout<<  "No\n";
        return 0;
    }

    int n= a.size();
    for(int i=0; i<n; i++)
    {
        if(s==t)
        {
            cout<<  "Yes\n";
            return 0;
        }
        s=s[n-1]+ s;
        s.pop_back();

    }
    cout<<  "No\n";

    return 0;
}




Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>

using namespace std;
const double PI (acos(-1));


int main()
{
  string S;
  cin >> S;

  string T;
  cin >> T;

  int A,B;
  cin >> A >> B;

  string U;
  cin >> U;

  if(U == S)
  {
    A--;
  }else
  {
    B--;
  }
  
  cout << A << " " << B;



}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n, x, t; cin >> n >> x >> t;
    int sum = 0;
    while(1){
        sum += t;
        n -= x;
        if(n <= 0){
            cout << sum << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>

using namespace std;

void calcMatrix(vector<vector<int>>& a)
{
  int sum;
  vector<int> temp;
  for(int i=0;i<a.size();i++)
  {
    sum=0;
    for(int value:a[i])
    {
      sum+=value;
    }
    a[i].push_back(sum);
  }
  for(int i=0;i<a[0].size();i++)
  {
    sum=0;
    for(int j=0;j<a.size();j++)
    {
      sum+=a[j][i];
    }
    temp.push_back(sum);
  }
  a.push_back(temp);
}

int main(int argc, char* argv[])
{
  int r,c,input;
  cin >> r >> c;
  vector<vector<int>> matrix(r);
  for(int i=0;i<r;i++)
  {
    for(int j=0;j<c;j++)
    {
      cin >> input;
      matrix[i].push_back(input);
    }
  }
  calcMatrix(matrix);
  for(int i=0;i<matrix.size();i++)
  {
    for(int j=0;j<matrix[i].size();j++)
    {
      cout << matrix[i][j];
      if(j!=matrix[i].size()-1) cout << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 3196
#include <string>
#include <queue>
#include <iostream>

using namespace std;

struct Process {
    string name;
    long long time;
};

int main() {
    queue<Process> que;
    int n, q;
    cin >> n >> q;
    Process p[n], pp;
    for (int i = 0; i < n; i++) {
        cin >> p[i].name >> p[i].time;
        que.push(p[i]);
    }

    int timer = 0;
    while (!que.empty()) {
        pp = que.front();
        if (pp.time > q) {
            pp.time -= q;
            timer += q;
            que.pop();
            que.push(pp);
        } else {
            timer += pp.time;

            cout << que.front().name << " " << timer << endl;
            que.pop();
        }
    }

    return 0;
}



Measured memory_bytes: 7064
program sample
    implicit none
  
    integer(8) :: i,j,m,n,a(8),b,c
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n
    allocate(x(n))
    read(*,*)x
    c=0
    a(:)=0
    do i=1,n
        b=x(i)/400+1
        if (b<9)then
            a(b)=a(b)+1
        else
            c=c+1
        end if
    end do
    b=0
    do i=1,8
        if(a(i)==0)then
            b=b+1
        end if
    end do
    b=8-b
    if(b==0)then
        b=1
        write(*,'(i1,x,i3)')b,c
        stop
    end if

    
    c=b+c
    
    write(*,'(i1,x,i3)')b,c
    stop
end program sample
  



Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
int a[100005];
map<int,int>mp;
int main()
{
	int n,ans=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	int nw=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]==i+1)nw++;
		else
		{
			ans+=(nw+1)/2;
			nw=0;
		}
	}
	ans+=(nw+1)/2;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
ll a[200005]={0};
int main()
{
    ll k,n,temp,maxx=0;
    cin>>k>>n;
    rep(i,n) cin>>a[i];
    rep1(i,n-1) maxx=max(maxx,a[i]-a[i-1]);
    maxx=max(maxx,a[0]+k-a[n-1]);
    cout<<k-maxx;
}


Measured memory_bytes: 1920
import java.util.Scanner;

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

		for (int i = 0; i < N; i++)
			d[i] = sc.nextInt();
		sc.close();
		int s = 0;
		for (int j = 0; j < N; j++) {
			for (int k = j + 1; k < N; k++) {
				s += d[j] * d[k];
			}

		}
		System.out.println(s);
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
 
    public static void main( String[] args ) {
 
        Scanner sc = new Scanner( System.in );
      
        int n = sc.nextInt();  
        String s = sc.next(); 
      
        String replaceStr = s.replaceAll( "ABC", "" );
        System.out.println( ( n - replaceStr.length() ) / 3 );
    }
}

Measured memory_bytes: 35668
N,K=list(map(int,input().split()))
A=list(map(int,input().split()))
mod=10**9+7
b=0
f=0
for i in range(N):
    for j in range(i+1,N):
        if A[i]>A[j]:
            #print(i,",",j)
            f+=1
           
            
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        if A[i]>A[j]:
            b+=1

ans=f*K
tmp=((K-1)*K)//2
ans+=b*tmp
#ans = K * f + (b * K * (K - 1)) // 2
ans%=mod

print(int(ans))

Measured memory_bytes: 3188
N=int(input() )
ans=0
S=[]
T=[]
S=[input() for i in range(0,N) ]
S.sort()
M=int(input() )
i=0
while i<M :
    T.append(input() )
    i=i+1
i=0
j=0
k=0
sans=0
while i<N :
    while S[i+k]==S[i] :
        k=k+1
        if(i+k==N):
            break
    j=0
    while j<M :
        if(S[i]==T[j]):
            sans=sans-1
        j=j+1
    sans+=k
    if(ans<sans):
        ans=sans
    sans=0
    i=i+k
    k=0
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<(n);i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
    string n;cin>>n;
    bool f =false;
    rep(i,n.length()-1){
        if(n[i]=='A'&&n[i+1]=='C')f=true;
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; int q;
    cin >> s >> q;
    deque<char> ans(all(s));
    int rev = 0;
    int t, f; char c;
    rep(i, q) {
        cin >> t;
        if(t == 1) {
            rev = 1 - rev;
        } else {
            cin >> f >> c;
            if(f==1) {
                rev == 0 ? ans.push_front(c):ans.push_back(c);
            } else {
                rev == 0 ? ans.push_back(c):ans.push_front(c);
            }
        }
    }

    if(rev == 1) reverse(all(ans));
    for(auto it = ans.begin(); it != ans.end(); ++it) {
        cout << *it;
    }
    cout << endl;
}

Measured memory_bytes: 976
#include <stdio.h>

int main(void)
{
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;
    int vert_length, hor_length;

    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

    vert_length = y2 - y1;
    hor_length = x2 - x1;
    x3 = x2 - vert_length;
    y3 = y2 + hor_length;
    x4 = x3 - hor_length;
    y4 = y3 - vert_length;

    printf("%d %d %d %d\n", x3, y3, x4, y4);

    return 0;

}


Measured memory_bytes: 128
n,m,l = map(int,input().split())
A = [[] for i in range(n)]
B = [[] for i in range(m)]
C = [[0 for i in range(l)] for j in range(n)]
for i in range(n):
    A[i].extend(map(int,input().split()))
for i in range(m):
    B[i].extend(map(int,input().split()))
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
for i in range(n):
    for j in range(l):
        print(f"{C[i][j]}",end = "")
        if j != l-1:
            print(" ",end = "")
        else:
            print()


Measured memory_bytes: 7160
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string Yes="Yes";
string YES="YES";
string NO="NO";
string No="No";
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define res resize
#define as assign
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
 
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const int mod = 1000000007ll;
const ll  MOD = 1000000007LL;
const double pi=3.1415926535897932384626;
int main(){
    int d[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    std::cin >> k;
    std::cout << d[k-1] << std::endl;
    
}

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

//#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define LL long long


#define PREC cout << setprecision(10) << fixed;
#define PI 3.14159265358979323846


double calcAngle(double h, double m)  
{  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
 
    double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
  
    double angle = abs(hour_angle - minute_angle);  
  
    angle = min(360 - angle, angle);  
  
    return angle;  
}  

int main() {
	int A,B,H,M;
	cin >> A >> B >> H >> M;
	double angle = calcAngle(H,M);

	double length = A*A + B*B - 2 * A * B * cos(angle * PI / 180.0);
	length = sqrt(length);
	printf ("%.20f\n", length);

	// cout << sqrt(length) << endl;

	return 0;
}


Measured memory_bytes: 4188
#include <stdio.h>
#include <string.h>
int main(){
  int i ,n ,cnt=0 ,accept[4]={};
  char pass[20];

  scanf( "%s" ,pass ); // 6文字以上か調べる
  n = strlen(pass);
  if( n >= 6 ){
    accept[0] = 1;
  }
  
  for( i=0 ; i<n ; i++ ){  // 数字が含まれるかを調べる
    if( pass[i] >= '0' && pass[i] <= '9'){
      accept[1] = 1;
      break;
    }
  }

  for( i=0 ; i<n ; i++ ){
    if( pass[i] >= 'a' && pass[i] <= 'z' ){
      accept[3] = 1;
      break;
    }
  }

  for( i=0 ; i<n ; i++ ){
    if( pass[i] >= 'A' && pass[i] <= 'Z' ){
      accept[2] = 1;
      break;
    }
  }

  for( i=0 ; i<4 ; i++ ){
    if( accept[i] == 1 ){
      cnt++;
    }
  }

  if( cnt == 4 ){
    printf( "VALID\n" );
  }

  else{
    printf( "INVALID\n" );
  }

  return 0;
}

Measured memory_bytes: 524
package main

import (
    "fmt"
)

func main() {
    var n, m int
    fmt.Scan(&n, &m)

    as := make([][]byte, n)
    for i := range as {
        var b []byte
        fmt.Scan(&b)
        as[i] = b
    }
    bs := make([][]byte, m)
    for i := range bs {
        var b []byte
        fmt.Scan(&b)
        bs[i] = b
    }

    var ok bool
    for i := 0; i < n; i++ {
        for j := 0; j < n; j++ {
            var ng bool
            for k := 0; k < m; k++ {
                for l := 0; l < m; l++ {
                    if i+k >= n || j+l >= n {
                        ng = true
                    } else if as[i+k][j+l] != bs[k][l] {
                        ng = true
                    }
                }
            }
            if !ng {
                ok = true
            }
        }
    }

    if ok {
        fmt.Println("Yes")
    } else {
        fmt.Println("No")
    }
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;
		int numC = 0;
		int numD = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();
			numC = scanner.nextInt();
			numD = scanner.nextInt();

			boolean canTalk = false;

			canTalk = ((Math.abs(numA - numB) <= numD && Math.abs(numB - numC) <= numD)
					|| Math.abs(numA - numC) <= numD);

			System.out.println(canTalk ? "Yes" : "No");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 23892