akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class Main {

  public static void main(String[] args) {
    final FastScanner scanner = new FastScanner();
    final PrintWriter writer = new PrintWriter(System.out);
    int length = Integer.parseInt(scanner.next());
    String s = scanner.next();
    int count = 0;
    for (int i = 0; i < s.length() - 2; i++) {
      count += s.substring(i, i + 3).equals("ABC") ? 1 : 0;
    }
    writer.println(count);
    writer.flush();
  }

  // FastScanner --
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte())
        return buffer[ptr++];
      else
        return -1;
    }

    private boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr]))
        ptr++;
      return hasNextByte();
    }

    public String next() {
      if (!hasNext())
        throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext())
        throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
        throw new NumberFormatException();
      return (int) nl;
    }

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

Measured memory_bytes: 21332
import numpy as np
N,D = (int(i) for i in input().split()) 
e = [[int(i) for i in input().split()] for i in range(N)] 

cnt = 0 
for i in range(N-1):
  for j in range(i+1,N):
    x = np.array(e[i])
    y = np.array(e[j])
    d = np.linalg.norm(x-y)
    if d.is_integer():
      cnt +=1
print(cnt)

Measured memory_bytes: 12428
import sys
import math
j=0
while j<20:
    n=int(input())
    if(n==0):
        break
    i=0
    a=0
    b=0
    c=0
    d=0
    e=0
    f=0
    while i<n:
        x,y,h,w=map(int,input().split())
        size=x+y+h
        if(size<=60 and w<=2):
            a=a+1
        elif(size<=80 and w<=5):
            b=b+1
        elif(size<=100 and w<=10):
            c=c+1
        elif(size<=120 and w<=15):
            d=d+1
        elif(size<=140 and w<=20):
            e=e+1
        elif(size<=160 and w<=25):
            f=f+1
        i=i+1
    total_money=(a*600)+(b*800)+(c*1000)+(d*1200)+(e*1400)+(f*1600)
    print(str(total_money))


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

using namespace std;

int main(void) {
	int h, w;
	char s[60][60];


	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	int c[8][2] = {
		{-1,-1},
		{-1,0 },
		{-1,1},
		{0,1},
		{1,1},
		{1,0},
		{1,-1},
		{0,-1}
	};

	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++) {
			if (s[i][j] == '.') {
				int mine = 0;
				for (int k = 0; k < 8; k++) {
					int y = i + c[k][0];
					int x = j + c[k][1];
					if (0 <= y && y <= h
						&& 0 <= x && x <= w) {
						if (s[y][x] == '#') mine++;
					}
				}
				s[i][j] = '0' + mine;
			}
		}


	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << s[i][j];
		}
		cout << '\n';
	}
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector <int> A(M, 0);
	int sum = 0;
	for (int ii = 0; ii < M; ++ii){
		cin >> A[ii];
		sum += A[ii];
	}

	if (sum > N){
		cout << -1 << endl;
	} else {
		cout << N - sum << endl;
	}





	return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
typedef long long LL;
const LL INF = 0x3f3f3f3f3f3f3f3f;
LL ans = 0;
int X[N], tot, cnt, g[N], nxt[N << 1], v[N << 1], w[N << 1];
struct E{int x,y; LL z;}e[N*20]; 
void init() {
    memset(g, -1, sizeof(g));
    tot = 0;
}
void add_edge(int x, int y, int z) {
    v[tot] = y, w[tot] = z, nxt[tot] = g[x], g[x] = tot++;
}
void ADD(int x,int y,LL z){
	e[cnt].x=x; e[cnt].y=y; e[cnt++].z=z;
}
int sum, root, size[N], dp[N], vis[N];
void getroot(int x, int fx) {
    size[x] = 1;
    dp[x] = 0;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != fx) {
            getroot(v[i], x);
            size[x] += size[v[i]];
            dp[x] = max(dp[x], size[v[i]]);
        }
    }
    dp[x] = max(dp[x], sum - size[x]);
    if (dp[x] < dp[root]) root = x;
}
LL val;
int u;
vector<LL> q;
inline void dfsadd(int x, LL l, int pre) {
    if(l+X[x]<val)val=l+X[x],u=x; 
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != pre) dfsadd(v[i], l + w[i], x);
    }
}
inline void dfscal(int x,LL l,int pre){
	if(x!=u)ADD(x,u,l+X[x]+val);
	for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]] && v[i] != pre) dfscal(v[i], l + w[i], x);
    }
}
void cal(int x) {
	val=INF; u=0;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) dfsadd(v[i], w[i], x);
    }
    if(u==0)return;
    if(X[x]<val)val=X[x],u=x;
    else ADD(x,u,val+X[x]);
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) dfscal(v[i],w[i],x);
    }
}
void solve(int x) {
    cal(x);
    vis[x] = 1;
    for (int i = g[x]; ~i; i = nxt[i]) {
        if (!vis[v[i]]) {
            root = 0;
            dp[0] = sum = size[v[i]];
            getroot(v[i], 0);
            solve(root);
        }
    }
}
int f[N];
int sf(int x){return x==f[x]?x:f[x]=sf(f[x]);}
int n; 
int main() {
    scanf("%d", &n);
    init();
    for (int i = 1; i <= n; i++) scanf("%d", &X[i]);
    for (int i = 1; i < n; i++) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        add_edge(a, b, c);
        add_edge(b, a, c);
    }
    dp[root = 0] = sum = n;
    getroot(1, 0);
    solve(root);
    for(int i=1;i<=n;i++)f[i]=i;
    sort(e,e+cnt,[](E a,E b){return a.z<b.z;});
    for(int i=0;i<cnt;i++){
    	//printf("%d %d %lld\n",e[i].x,e[i].y,e[i].z);
    	if(sf(e[i].x)==sf(e[i].y))continue;
    	f[sf(e[i].x)]=sf(e[i].y);
    	ans+=e[i].z;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 69248
import java.util.*;


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();
      System.out.println((Math.abs(a-b)<Math.abs(a-c))?"A":"B");
    }
}


