akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;
import static java.util.Arrays.copyOfRange;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    private static int mod = 1000000007;

    public int cal(int n, int m) {
        while (n > 0) {
            int nn = n % 2;
            int mm = m % 2;
            if (mm > nn) {
                return 0;
            }
            n /= 2;
            m /= 2;
        }
        return 1;
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        String s = in.next();
        int n = s.length();
        out.println(check(s) && check(s.substring(0, (n - 1) /2)) && check(s.substring((n + 3) / 2 - 1, n)) ? "Yes" : "No");

    }

    private boolean check(String s) {
        int n = s.length();
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) != s.charAt(n - 1 - i)) {
                return false;
            }
        }
        return true;
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

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

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

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

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

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

}


Measured memory_bytes: 22868
#include <iostream>
#include <vector>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <climits>
#include <cmath>

using namespace std;

typedef complex<double> P;
int n;
class Circle{
public:
  P cp;
  double r;
};

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b))<EPS)

const double INF=-1;
const int band=3;
int main(){
  int n;
  while(cin>>n&&n!=0){
    int xsortedIdxs[100001];
    int ysortedIdxs[100001];
    vector<Circle> cs;
    vector<pair<double,int> > xsorted;
    vector<pair<double,int> > ysorted;
    double x,y,r;
    for(int i = 0; i < n; i++){
      Circle c;
      cin>>r>>x>>y;
      c.r=r;
      c.cp=P(x,y);
      cs.push_back(c);
      xsorted.push_back(make_pair(x,i));
      ysorted.push_back(make_pair(y,i));
    }
    sort(xsorted.begin(),xsorted.end());
    sort(ysorted.begin(),ysorted.end());
    for(int i = 0; i < n; i++){
      xsortedIdxs[xsorted[i].second]=i;
      ysortedIdxs[ysorted[i].second]=i;
    }
    double minDist=INF;
    for(int i = 0; i < n; i++){
      // x,zÀW»ê¼êÉÂ¢ÄA
      // ©ªÌê©ç-10,+10ÌÆ±ëðTõ
      int xsidx=xsortedIdxs[i];
      int ysidx=ysortedIdxs[i];
      for(int j = xsidx; j < min(xsidx+band,n);j++){
	int idx=xsorted[j].second;
	if(i==idx)continue;
	double d=abs(cs[idx].cp-cs[i].cp)
	  -cs[idx].r-cs[i].r;
	if(EQ(minDist,INF)||minDist>d)
	  minDist=d;
      }
      for(int j = xsidx; j >= max(0,xsidx-band); j--){
	int idx=xsorted[j].second;
	if(i==idx)continue;
	double d=abs(cs[idx].cp-cs[i].cp)
	  -cs[idx].r-cs[i].r;
	if(EQ(minDist,INF)||minDist>d)
	  minDist=d;
      }
      for(int j = ysidx; j < min(ysidx+band,n);j++){
	int idx=ysorted[j].second;
	if(i==idx)continue;
	double d=abs(cs[idx].cp-cs[i].cp)
	  -cs[idx].r-cs[i].r;
	if(EQ(minDist,INF)||minDist>d)
	  minDist=d;
      }
      for(int j = ysidx; j >= max(0,ysidx-band); j--){
	int idx=ysorted[j].second;
	if(i==idx)continue;
	double d=abs(cs[idx].cp-cs[i].cp)
	  -cs[idx].r-cs[i].r;
	if(EQ(minDist,INF)||minDist>d)
	  minDist=d;
      }
    }
    printf("%.8f\n",minDist);
    //cout<<minDist<<endl;
  }

  return 0;
}

Measured memory_bytes: 6600
#include <iostream>

int gcd(int x,int y){
  if(x%y==0){
    return y;
  }

  else{
    return(gcd(y,x%y));
  }
}

int main(){
  int x,y;

  std::cin >> x >> y;

  std::cout << gcd(x,y) << "\n";

  return 0;
}



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

using namespace std;

class DisjoitSet {
public:
    vector<int> rank, p, s;
    DisjoitSet() {}
    DisjoitSet(int n) {
        rank.resize(n, 0);
        p.resize(n, 0);
        s.resize(n, 0);
        for (int i = 0; i < n; i++)
        {
            makeSet(i);
        }
    }
    void makeSet(int x) {
        p[x] = x;
        rank[x] = 0;
        s[x] = 1;
    }

