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

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

// 1-indexed
template <class T, class E>
struct SegmentTreeLaze {
  // a,b:T c,d:E e:E(unit)
  // g(f(a,b),c) = f(g(a,c),g(b,c))
  // g(g(a,c),d) = g(a,h(c,d))
  // g(a,e) = a
  typedef function<T(T, T)> F;
  typedef function<T(T, E)> G;
  typedef function<E(E, E)> H;
  int n, height;
  F f;
  G g;
  H h;
  T tunit;
  E eunit;
  vector<T> dat;
  vector<E> laz;
  SegmentTreeLaze(){};
  SegmentTreeLaze(int newn, F f, G g, H h, T nt, E ne)
      : f(f), g(g), h(h), tunit(nt), eunit(ne) {
    init(newn);
  }
  void init(int newn) {
    n = 1, height = 0;
    while(n < newn) n <<= 1, ++height;
    dat.assign(n << 1, tunit);
    laz.assign(n << 1, eunit);
  }

  inline T reflect(int k) {
    return laz[k] == eunit ? dat[k] : g(dat[k], laz[k]);
  }

  inline void eval(int k) {
    if(laz[k] == eunit) return;
    laz[k << 1] = h(laz[k << 1], laz[k]);
    laz[(k << 1) | 1] = h(laz[(k << 1) | 1], laz[k]);
    dat[k] = reflect(k);
    laz[k] = eunit;
  }

  inline void thrust(int k) {
    for(int i = height; i; --i) eval(k >> i);
  }

  void recalc(int k) {
    while(k >>= 1)
      dat[k] = f(reflect(k << 1), reflect((k << 1) | 1));
  }
  // [a,b)
  void update(int a, int b, E newdata) {
    thrust(a += n);
    thrust(b += n - 1);
    for(int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) laz[l] = h(laz[l], newdata), l++;
      if(r & 1) --r, laz[r] = h(laz[r], newdata);
    }
    recalc(a);
    recalc(b);
  }

  void set_val(int k, T newdata) {
    thrust(k += n);
    dat[k] = newdata;
    laz[k] = eunit;
    recalc(k);
  }

  // [a,b)
  T query(int a, int b) {
    thrust(a += n);
    thrust(b += n - 1);
    T vl = tunit, vr = tunit;
    for(int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) vl = f(vl, reflect(l++));
      if(r & 1) vr = f(reflect(--r), vr);
    }
    return f(vl, vr);
  }
};

long long n, q;

int main() {
  cin >> n >> q;
  auto f = [](P l, P r) {
    return P(l.first + r.first, l.second + r.second);
  };
  auto g = [](P l, long long r) {
    return P(l.first + r * l.second, l.second);
  };
  auto h = [](long long l, long long r) { return l + r; };
  SegmentTreeLaze<P, long long> seg(n, f, g, h, P(0, 0), 0);
  for(int i = 0; i < n; ++i) seg.set_val(i, P(0, 1));
  for(int i = 0; i < q; ++i) {
    long long c, s, t, x;
    cin >> c >> s >> t;
    --s, --t;
    if(c) { cout << seg.query(s, t + 1).first << endl; }
    else {
      cin >> x;
      seg.update(s, t + 1, x);
    }
  }
  return 0;
}