Measured memory_bytes: 21716
#!/usr/bin/env python

def main():
    k, s = list(map(int, input().split()))

    ans = 0
    for x in range(k+1):
        for y in range(k+1):
            z = s - x - y
            if z >= 0 and z <= k:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()
    


Measured memory_bytes: 40940
N = input()

def r(s):
    me = '3' in s and '5' in s and '7' in s
    if len(s) < len(N):
        return r(s+'3') + r(s+'5') + r(s+'7') + me
    elif s<=N:
        return me
    else:
        return 0

print(r(''))


Measured memory_bytes: 2940
#include <iostream>
#include <string>
using namespace std;
string s;
int n;
int main(void){
    cin>>s;
    int min=(int)1e9;
    for(int i=0;i<s.size()-2;i++){
        n=stoi(s.substr(i,3));
        if(abs(n-753)<min)min=abs(n-753);
    }
    cout<<min<<endl;
    return 0;
}


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

#define 	ll				long long
#define 	vi				vector<int>
#define		rep(i,n) 		for(i=0;i<n;i++)
#define		repe(i,I1,I2) 	for(i=I1;i<I2;i++)
#define		INF  			1e9 + 7
#define		pb  			push_back
#define		mp  			make_pair
#define		endl			'\n'
#define 	mod				1000000007


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k,t,c=0,i,mn,m=-1;
	t=1;
	//cin>>t;
	
	while(t--)
	{
		cin>>n;
		ll a[n];
		rep(i,n)
		{
			cin>>a[i];
			m=max(a[i],m);
		}
		k=m/2;
		mn=INT_MIN;
		rep(i,n)
		{
			if(a[i]==m)
				continue;
			if(abs(k-a[i])<abs(k-mn))
				mn=a[i];
			if(n%2==1)
			{
				if(abs((k+1)-a[i])<abs(k-mn) || abs((k+1)-a[i])<abs((k+1)-mn) || abs(k-a[i])<abs((k+1)-mn))
					mn=a[i];
			}
		}
		cout<<m<<" "<<mn;
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

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

int main()
{
	int r, c;
	std::cin >> r >> c;
	std::vector< std::vector<int> > table;
	table.resize(r + 1);
	for (int i = 0; i <= r; i++)
	{
		table[i].resize(c + 1);
	}
	for (int i = 0; i < r; i++)
	{
		int rowTotal = 0;
		for (int j = 0; j < c; j++)
		{
			int data;
			std::cin >> data;
			table[i][j] = data;
			rowTotal += data;
		}
		table[i][c] = rowTotal;
	}
	for (int j = 0; j <= c; j++)
	{
		int columnTotal = 0;
		for (int i = 0; i < r; i++)
		{
			columnTotal += table[i][j];
		}
		table[r][j] = columnTotal;
	}
	for (int i = 0; i <= r; i++)
	{
		for (int j = 0; j <= c; j++)
		{
			if (j > 0)
			{
				std::cout << " ";
			}
			std::cout << table[i][j];
		}
		std::cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int A, B, C;
int main() {
	while (cin >> A >> B >> C) {
		A -= B;
		cout << A%C << endl;
	}
}







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


int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return (int)index;
  }
  else { // 発見できなかったとき
    return -1;
  }
}
 
int main() {
  vector<int>array(9);
  vector<bool>result{false,false,false,false,false,false,false,false,false};
  int N;
  
  for(int i=0;i<3;i++){
  	for(int j=0;j<3;j++){
      cin >> array.at(i*3+j);
    }
  }
  

  cin >> N;
  
  vector<int>num(N);
  for(int i=0; i<N; i++){
    cin>>num.at(i);
    int res = vector_finder(array, num.at(i));
    //cout << num.at(i) << ", " << res << endl;
    if( res != -1)
      result.at(res) = true;
   }
  bool kekka = false;
  // 横
  for(int i=0;i<3;i++){
   if(result.at(i*3+0) == true &&
     result.at(i*3+1) == true &&
     result.at(i*3+2) == true)
     kekka = true;
  }
  
  // 縦
  for(int i=0;i<3;i++){
   if(result.at(0*3+i) == true &&
     result.at(1*3+i) == true &&
     result.at(2*3+i) == true)
     kekka = true;
  }
  
  //斜め
  if(result.at(0) == true && result.at(4) == true&& result.at(8) == true)
   kekka = true;

  if(result.at(2) == true && result.at(4) == true &&result.at(6) == true)
   kekka = true;

  if(kekka)
    cout << "Yes";
  else
    cout << "No";
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<algorithm>
#include<sstream>
#include<iomanip>


using namespace std;

typedef long long ll;


int main() {
	int n;
	cin >> n;
	
	vector<ll> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int i = n - 1; i >= 0; i -= 2) {
		cout << a[i] << " ";
	}

	for (int i = n % 2; i < n; i += 2) {
		cout << a[i] << " ";
	}
}

Measured memory_bytes: 3712
#include<stdio.h>

int main(){
	int n,i,j,k,b,f,r,v,count[4][3][10] ={0};
	char gara;
    
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&b,&f,&r,&v);
		
			count[b-1][f-1][r-1]+=v;
	}
	
	for(i=0;i<4;i++){
		for(j=0;j<3;j++){
			for(k=0;k<10;k++){
				printf(" %d",count[i][j][k]);
			}
			printf("\n");
		}
		if(i<3) printf("####################\n");
	}
	
    return 0;
}


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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n;
    set<string> ss;
    cin>>n;
    string s;
    rep(i,1,n){
        cin>>s;
        ss.insert(s);
    }
    cout<<sz(ss)<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 19284
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
using namespace std;
 