    bool same(int x, int y) {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
        if (same(x,y))return;
        if (rank[x] > rank[y]) {
            p[y] = x;
            s[x] += s[y];
            s[y] = s[x];
        }
        else
        {
            p[x] = y;
            s[y] += s[x];
            s[x] = s[y];
            if (rank[x] == rank[y])
            {
                rank[y]++;
            }
        }
    }
    int size(int x)
    {
        int p = findSet(x);
        return s[p];
    }
    int findSet(int x) {
        if (x != p[x]) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};
int deg[100005] = { 0 };
vector<int> block[100005];
int main()
{

    int N, M, K;
    cin >> N >> M >> K;
    DisjoitSet ds = DisjoitSet(N);
    int A, B;
    for (int i = 0; i < M; i++)
    {
        cin >> A >> B;
        A--;
        B--;
        ds.unite(A, B);
        deg[A]++;
        deg[B]++;
    }
    for (int i = 0; i < K; i++)
    {
        cin >> A >> B;
        A--;
        B--;
        block[A].push_back(B);
        block[B].push_back(A);
    }
    for (int i = 0; i < N; i++)
    {
        int ans = ds.size(i) - 1 - deg[i];
        for (int u : block[i]) {
            if (ds.same(i, u))
                ans--;
        }
        cout << ans << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 7552
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      x: usize,
      y: usize,
   }
   let mut ans = 0;
   let mut now = x;
   while now <= y {
      ans += 1;
      now *= 2;
   }
   println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
#define pb push_back
#define mp make_pair
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b,x;
	cin>>a>>b>>x;
	if(x >= a && x <= a + b)cout<<"YES\n";
	else cout<<"NO\n";

	
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {

	class Vertex {
		int id;
		int color = -1;
		List<Integer> vertices = new ArrayList<>();
		public Vertex(int id) {
			this.id = id;
		}
	}
	
	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	
	private void run() throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(reader.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		Vertex[] vertices = new Vertex[n];
		for (int i = 0; i < n; i++) {
			vertices[i] = new Vertex(i);
		}
		for (int i = 0; i < m; i++) {
			st = new StringTokenizer(reader.readLine());
			int id1 = Integer.parseInt(st.nextToken());
			int id2 = Integer.parseInt(st.nextToken());
			vertices[id1].vertices.add(id2);
			vertices[id2].vertices.add(id1);
		}
		
		assignColor(vertices);
		
		int q = Integer.parseInt(reader.readLine());
		for (int i = 0; i < q; i++) {
			st = new StringTokenizer(reader.readLine());
			int id1 = Integer.parseInt(st.nextToken());
			int id2 = Integer.parseInt(st.nextToken());
			int c1 = vertices[id1].color;
			int c2 = vertices[id2].color;
			if (c1 == c2 && c1 != -1) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
		reader.close();
	}

	private void assignColor(Vertex[] vertices) {
		int color = 0;
		for (Vertex vertex : vertices) {
			if (vertex.color == -1) {
				assignColor(vertex, vertices, color);
				color++;
			}
		}
	}

	private void assignColor(Vertex vertex, Vertex[] vertices, int color) {
		Stack<Integer> stack = new Stack<>();
		stack.push(vertex.id);
		while(!stack.empty()) {
			int id = stack.pop();
			if (vertices[id].color != -1) {
				continue;
			}
			vertices[id].color = color;
			for (int nId : vertices[id].vertices) {
				if (vertices[nId].color == -1) {
					stack.push(nId);
				}
			}
		}
	}
}


Measured memory_bytes: 82376
//#include "atcoder.h"
//#include "math.h"
//#include "prime.h"
//#include "countmap.h"
//#include "bigint.h"
//#include <bits/stdc++.h>
//using namespace std;
//using Int = long long;
//#define PUTS(x) cout << (x) << endl;
//#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
//#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
//#define PB push_back
//#define MP make_pair
//#define MT make_tuple
//#define F first
//#define S second
//#define ALL(v) (v).begin(), (v).end()
//#define SZ(x) ((int)(x).size())
//#define LEN(x) ((int)(x).length())
//#define MOD 1000000007

// #include <bits/stdc++.h>
// using namespace std;
// using Int = long long;
// #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
// #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
// #define ALL(v) (v).begin(), (v).end()
// #define PUTS(x) cout << (x) << endl;
// #define PB push_back
// #define MP make_pair
// #define F first
// #define S second
// vector<Int> IntsIn(int n) {
//     auto v = vector<Int>(0);
//     for (int i = 0; i < n; i++) {
//         Int a;
//         cin >> a;
//         v.push_back(a);
//     }
//     return v;
// }

// #define INF 100000000000LL

#include <bits/stdc++.h>
using Int = long long;
using namespace std;
int main() {
    Int n;
    cin >> n;
    Int ans = 0LL;
    for (Int i = 1; i * i < n; i++) {
        if (n % i == 0) {
            auto j = n / i;
            if (j - i >= 2) {
                ans += j - 1;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void main(){
	while(true) {
		auto l = readInts();
		auto N = l[0];
		auto A = l[1];
		auto B = l[2];
		auto C = l[3];
		auto X = l[4];
		if(N == 0) {
			return;
		}
		auto Y = readInts();
		int c = 0;
		auto n = 0;
		while(c <= 10000 && n < N) {
			if(X == Y[n]) {
				++n;
				if(n == N){
					break;
				}
			}
			X = (A * X + B) % C;
			++c;
		}
		if(n == N) {
			writeln(c);
		} else {
			writeln(-1);
		}
	}
}

Measured memory_bytes: 2960
#include<bits/stdc++.h>
using namespace std;
int n;
main()
{
    int l,r,x;
    scanf("%d",&n);
    l = 1005; r = -1005;
    while(n--)
    {
        scanf("%d",&x);
        l = min(l,x); r = max(r,x);
    }
    printf("%d",r-l);
}


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

int main() {
	int x, y;
	cin >> x >> y;
	for (int i = 0; i <= x; i++) {
		if (i*2 + (x-i)*4 == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define modulo 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N; cin >> N;
	double ans = 0;
	const double BtoY = 380000;

	for (int i = 0; i < N; i++) {
		double tmp;
		string S;
		cin >> tmp >> S;
		if (S == "JPY") ans += tmp;
		else ans += tmp * BtoY;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split(" "))

dx = tx - sx
dy = ty - sy
ans = ""
# first turn
ans += "R" * dx
ans += "U" * dy
ans += "L" * dx
ans += "D" * dy
# second turn
ans += "D"
ans += "R" * (dx+1)
ans += "U" * (dy+1)
ans += "L"

ans += "U"
ans += "L" * (dx+1)
ans += "D" * (dy+1)
ans += "R"
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

vector<complex<double>> fft(vector<complex<double>> a, bool inverse = false) {
    int n = a.size();
    int h = 0;
    for (int i = 0; 1 << i < n; i++) h++;
    for (int i = 0; i < n; i++) {
        int j = 0;
        for (int k = 0; k < h; k++) j |= (i >> k & 1) << (h - 1 - k);
        if (i < j) swap(a[i], a[j]);
    }
    for (int b = 1; b < n; b *= 2) {
        for (int j = 0; j < b; j++) {
            complex<double> w = polar(1.0, (2 * M_PI) / (2 * b) * j * (inverse ? 1 : -1));
            for (int k = 0; k < n; k += b * 2) {
                complex<double> s = a[j + k];
                complex<double> t = a[j + k + b] * w;
                a[j + k] = s + t;
                a[j + k + b] = s - t;
            }
        }
    }
    if (inverse)
        for (int i = 0; i < n; i++) a[i] /= n;
    return a;
}

vector<complex<double>> fft(vector<double> a, bool inverse = false) {
    vector<complex<double>> a_complex(a.size());
    for (int i = 0; i < a.size(); i++) a_complex[i] = complex<double>(a[i], 0);
    return fft(a_complex, inverse);
}

vector<double> convolve(vector<double> a, vector<double> b) {
    int s = a.size() + b.size() - 1;
    int t = 1;
    while (t < s) t *= 2;
    a.resize(t);
    b.resize(t);
    vector<complex<double>> A = fft(a);
    vector<complex<double>> B = fft(b);
    for (int i = 0; i < t; i++) {
        A[i] *= B[i];
    }
    A = fft(A, true);
    a.resize(s);
    for (int i = 0; i < s; i++) a[i] = A[i].real();
    return a;
}

int main() {
    int n; ll m; cin >> n >> m;
    vector<double> a(200100, 0);
	vector<double> b(200100, 0);
    ll maxpoint = 0;
	for(int i = 0; i < n; i++) {
		ll x; cin >> x;
		maxpoint = max(maxpoint, 2*x);
		++a[x]; ++b[x];
    }
    vector<double> ans = convolve(a, b);
    ll sum = 0;
	ll t = 0;
	for( ll k = maxpoint; k > 0; k-- ){
		ll pntcnt = ans[k]+0.5;
		t += pntcnt;
		sum += ( pntcnt * k );
		if( t > m ){
			sum -= ( (t-m) * k );
			break;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 40384
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template <class _T> static _T tp_abs(const _T& a) {
	//	usage:  tp_abs<type name>(a);
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}

static void ARC069D_Menagerie();

#if 1
int main()
{
	ARC069D_Menagerie();
	fflush(stdout);
	return 0;
}
#endif

static void ARC069D_Menagerie()
{
	int N;
	get1int(N);

	auto seq = new char[N + 1];
	getstring(seq);
	auto ans = new char[N + 1];
	ans[N] = 0;

	const char* first = "SSWW";
	const char* second = "SWSW";
	bool success = true;
	for (int i = 0; i < 4; i++) {
		ans[0] = first[i];
		ans[1] = second[i];

		for (int j = 1; j < (N - 1); j++) {
			int next = j + 1;
			int bfr = j - 1;

			if (ans[j] == 'S') {
				if (seq[j] == 'o') {
					ans[next] = ans[bfr];
				}
				else {
					if (ans[bfr] == 'S') ans[next] = 'W';
					else ans[next] = 'S';
				}
			}
			else {
				if (seq[j] == 'o') {
					if (ans[bfr] == 'S') ans[next] = 'W';
					else ans[next] = 'S';
				}
				else {
					ans[next] = ans[bfr];
				}
			}
		}

		success = true;
		for (int j = 0; j < N; j++) {
			int next = j + 1;
			int bfr = j - 1;
			if (next >= N) next = 0;
			if (bfr < 0) bfr = N - 1;

			if (ans[j] == 'S') {
				if (seq[j] == 'o') {
					if (ans[bfr] != ans[next]) {
						success = false;
						break;
					}
				}
				else {
					if (ans[bfr] == ans[next]) {
						success = false;
						break;
					}
				}
			}
			else {
				if (seq[j] == 'o') {
					if (ans[bfr] == ans[next]) {
						success = false;
						break;
					}
				}
				else {
					if (ans[bfr] != ans[next]) {
						success = false;
						break;
					}
				}
			}
		}
		if (success) break;
	}
	if (success) printf("%s\n", ans);
	else printf("-1\n");

	delete[] seq;
	delete[] ans;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define fs first
#define ss second



int main(){
 
  ll n,a,b;
  cin >> n >> a >> b;

  ll ans = (n/(a+b)) * a + min(a,n%(a+b));

  cout << ans <<endl; 


}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<functional>
#include<string.h>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<queue>
#include<deque>
#include<string>
#include<random>
#include<stack>
#include<limits.h>
using namespace std;

signed main() {
	string a; cin >> a;
	for (int i = 0; i < a.length() - 1; i++) {
		if (a[i] == 'A'&&a[i + 1] == 'C') { puts("Yes"); return 0; }
	}
	puts("No");
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let x = get!(usize);
    if x < 1200 {
        println!("ABC");
    } else {
        println!("ARC");
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>
#include <cstdlib>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

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

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

const ll INF = 1ll<<62;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int n, m;
int cnt[112345];
ll d[112345];
vector<pll> g[112345];

int main() {
	cin >> n >> m;
	REP(i, m) {
		ll a, b, c;
		scanf("%lld %lld %lld", &a, &b, &c);
		g[a - 1].push_back(pll(b - 1, c));
	}
	
	fill(d, d + n, -INF);
	
	priority_queue<pll> pq;
	pq.push(pll(0, 0));
	
	bool ng = false;
	
	while (!pq.empty()) {
		pll now = pq.top();
		pq.pop();
		
		ll pos = now.second;
		ll cost = now.first;
		
		if (chmax(d[pos], cost)) {
			cnt[pos]++;
			if (cnt[n - 1] > 10) {
				ng = true;
				break;
			}
			else if (pos != n - 1 && cnt[pos] >= 500) continue;
		}
		else continue;
		
		REP(i, g[pos].size()) {
			ll next = g[pos][i].first;
			ll nextc = g[pos][i].second + cost;
			
			if (d[next] >= nextc) continue;
			pq.push(pll(nextc, next));
		}
	}
	
	if (ng) puts("inf");
	else cout << d[n - 1] << endl;
	
	return 0;
}

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

using namespace std;

unordered_set<int> dp[9];

bool solve(int val) {
    for (auto it:dp[7])
        if (it == val)
            return false;
    for (int j = 6; j > 0; j--) {
        for (auto it:dp[j]) {
            dp[j + 1].insert(it ^ val);
        }
    }
    dp[1].insert(val);
    return true;
}

int main() {

    int r;
    cin >> r;
    cout << r * r;
    return 0;
}

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

int main(void){
    char b;
    cin >> b;
    
    if(b == 'A'){
        cout << 'T';
    }else if(b == 'T'){
        cout << 'A';
    }else if(b == 'C'){
        cout << 'G';
    }else if(b == 'G'){
        cout << 'C';
    }
}

Measured memory_bytes: 3572
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)

	num := make([]int, n)
	for i := range num {
		num[i] = -1
	}

	var s, c int
	duplicatedDefinition := false
	for i := 0; i < m; i++ {
		fmt.Scanf("%d %d", &s, &c)
		if num[s-1] != -1 && num[s-1] != c {
			duplicatedDefinition = true
		}
		num[s-1] = c
	}
	if duplicatedDefinition {
		fmt.Println(-1)
		return
	}
	if (num[0] == 0 && n == 1) || (num[0] == -1 && n == 1) {
		fmt.Println(0)
		return
	} else if num[0] == 0 {
		fmt.Println(-1)
		return
	}

	answer := ""
	for i, val := range num {
		if val == -1 {
			if i == 0 {
				val = 1
			} else {
				val = 0
			}
		}
		answer += fmt.Sprintf("%d", val)
	}

	fmt.Println(answer)

}


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

using namespace std;
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)

#pragma comment(linker, "/STACK:16777216")

typedef long long int64;
typedef unsigned long long uint64;

int main()
{
	int64 n, d, x;
	cin >> n >> d >> x;

	int64 res = x;

	for (int i = 1; i <= n; i++) {
		int64 a;
		cin >> a;

		int64 m = (d - 1) / a;
		int64 last = m * a + 1;
		int64 cnt = (last - 1) / a + 1;

		res += cnt; 
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int t[4][14];
  int n, i,j,c;
  char m, d;
  for(i=0; i < 4; i++){
    for(j=0; j < 14; j++){
      t[i][j]=0;
    }
  }
 scanf("%d", &c);
  for(i = 0; i < c; i++){
    scanf("%c", &d);
    scanf("%c %d", &m, &n);
    if(m == 'S'){
      t[0][n] = 1;
    }
    else if(m == 'H'){
      t[1][n] = 1;
    }
    else if(m == 'C'){
      t[2][n] = 1;
    }
    else if(m == 'D'){
      t[3][n] = 1;
    }
  }
  for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }

 for(j=1; j < 14; j++){
    if(t[1][j] != 1){
      printf("H %d\n", j);
    }
  }

 for(j=1; j < 14; j++){
    if(t[2][j] != 1){
      printf("C %d\n", j);
    }
  }

 for(j=1; j < 14; j++){
    if(t[3][j] != 1){
      printf("D %d\n", j);
    }
  }
 return 0;
}



Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
int N;
int A[100005];
int B[100005];
int main(){
  cin >> N;
  int res = 0;
  for(int i=1;i<=N;i++){
    cin >> A[i];
    if( A[A[i]] == i )  res++;
  }
  cout << res << endl;
}


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

string cipher(string& s, int& index);
string str(string& s, int& index);
char letter(string& s, int& index);

string cipher(string& s, int& index){
    string ret = str(s, index);

    while(true){
        if(s[index] == '#' || s[index] == ']'){
            break;
        }
        else{
            ret += str(s, index);
        }
    }

    return ret;
}

string str(string& s, int& index){
    if(s[index] == '['){
        index++;
        string temp = cipher(s, index);
        index++;
        reverse(temp.begin(), temp.end());
        return temp;
    }
    else{
        string ret = "";
        ret += letter(s, index);
        return ret;
    }
}

char letter(string& s, int& index){
    if(s[index] == '+'){
        index++;
        char temp = letter(s, index);
        int tempInt = temp - 'A';
        tempInt = (tempInt + 1) % 26;
        return 'A' + tempInt;
    }
    else if(s[index] == '-'){
        index++;
        char temp = letter(s, index);
        int tempInt = temp - 'A';
        tempInt = (tempInt - 1 + 26) % 26;
        return 'A' + tempInt;
    }
    else{
        char ret = s[index];
        index++;
        return ret;
    }
}

string replaceQ(string s, int cnt, vector<int>& qIndexList, int depth){
    if(cnt == depth){
        string temp = s + '#';
        int index = 0;
        return cipher(temp, index);
    }

    string ret = "";
    for(int i = 0; i < 26; i++){
        char c = 'A' + i;
        string temp = s;
        temp[qIndexList[depth]] = c;
        string statement = replaceQ(temp, cnt, qIndexList, depth + 1);

        if(ret == ""){
            ret = statement;
        }
        else{
            if(statement < ret){
                ret = statement;
            }
        }
    }

    return ret;
}

int main(){

    while(true){
        string s;
        cin >> s;
        if(s == "."){
            break;
        }

        int cnt = 0;
        vector<int> qIndexList;

        for(int i = 0; i < (int)s.size(); i++){
            if(s[i] == '?'){
                cnt++;
                qIndexList.push_back(i);
            }
        }

        string ans = replaceQ(s, cnt, qIndexList, 0);
        cout << ans << endl;
    }

    return 0;
}


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

using namespace std;
typedef long long ll;


int main(){



    string S;
    cin >> S;

    int m = 2019;

    int n = S.size();

    vector<int> kasu(m,0);

    kasu[0] =1;


    int now = 0;


    int tens = 1;


    for(int i=n-1;i>=0;i--){
        
        int number = n-i-1;

        
        

        now =  (now+ tens*(S[i]-'0'))%m;

       
        
        
        kasu[now]++;
        

        tens  = (tens*10)%m;


    }


    int ans=0;

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


        ans += (kasu[i])*(kasu[i]-1)/2;

    }


    cout << ans << endl;

    return 0;

    


    
}

Measured memory_bytes: 3712
import sys
from io import StringIO
import unittest


def resolve():
    n = int(input())
    hh = list(map(int, input().split()))

    ans = 0
    tmp_ans = 0
    h = hh[0]
    for next_h in hh[1:]:
        if h >= next_h:
            tmp_ans += 1
        else:
            if ans < tmp_ans:
                ans = tmp_ans
            tmp_ans = 0

        h = next_h

    if ans < tmp_ans:
        ans = tmp_ans

    print(ans)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5
10 4 8 7 3"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """7
4 4 5 6 6 5 5"""
        output = """3"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """4
1 2 3 4"""
        output = """0"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Measured memory_bytes: 16800
k, s= map(int, input().split())
a = [1]
p = [1]
for i in range(k):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n, k):
    if k == 0:
        return 1 if n==1 else 0
    elif n == 1:
        return 0
    elif 1 < n <= 1 + a[k-1]:
        return f(n-1, k-1)
    elif n == 2 + a[k-1]:
        return 1 + p[k-1]
    elif 2 + a[k-1] < n <= 2 + 2 * a[k-1]:
        return 1 + p[k-1] + f(n-2-a[k-1], k-1)
    elif n == 3 + 2 * a[k-1]:
        return 1 + 2 * p[k-1]
    else:
        return 'Err'

ans=f(s, k)
print(ans)

Measured memory_bytes: 38256
S = input()
List1= []
List2 = []
n1 = 0
n2 = 0
for i in range(0,len(S),2):
  List1.append(S[i])
for i in range(1,len(S),2):
  List2.append(S[i])
n1 = List1.count("h")
n2 = List2.count("i")
if n1 == len(List1) and n2 == len(List2) and n1 == n2:
  print("Yes")
else:
  print("No")


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

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

  int h, n;
  cin >> h >> n;
  int s = 0;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    s += a;
  }
  string ans = (s >= h) ? "Yes" : "No";
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
N, Q = gets.split(" ").map(&:to_i)
S = gets.chomp!
s_cs = S.chars

# 累積和用のarray
cumulative_sums = Array.new(N+1, 0) # N+1 のarrayで 0で初期化

# 文字列の長さで回す
N.times.with_index do |i|
  if (i+1 < N && s_cs[i] == 'A' && s_cs[i+1] == "C")
    # "AC"があれば、累積和に値を加える 累積+1　として。[0, 1, 2, 3, 4 ..]
    cumulative_sums[i+1] = cumulative_sums[i] + 1
  else
    # ない場合は + 0 の累積を追加
    cumulative_sums[i+1] = cumulative_sums[i]
  end
end

# クエリ
Q.times.with_index do |i|
  l, r = gets.split(" ").map(&:to_i)
  # index のために 1をへらす
  l -= 1
  r -= 1
  print("#{cumulative_sums[r] - cumulative_sums[l]}\n")
end



Measured memory_bytes: 10748
#include <iostream>
#include <algorithm>

int main() {
  int n;
  std::cin >> n;
  int a[n + 1], b[n];
  for (int i = 0; i < n + 1; i++) {
    std::cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    std::cin >> b[i];
  }
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int d = std::min(a[i], b[i]);
    sum += d;
    a[i] -= d;
    b[i] -= d;
    d = std::min(a[i + 1], b[i]);
    sum += d;
    a[i + 1] -= d;
    b[i] -= d;
  }
  std::cout << sum << "\n";
  return 0;
}

Measured memory_bytes: 1024
S = input()

A_index = 0
Z_index = 0

for i in range(len(S)):
    if S[i] == 'A':
        A_index = i
        break
        
        
for i in range(len(S)-1, 0, -1):
    if S[i] == 'Z':
        Z_index = i
        break
        
print(len(S[A_index:Z_index+1]))

Measured memory_bytes: 3516
import math
N = int(input())
X = list(map(int,input().split()))
medf = math.floor(sum(X)/N)
medc = math.ceil(sum(X)/N)
cf = 0
cc = 0
for i in range(N):
  cf += (X[i] - medf)**2
  cc += (X[i] - medc)**2
print(min(cf,cc))

Measured memory_bytes: 9112
#include <stdio.h>

int main(void)
{
	int n, i;
	int nzero_c, max;

	while (scanf("%d", &n), n){
		nzero_c = 0;
		max = 0;
		for (i = 0; i < n; i++){
			int v;
			scanf("%d", &v);
			if (v != 0) nzero_c++;
			max = fmax(v, max);
		}
		if (max < 2){
			puts("NA");
		}
		else {
			printf("%d\n", nzero_c + 1);
		}
	}
	return (0);
}

Measured memory_bytes: 616
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const double pi=acos(-1.0);//pi的表示
int main(){
    double c;
    double a,b,h,m;
    scanf("%lf%lf%lf%lf",&a,&b,&h,&m);
    double cal=fabs(h*30+m/2-m*6);//计算夹角
    double val=pi/180;//计算每一度的弧度
    double ret=cos(cal*val);
    double ans=sqrt(a*a+b*b-2*a*b*ret);//余弦定理
    printf("%.20f\n",ans);
    return 0;
}



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

int main(){
  long long A,B,C;
  cin>>A>>B>>C;
  if((A%2==0)||(B%2==0)||(C%2==0)){
    cout<<0<<endl;
    return 0;
  }
  if ((A>=B)&&(A>=C)){
    cout<<B*C<<endl;
    return 0;
  }
  else if((B>=A)&&(B>=C)){
    cout<<A*C<<endl;
    return 0;
  }
  else if((C>=A)&&(C>=B)){
    cout<<A*B<<endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;

class Program{
    static void Main(string[] args){
        var arr = Console.ReadLine().Split();
        var H = long.Parse(arr[0]);
        var W = long.Parse(arr[1]);
        long answer = H == 1 || W == 1 ? 1 : (H * W + 1) / 2;
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

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

int main(){
  string s;
  int q;
  cin >> s >> q;
  deque<char> ds(s.size());
  rep(i, s.size()) {
    ds[i] = s[i];
  }
  
  
  bool rev = 0;
  rep(i, q){
    int a;
    cin >> a;
    if (a == 2){
      int b;
      char c;
      cin >> b >>  c; --b;
      if (rev) b = 1 - b;
      if (b == 0) ds.push_front(c);
      else ds.push_back(c);
    }
    else if (a == 1){
      rev = 1 - rev;
    }
  }
  
  if (rev) reverse(ds.begin(), ds.end());
    
  for (auto x: ds) cout << x;
  cout << endl;
}

Measured memory_bytes: 896
def LCS(s, t): 
    A = []
    for i in range(len(s)+1):
        A.append([0]*(len(t)+1))
    for i in range(1, len(s)+1):
        for j in range(1, len(t)+1): 
            if s[i-1] == t[j-1]:
                A[i][j] =max(1 + A[i-1][j-1], A[i-1][j], A[i][j-1])
            else: 
                A[i][j] = max(A[i-1][j], A[i][j-1])
    dlugosc = A[-1][-1]
    i = len(s)
    j = len(t)
    odp = []
    while dlugosc > 0: 
        if s[i-1]==t[j-1] and A[i-1][j-1]+1== A[i][j]:
            odp.append(s[i-1])
            i -= 1
            j -= 1
            dlugosc -= 1
        else: 
            if A[i-1][j] == A[i][j]:
                i -= 1
            else: 
                j -= 1
    return ''.join(odp [::-1])
        
def LCS_zadanie(): 
    s = input()
    t = input()
    print(LCS(s,t))

LCS_zadanie()

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

int main() {
    string S;
    cin >> S;
    int ans = 0;
    int cnt = 0;
    rep(i, S.size()) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            ++cnt;
        } else
            cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int find(int i,int arr[],int n,int dp[],int k)
{
  int kc=1;
  int mn=1e9;
  while(i-kc>-1&&kc<=k)
  {
    mn=min(abs(arr[i]-arr[i-kc])+dp[i-kc],mn);
    kc++;
  }
  return mn;
}
int main()
{
  int n,k;cin>>n>>k;
  int arr[n];
  for(int i=0;i<n;i++)
     cin>>arr[i];
  int dp[n];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for(int i=2;i<n;i++)
  {
    dp[i]=find(i,arr,n,dp,k);
  }
  cout<<dp[n-1];
  
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=998244353;

const int MAX=200010;

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

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

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

int main() {
    ios_base::sync_with_stdio(false); 

    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> p(n+1);
    p[0]=1;
    rep(i,n) p[i+1]=(p[i]*(m-1))%MOD;
    ll ans=0;
    cmbInit();
    rep(i,k+1) {
        ll a=(m*p[n-(i+1)])%MOD,b=cmb(n-1,i);
        ans+=(a*b)%MOD;
        ans=ans%MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9572
N,M,Q = map(int,input().split())

ans = 0

lis = [ [i+1] for i in range(M) ]

for i in range(N-1):

    newlis = []
    for j in lis:

        for k in range(j[-1],M+1):
            cp = j.copy()
            cp.append(k)
            newlis.append(cp)

    lis = newlis

ans = 0
abcd = []

for i in range(Q):

    a,b,c,d = map(int,input().split())
    abcd.append([a-1,b-1,c,d])

for A in lis:

    now = 0
    
    for i in range(Q):

        a,b,c,d = abcd[i]

        if A[b] - A[a] == c:
            now += d

    ans = max(ans,now)

print (ans)

Measured memory_bytes: 38636
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>vector<T> vec(int len, T elem) { return vector<T>(len, elem); } // auto dp = vec(52, vec(103, vec(103, INF)));
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>inline int popcount(T a) {return __builtin_popcount(a);}
template<class T>inline T emod(T a, T p) { return (a%p + p) % p;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; }
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << '\n'; for (auto v : vec) os << v << ' '; os << '\n'; return os;}
template <typename T> ostream &operator<<(ostream &os, const deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <typename T> ostream &operator<<(ostream &os, const set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa) { os << '(' << pa.first << ',' << pa.second << ')'; return os; }
template <typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
template <typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
//-------------------
int main() {
    cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15);
    int n; cin >> n;
    vector<ll> a(n);
    vector<ll> sm(n);
    rep(i,n) cin >> a[i];
    sm[0] = a[0];
    FOR(i,1,n-1) sm[i] = (sm[i-1]+a[i])%mod;
    ll ans = 0;
    FOR(i,1,n-1) {
        ll cur = (a[i] * sm[i-1]) % mod; 
        ans = (ans + cur) % mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6356
import sys
a=[]
for i in range(3):
    a+=list(map(int,input().split()))

n=int(input())
b=[]
for i in range(n):
    b.append(int(input()))
x=[[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]]
for i in range(8):
    if a[x[i][0]-1] in b and a[x[i][1]-1] in b and a[x[i][2]-1] in b:
        print("Yes")
        sys.exit()
print("No")

Measured memory_bytes: 3064
#include <stdio.h>

int pa(int*,int,int);

int main(){
  int i,q,n;

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

  q=pa(A,0,n-1);

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

  return 0;
}

int pa(int *A,int p,int r){
  int x,i,j,a;

  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i+=1;
      a=A[i];
      A[i]=A[j];
      A[j]=a;
    }
  }
  a=A[i+1];
  A[i+1]=A[r];
  A[r]=a;

  return i+1;
}


Measured memory_bytes: 2120
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  char s[N];
  ll r=0,w=0;
  rep(i,N){
    cin>>s[i];
    if(s[i]=='W') w++;
    else r++;
  }
  ll ans=0;
  if(r>w){
    for(int i=0;i<r;i++){
      if(s[i]=='W') ans++;
    }
  }
  else{
    for(int i=N-1;i>N-1-w;i--){
      if(s[i]=='R') ans++;
    }
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 3836
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>

int main() {
	int n;
	std::cin >> n;
	long long int l[86];
	l[0] = 2;
	l[1] = 1;
	for (int i = 2;i < 87;i++) {
		l[i] = l[i - 2] + l[i - 1];
	}
	std::cout << l[n] << std::endl;
	return 0;
}

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

#define ll long long
#define pb push_back
#define INF int(1e9+7)
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	ll n,k;
	cin>>n>>k;
	ll a[n];
	rep(i,1,n+1){
		cin>>a[i];
	}
	ll dp[n+1];
	memset(dp,INF,sizeof(dp));
	dp[1]=0;
	rep(i,1,n+1){
		rep(j,i+1,i+k+1){
			if(j>n){
				break;
			}
			dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
			// test2(j,dp[j])
		}
		// cout<<"\n";
	}
	cout<<dp[n];
	
	
	
	return 0;
}

Measured memory_bytes: 5204
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int count = 0;
		while(N > 0){
			N = N/K;
			count++;
		}
		System.out.println(count);
	}
}

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

int main() {
	int n;
	char bt[4];
	int ans[4] = {0};

	int i;

	while(scanf("%d,%s", &n, bt) != EOF) {
		if(!strcmp(bt, "A"))
			ans[0]++;
		else if(!strcmp(bt, "B"))
			ans[1]++;
		else if(!strcmp(bt, "O"))
			ans[3]++;
		else
			ans[2]++;
	}

	for(i = 0; i < 4; i++)
		printf("%d\n", ans[i]);

	return 0;
}

Measured memory_bytes: 592
//
// Created by Huang,Zhiqiang on 2018/8/20.
//

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

int n, m, q;

int main() {
    cin >> n >> m >> q;
    vector<vector<int>> dp1(n + 1, vector<int>(n + 1, 0));
    vector<vector<int>> dp2(n + 1, vector<int>(n + 1, 0));
    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        dp1[l][r]++;
    }
    for (int i = n; i >= 1; i--) {
        for (int j = 1; j <= n; j++) {
            if (i == n) {
                dp2[i][j] = dp1[i][j];
            } else {
                dp2[i][j] = dp1[i][j] + dp2[i + 1][j] + dp2[i][j - 1] - dp2[i + 1][j - 1];
            }
        }
    }
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        cout << dp2[l][r] << endl;
    }
}

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

int main() {
  int s, s1, s2, s3;

  cin >> s;

  s1 = s % 2;
  s2 = ((s - s1) / 10) % 2;
  s3 = ((s - (s1 + s2 * 10)) / 100) % 2;
  
  cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
// const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(5);
    ll m = 1e16;
    for (int i = 0; i < 5; i++) {
        cin >> A.at(i);
        chmin(m, A[i]);
    }
    cout << (N + m - 1) / m + 4 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int i,n;
    int number;
    long long int sum=0;
    int min=0;
    int max=0;

    scanf("%d",&n);

    for(i=0;i<n;i++)
    {
        scanf("%d",&number);

        if(i==0)
        {
            min = number;
            max = number;
        }
        if(number<min) min = number;
        if(number>max) max = number;

        sum += number;

    }
 
    printf("%d %d %lld\n",min,max,sum);

    return 0;

}

Measured memory_bytes: 600
/*
 * written by Yaqi Zhang
 * University of Wisconsin-Madison
 * 2020
 */

#include<algorithm>
#include<cstring>
#include<iostream>
#include<map>
#include<set>
#include<stdio.h>
#include<vector>

#define INF 0x3f3f3f3f

using namespace std;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long N, K;
    cin >> N >> K;
    // N -> |N - K|
    if(N >= K) {
        long long r = N % K;
        cout << min(r, K - r) << endl;
    } else {
        cout << min(N, K - N) << endl;
    }

    return 0;

}



Measured memory_bytes: 256