Measured memory_bytes: 8820
import java.util.Scanner;

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

        if (a == b && a != c && b != c || a == c && a != b && b != c || b == c && a != b && a != c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35640
n = int(input())
ans = "Yes"
now_x = 0
now_y = 0
now_t = 0

for i in range(n):
  t,x,y = map(int,input().split())
  
  if abs(now_x-x)+abs(now_y-y) > (t-now_t):
    ans = "No"
    break
    
  if (abs(now_x-x)+abs(now_y-y)-(t-now_t))%2 == 1:
    ans = "No"
    break
    
  now_x = x
  now_y = y
  now_t = t
    
print(ans)

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

int main()
{
  int N, M;
  while (cin >> N >> M && N != 0) {
    vector<int> h(N), w(M);
    for (int i = 0; i < N; i++) {
      cin >> h[i];
    }
    for (int i = 0; i < M; i++) {
      cin >> w[i];
    }

    vector<int> tbl(1000*1500, 0);
    int ans = 0;
    for (int i = 0; i < N; i++) {
      int t = 0;
      for (int j = i; j < N; j++) {
        t += h[j];
        tbl[t]++;
      }
    }
    for (int i = 0; i < M; i++) {
      int t = 0;
      for (int j = i; j < M; j++) {
        t += w[j];
        ans += tbl[t];
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

//#define int long long
using ll = long long;
const int INF = 1<<29;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline bool isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

const ll N_MAX = 1000000000000;

ll N;


//nの約数を返す　ソートされていないので必要に応じてsort(all(yakusuu));してください
template<typename T>
vector<T> divisor(T n){
	vector<T> div;
	for(T i=1 ; i*i<=n ; ++i){
		if(n%i == 0){
			div.push_back(i);
			if(i!=1 && i*i!=n){
				div.push_back(n/i);
			}
		}
	}
	div.push_back(n);
	return div;
}


void solve() {
	ll ans = 0;

	vector<ll> div=divisor(N);
	for(ll d:div){
		if(d==1)continue;
		ll dd=d-1;
		if(N/dd==N%dd){
			ans+=dd;
		}
	}

	printf("%lld\n", ans);
}

void input() {
	scanf("%lld", &N);
}

signed main() {
	input();
	solve();
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int X, A;
    cin >> X >> A;
    if(X < A) cout << 0 << endl;
    else cout << 10 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

vector<vector<int> > a;
int dp[22][(1<<21)];
int n;
int fun(int idx,int mask){
	if(idx == n)
		return (mask == 0);
	int &ans = dp[idx][mask];
	if(ans != -1)
		return ans;
	ans = 0;
	for(int i=0;i<n;++i){
		if(a[idx][i] && (mask&(1<<i)))
			ans = (ans+fun(idx+1,mask^(1<<i)))%mod;
	}
	return ans;
}

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	cin>>n;
	memset(dp,-1,sizeof dp);
	a.assign(n,vector<int>(n));
	for(int i=0;i<n;++i)
		for(int j=0;j<n;++j)
			cin>>a[i][j];

	cout<<fun(0,((1<<n)-1));
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 180480
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int x = 0, y = 0, t = 0;
            for (int i = 0; i < N; i++) {
                int nt = in.nextInt();
                int nx = in.nextInt();
                int ny = in.nextInt();

                int d = dist(x, y, nx, ny);

                if (d % 2 != (nt - t) % 2 || d > (nt - t)) {
                    out.println("No");
                    return;
                }

                x = nx;
                y = ny;
                t = nt;
            }
            out.println("Yes");
        }

        private int dist(int x, int y, int nx, int ny) {
            return Math.abs(nx - x) + Math.abs(ny - y);
        }

    }

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

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

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

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

    }
}



Measured memory_bytes: 41572
#include<stdio.h>
int main(){
int w,n,i;
scanf("%d",&w);
scanf("%d",&n);
int l[w];
for(i=0;i<w;i++){
l[i]=i;
}
for(i=0;i<n;i++){
int a,b,t;
scanf("%d,%d",&a,&b);
t=l[a-1];
l[a-1]=l[b-1];
l[b-1]=t;
}
for(i=0;i<w;i++){
printf("%d\n",l[i]+1);
}
return 0;
}

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

#define ll long long

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> arr(n);
    for (int i=0;i<n;i++) cin >> arr[i];
    if (n <= 0 || n == 1) {
        cout << "0\n";
        return 0;
    }
    if (n == 2) {
        cout << max(arr[0], arr[1]) << "\n";
        return 0;
    }
    sort(arr.begin(), arr.end());
    int cnt = 2;
    ll ans = arr.back();
    for (int i=n-2;i>=0;i--) {
        ans += (2*arr[i]);
        cnt += 2;
        if (cnt == n) {
            cout << ans << "\n";
            break;
        } else if (cnt == n+1) {
            cout << ans - arr[i] << "\n";
            break;
        }
    }
}


Measured memory_bytes: 3972
N, M = map(int, input().split())
cake = [list(map(int, input().split())) for _ in range(N)]

ans = [[] for _ in range(8)]
for x, y, z in cake:
    for msk in range(8):
        mx = x * (1 - 2 * (msk >> 2 & 1))
        my = y * (1 - 2 * (msk >> 1 & 1))
        mz = z * (1 - 2 * (msk >> 0 & 1))
        ans[msk].append(mx + my + mz)

print(max(sum(sorted(x, reverse=True)[:M]) for x in ans))

Measured memory_bytes: 40816
#include <bits/stdc++.h>
using namespace std;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"

int main() {

    FAST_IO;

    int n;
    cin >> n;

    string s;
    cin >> s;

    int cnt = 0;
    for (int i = 0; i <= n - 3; ++i) {
        string temp = s.substr(i, 3);
        if (temp == "ABC") {
            ++cnt;
        }
    }
    cout << cnt << endl;
    
    return 0;
}

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for(int i=0; i<n; i++) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());
    
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size();
    return 0;
}



Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
console.log(input.map(function(x) {
  const arr = x.split(' ').map(Number);
  return arr[0] == 0 ? '' : function(h, w) {
    const frame = [];
    const ends = Array(w+1).join('#').concat('\n');
    frame.push(ends);
    frame.push(Array(h - 1).join('#'.concat(Array(w - 1).join('.').concat('#\n'))));
    frame.push(ends);
    return frame.join('');
  }(arr[0], arr[1]);
}).join('\n').trim().concat('\n'));