#define int                 long long int
#define ull                 unsigned int
#define ld                  long double
#define pb                  push_back
#define ff                  first
#define ss                  second
#define S(arr)              sort(arr.begin(),arr.end());
#define RS(arr)              sort(arr.rbegin(),arr.rend());
#define R(arr)              reverse(arr.begin(),arr.end());
#define si                  set <int>
#define vi                  vector <int>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vpp                 vector <pair<int, pii>>
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define spi                 set <pii>
#define speed               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl                "\n"
#define all(p)              p.begin(), p.end()
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(t)             priority_queue <t>
#define que_min(t)             priority_queue <t, vector<t>, greater<t>>
#define debuga(a, l, r)     for(auto x:a)cout<<x<<" ";cout<<endl;
#define debug1(x)           cout << #x " = " << x << endl;
#define debug2(x,y)         cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x,y,z)       cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x,y,z,w)     cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x,y,z,w,v)   cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define debug6(x,y,z,w,v,a) debug3(a, y, x)debug3(w, v, a)
#define p2d(v)          for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)              for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppi(v)  for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
 
 
void read(int n=10){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    // #ifndef ONLINE_JUDGE
    //      freopen("input.txt",  "r",  stdin);
    //      freopen("output.txt", "w", stdout);
    // #endif
}
 
int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005
 
 
int32_t main(){
    read();
    int n,m;
    cin>>n>>m;
    vi arr(n+1,0);
    vi ok(n+1,0);
    for(int i=0;i<m;i++){
        int a;
        string str;
        cin>>a>>str;
        if(str[0] == 'A'){
            ok[a] = 1;
        }else{
            if( !ok[a]){
                arr[a]++;
            }
        }
    }
    int coount=0,sum = 0;
    for(int i=1;i<=n;i++){
        if(ok[i]){
            coount++;
            sum+=arr[i];
        }
    }
    cout<<coount<<" "<<sum<<endl;;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _                             \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define mod 998244353
typedef long long int ll;

int main()
{
    int n, k, a[101];
    cin >> n >> k;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    bool dp[k + 1];

    for (int i = 0; i < a[0]; i++)
        dp[i] = 0;

    for (int i = a[0]; i <= k; i++)
    {
        int res = 0;
        for (int j = 0; j < n; j++)
        {
            if (a[j] > i)
                break;

            if (dp[i - a[j]] == 0)
            {
                res = 1;
                break;
            }
        }
        dp[i] = res;
        //   cout << dp[i] << " ";
    }

    if (dp[k])
    {
        cout << "First";
    }
    else
    {
        cout << "Second";
    }
}


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

constexpr int INF = 1 << 20;

class Graph {
private:
	const int N;
	vector<int> edge;
public:
	Graph(int n) : N(n), edge(n*n, INF) {}
	void InputEdge(int a, int b, int c, int d) {
		edge[(a - 1) * N + b - 1] = c;
		edge[(b - 1) * N + a - 1] = d;
	}
	void Show() {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				int e = edge[i * N + j];
				if (e == INF)
					cout << "Inf" << "\t";
				else
					cout << e << "\t";
			}
			cout << endl;
		}
	}
	int FWSearch(int s, int g);
};

int Graph::FWSearch(int s, int g) {
	for (int k = 0; k < N; k++)
		for (int i = 0; i < N; i++)
			for (int j = 0; j < N; j++)
				if (edge[i * N + j] > edge[i * N + k] + edge[k * N + j])
					edge[i * N + j] = edge[i * N + k] + edge[k * N + j];
	return edge[(s - 1) * N + g - 1];
}

int main() {
	int n, m;
	cin >> n >> m;
	Graph G(n);
	for (int i = 0; i < m; i++) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		G.InputEdge(a, b, c, d);
	}
	int s, g, V, P;
	scanf("%d,%d,%d,%d", &s, &g, &V, &P);
	int C[2] = { G.FWSearch(s, g), G.FWSearch(g, s) };
	cout << V - P - C[0] - C[1] << endl;
}


Measured memory_bytes: 3136
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	
	x := c - a
	y := d - b
	fmt.Printf("%d %d %d %d", c-y, d+x, a-y, b+x)
}

Measured memory_bytes: 1836
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long

int main(int argc, char const *argv[])
{
	char s[103];
	scanf("%s",s);
	printf("%c%d%c\n", s[0], (strlen(s) - 2), s[strlen(s) - 1]);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define DEKAI 1000000007
#define INF (1<<28)
#define int long long
/* ┗(^o^)┛ｗｗｗｗｗ┏(^o^)┓ﾄﾞｺﾄﾞｺﾄﾞｺﾄﾞｺｗｗｗｗｗ */

int a[110][110];	

signed main(){
	int n;
	cin>>n;
	int x[100],y[100],ha[100];
	lp(i,n) {
		cin>>x[i]>>y[i]>>ha[i];
		a[x[i]][y[i]]==ha[i];
	}
	int ansi,ansj,ansh,ac=-1;
	lp(i,101){
		lp(j,101){
			int h=INF,count=0;
			lp(z,n){
				if(ha[z]==0){
					if(h==INF) continue;
					if(h==ha[z]+abs(x[z]-i)+abs(y[z]-j)) count++;
					continue;
				}
				if(h==INF){
					h=ha[z]+abs(x[z]-i)+abs(y[z]-j);
				}
				else{
					if(h!=ha[z]+abs(x[z]-i)+abs(y[z]-j)){
						h=-1;
						break;
					} 
				}
			}
			if(h>=1) {
				if(ac<=count) {
					ac=count;
					ansi=i;
					ansj=j;
					ansh=h;
				}
			}
		}
	}
	cout<<ansi<<" "<<ansj<<" "<<ansh<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define MOD 1000000007
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define vii vector<pii>
#define vvi vector<vi>
#define endl "\n"
#define rep(i, n) for(i = 0; i < (n); i++)
#define rrep(i, n) for(i = (n - 1); i >= 0; i--)
using namespace std;

bool vis[200005]={0};
void solve1();
void solve()
{
    int t;cin>>t;
    while(t--)
    {
        solve1();
    }
}
signed main()
{
    solve1();
    return 0;
}
void solve1()
{
    int n;
    cin>>n;
    cout<<n+(n*n)+(n*n*n)<<endl;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P,L;
string S,T;
ll ans;
ll x[101010];
ll y[101010];
ll a[1010][1010];
ll b[101010];
ll c[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main() {
    cin>>N>>M>>C;
    rep(i,0,M){
        cin>>b[i];
    }
    ans=0;
    rep(i,0,N){
         ll num=0;
        rep(j,0,M){
            cin>>a[i][j];
            num+=a[i][j]*b[j];
        }
        if(num+C>0)ans++;
    }
    
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
double ans[200005];
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int lli;
int main()
{
    fio;
    int n;
    cin>>n;
    lli dp[n+1];
    lli a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        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];
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;


int N, a[100000], b[100000], c[100000], t;
bool vis[100000];
ll s[100000], res[100000];
vector<int>v[100000];
vector<pair<int, ll>>V[100000];

void dfs(int x) {
	vis[x] = true;
	for (int i : v[x]) {
		if (!vis[i]) {
			dfs(i);
			c[x] += c[i];
		}
	}
}

ll dfs2(int x,ll dis) {
	ll a = dis;
	vis[x] = false;
	for (pair<int,ll> p: V[x]) {
		if (vis[p.first]) {
			a += dfs2(p.first, dis + p.second);
		}
	}
	return a;
}

int main() {
	cin >> N;
	for (int i = 0; i < N - 1; ++i) {
		cin >> a[i] >> b[i];
		--a[i];
		--b[i];
		v[a[i]].push_back(b[i]);
		v[b[i]].push_back(a[i]);
	}
	for (int i = 0; i < N; ++i) {
		cin >> s[i];
		c[i] = 1;
	}
	dfs(0);
	t = -1;
	for (int i = 0; i < N - 1; ++i) {
		int p = min(c[a[i]], c[b[i]]);
		if (p * 2 == N) {
			t = i;
		}
		else {
			res[i] = abs((s[a[i]] - s[b[i]]) / (N - p - p));
		}
	}
	if (t != -1) {
		for (int i = 0; i < N - 1; ++i) {
			V[a[i]].push_back(mkp(b[i], res[i]));
			V[b[i]].push_back(mkp(a[i], res[i]));
		}
		res[t] = (s[a[t]]-dfs2(a[t], 0)) / (N / 2);
	}
	for (int i = 0; i < N - 1; ++i) {
		cout << res[i] << endl;
	}
}

Measured memory_bytes: 20864
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M,X,Y=map(int,input().split())
    x=list(map(int,input().split()))
    y=list(map(int,input().split()))
    for Z in range(X+1,Y+1):
        for xi in x:
            if xi>=Z:
                break
        else:
            for yi in y:
                if yi<Z:
                    break
            else:
                print('No War')
                exit()
    print('War')
            
                

if __name__ == '__main__':
    main()


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

void rotate(int b, int e, int m, int n,long* A);

int main(void){
  int n;
  cin>>n;
  long A[n];
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  int q;
  cin>>q;
  int b,e,m;
  for(int i=0;i<q;i++){
    cin>>b>>m>>e;
    rotate(b,e,m,n,A);
  }
  for(int i=0;i<n-1;i++){
    cout<<A[i]<<" ";
  }
  cout<<A[n-1]<<endl;
  return 0;
}


void rotate(int b,int e,int m,int n,long* A){
  long tmp[n];
  for(int i=b;i<e;i++){
    tmp[i]=A[i];
  }
  for(int i=b;i<e;i++){
    A[b+((i-b+e-m)%(e-b))]=tmp[i];
  }
}



Measured memory_bytes: 3108
#include <iostream>
#include <algorithm>
#include <cassert>
#include <climits>
using namespace std;
const int MAX = 1000000;
int main(){
  long long n, x, sum = 0, maxi = -MAX, mini = MAX;
  cin >> n;
  //  assert(n <= 10000);
  for(int i=0;i<n;i++){
    cin >> x;
    maxi = max(maxi, x);
    mini = min(mini, x);
    //assert((long long)sum + (long long)x < INT_MAX);
    sum += x;
  }
  cout << mini << ' ' << maxi << ' ' << sum << endl;
}

Measured memory_bytes: 3124
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Console.ReadLine().ToCharArray();
            bool flag = false;
            foreach(char n in nums)
            {
                if(n == '7')
                {
                    flag = true;
                }
            }
            Console.WriteLine(flag ? "Yes" : "No");
        }
    }
}


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

typedef long long ll;
typedef pair<ll,ll> P;

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

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

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

  if (a <= 0 && b >= 0){
    cout << "Zero" << endl;
  }else if (a > 0 && b > 0){
    cout << "Positive" << endl;
  }else if (a < 0 && b < 0){
    if ((b - a) % 2 == 0){
      cout << "Negative" << endl;
    }else{
      cout << "Positive" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
use std::cmp::min;
use std::io;
use std::io::prelude::*;
use std::iter::repeat;

struct MinSegTree {
    n: usize,
    nodes: Vec<i32>,
}

impl MinSegTree {
    fn init(n: usize) -> MinSegTree {
        let n = 1 << f64::log2(n as f64).ceil() as usize;
        let mut ret = MinSegTree {
            n,
            nodes: repeat(std::i32::MAX).take(2 * n - 1).collect(),
        };
        for i in (0..(n - 1)).rev() {
            ret.update1(i);
        }
        ret
    }

    fn update1(&mut self, idx: usize) {
        self.nodes[idx] = min(self.nodes[2 * idx + 1], self.nodes[2 * idx + 2]);
    }

    fn update_rec(&mut self, idx: usize) {
        self.update1(idx);
        if idx > 0 {
            self.update_rec((idx - 1) / 2);
        }
    }

    fn update(&mut self, i: usize, x: i32) {
        let ni = self.n + i - 1;
        self.nodes[ni] = x;
        if self.n > 1 {
            self.update_rec((ni - 1) / 2);
        }
    }

    fn find(&self, i: usize, j: usize, ni: usize, l: usize, r: usize) -> i32 {
        if i <= l && r <= j {
            self.nodes[ni]
        } else if r <= i || j <= l {
            std::i32::MAX
        } else {
            min(
                self.find(i, j, 2 * ni + 1, l, (l + r) / 2),
                self.find(i, j, 2 * ni + 2, (l + r) / 2, r),
            )
        }
    }
}

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();

    let line0 = lines.next().unwrap().unwrap();
    let n = line0.split_whitespace().next().unwrap().parse().unwrap();

    let mut mst = MinSegTree::init(n);

    for l in lines.map(Result::unwrap) {
        let mut words = l.split_whitespace();
        let com = words.next().unwrap().parse().unwrap();
        let x = words.next().unwrap().parse().unwrap();
        let y: usize = words.next().unwrap().parse().unwrap();
        match com {
            0 => mst.update(x, y as i32),
            1 => println!("{}", mst.find(x, y + 1, 0, 0, mst.n)),
            _ => (),
        }
    }
}



Measured memory_bytes: 5156
#include <stdio.h>

int main(){
    int p,q,r;
    scanf("%d%d%d",&p,&q,&r);

    if(p>=q&&p>=r) printf("%d\n",q+r);
    else
    if(q>=p&&q>=r) printf("%d\n",p+r);
    else
    if(r>=p&&r>=q) printf("%d\n",p+q);
    

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll A,B,m;cin>>A>>B>>m;
    vector<ll> a(A),b(B),x(m),y(m),c(m);
    rep(i,A)cin>>a[i];
    rep(i,B)cin>>b[i];
    rep(i,m)cin>>x[i]>>y[i]>>c[i];
    ll ans = *min_element(a.begin(),a.end())+*min_element(b.begin(),b.end());
    rep(i,m){
        ans = min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
vector<int>vec;
int main()
{

    int t,i,j,n,a,b,flag=0;
    string s,s1;
    cin>>a;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if((i*j)==a){
                flag=1;
            break;
            }
        }
        if(flag==1)
            break;
    }
    if(flag==1)
        cout<<"Yes"<<"\n";
    else
        cout<<"No"<<"\n";



return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    string s,t; cin >> s >> t;
    int c = 0;
    rep(i,3) if(s[i]==t[i]) c++;
    cout << c << endl;

    return 0;
}

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


int main() {
  
  int A,B,C;
  
  cin>>A>>B>>C;
  
  if(A==B&&B!=C){
    cout<<"Yes"<<endl;
  }else if(B==C&&A!=C){
    cout<<"Yes"<<endl;
  }else if(A==C&&A!=B){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;

int main()
{
    int n, x, y;
    cin >> n >> x >> y;
    mii mp;
    for(int i=1; i<n; i++)
    {
        mp[i] = 0;
    }

    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            int dist;
            if(j <= x)
            {
                dist = j - i;
            }
            else if(i <= x && x <= j && j <= y)
            {
                dist = x - i + min(j - x, 1 + y - j);
            }
            else if(x <= i && j <= y)
            {
                dist = min(j - i, i - x + 1 + y - j);
            }
            else if(i <= x && y <= j)
            {
                dist = x - i + 1 + j - y;
            }
            else if(x <= i && i <= y && y <= j)
            {
                dist = min(i - x + 1, y - i) + j - y;
            }
            else if (y <= i)
            {
                dist = j - i;
            }
            // cout << "(" << i << ", " << j << "), dist=" << dist << endl;
            mp[dist]++;
        }
    }
    for(int i=1; i<n; i++)
    {
        cout << mp[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) a[i] = in();

    if (a[0] != 0){
        cout << -1 << endl;
        return 0;
    }

    REP(i,n-1){
        if (a[i+1] > a[i] + 1){
            cout << -1 << endl;
            return 0;
        }
    }

    ll ans = a[n - 1];
    FORR(i,n-2,0){
        if (a[i] == a[i+1] - 1) continue;
        ans += a[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

typedef complex<double> P;

bool equal(double d){
	return d<0.0+EPS && d>0.0-EPS ;
}
double cross(P a, P b){
	return a.real()*b.imag() - a.imag()*b.real();
}

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3, x4, y4;
	scanf("%d",&n);
	while(n--){
		scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		P A(x1,y1), B(x2,y2), C(x3,y3), D(x4,y4);
		if( equal(cross(A-B,C-D)) ){
			puts("YES");
		}else{
			puts("NO");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<algorithm>
#include<iomanip>
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
using namespace std;

typedef long long lint;

int main(){
    int n;
    cin >> n;
    vector<int> six, nine;
    for(int i = 1 ; i <= n ; i *= 6){
        six.push_back(i);
    }
    for(int i = 1 ; i <= n ; i *= 9){
        nine.push_back(i);
    }
    int ans = n;
    for(int i = 0 ; i <= n ; i++){
        int cnt = 0, tmp = i;
        for(int j = six.size() - 1 ; j >= 0 ; j--){
            while(tmp >= six[j]){
                tmp -= six[j];
                cnt++;
            }
        }
        tmp = n - i;
        for(int j = nine.size() - 1 ; j >= 0 ; j--){
            while(tmp >= nine[j]){
                tmp -= nine[j];
                cnt++;
            }
        }
        if(ans > cnt){
            ans = cnt;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<string> w(n);
  for(int i=0;i<n;i++){
    cin >> w[i];
  }
 bool b=true;
  for(int i=0;i<n-1;i++){
    if(w[i].back()!=w[i+1].front()){
      b=false;
      break;
    }
  }
  sort(w.begin(),w.end());
  for(int i=0;i<n-1;i++){
    if(w[i]==w[i+1]){
      b=false;
    }
  }
  if(b){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int n,x[2],y[2],z[2],w[2],ans[4],i;
  while(1){
    scanf("%d",&n);
    if(!n)
      break;
    while(n--){
      for(i=0;i<2;i++)
	scanf("%d %d %d %d",&x[i],&y[i],&z[i],&w[i]);
      ans[0]=x[0]*x[1]-y[0]*y[1]-z[0]*z[1]-w[0]*w[1];
      ans[1]=x[0]*y[1]+y[0]*x[1]+z[0]*w[1]-w[0]*z[1];
      ans[2]=x[0]*z[1]-y[0]*w[1]+z[0]*x[1]+w[0]*y[1];
      ans[3]=x[0]*w[1]+y[0]*z[1]-z[0]*y[1]+w[0]*x[1];
      for(i=0;i<4;i++){
	if(i)
	  putchar(' ');
	printf("%d",ans[i]);
      }
      puts("");
    }
   }
   return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#ifdef BTK
#include <dvector.h>
#define DEBUG if(1)
#else
#define DEBUG if(0)
#endif

#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}

int cross(int x1,int y1,int x2,int y2){
    return x1*y2-y1*x2;
}
const int mod=998244353;
int main(){
    int n;
    cin>>n;
    vector<int> x(n),y(n);
    REP(i,n)cin>>x[i]>>y[i];
    vector<int> line;
    vector<vector<int>> used(n,vector<int>(n,0));
    REP(i,n)used[i][i]=1;
    REP(i,n)REP(j,n)if(used[i][j]==0){
        vector<int> l;
        REP(k,n)
            if(cross(
                     x[i]-x[j],
                     y[i]-y[j],
                     x[i]-x[k],
                     y[i]-y[k]
                     )==0)
                l.pb(k);
        for(auto a:l)
            for(auto b:l)
                used[a][b]=1;
        line.pb(l.size());
    }
    LL ret=1;
    REP(i,n)ret=(ret+ret)%mod;
    ret+=mod-n-1;ret%=mod;
    for(auto &it:line){
        DEBUG cout<<it<<endl;
        LL s=1;
        REP(i,it)s=(s+s)%mod;
        s+=mod-it-1;s%=mod;
        ret+=mod-s;ret%=mod;   
    }
    cout<<ret<<endl;
    return 0;
}


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

using namespace std;

map<int, int>mp;
int dp[10][20100], used[10][20100], qtd[4];

int solve(int coin, int amount){
	if(amount < 0){
		return 0;
	}
	
	if(amount == 0){
		return 1;
	}
	
	if(coin > 2){
		return 0;
	}
	
	int &ans = dp[coin][amount];
	
	if(used[coin][amount]){
		return ans;
	}
	
	used[coin][amount] = 1;
	
	for(int k = 0 ; k <= qtd[coin]; k++){
		ans += solve(coin + 1, amount - k * mp[coin]);
	}
	
	return ans;
}
int main (){
	mp[0] = 500;
	mp[1] = 100;
	mp[2] = 50;

	for(int i = 0 ; i < 3 ; i++){
		cin >> qtd[i];
	}		
	
	int x;
	
	cin >> x;
	
	cout << solve(0, x) << '\n';
	
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const int INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi = acos(-1);
const double eps = 1e-9;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    rep2(i,1,10){
        if(n%i==0&& n/i<10){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX_NUM (10001)
int main() {
	int areas[MAX_NUM], n, i;

	areas[0] = 1;
	for (i = 1; i < MAX_NUM; i++) {
		areas[i] = areas[i - 1] + i;
	}

	while (scanf(" %d ", &n) != EOF) {
		printf("%d\n", areas[n]);
	}
	return 0;
}

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

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

    string s;
    cin >> s;
    
    int ans = 0;
    if(s == "SUN") ans = 7;
    if(s == "MON") ans = 6;
    if(s == "TUE") ans = 5;
    if(s == "WED") ans = 4;
    if(s == "THU") ans = 3;
    if(s == "FRI") ans = 2;
    if(s == "SAT") ans = 1;
    
    cout << ans << endl;

    return 0;
}

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


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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

struct UnionFind{
    vector<ll> par;
    vector<ll> rank;

    UnionFind(ll N): par(N,-1), rank(N, 1){}

    ll root(ll x){
        if(par[x] < 0) return x;
        else{
            par[x] = root(par[x]);
            return par[x];
        }
    }

    void unite(ll x, ll y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(rank[x] < rank[y]) swap(x,y);
        if(rank[x] == rank[y])rank[x]++;
        par[x] += par[y];
        par[y] = x;
        return;
    }

    bool is_same(ll x, ll y){
        return root(x) == root(y);
    }

    ll size(ll x){
        return -1 * par[root(x)];
    }
};

int main(){
    ll N,M;
    cin>>N>>M;
    UnionFind U(N);
    rep(i,0,M){
        ll a,b;
        cin>>a>>b;a--;b--;
        U.unite(a,b);
    }
    ll ans = 0;
    rep(i,0,N){
        if(U.root(i) == i)ans++;
    }
    cout<<ans-1;
    return 0;
}

Measured memory_bytes: 4776
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
using namespace std;
#define int long

signed main() {
	string s;
	cin >> s;
	if (s[6] <= '4' && s[5] == '0')cout << "Heisei";
	else cout << "TBD";
}

Measured memory_bytes: 256
#define H 10000
n,d,p,q,m[H];
b,h;
main(){
	for(;scanf("%d",&n),n;){
		memset(m,0,sizeof(m));
		for(;n--;){
			scanf("%d%d%d",&d,&p,&q);
			if(d==1)
				b=((1<<p)-1)<<q;
			else
				b=1<<q;
			for(h=H-1;h>=0;h--)
				if(m[h]&b)
					break;
			h++;
			if(d==1)
				p=1;
			for(;p--;){
				m[h]|=b;
				if(m[h]==0x3e)
					memmove(m+h,m+h+1,H-h-1);
				else
					h++;
			}
		}
		p=0;
		for(h=0;h<H;h++){
			for(;q=-m[h]&m[h];m[h]-=q)
				p++;
		}
		printf("%d\n",p);
	}
	exit(0);
}

Measured memory_bytes: 0
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var xs = Console.ReadLine().Split().Select(x => int.Parse(x)).OrderBy(x => x).ToArray();
        var z = xs[1] - xs[0] + xs[2] - xs [1];
        Console.WriteLine(z);
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <math.h>
#include <iomanip>
using namespace  std;
typedef pair<string, int> Psi;
int main(){
    queue<Psi> que;
    int n, q; cin >> n >> q;
    for(int i=0; i<n; i++){
        string p;
        int t;
        cin >> p >> t;
        que.push(Psi(p, t));
    }
    int res = 0;
    while(que.size()){
        Psi x = que.front();
        que.pop();
        if(x.second <= q){
            res += x.second;
            cout << x.first << " " << res << endl;
        } 
        else{
            x.second -= q;
            res += q;
            que.push(x);
        }
    }
    return 0;
}


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

int main() {
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = (S % 3600) / 60;
	s = S - (h * 3600) - (m * 60);
	cout << h << ":" << m << ":" << s << endl;
	return 0;
}

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

typedef long long ll;

ll H, W;

ll search(ll H, ll W){
    ll s1, s2, s3, s_max, s_min, tmp;
    tmp = H*W;
    for(ll i=1; i<=H; i++){
        s1 = i*W;
        s2 = (H-i)*(W/2);
        s3 = (H-i)*(W-(W/2));
        s_max = max(s1, s2);
        s_max = max(s_max, s3);
        s_min = min(s1, s2);
        s_min = min(s_min, s3);
        tmp = min(tmp, s_max-s_min);
    }
    return tmp;
}
int main(){
    cin >> H >> W;
    if(H%3==0 || W%3==0){
        cout << 0 << endl;
        return 0;
    }
    ll ans;
    ans = min(W, search(H, W));
    ll ans2;
    ans2 = min(H, search(W, H));
    ans = min(ans, ans2);
    cout << ans << endl;
}


Measured memory_bytes: 256