Measured memory_bytes: 16796
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);
        var q = int.Parse(spl[2]);

        var AA = new List<int[]>();
        for (int i = 0; i < q; i++) {
            var ary = ToIntArray(input.ReadLine(), 4);
            AA.Add(ary);
        }

        Func<int[], long> count = (A) => {
            long sum = 0;
            foreach (var aa in AA) {
                var ai = aa[0] - 1;
                var bi = aa[1] - 1;
                var ci = aa[2];
                var di = (long)aa[3];
                sum += (A[bi] - A[ai] == ci ? di : 0);
            }
            return sum;
        };

        int[] tmp = new int[n];
        for (int i = 0; i < n-1; i++) tmp[i] = 1;

        long max = 0;
        bool end = false;

        while (!end) {
            var sum = count(tmp);
            max = Math.Max(max, sum);
            end = next(tmp, m);
        }

        return max;
    }

    static bool next(int[] ary, int max) {
        for(int i=ary.Length-1; i>=0; i--) {
            if(ary[i] < max) {
                ary[i]++;
                for(int j=i+1; j<ary.Length-1; j++) {
                    ary[j] = ary[i];
                }
                return false;
            }
        }
        return true;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27784
use std::io::{stdin, Read};
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    let mut ba = (0..m)
        .map(|_| {
            let (a, b) = (read::<usize>(), read::<usize>());
            (b, a)
        })
        .collect::<Vec<_>>();

    ba.sort();
    let mut last_cut = 0;
    let mut ans = 0;
    for (b, a) in ba {
        if last_cut <= a {
            last_cut = b;
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

int main(){
  int i,j,cnt=INT_MAX;
  int x,y;
  cin>>x>>y;
  if(x<=y)cnt=y-x;
  if(-x<=y)cnt=min(cnt,1+x+y);
  if(x<=-y)cnt=min(cnt,1-x-y);
  if(-x<=-y)cnt=min(cnt,2+x-y);
  cout<<cnt<<endl;
}

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

using namespace std;

using int64 = long long;

int main() {
  int N;
  cin >> N;
  vector< int > interval[26];
  for(int i = 0; i < N; i++) {
    string s;
    cin >> s;
    interval[s[0] - 'a'].emplace_back(i);
  }
  vector< int > beet[100005];
  for(int i = 0; i < 26; i++) {
    for(int j = 1; j < interval[i].size(); j++) {
      beet[interval[i][j]].emplace_back(interval[i][j - 1]);
    }
  }
  vector< int > dp(N + 1, 1 << 30);
  dp[0] = 0;

  for(int i = 1; i <= N; i++) {
    dp[i] = min(dp[i], dp[i - 1] + 1);
    for(auto &p : beet[i]) {
      dp[i] = min(dp[i], dp[p]);
    }
  }
  cout << dp[N] << endl;
}


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

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

  long long K;
  cin >> K;
  long long x = 7 % K;
  for(int i = 1; i <= K; i++) {
    if(x == 0) {
      cout << i << endl;
      return 0;
    }
    x = (x*10+7)%K;
  }

  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3576
import numpy as np

from numba import njit


@njit("i8[:](i8, i8[:], i8[:])", cache=True)
def cumsum(K, A, cA):
    for i, a in enumerate(A):
        cA[i] += cA[i - 1] + A[i]
        if cA[i] > K:
            break

    cA = cA[cA != 0]
    cA = np.append(0, cA)
    return cA


@njit("i8(i8, i8[:], i8[:])", cache=True)
def solve(K, cA, cB):
    ans = np.searchsorted(cA, K - cB, side="right") - 1
    ans += np.arange(len(cB))
    return ans.max()


N, M, K = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
B = np.array(input().split(), dtype=np.int64)

cA = np.zeros(N, dtype=np.int64)
cB = np.zeros(M, dtype=np.int64)

# np.cumsumだとoverflowする
cA = cumsum(K, A, cA)
cB = cumsum(K, B, cB)

ans = solve(K, cA, cB)
print(ans)


Measured memory_bytes: 133572
// AtCoder Beginner Contest 179 C.cpp

#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

	int an = 0;
	for (int i = 1; i < n; i++) {
		an += (n - 1) / i;
	}

	cout << an << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long ll;
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int,int> >  s(m);
    rep(i,0,m) cin >> s[i].first >> s[i].second;
    rep(i,0,1000) {
        int ni=i/10;
        vector<int> d(1,i%10);
        while(ni) {
            d.push_back(ni%10);
            ni/=10;
        }
        reverse(d.begin(),d.end());
        if (d.size()!=n) continue;
        bool flag=true;
        rep(j,0,m) {
            if (d[s[j].first-1]!=s[j].second) flag=false;
        }
        if (flag) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

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

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    char c[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> c[i][j];
        }
    }

    int ans = 0;
    for (int bitH = 0; bitH < (1 << H); bitH++) {
        for (int bitW = 0; bitW < (1 << W); bitW++) {
            int black = 0;
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (!(bitH & (1 << i)) && !(bitW & (1 << j))) {
                        if (c[i][j] == '#') black++;
                    }
                }
            }
            if (black == K) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,c,n,i,m,t=0;
	float b;
	vector <int> v;

	
	cin>>n>>m;
	int tot=0;
	for(i=0;i<n;i++)
	{
		cin>>a;
		tot+=a;
		v.push_back(a);
	}
	

	b=(float)tot/(4*m);
   
	int tt=0;
	for(i=0;i<n;i++)
	{ 
		if(v[i]>=b)
		t++;
	    
			
	}
	if(t<m) cout<<"No"; else cout<<"Yes";
	
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val bingo = Array.fill[Array[Int]](3)(Array.fill[Int](3)(0))
    for (i <- 0 until 3; j <- 0 until 3) {
      bingo(i)(j) = sc.nextInt()
    }
    val n = sc.nextInt()
    val bs = new Array[Int](n)
    for (num <- 0 until n) {
      bs(num) = sc.nextInt()

      for (i <- 0 until 3; j <- 0 until 3) {
        if (bingo(i)(j) == bs(num)) {
          // 埋まったマス
          bingo(i)(j) = -1
        }
      }
    }


    var ans = false
    for (i <- 0 until 3) {
      if (bingo(i)(0) == -1 && bingo(i)(1) == -1 && bingo(i)(2) == -1) {
        ans = true
      }

      if (bingo(0)(i) == -1 && bingo(1)(i) == -1 && bingo(2)(i) == -1) {
        ans = true
      }
    }

    if (bingo(0)(0) == -1 && bingo(1)(1) == -1 && bingo(2)(2) == -1) {
      ans = true
    }
    if (bingo(2)(0) == -1 && bingo(1)(1) == -1 && bingo(0)(2) == -1) {
      ans = true
    }

    println(if (ans) "Yes" else "No")
  }
}


Measured memory_bytes: 25808
#include <cstdio>
#include <algorithm>
using namespace std;

#define iter(i, n) for (int i = 1; i <= n; ++i)
#define NR 501000

typedef double ld;

int n, L;
ld T[NR], V[NR];

int main() {
	scanf("%d%d", &n, &L);
	int l = 1, r = 0;
	ld ys = 0, vs = 0;
	iter(i, n) {
		int t, v;
		scanf("%d%d", &t, &v);
		vs += v; ys += (ld) t * v;
	//	printf("!!%d %d %.6f\n", l, r, V[l]);
		while (l <= r) {
			if (vs > L) {
				ld _v = min(vs - L, V[l]);
				V[l] -= _v;
				vs -= _v;
				ys -= _v * T[l];
			}
			if (V[l] == 0) ++l;
			else break;
		}
		ld y = (ld) t * v, x = v;
		while (l <= r && T[r] > y / x) {
			y += T[r] * V[r];
			x += V[r];
			--r;
		}
		++r;
		T[r] = y / x;
		V[r] = x;
		printf("%.8f\n", (double) (ys / vs));
		//printf("!%.6f %.6f\n", vs, x);
	}
	return 0;
}

Measured memory_bytes: 17280
import java.util.ArrayList;
import java.util.*;
  public class Main
{
	public static void main (String[] args)
	 {
		Scanner sc=new Scanner(System.in);
		int t=1;
		while(t>0) 
		{
			t--;
			int n=sc.nextInt();
			if(n>=30)
				System.out.println("Yes");
			else
				System.out.println("No");
		}
	}
}

Measured memory_bytes: 35668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())


//Bellman_Ford
const int MAX_V = 2500;
const ll INF = 1e9;
using Edge = struct{
  int from;
  int to;
  ll cost;
};

int V, E;
ll d[MAX_V];
vector<Edge> edge;
bool c1[MAX_V], c2[MAX_V], c3[MAX_V];

void init1(int n) {
  if (c1[n])
    return;
  c1[n] = true;
  rep(i,E) {
    Edge e = edge[i];
    if (e.from == n)
      init1(e.to);
  }
}

void init2(int n) {
  if (c2[n])
    return;
  c2[n] = true;
  rep(i,E) {
    Edge e = edge[i];
    if (e.to == n)
      init2(e.from);
  }
}

void init() {
  init1(0);
  init2(V-1);
  rep(i,V) {
    c3[i] = c1[i] && c2[i];
  }
}

bool Bellman_Ford(int s) {
  fill(d, d+V, INF);
  d[s] = 0;
  rep(i,V) {
    rep(j,E) {
      Edge e = edge[j];
      if (d[e.to] > d[e.from]+e.cost) {
        d[e.to] = d[e.from] + e.cost;
        if (i == V-1) {
          if (c3[e.to] && c3[e.from])
            return true;
        }
      }
    }
  }
  return false;
}


int main() {
  int P, a, b, c;
  cin >> V >> E >> P;
  rep(i,E) {
    cin >> a >> b >> c;
    a--; b--; c = P-c;
    edge.push_back({a, b, c});
  }
  init();
  bool mcycle = Bellman_Ford(0);
  if (mcycle) {
    print(-1);
  } else {
    ll ans = -d[V-1];
    ans = max(ans, (ll)0);
    print(ans);
  }
  return 0;
}

Measured memory_bytes: 3836
#! usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    n = int(input())

    ans = 0
    for i in range(1, n+1):
        if i % 2 == 0:
            continue
        div = []
        j = 1
        while j * j <= i:
            if i % j == 0:
                if i // j != j:
                    div.append(j)
                    div.append(i//j)
                else:
                    div.append(j)
            j += 1

        if len(div) == 8:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;

const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;

void solve(){
    int dp[N];
    int n;
    cin >> n;
    int a[N];
    rep(i, n) cin >> a[i];
    dp[0] = 0;
    dp[1] = abs(a[1] - a[0]);
    Rep(i, 2, n)
    {
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));   
    }
    cout << dp[n - 1];
}

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


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#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=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;
int n;
ll a,b;
const int N = (int)(1e5)+2;
ll enemy[N];
ll t_e[N];
bool judge(ll num){
    REP(i,n){
        t_e[i] = enemy[i] - num*b;
    }
    REP(i,n){
        if(t_e[i] <= 0)continue;
        num -= ceil(t_e[i]/(double)(a-b));
        if(num < 0)return false;
    }
    return true;
}

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

  cin>>n;
  cin>>a>>b; //a > b
  REP(i,n)cin>>enemy[i];
  ll l = 0,r = 3*(1e9) + 1;
  while(abs(r-l)>1){
      ll mid = (r+l)/2;
      if(judge(mid))r = mid;
      else l = mid;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int ll;
#define FOR(i, a, b) for (ll i = (signed)(a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define EREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define MOD 1000000007
#define pb push_back
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
#define tp(a, b, c) make_tuple(a, b, c)
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
template <typename T> void fill_all(T &arr, const T &v) { arr = v; }
template <typename T, typename ARR> void fill_all(ARR &arr, const T &v) {
  for (auto &i : arr) {
    fill_all(i, v);
  }
}
//------------------変数-----------------------//
//-------------------関数----------------------//
ll n;
vector<ll> c, s, f;
ll calc(ll tim, ll place) {
  if (place == n - 1) {
    return tim;
  }
  if (s[place] >= tim) {
    return calc(s[place] + c[place], place + 1);
  }
  REP(i, 114514) {
    if ((tim + i - s[place]) % f[place] == 0) {
      return calc(tim + i + c[place], place + 1);
    }
  }
}

int main() {
  cin >> n;
  REP(i, n - 1) {
    ll C, S, F;
    cin >> C >> S >> F;
    c.pb(C);
    s.pb(S);
    f.pb(F);
  }
  REP(start, n - 1) { cout << calc(0, start) << endl; }
  cout << 0 << endl;
}


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;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int dp[100010];
int main(){
    int n,q; cin>>n>>q;
    string s; cin>>s;
    for(int i=1;i<n;i++){
        dp[i+1]=dp[i];
        if(s[i-1]=='A'&&s[i]=='C') dp[i+1]++;
    }
    while(q--){
        int l,r; cin>>l>>r;
        cout<<dp[r]-dp[l]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	C = inputStr()

	aida = []
	anzen = 0
	ai = 0
	yokei = 0
	flg = False
	for i,val in enumerate(C):
		ai += 1
		if val == "W":
			if flg == False:
				flg = True
		elif val == "R":
			anzen += 1
			if flg == False:
				aida.append(ai)
			else:
				yokei += 1
				aida.append(ai)

	if yokei == 0:
		print(0)
		sys.exit()

	ans = 0
	for i,val in enumerate(aida):
		if val <= anzen:
			continue
		ans += 1

	print(ans)
	#print(aida)
	#print(yokei)


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


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

int main(){

  long long i, j, k, Sum=0, N;
  cin>>N;
  map<char, long long> S;
  string s;
  vector<char> I={'M', 'A', 'R', 'C', 'H'};
  
  for(i=0; i<N; i++){
    cin>>s;
    S[s[0]]++;
  }
  for(i=0; i<5; i++){
    for(j=i+1; j<5; j++){
      for(k=j+1; k<5; k++){
        Sum+=S[I[i]]*S[I[j]]*S[I[k]];
      }
    }
  }
  cout << Sum << endl;
  return 0;
}

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
   int n; cin >> n;
   int d[n],e[n];
   rep(i,0,n){
      cin >> d[i] >> e[i];
   }

   string ans = "No\n";
   rep(i,0, n-2){
      if(d[i] == e[i] && d[i+1] == e[i+1] && d[i+2] == e[i+2]){
         ans = "Yes\n";
      }
   }

   cout << ans;
}

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

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

  vector<int> p(n);
  for(int i=0;i<n;i++) {
    cin >> p[i];
  }
  int total = 0;
  for(int i=1;i<n-1;i++) {
    if(p[i-1] < p[i] && p[i] < p[i+1]) {
      total++;
    }
    if(p[i-1] > p[i] && p[i] > p[i+1]) {
      total++;
    }
  }

  cout << total << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
using namespace std;
#define MAX 100
static const long long INF = (1LL << 32);
int v, e;
long long dp[MAX][MAX];

void floyd(){
  for ( int k = 0; k < v; k++){
    for ( int i = 0; i < v; i++){
      if ( dp[i][k] == INF) continue;
      for ( int j = 0; j < v; j++){
        if ( dp[k][j] == INF) continue;
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }
}

int main(){
  cin >> v >> e;
  int s, t, d;
  //init
  for ( int i = 0; i < v; i++){
    for ( int j = 0; j < v; j++){
      dp[i][j] = ((i == j) ? 0 : INF);
    }
  }

  for ( int i = 0; i < e; i++){
    cin >> s >> t >> d;
    dp[s][t] = d;
  }

  floyd();

  for ( int i = 0; i < v; i++){
    if ( dp[i][i] < 0){
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }

  for ( int i = 0; i < v; i++){
    for ( int j = 0; j < v; j++){
      if ( j ) cout << " ";
      if ( dp[i][j] == INF) cout  << "INF";
      else cout  << dp[i][j];
    }
    cout << endl;
  }

  return 0;
}


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

using namespace std;

int main() {
  string s = "Sunny", c = "Cloudy", r = "Rainy", in, res;
  cin >> in;
  if (in == s)
    res = c;
  else if (in == c)
    res = r;
  else if (in == r)
    res = s;

  cout << res << endl;

  return 0;
}


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

int N;
long long Z, W;
vector<long long> a;
vector<long long> xx, yy;
long long sx(int y );
long long sy( int x ){
  if( yy[x] >= 0 ) return yy[x];
  //  cout << "sy x=" << x << endl;
  long long ans = abs( a[N] - a[x] );
  //  cout << ans << endl;
  for(int i = x + 1; i < N; i++){
    ans = min( ans, sx( i ) );
  }
  return yy[x] = ans;
}
long long sx( int y ){
  if( xx[y] >= 0 ) return xx[y];
  //  cout << "sx y=" << y << endl;
  long long ans = abs( a[N] - a[y] );
  //  cout << ans << endl;
  for(int i = y + 1; i < N; i++){
    ans = max( ans, sy( i ) );
  }
  return xx[y] = ans;
}
int main(){
  cin >> N;
  a.resize(N+1);
  xx.resize(N+1,-1);
  yy.resize(N+1,-1);
  
  cin >> Z >> W;
  a[0] = W;
  for(int i = 0; i < N; i++){
    cin >> a[i+1];
  }
  cout << sx(0) << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>


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

	if(a < b){
	printf("a < b\n");

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

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

}
 
	
return 0;

}

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

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr ll inf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    ll n, k;
    in(n);
    in(k);
    ll h[n];
    floop(i, n) in(h[i]);
    sort(h, h + n);
    ll ans = 0;
    if (n > k)
    {
        floop(i, n - k)
        {
            ans += h[i];
        }
    }
    out(ans);
}

Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <functional>
#include <typeinfo>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>

using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define reprrev(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); i--)
#define reprev(i, n) reprrev(i, 0, n)
#define mp(a, b) make_pair(a, b)
#define all(vec) (vec).begin(), (vec).end()
#define yn(formula) (formula) ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(formula) (formula) ? (cout << "YES" << endl) : (cout << "NO" << endl)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;

constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1ll << 59;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };

/*<ここから>***********************************************************/


int main()
{
	int K;
	cin >> K;
	vvi g(K);

	rep(i, K) {
		g[i].push_back((i + 1) % K);
		g[i].push_back((i * 10) % K);
	}

	vi visited(K, 0);
	priority_queue<pii> pq;
	pq.push(pii(-1, 1));
	int ans;
	while (!pq.empty()) {

		int crr = pq.top().second;
		int cost = -pq.top().first;
		pq.pop();

		if (crr == 0) {
			ans = -cost;
			break;
		}

		visited[crr] = 1;

		if (visited[(crr + 1) % K] == 0) {
			pq.push(pii(-cost - 1, (crr + 1) % K));
		}
		if (visited[(crr * 10) % K] == 0) {
			pq.push(pii(-cost, (crr * 10) % K));
		}
	}

	cout << -ans << endl;

	return 0;
}


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

int findSol(vector < vector < int > > &points, int n, int i, vector < vector < int > > &dp) {
  // cout<<"function called with args n = "<<n<<" i = "<<i<<endl;
  if (n == 0) {
    return points[n][i];
  }

  if (n != points.size() && dp[n][i] != -1) {
    return dp[n][i];
  }

  int maxi = 0;
  for (int j = 0; j < 3; j++) {
    if (i != j) {
      maxi = max(maxi, findSol(points, n - 1, j, dp));
    }
  }


  if (n == points.size()) {
    return maxi;
  } else {
    dp[n][i] = maxi + points[n][i];
    return dp[n][i];
  }

}

int recursiveSol(vector < vector < int > > &points) {
  int n = points.size();
  int maxi = 0;
  vector < vector < int > > dp(n, vector < int >(3, -1));
  maxi = findSol(points, n, 3, dp);
  return maxi;
}

int findMaxPoints(vector < vector < int > > &points) {
  int n = points.size();
  for (int i = 1; i < n; i++) {
    points[i][0] += max(points[i - 1][1], points[i - 1][2]);
    points[i][1] += max(points[i - 1][0], points[i - 1][2]);
    points[i][2] += max(points[i - 1][1], points[i - 1][0]);
  }

  return max(max(points[n - 1][0], points[n - 1][1]), points[n - 1][2]);
}

int main() {
  int n;
  cin>>n;
  vector < vector < int > > points(n, vector < int > (3, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin>>points[i][j];
    }
  }

  // cout<<"dp bottom up solution"<<endl;
  // cout<<findMaxPoints(points)<<endl;
  // cout<<"recursive solution"<<endl;
  cout<<recursiveSol(points)<<endl;
  return 0;
}


Measured memory_bytes: 22008
n, m, c = map(int, input().split())
blst = list(map(int, input().split()))
res = 0
for i in range(n):
  temp = c
  alst = list(map(int, input().split()))
  for j in range(m):
    temp += (alst[j] * blst[j])
  if temp > 0:
    res += 1
print(res)

Measured memory_bytes: 9084
import itertools
import math
n=int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
l=list(range(n))
p=itertools.permutations(l,n)
tot=0
for i in p:
    #print(i)
    for j in range(n-1):
        tot+=math.sqrt((xy[i[j+1]][0]-xy[i[j]][0])**2 + (xy[i[j+1]][1]-xy[i[j]][1])**2)

ans=tot/math.factorial(n)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
int A,B,K;
  cin>>A>>B>>K;
  if(B-A<=2*K-2){
  for(int i=A;i<=B;i++)
    cout<<i<<endl;
  }else{
  for(int i=A;i<=A+K-1;i++)
    cout<<i<<endl;
    for(int i=B-K+1;i<=B;i++)
     cout<<i<<endl;
  }
   return 0;
}

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

int main () {
  ll h, ans = 1, b = 1;
  cin >> h;
  
  while (h != 1) {
    h = h/2;
    b *= 2;
    ans = ans+b;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
ary = list(map(int,input().split()))
money = 1000
kabu = 0

for i in range(n-1):
    if ary[i] < ary[i+1] and money>ary[i]:
        kabu += money//ary[i]
        money -= kabu*ary[i]
    elif ary[i] > ary[i+1]:
        money += kabu*ary[i]
        kabu = 0

print(money+kabu*ary[n-1])


Measured memory_bytes: 9140
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define ll long long

int main(){

    int r; cin >> r;
    if(r<1200){
        cout << "ABC" << endl;
    }
    else if(r<2800){
        cout << "ARC" << endl;
    }
    else cout << "AGC" << endl;

    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int n, m; cin >> n >> m;
	int a[100][100], b[100];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> a[i][j];
	for (int j = 0; j < m; j++)
		cin >> b[j];
	for (int i = 0; i < n; i++) {
		int c = 0;
		for (int j = 0; j < m; j++)
			c += a[i][j] * b[j];
		cout << c << endl;
	}

	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    
    for (int i=0;i<N;i++){
        cin >> X[i];
    }

    int ans=INF;



    for(int p=1;p<=100;p++){
        int cost=0;
        for(int i=0;i<N;i++){
            cost += (X[i]-p) * (X[i]-p);
        }
        ans = min(ans,cost);
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func calc(n int) int {
	ac := 0
	for 0 < n {
		ac += n % 10
		n = n / 10
	}

	return ac
}

func main() {

	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var ans int

	for i := 1; i <= n; i++ {
		nc := calc(i)
		if nc >= a && b >= nc {
			// fmt.Print(nc)
			// fmt.Print(":")
			ans += i
		}
	}

	fmt.Print(ans)
}

Measured memory_bytes: 512
def main():
    N, A, B = map(int, input().split())

    ans = 0

    for i in range(1, N + 1):
        tmpSum = 0
        num = str(i)
        array = list(map(int, list(num)))
        tmpSum = sum(array)

        ans += i if A <= tmpSum and tmpSum <= B else 0

    print(ans)
        
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import sys

# sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


n = read_int()
a = [read_int() -1 for i in range(n)]
res = -1
s = set()
i = 0
step = 1
while a[i] not in s:
    if a[i] == 1:
        res = step
    s.add(a[i])
    i = a[i]
    step += 1
print(res)


Measured memory_bytes: 13252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[200007];
ll brr[200007];
ll m = 1e9+7;
int main()
{
    ll n;
    cin>>n;
    for(ll i=1;i<=n;++i)
    {
        cin>>arr[i];
        brr[i] = ((arr[i]%m)+(brr[i-1]%m))%m;
    }
    ll sum = 0;
    for(ll i=2;i<=n;++i)
    {
        ll val  = ((arr[i]%m)*(brr[i-1]%m))%m;
        sum = ((sum%m)+(val%m))%m;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 6676
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 105;

int i,x,k,d;

void solve()
{
    cin>>x>>k>>d;
    int ans;
    if(x==0)
    {
        if(k%2==0)
            ans=0;
        else
            ans=d;
    }
    else if(x>0)
    {
        if(x/k>=d)
            ans=x-k*d;
        else
        {
            int m=x/d,rem=k-m;
            if(rem%2==0)
                ans=x%d;
            else
                ans=d-x%d;
        }
    }
    else
    {
        if(-x/k>=d)
            ans=abs(x+k*d);
        else
        {
            int m=abs(x)/d,rem=k-m;
            if(rem%2==0)
                ans=abs(x)%d;
            else
                ans=d-abs(x)%d;
        }
    }
    cout<<ans;
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define dbg(x) cout << #x << ": " << (x) << '\n'
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

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

   int l, r, d;
   cin >> l >> r >> d;
   cout << (r / d) - (l / d) + bool(!(l % d)) << '\n';


   return 0;
}

Measured memory_bytes: 3596
from math import ceil
def myAnswer(N:int,K:int,A:list) -> int:
   return ceil((N - 1)/(K - 1))


def modelAnswer():
   return
def main():
   N,K = map(int,input().split())
   A = list(map(int,input().split()))
   print(myAnswer(N,K,A[:]))
if __name__ == '__main__':
   main()

Measured memory_bytes: 13812
n = int(input())
sp = [list(input().split()) + [i+1] for i  in range(n)]

sp_sorted = sorted(sp, key=lambda x: x[0])

city_now = sp_sorted[0][0]
tmp = []
for sp in sp_sorted:
	if sp[0] == city_now:
		tmp.append(sp)
	else:
		tmp_sorted = sorted(tmp, key=lambda x:int(x[1]), reverse=True)
		for t in tmp_sorted:
			print(t[2])
		city_now = sp[0]
		tmp = [sp]

if tmp:
	tmp_sorted = sorted(tmp, key=lambda x:int(x[1]), reverse=True)
	for t in tmp_sorted:
		print(t[2])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef vector<int> vi;

template<class T> inline T re(){
	T N = 0; char c = getchar(); bool neg = 0;
	for (; c < '0' || c > '9'; c = getchar()) neg |= c == '-';
	for (; c >= '0' && c <= '9'; c = getchar())
		N = (N<<3)+(N<<1) + c - '0';
	return neg ? -N : N;
}

const int mxsz = 1e3 + 5;
int n, m;
vi adj[mxsz];

vi minCycle;
int q[mxsz], H = -1, T = -1;
int d[mxsz], par[mxsz];

int main(){
	n = re<int>(); m = re<int>();
	for (int i = 1, a, b; i <= m; i++){
		a = re<int>(); b = re<int>();
		adj[a].pb(b);
	}
	for (int i = 1; i <= n; i++){
		H = T = 0;
		q[++T] = i;
		for (int j = 1; j <= n; j++) d[j] = par[j] = n + 1;
		d[i] = 0; par[i] = -1;
	//	cout << "start\n";
		while (H < T){
			int u = q[++H];
	//		cout << "srch " << u << '\n';
			for (int nx : adj[u]){
	//			cout << "cur " << nx << '\n';
				if (nx == i){
					vi tmp;
					int cur = u;
	//				cout << "found\n";
					while (cur != i){
	//					cout << cur << '\n';
						tmp.pb(cur);
						cur = par[cur];
					}
					tmp.pb(i);
					if (tmp.size() < minCycle.size() || minCycle.empty()){
						minCycle.clear();
						while (tmp.size()){
							minCycle.pb(tmp.back());
							tmp.pop_back();
						}
					}
					H = T;
					break;
				}
				if (d[nx] > d[u] + 1){
					d[nx] = d[u] + 1;
					par[nx] = u;
					q[++T] = nx;
				}
			}
		}
	}
	if (minCycle.empty()) printf("-1\n");
	else{
		printf("%lu\n", minCycle.size());
		for (int u : minCycle) printf("%d\n", u);
	}
	return 0;
}


Measured memory_bytes: 384